/* *
author: Artur Godzina, Odkryjpolske.pl
modifications: Justyna Karamuz, Konsultor
*/ 

function generateMap (type, number, latitude, longtude, zoom, name) {
	
	//define urls
	baseUrl = "http://www.hotele.eu";
	imageUrl = baseUrl + "/public/images/googlemap/";
	//dispaly map container
	//alert(type);
	
	//with jQuery
	var mapContainer = "#gmapContainer" + type + number;
	//jQuery(mapContainer).slideDown("normal");
	jQuery(mapContainer).toggle("normal");
	
	
	//wihout jQuery 
	/*
	var mapContainer = "#gmapContainer" + type + number;
	document.getElementById(mapContainer).style.display = "block";
	*/
	
	
	//generate single map
	var mapId = document.getElementById("gmap" + type + number);
	var map = new GMap2(mapId);
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
	map.setCenter(new GLatLng(latitude, longtude), zoom);
	var point = new GLatLng (latitude, longtude);
	
	var baseIcon = new GIcon();
	baseIcon.image = imageUrl +"cityH.png";
	baseIcon.shadow = imageUrl + "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);
	baseIcon.infoShadowAnchor = new GPoint(18, 25);
	var marker = new GMarker(point, baseIcon); 
	map.addOverlay (marker); 
	
	GEvent.addListener(marker, "click", function() {
	marker.openInfoWindowHtml("<h3>Hotel " + name + "</h3>");
	});
	
	

}

function hideMap (type, number) {
	
	//with jQuery
	var mapContainer = "#gmapContainer" + type + number;
	jQuery(mapContainer).slideUp("normal");
	
	//wihout jQuery 
	/*
	var mapContainer = "#gmapContainer" + type + number;
	document.getElementById(mapContainer).style.display = "none";
	*/
	
	

}
