
/*var so = new SWFObject("swf/h4_3.swf", "flash_main", "979", "269", "9", "");
so.addParam("wmode", "transparent");
so.write("swf_main"); 
var so = new SWFObject("swf/h1.swf", "flash_bies", "979", "269", "9", "");
so.addParam("wmode", "transparent");
so.write("swf_bies"); 
var so = new SWFObject("swf/h2.swf", "flash_larive", "979", "269", "9", "");
so.addParam("wmode", "transparent");
so.write("swf_larive");
var so = new SWFObject("swf/h3.swf", "flash_pv", "979", "269", "9", "");
so.addParam("wmode", "transparent");
so.write("swf_pv");*/

/**
* Обновление картинки CAPTCHA
* captchaKey - идентификатор CAPTCHA
* captchaHeight - высота картинки с CAPTCHA
 */
function ReNewCaptcha(captchaKey, captchaHeight)
{
 if (document.images['captcha'] != undefined)
 {
 var antiCache = Math.floor(Math.random()*100000);
 document.images['captcha'].src = "/captcha.php?get_captcha=" + captchaKey + "&height=" + captchaHeight + "&anc=" + antiCache;
 }
}

/**
* Обновление картинки CAPTCHA для картинки по ее ID
 * captchaKey - идентификатор CAPTCHA
* captchaHeight - высота картинки с CAPTCHA
*/
function ReNewCaptchaById(imageId, captchaKey, captchaHeight)
{
 // Пытаемся получить скрытый объект для input-а
 var captchaObject = document.getElementById(imageId);

 // Элемента нет, добавим его
 if (null != captchaObject && undefined !== captchaObject)
 {
 var antiCache = Math.floor(Math.random()*100000);
 captchaObject.src = "/captcha.php?get_captcha=" + captchaKey + "&height=" + captchaHeight + "&anc=" + antiCache;
 }
} 
/*порядковый номер пары координат должен совпадать с порядковым номером адреса на странице (порядковый номер адреса определяется цифрой в конце имени класса. например: class="adr_5")*/ 
var map;										/* порядковый номер*/
var points =  new Array(55.562846, 37.749555,  		/* 0 */
			47.249909, 39.840686,  		/* 1 */
			51.66472,  39.158911,   	/* 2 */
			59.88231,  30.399696,   	/* 3 */
			53.333996, 34.260144,   	/* 8 */
			56.346951, 43.890708,   	/* 6 */
			57.661521, 39.841938,   	/* 5 */
			53.190234, 50.241288,	   	/* 7 */
			51.609196, 45.958146  		/* 4 */
						
);	
						
    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("mapID"));
        map.setCenter(new GLatLng(37.749555, 55.562846), 9);
        map.setUIToDefault();	
		
        // Create a base icon for all of our markers that specifies the
        // shadow, icon dimensions, etc.
        var baseIcon = new GIcon(G_DEFAULT_ICON);
        baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
        baseIcon.iconSize = new GSize(20, 34);
        baseIcon.shadowSize = new GSize(37, 34);
        baseIcon.iconAnchor = new GPoint(9, 34);
        baseIcon.infoWindowAnchor = new GPoint(9, 2);

        // Creates a marker whose info window displays the letter corresponding
        // to the given index.
        function createMarker(point, index) {
          // Create a lettered icon for this point using our icon class
          var letter = String.fromCharCode("A".charCodeAt(0) + index);
          var letteredIcon = new GIcon(baseIcon);
          letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";

          // Set up our GMarkerOptions object
          markerOptions = { icon:letteredIcon };
          var marker = new GMarker(point, markerOptions);

		  var html_cod = $('h3.adr_'+index).text()+ "<p>" +$(' h3.adr_'+index).next('p').html() + "</p>"; 
		  
		  
          GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(html_cod);
          });
		  $('h3.adr_'+index).click(function(){
				marker.openInfoWindowHtml(html_cod);
			});
		  if (index == 0) {marker.openInfoWindowHtml(html_cod);}	
          return marker;
        }

        // Add 9 markers to the map at random locations
        var bounds = map.getBounds();
        for (var i = 0; i < points.length/2; i++) {
          var latlng = new GLatLng(points[i*2],points[i*2+1]);
          map.addOverlay(createMarker(latlng, i));
        }
      }
    }
	
	function map_animate(point) {   
      map.panTo(new GLatLng(points[point*2], points[point*2+1]));
	  return false;
    }
    

/* для страницы контактов (адреса) */
$(document).ready(function(){

	$(".accord_adr .adr:first").addClass("act_adr");
	$(".accord_adr p:not(:first)").hide();

	$(".accord_adr h3").click(function(){
		$(this).next("p").slideToggle("slow")
		.siblings("p:visible").slideUp("slow");
		$(this).children().toggleClass("act_adr");
		$(this).siblings("h3").children("a").removeClass("act_adr");
		var class_name = $(this).attr('class');
		var adr_index = class_name.substring(4) - 0;
		if (adr_index<points.length/2){map_animate(adr_index);}
		return false;
	});
});
