/* ******************* */
/* iMap JavaScript   */
/* ****************** */

		var map ="";
		
		var iWide = 600;
		var iHigh = 500;
		
		var myCount = -1;
		
		var myPoints = new Array();
		var myInfo = new Array();
		var myType = new Array();
		
		var generalIcon = new GIcon();
		
		var myCenterX = 0;
		var myCenterY = 0;
		var myZoom = 2;
		var myFocusZoom = 10;
		
		function resetMyMap(){
			map.closeInfoWindow();			
			map.setCenter(new GLatLng(myCenterY, myCenterX), myZoom);
			showAll();
		}
		
		function zoomOutMAX(){
			map.setZoom(1);
		}
		
		function zoomInMAX(){
			map.setZoom(17);
		}
		
		function showAll(){
			for (i = 0; i < myCount; i++) {
				myPoints[i].show()
			}
		}
		
		function hideAll(){
			map.closeInfoWindow();	
			for (i = 0; i < myCount; i++) {
				myPoints[i].hide()
			}
		}
		
		function setIcons(){
			generalIcon.iconSize = new GSize(24	, 24);
			generalIcon.image = "http://spiritmag.com/images/mapIcons/vegasIcon2.png";
			generalIcon.shadow = "http://spiritmag.com/images/mapIcons/vegasShadow2.png";
			generalIcon.shadowSize =  new GSize(44, 24);
			generalIcon.iconAnchor = new GPoint(12, 24);
			generalIcon.infoWindowAnchor = new GPoint(12,0);

		}
			
		function createMarker(point,info,type) {
		  var thisIcon = new GIcon();
		  if(type=="general"){thisIcon=generalIcon;}
		  
		  var marker = new GMarker(point, thisIcon);
		  GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml(info);
		  });
		  return marker;}
		
		function activateMyPoint(num){
			showAll();
			map.setZoom(myFocusZoom);
			myPoints[num].openInfoWindowHtml(myInfo[num]);
		}
		
		function showOneType(showType){
			map.closeInfoWindow();			
			for (i = 0; i < myCount; i++) {
				if(myType[i] == showType)
					{ myPoints[i].show(); }
				else
					{ myPoints[i].hide(); }
			}
		}
		
		function createVegasMap(){
			map = new GMap2(document.getElementById("map"));
			map.setCenter(new GLatLng(myCenterY, myCenterX), myZoom); 
    		map.addControl(new GSmallMapControl());
			setIcons();
		}
		
		function createVegasPoint(pointy, pointx, winW, winH){
			myCount = myCount +1;
			
			if(myCount < 10){
				myNumx = "0"+myCount.toString();
			}
			else{
				myNumx= myCount.toString();
			}
			point=new GLatLng(pointx, pointy);
			myInfo[myCount] = "<iframe src='http://spiritmag.com/las_vegas_strip/infoPage.php?x" + myNumx + "' width=" + winW + " height=" + winH +" frameborder='0' scrolling='no'>";
			myPoints[myCount]=createMarker(point,myInfo[myCount],"general");
			myType[myCount]="general";
			map.addOverlay(myPoints[myCount]);
		}
		
		function setMyCenter(){
		tempPoint =myPoints[0].getPoint();
		var MinX = tempPoint.x;
		var MinY = tempPoint.y;
		var MaxX = tempPoint.x;
		var MaxY = tempPoint.y;
		for (i = 0; i < myCount; i++) {
			
			tempPoint =myPoints[i].getPoint();
			
			if(tempPoint.x > MaxX){
				MaxX = tempPoint.x;
			}
			
			if(tempPoint.x < MinX){
				MinX = tempPoint.x;
			}
			
			if(tempPoint.y > MaxY){
				MaxY = tempPoint.y;
			}
			
			if(tempPoint.y < MinY){
				MinY = tempPoint.y;
			}
			
		}
			myCenterX = (MinX + MaxX)/2;
			myCenterY = (MinY + MaxY) / 2;
			map.setCenter(new GLatLng(myCenterY, myCenterX), myZoom);
		}
		
		function setMyCenterManual(manualX, manualY){
			myCenterX=manualX;
			myCenterY=manualY;
			map.setCenter(new GLatLng(manualY, manualX), myZoom);
		}
		
		function setMyZoom(myNewZoom){
			myZoom= myNewZoom;
		}
		
		function setMyZoomFocus(myNewZoomFocus){
			myFocusZoom = myNewZoomFocus;
		}
		
		
		function vegasMapLoad(){
			
			createVegasMap();
			
			//*** Edit Here **
			
			//setMyZoom = Zoom When map is set
			setMyZoom(15);
			
			//setMyZoomFocus = Zoom When point is activated
			setMyZoomFocus(16);
			
			//createVegasPoint(Coord1,Coord1,Pop-Up Width, Pop-Up Height);
			createVegasPoint(-115.172256,36.119453,485,295); //Harrah's
			createVegasPoint(-115.170341,36.124409,305,115); //Treasure Island
			createVegasPoint(-115.155357,36.147072,305,115); //Stratosphere
			createVegasPoint(-115.170876,36.122536,305,115); //Venetian
			createVegasPoint(-115.167702,36.127129,305,115); //Wynn
			createVegasPoint(-115.157837,36.142498,305,115); //Sahara
			createVegasPoint(-115.154671,36.136116,305,115); //Hilton
			createVegasPoint(-115.162773,36.135075,305,115); //Riviera
			
			//South Vegas
			createVegasPoint(-115.172577,36.102047,305,115); //MGM Grand
			createVegasPoint(-115.172653,36.110023,305,115); //Planet Hollywood
			createVegasPoint(-115.172562,36.112354,305,115); //Paris Resort
			createVegasPoint(-115.172432,36.113483,305,115); //Bally's Resort & Casino
			createVegasPoint(-115.172684,36.116463,305,115); //Harrah's Flamingo
			createVegasPoint(-115.172523,36.118172,305,115); //Imperial Palace
			createVegasPoint(-115.173286,36.090656,305,115); // Mandalay Bay
			createVegasPoint(-115.173515,36.096916,305,115); //Luxor Resort and Casino
			createVegasPoint(-115.173409,36.099983,305,115); //Excalibur Hotel and Casino
			createVegasPoint(-115.173309,36.101357,305,115); //New York, New York
			createVegasPoint(-115.173515,36.104160,305,115); //Monte Carlo Resort and Casino
			createVegasPoint(-115.173264,36.110687,305,115); //Bellagio Hotel and Casino
			createVegasPoint(-115.173264,36.117111,305,115); //Caesar's Palace
			createVegasPoint(-115.173347,36.121014,305,115); //Mirage Hotel and Casino
			createVegasPoint(-115.188087,36.115761,305,115); //Rio Suites Hotel and Casino
			createVegasPoint(-115.188087,36.115761,280,90); //Platinum
			
			//*** End Edit Here **
			
			setMyCenterManual(-115.172093, 36.118864)
			
		}