// JavaScript Document

$(document).ready(function(){
		$(".estateMap").css({"top":"-866px"});
$(".button2").click(function(){
		$(".estateMap").css({"top":"150px"});
		$('html, body').animate({ scrollTop: 325 }, 'slow');

  });
  $(".galleryButton").click(function(){
		$(".estateMap").css({"top":"-866px"});

  });
});

//initialize(7,42.8,25);
function initialize(zoomLevel,mapLat,MapLng) {

	var mapX = document.getElementById('mapX');
	var mapY = document.getElementById('mapY');
	//alert(mapX.innerHTML + "        " + mapY.innerHTML);
	var mapPosX = mapX.innerHTML;
	var mapPosY = mapY.innerHTML;

    var latlng = new google.maps.LatLng(mapLat,MapLng);
    var myOptions = {

      zoom: zoomLevel,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var mapBG = new google.maps.Map(document.getElementById("estateMap"), myOptions);
	var MyMapStyles = [
	  {
		featureType: "all",
    	elementType: "geometry",
    	stylers: [
     		{ saturation: 45 },
		  	{ lightness: 50 },
		  	{ gamma: 1 }
    ]
	  }
	];

	mapBG.setOptions({styles: MyMapStyles});

	function CreateSingleMarker(lat,lng,smalltitle,infoWindowText){
		var latlngCity = new google.maps.LatLng(lat,lng);
		var marker = new google.maps.Marker({
		map: mapBG,
		position: latlngCity,
		title: smalltitle,
		clickable:true
		});
		google.maps.event.addListener(marker, 'click', function(event) {
  		CreateInfoWindow(mapBG, marker, infoWindowText);
 		});
	}
	var infowindow = new google.maps.InfoWindow();
	function CreateInfoWindow(objMap, objMarker, strInfoWindowText) {
	 infowindow.setContent(strInfoWindowText);
	 infowindow.open(objMap, objMarker);
	}
function GenerateMapMarkers(var1,var2){

	CreateSingleMarker(var1,var2,'','');

	//CreateSingleMarker('','','','<p>София</p><p></p><p></p>');

}
   	GenerateMapMarkers(mapPosX,mapPosY);
	function zoomSofia(zoomLevel){
		mapBG.setZoom(zoomLevel);
	};
	zoomSofia(zoomLevel);

}


