/**
 * @author Abraham Thomas, Sepia Catalyst Technologies, Bangalore, India
 */

$(document).ready(function(){
	
		// FUNCTION: Sample custom marker code created with Google Map Custom Marker Maker
		// http://www.powerhut.co.uk/googlemaps/custom_markers.php
		function createCustomIcon(fnamePart){
			var fNamePrefix = './images/mapicons/';
			var fName = fNamePrefix+fnamePart+'/';
			var myIcon = new GIcon(G_DEFAULT_ICON);
			myIcon.image = fName + 'image.png';
			myIcon.shadow = fName + 'shadow.png';
			myIcon.iconSize = new GSize(32, 37);
			myIcon.shadowSize = new GSize(51, 37);
			myIcon.iconAnchor = new GPoint(16, 37);
			myIcon.infoWindowAnchor = new GPoint(16, 8);
			myIcon.printImage = fName + 'printImage.gif';
			myIcon.mozPrintImage = fName + 'mozPrintImage.gif';
			myIcon.printShadow = fName + 'printShadow.gif';
			myIcon.transparent = fName + 'transparent.png';
			myIcon.imageMap = [29, 0, 30, 1, 31, 2, 31, 3, 31, 4, 31, 5, 31, 6, 31, 7, 31, 8, 31, 9, 31, 10, 31, 11, 31, 12, 31, 13, 31, 14, 31, 15, 31, 16, 31, 17, 31, 18, 31, 19, 31, 20, 31, 21, 31, 22, 31, 23, 31, 24, 31, 25, 31, 26, 31, 27, 31, 28, 31, 29, 30, 30, 29, 31, 23, 32, 22, 33, 21, 34, 20, 35, 19, 36, 12, 36, 11, 35, 10, 34, 9, 33, 8, 32, 2, 31, 1, 30, 0, 29, 0, 28, 0, 27, 0, 26, 0, 25, 0, 24, 0, 23, 0, 22, 0, 21, 0, 20, 0, 19, 0, 18, 0, 17, 0, 16, 0, 15, 0, 14, 0, 13, 0, 12, 0, 11, 0, 10, 0, 9, 0, 8, 0, 7, 0, 6, 0, 5, 0, 4, 0, 3, 0, 2, 1, 1, 2, 0];
			return myIcon;
		}

	      function createMarker(point, html, theIcon) {
		        var marker = new GMarker(point, {icon:theIcon});
		        GEvent.addListener(marker, "click", function() {
		          marker.openInfoWindowHtml(html);
		        });
		
		        // The new marker "mouseover" listener        
		        GEvent.addListener(marker,"mouseover", function() {
		          marker.openInfoWindowHtml(html);
		        });        

		        marker.openInfoWindowHtml(html);
		        return marker;
	      }


		//Map related stuff
	  	  var map = new GMap2(document.getElementById('mapbox'));
	      var rsuPoint = new GLatLng(13.028007, 77.633134);
	      var rsuHtml = '<div class="maptext">\
					  		<strong>Royal Suites</strong><br/>\
							Phone: +91 80 4019 9999, +91 98450 81006<br/>\
							<a href="rsulocation.html#locus"> More directions & location information<\/a>\
						</div>';

          map.setCenter(rsuPoint, 13);
  		  map.setUIToDefault();
		  //put a marker on Royal Suites
		  var rsuIcon = createCustomIcon('rsuites');
	      var rsuMarker = createMarker(rsuPoint, rsuHtml, rsuIcon);
	      map.addOverlay(rsuMarker);

});
