$(document).ready(function() {

	// GOOGLE MAP
	var map = new GMap2($("#map").get(0));
	var ecurie = new GLatLng(46.184685, 6.700909);
	var philippe = new GLatLng(46.179730, 6.707088);
	var lodge = new GLatLng(46.188755, 6.694311);
	var superMorzine = new GLatLng(46.183519, 6.703441);
	var pleney = new GLatLng(46.179908, 6.701767);
	map.setCenter(ecurie, 14);
	map.addControl(new GLargeMapControl3D());
	map.addControl(new GMenuMapTypeControl());

	var chaletMarker = new GIcon();
	     chaletMarker.image = "i/chalet_pin.png";
	     chaletMarker.shadow = "i/pin_shaddow.png";
	     chaletMarker.iconSize = new GSize(52, 39);
	     chaletMarker.shadowSize = new GSize(52, 39);
	     chaletMarker.iconAnchor = new GPoint(15, 39);
	     chaletMarker.infoWindowAnchor = new GPoint(29, 2);

	var liftMarker = new GIcon();
	     liftMarker.image = "i/lift_pin.png";
	     liftMarker.shadow = "i/pin_shaddow_small.png";
	     liftMarker.iconSize = new GSize(35, 26);
	     liftMarker.shadowSize = new GSize(35, 26);
	     liftMarker.iconAnchor = new GPoint(11, 26);
	  liftMarker.infoWindowAnchor = new GPoint(21, 1);

	var ecurie_marker = new GMarker(ecurie,chaletMarker);
	map.addOverlay(ecurie_marker);
	var ecurie_text = '<div class="customInfoWindow">'+
					'<img src="i/ecurie_vSml.jpg" width="70" height="70" alt="Chalet Ecurie" style="float:left; margin-right: 10px;" />'+
					'<div class="title">Chalet l\'Ecurie</div>'+
					'<p>Chalet l\'Ecurie, Route de la Vielle Plagne, 74110, Morzine</p>'+
					'<p><a href="summer_chalet_lecurie.php">Chalet l\'Ecurie</a></p>'+
					'</div>';
	   // Display marker text on click
	   GEvent.addListener(ecurie_marker, "click", function() {
	   	ecurie_marker.openInfoWindowHtml(ecurie_text,{maxWidth:260});
	   });

	var philippe_marker = new GMarker(philippe,chaletMarker);
	map.addOverlay(philippe_marker);
	var philippe_text = '<div class="customInfoWindow">'+
						'<img src="i/philippe_vSml.jpg" width="70" height="70" alt="Chalet Philippe" style="float:left; margin-right: 10px;" />'+
						'<div class="title">Chalet Philippe</div>'+
						'<p>Chalet Philippe, 137 Route du Plan, 74110, Morzine</p>'+
						'<p><a href="summer_chalet_philippe.php">Chalet Philippe</a></p>'+
						'</div>';
	   // Display marker text on click
	   GEvent.addListener(philippe_marker, "click", function() {
	   	philippe_marker.openInfoWindowHtml(philippe_text,{maxWidth:260});
	   });

	var lodge_marker = new GMarker(lodge,chaletMarker);
	map.addOverlay(lodge_marker);
	var lodge_text = '<div class="customInfoWindow">'+
					'<img src="i/lodge_vSml.jpg" width="70" height="70" alt="The Lodge" style="float:left; margin-right: 10px;" />'+
					'<div class="title">The Lodge</div>'+
					'<p>The Lodge, 1100 Route de la Plagne, 74110, Morzine</p>'+
					'<p><a href="summer_the_lodge.php">The Lodge</a></p></div>'+
					'</div>';
	   // Display marker text on click
	   GEvent.addListener(lodge_marker, "click", function() {
	   	lodge_marker.openInfoWindowHtml(lodge_text,{maxWidth:260});
	   });

	var superMorzine_marker = new GMarker(superMorzine,liftMarker);
	map.addOverlay(superMorzine_marker);
	var superMorzine_text = '<div class="customInfoWindow">'+
							'<div class="title">Super Morzine lift</div>'+
							'<p>Leads to: Avoriaz, Chatel, Morgins, Les Crosets</p>'+
							'</div>';
	   // Display marker text on click
	   GEvent.addListener(superMorzine_marker, "click", function() {
	   	superMorzine_marker.openInfoWindowHtml(superMorzine_text,{maxWidth:260});
	   });

	var pleney_marker = new GMarker(pleney,liftMarker);
	map.addOverlay(pleney_marker);
	var pleney_text = '<div class="customInfoWindow">'+
					'<div class="title">Pleney lift</div>'+
					'<p>Leads to: Morzine, Les Gets</p>'+
					'</div>';
	   // Display marker text on click
	   GEvent.addListener(pleney_marker, "click", function() {
	     	pleney_marker.openInfoWindowHtml(pleney_text,{maxWidth:260});
	   });

	  	// Open marker text as default

	var defaultMarker = $('#map').attr('class');

	switch (defaultMarker)
	{
	case 'ecurie':
	  ecurie_marker.openInfoWindowHtml(ecurie_text,{maxWidth:260});
	  break;
	case 'philippe':
	  philippe_marker.openInfoWindowHtml(philippe_text,{maxWidth:260});
	  break;
	case 'lodge':
	  lodge_marker.openInfoWindowHtml(lodge_text,{maxWidth:260});
	  break;
	default:
	  ecurie_marker.openInfoWindowHtml(ecurie_text,{maxWidth:260});
	}
	
});