/**
 * @author Valentin Todorov
 */

$(document).ready(function(){
	$(".gallery a").fancybox();
	
	$('.scrollable').jScrollPane();

	$("#menu li").hover(
		function(){ $("ul", this).show(); }, 
		function() { $("ul", this).hide(); } 
	);
});


var div_office = "map_office";
var centerPointOffice;
var point_office;
					
var div_studio = "map_studio";
var centerPointStudio;
var point_studio;
	
function load() {
	makePoints();
	loadMap(centerPointOffice, div_office, point_office, info_office);
	loadMap(centerPointStudio, div_studio, point_studio, info_studio);
}
						
function makePoints(){
	centerPointOffice = new GLatLng(42.683391, 23.315837);
	point_office = new GLatLng(42.683391, 23.315837);
	
	centerPointStudio = new GLatLng(42.668032, 23.350561);
	point_studio = new GLatLng(42.668032, 23.350561);
}

function loadMap(centerPoint, element_id, point, info) {
	if (GBrowserIsCompatible()) {

		var map = new GMap2(document.getElementById(element_id), {mapTypes: [G_HYBRID_MAP, G_SATELLITE_MAP, G_NORMAL_MAP]});
		
		// function for showing the bubble
		var showBubble = function(marker, info){
			var tab1 = new GInfoWindowTab("Info", '<div id="tab_'+element_id+'" class="bubble">' + info + '</div>');
			marker.openInfoWindowTabsHtml([tab1]);
		}
		
		// setup controls
		map.setCenter(centerPoint, 15);
		map.addControl(new GScaleControl());
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.enableContinuousZoom();
		
		// add marker
		var marker = new GMarker(point);
		GEvent.addListener(marker, "click", function() { showBubble(marker, info); });
		map.addOverlay(marker);

		// show bubble after a while
//		setTimeout(function(){showBubble(marker, info);}, 7000);
	}
}

