    var map;
    var myPano;   
    var panoClient;
    var mapCenter = new GLatLng(36.10808, -115.171212);
    
    var currentLatLng = new GLatLng(36.114756, -115.172951);
    var currentYaw = 180;
    var currentPitch = 0;
    var oldLatLng = currentLatLng;
    
    var fovIcon = new GIcon(G_DEFAULT_ICON);
    var fovMarker;
    var guyMarker;
    var hotelMarker = [];
    var overlayInstance = null;
    var iconSize = 150; // field of view icon marker height/width
 	
 	var hotels = [];
 		// 0 Hotel name
	    // 1 Marker point
	    // 2 View point
	    // 3 POV
	    // 4 Polygon points (array) 
	    // 5 Icon information

    var hotelCount = 29;
        
    for (var i=0; i<hotelCount; i++) {
	    hotels[i] = [];
	    hotels[i][4] = [];
	}
	    // 0 Hotel name
	    // 1 Marker point
	    // 2 View point
	    // 3 POV
	    // 4 Polygon (array) 
	    // 5 Icon information
	   
	hotels[0][0] = 'Mandalay Bay';
	hotels[0][2] = new GLatLng(36.093617,-115.173022); 
	hotels[0][3] = {yaw:227,pitch:-32};    	
	hotels[0][4].push(new GLatLng(36.090239571138, -115.17345428466797));
	hotels[0][4].push(new GLatLng(36.09349937380574, -115.17354011535644));
	hotels[0][4].push(new GLatLng(36.09348203478753, -115.17791748046875));
	hotels[0][4].push(new GLatLng(36.093291305334624, -115.17989158630371));
	hotels[0][4].push(new GLatLng(36.09025691087156, -115.17991304397583));
	hotels[0][4].push(new GLatLng(36.090239571138, -115.17345428466797));
	
	hotels[1][0] = 'Luxor';
	hotels[1][2] = new GLatLng(36.093617,-115.173022); // Luxor
	hotels[1][3] = {yaw:326,pitch:-10};  
	hotels[1][4].push(new GLatLng(36.09391550909546, -115.17362594604492));
	hotels[1][4].push(new GLatLng(36.097244512088324, -115.17362594604492));
	hotels[1][4].push(new GLatLng(36.097244512088324, -115.17989158630371));
	hotels[1][4].push(new GLatLng(36.09370744172604, -115.17989158630371));
	hotels[1][4].push(new GLatLng(36.09391550909546, -115.1780891418457));
	hotels[1][4].push(new GLatLng(36.09391550909546, -115.17362594604492));
	
	hotels[2][0] = 'Excalibur';
	hotels[2][2] = new GLatLng(36.100934,-115.173061); // Exaclibur
	hotels[2][3] = {yaw:220,pitch:0};
	hotels[2][4].push(new GLatLng(36.10008792380247, -115.17362594604492));
	hotels[2][4].push(new GLatLng(36.100434674289374, -115.17379760742187));
	hotels[2][4].push(new GLatLng(36.10036532431443, -115.1777458190918));
	hotels[2][4].push(new GLatLng(36.09752192263873, -115.17765998840332));
	hotels[2][4].push(new GLatLng(36.09752192263873, -115.17354011535644));
	hotels[2][4].push(new GLatLng(36.10008792380247, -115.17362594604492));             
	
	hotels[3][0] = 'New York New York';
	hotels[3][2] = new GLatLng(36.100934,-115.173061); // NYNY
	hotels[3][3] = {yaw:315,pitch:-20};
	hotels[3][4].push(new GLatLng(36.10161361449842, -115.17354011535644));
	hotels[3][4].push(new GLatLng(36.103694054065635, -115.17354011535644));
	hotels[3][4].push(new GLatLng(36.10360737018357, -115.17787456512451));
	hotels[3][4].push(new GLatLng(36.10133621839366, -115.17783164978027));
	hotels[3][4].push(new GLatLng(36.10140556751166, -115.17354011535644));
	hotels[3][4].push(new GLatLng(36.10161361449842, -115.17354011535644));
	
	hotels[4][0] = 'MGM Grand';
	hotels[4][2] = new GLatLng(36.100768, -115.172952); // MGM Grand
	hotels[4][3] = {yaw:45,pitch:-15};
	hotels[4][4].push(new GLatLng(36.10133621839366, -115.1722526550293));
	hotels[4][4].push(new GLatLng(36.10133621839366, -115.16991376876831));
	hotels[4][4].push(new GLatLng(36.10133621839366, -115.16772508621216));
	hotels[4][4].push(new GLatLng(36.10393676842652, -115.16770362854004));
	hotels[4][4].push(new GLatLng(36.10393676842652, -115.17060041427612));
	hotels[4][4].push(new GLatLng(36.10234177461357, -115.17062187194824));
	hotels[4][4].push(new GLatLng(36.10230710047541, -115.1722526550293));
	hotels[4][4].push(new GLatLng(36.10133621839366, -115.1722526550293));
	
	hotels[5][0] = 'Monte Carlo';
	hotels[5][2] = new GLatLng(36.104939,-115.173099); // Monte Carlo
	hotels[5][3] = {yaw:260,pitch:-15};
	hotels[5][4].push(new GLatLng(36.104179482037566, -115.17362594604492));
	hotels[5][4].push(new GLatLng(36.10527168400754, -115.1736044883728));
	hotels[5][4].push(new GLatLng(36.10527168400754, -115.17538547515869));
	hotels[5][4].push(new GLatLng(36.10650256009136, -115.17536401748657));
	hotels[5][4].push(new GLatLng(36.10650256009136, -115.17858266830444));
	hotels[5][4].push(new GLatLng(36.103954105137895, -115.17860412597656));
	hotels[5][4].push(new GLatLng(36.103954105137895, -115.17669439315796));
	hotels[5][4].push(new GLatLng(36.104179482037566, -115.17362594604492));
	
	hotels[6][0] = 'Paris';
	hotels[6][2] = new GLatLng(36.111563,-115.173091); // Paris
	hotels[6][3] = {yaw:70,pitch:-15};
	hotels[6][4].push(new GLatLng(36.11125252076156, -115.16768217086792)); //bottom right
	hotels[6][4].push(new GLatLng(36.11314202379141, -115.16768217086792)); //top right corner
	hotels[6][4].push(new GLatLng(36.11314202379141, -115.17235994338989)); //top left corner
	hotels[6][4].push(new GLatLng(36.11125252076156, -115.17235994338989)); //bottom left
	hotels[6][4].push(new GLatLng(36.11125252076156, -115.16768217086792));    
	
	hotels[7][0] = 'Bellagio';
	hotels[7][2] = new GLatLng(36.11228,-115.174802);
	hotels[7][3] = {yaw:290,pitch:-15};  
	hotels[7][4].push(new GLatLng(36.108322834440806, -115.17866849899292));
	hotels[7][4].push(new GLatLng(36.10882556944623, -115.17759561538696));
	hotels[7][4].push(new GLatLng(36.11048977271466, -115.17759561538696));
	hotels[7][4].push(new GLatLng(36.11048977271466, -115.1737117767334));
	hotels[7][4].push(new GLatLng(36.114234101142344, -115.17362594604492));
	hotels[7][4].push(new GLatLng(36.114234101142344, -115.17980575561523));
	hotels[7][4].push(new GLatLng(36.108322834440806, -115.17980575561523));
	hotels[7][4].push(new GLatLng(36.108322834440806, -115.17866849899292));
	
	hotels[8][0] = 'Bally\'s';
	hotels[8][2] = new GLatLng(36.114033,-115.172755); // Bally's
	hotels[8][3] = {yaw:100,pitch:-15};
	hotels[8][4].push(new GLatLng(36.113246031812444, -115.16987085342407)); //crook
	hotels[8][4].push(new GLatLng(36.113246031812444, -115.1675534248352)); //leg left
	hotels[8][4].push(new GLatLng(36.11232728952763, -115.1675534248352)); //leg right
	hotels[8][4].push(new GLatLng(36.11232728952763, -115.16637325286865)); //right bottom
	hotels[8][4].push(new GLatLng(36.11420744535703, -115.16635179519653)); //top right
	hotels[8][4].push(new GLatLng(36.11420744535703, -115.17235994338989)); //top left
	hotels[8][4].push(new GLatLng(36.113246031812444, -115.17235994338989)); //bottom left
	hotels[8][4].push(new GLatLng(36.113246031812444, -115.16987085342407)); //crook
	
	hotels[9][0] = 'Flamingo';
	hotels[9][2] = new GLatLng(36.115326,-115.172719); // Flamingo
	hotels[9][3] = {yaw:45,pitch:-15};
	hotels[9][4].push(new GLatLng(36.11581283425664, -115.16869068145752)); //bottom right
	hotels[9][4].push(new GLatLng(36.1174409071749, -115.16869068145752)); //top right
	hotels[9][4].push(new GLatLng(36.1174409071749, -115.17238140106201)); //top left
	hotels[9][4].push(new GLatLng(36.11581283425664, -115.17238140106201)); //bottom left
	hotels[9][4].push(new GLatLng(36.11581283425664, -115.16869068145752)); //bottom right
	
	hotels[10][0] = 'Caesars Palace';
	hotels[10][2] = new GLatLng(36.117078,-115.172945); // Caesars Palace
	hotels[10][3] = {yaw:255,pitch:-15};
	hotels[10][4].push(new GLatLng(36.11534349750438, -115.17791748046875)); //mid bottom
	hotels[10][4].push(new GLatLng(36.115204823816214, -115.17354011535644)); //bottom right
	hotels[10][4].push(new GLatLng(36.118342256103126, -115.17345428466797)); //mid right
	hotels[10][4].push(new GLatLng(36.11981559264845, -115.1731538772583)); //top right
	hotels[10][4].push(new GLatLng(36.12019692230931, -115.17980575561523)); //top left
	hotels[10][4].push(new GLatLng(36.11513548688032, -115.17980575561523)); //bottom left
	hotels[10][4].push(new GLatLng(36.11534349750438, -115.17791748046875)); //mid bottom
	
	hotels[11][0] = 'Imperial Palace';
	hotels[11][2] = new GLatLng(36.117947, -115.172901); // Imperial Palace
	hotels[11][3] = {yaw:50,pitch:-15};
	hotels[11][4].push(new GLatLng(36.117544915195934, -115.16855120658874)); //bottom right
	hotels[11][4].push(new GLatLng(36.11884492697276, -115.16855120658874)); //top right
	hotels[11][4].push(new GLatLng(36.11884492697276, -115.17229557037353)); //top left
	hotels[11][4].push(new GLatLng(36.117544915195934, -115.17238140106201)); //bottom left
	hotels[11][4].push(new GLatLng(36.117544915195934, -115.16855120658874)); //bottom right
	
	hotels[12][0] = 'Harrah\'s';
	hotels[12][2] = new GLatLng(36.120226, -115.172449);
	hotels[12][3] = {yaw:143, pitch:5};
	hotels[12][4].push(new GLatLng(36.118948934993794, -115.16849756240845));
	hotels[12][4].push(new GLatLng(36.12014492291916, -115.16849756240845));
	hotels[12][4].push(new GLatLng(36.12014492291916, -115.17173767089844));
	hotels[12][4].push(new GLatLng(36.118948934993794, -115.17208099365234)); //bottom left
	hotels[12][4].push(new GLatLng(36.118948934993794, -115.16849756240845)); //bottom right  		 
	
	hotels[13][0] = 'Mirage';
	hotels[13][2] = new GLatLng(36.121236,-115.172045); // Mirage
	hotels[13][3] = {yaw:276,pitch:-15};
	hotels[13][4].push(new GLatLng(36.12343814964947, -115.17145872116089)); //top right
	hotels[13][4].push(new GLatLng(36.12205154470539, -115.17229557037353)); //mid right
	hotels[13][4].push(new GLatLng(36.119919600669484, -115.1731538772583)); //bottom right
	hotels[13][4].push(new GLatLng(36.120300930330344, -115.17980575561523)); //bottom left
	hotels[13][4].push(new GLatLng(36.12366347063968, -115.17765998840332)); //top left
	hotels[13][4].push(new GLatLng(36.12343814964947, -115.17145872116089)); //top right 		 
	
	hotels[14][0] = 'Casino Royale';
	hotels[14][2] = new GLatLng(36.120685, -115.172275);
	hotels[14][3] = {yaw:97, pitch:-22};		
	hotels[14][4].push(new GLatLng(36.12023559034539, -115.17170767089844)); //bottom left
	hotels[14][4].push(new GLatLng(36.12023559034539,  -115.17049650498116)); //bottom right
	hotels[14][4].push(new GLatLng(36.121328895604985, -115.17049650498116)); //top right DONE
	hotels[14][4].push(new GLatLng(36.121328895604985, -115.17129705978393)); //top left DONE
	hotels[14][4].push(new GLatLng(36.12023559034539, -115.17170767089844)); //bottom left
	
	hotels[15][0] = 'Venetian';
	hotels[15][2] = new GLatLng(36.122742,-115.171012); // Venetian
	hotels[15][3] = {yaw:146,pitch:-15};
	hotels[15][4].push(new GLatLng(36.12338615240604, -115.17008543014526));
	hotels[15][4].push(new GLatLng(36.12338615240604, -115.16802549362182));
	hotels[15][4].push(new GLatLng(36.12023559034539, -115.16802549362182));
	hotels[15][4].push(new GLatLng(36.12023559034539, -115.17038583755493));
	hotels[15][4].push(new GLatLng(36.121479563031215, -115.17038583755493));
	hotels[15][4].push(new GLatLng(36.121479563031215, -115.17128705978393));
	hotels[15][4].push(new GLatLng(36.12338615240604, -115.17008543014526));
	
	hotels[16][0] = 'Treasure Island';
	hotels[16][2] = new GLatLng(36.124568,-115.169957); // Treasure Island
	hotels[16][3] = {yaw:260,pitch:-15};   
	hotels[16][4].push(new GLatLng(36.12520603543386, -115.17291784286499)); //top middle
	hotels[16][4].push(new GLatLng(36.12518870341353, -115.17017126083374)); //top right
	hotels[16][4].push(new GLatLng(36.123642157670504, -115.17137068676758)); //bottom right
	hotels[16][4].push(new GLatLng(36.123777478660714, -115.17749958099365)); //bottom left
	hotels[16][4].push(new GLatLng(36.12548334723858, -115.17656564712524)); //top left
	hotels[16][4].push(new GLatLng(36.12520603543386, -115.17291784286499)); //top middle
	
	hotels[17][0] = 'Planet Hollywood';
	hotels[17][2] = new GLatLng(36.10808, -115.172612); // Planet Hollywood
	hotels[17][3] = {yaw:25, pitch:-27};   
	hotels[17][4].push(new GLatLng(36.10847885599373, -115.16772508621216)); //bottom right
	hotels[17][4].push(new GLatLng(36.10844418456433, -115.17233848571777)); //bottom left
	hotels[17][4].push(new GLatLng(36.111148512740526, -115.17233848571777)); //top left
	hotels[17][4].push(new GLatLng(36.111148512740526, -115.16772508621216)); //top right
	hotels[17][4].push(new GLatLng(36.10847885599373, -115.16772508621216)); //bottom right
	
	hotels[18][0] = 'Tropicana';
	hotels[18][2] = new GLatLng(36.100929,-115.172801); // Tropicana
	hotels[18][3] = {yaw:145,pitch:-20};
	hotels[18][4].push(new GLatLng(36.09759127512331, -115.16872339309692));
	hotels[18][4].push(new GLatLng(36.10036532431443, -115.16872339309692));
	hotels[18][4].push(new GLatLng(36.10036532431443, -115.1722526550293));
	hotels[18][4].push(new GLatLng(36.09759127512331, -115.1722526550293));
	hotels[18][4].push(new GLatLng(36.09759127512331, -115.16872339309692));
	
	hotels[19][0] = 'Wynn';
	hotels[19][2] = new GLatLng(36.127694, -115.167887);
	hotels[19][3] = {yaw:120, pitch:-17};
	hotels[19][4].push(new GLatLng(36.125258031471866, -115.16684532165527));
	hotels[19][4].push(new GLatLng(36.12458208029139, -115.16622304916382));
	hotels[19][4].push(new GLatLng(36.12333415512819, -115.16562223434448));
	hotels[19][4].push(new GLatLng(36.122848845540695, -115.16491413116455));
	hotels[19][4].push(new GLatLng(36.122796847906955, -115.16416311264038));
	hotels[19][4].push(new GLatLng(36.12778846369744, -115.16296148300171));
	hotels[19][4].push(new GLatLng(36.12929628520915, -115.16324043273926));
	hotels[19][4].push(new GLatLng(36.12966023778605, -115.16416311264038));
	hotels[19][4].push(new GLatLng(36.130422799617484, -115.16536474227905));
	hotels[19][4].push(new GLatLng(36.125760658063626, -115.16851902008056));
	hotels[19][4].push(new GLatLng(36.12560467084508, -115.16761779785156));
	hotels[19][4].push(new GLatLng(36.125258031471866, -115.16684532165527));
	
	hotels[20][0] = 'Palazzo';
	hotels[20][2] = new GLatLng(36.12554,-115.169331); // Palazzo
	hotels[20][3] = {yaw:148, pitch:-28};
	hotels[20][4].push(new GLatLng(36.124244102518496, -115.16729593276977));
	hotels[20][4].push(new GLatLng(36.12450408554989, -115.16745686531067));
	hotels[20][4].push(new GLatLng(36.12469473922567, -115.16768217086792));
	hotels[20][4].push(new GLatLng(36.12486806034732, -115.16803622245788));
	hotels[20][4].push(new GLatLng(36.12498071887117, -115.16859412193298));
	hotels[20][4].push(new GLatLng(36.1250067169691, -115.1690125465393));
	hotels[20][4].push(new GLatLng(36.12355947641686, -115.16999959945679));
	hotels[20][4].push(new GLatLng(36.12355947641686, -115.16701698303222));
	hotels[20][4].push(new GLatLng(36.124244102518496, -115.16729593276977));
	
	hotels[21][0] = 'Stratosphere';
	hotels[21][2] = new GLatLng(36.146249, -115.155605); // Stratosphere
	hotels[21][3] = {yaw:328, pitch:-34};
	hotels[21][4].push(new GLatLng(36.14653885040467, -115.1561164855957));
	hotels[21][4].push(new GLatLng(36.14884334839594, -115.15472173690796));
	hotels[21][4].push(new GLatLng(36.14896463588831, -115.15774726867676));
	hotels[21][4].push(new GLatLng(36.146608159602486, -115.15809059143066));
	hotels[21][4].push(new GLatLng(36.14653885040467, -115.1561164855957));
	
	hotels[22][0] = 'Circus Circus';
	hotels[22][2] = new GLatLng(36.13632373781243, -115.16225337982178);
	hotels[22][3] = {yaw:318, pitch:-10};		
	hotels[22][4].push(new GLatLng(36.1364190503532, -115.16369104385376));
	hotels[22][4].push(new GLatLng(36.136159106787495, -115.1630687713623));
	hotels[22][4].push(new GLatLng(36.137008252580635, -115.1625108718872));
	hotels[22][4].push(new GLatLng(36.139122412388104, -115.16744613647461));
	hotels[22][4].push(new GLatLng(36.13662700458573, -115.16907691955566));
	hotels[22][4].push(new GLatLng(36.13473806674099, -115.16478538513183));
	hotels[22][4].push(new GLatLng(36.1364190503532, -115.16369104385376));
	
	hotels[23][0] = 'Riviera';
	hotels[23][2] = new GLatLng(36.135348, -115.162867);
	hotels[23][3] = {yaw:132, pitch:0};		
	hotels[23][4].push(new GLatLng(36.13510199408225, -115.1582407951355));
	hotels[23][4].push(new GLatLng(36.13510199408225, -115.15706062316894));
	hotels[23][4].push(new GLatLng(36.13610711797104, -115.15706062316894));
	hotels[23][4].push(new GLatLng(36.136141777185834, -115.16169548034668));
	hotels[23][4].push(new GLatLng(36.134616757252154, -115.1627254486084));
	hotels[23][4].push(new GLatLng(36.134616757252154, -115.1582407951355));
	hotels[23][4].push(new GLatLng(36.13510199408225, -115.1582407951355));
	
	hotels[24][0] = 'Sahara';
	hotels[24][2] = new GLatLng(36.14145312090948, -115.15869140625);
	hotels[24][3] = {yaw:75, pitch:-9};		
	hotels[24][4].push(new GLatLng(36.14106323025447, -115.15544056892395));
	hotels[24][4].push(new GLatLng(36.143211936889166, -115.15542984008789));
	hotels[24][4].push(new GLatLng(36.143211936889166, -115.15714645385742));
	hotels[24][4].push(new GLatLng(36.14106323025447, -115.15843391418457));
	hotels[24][4].push(new GLatLng(36.14106323025447, -115.15544056892395));
	
	hotels[25][0] = 'Rio';
	hotels[25][2] = new GLatLng(36.115548, -115.188176);
	hotels[25][3] = {yaw:28, pitch:-23};		
	hotels[25][4].push(new GLatLng(36.116036862271876, -115.18830299377441));
	hotels[25][4].push(new GLatLng(36.115274160690916, -115.18538475036621));
	hotels[25][4].push(new GLatLng(36.11998892454208, -115.18220901489258));
	hotels[25][4].push(new GLatLng(36.12269285253613, -115.18778800964355));
	hotels[25][4].push(new GLatLng(36.11894892744056, -115.18778800964355));
	hotels[25][4].push(new GLatLng(36.11894892744056, -115.18967628479004));
	hotels[25][4].push(new GLatLng(36.116036862271876, -115.18950462341308));
	hotels[25][4].push(new GLatLng(36.116036862271876, -115.18830299377441));
	
	hotels[26][0] = 'Palms';
	hotels[26][2] = new GLatLng(36.115633, -115.19479);
	hotels[26][3] = {yaw:164, pitch:-25};
	hotels[26][4].push(new GLatLng(36.11381807346601, -115.19268035888672));
	hotels[26][4].push(new GLatLng(36.11513548688032, -115.19268035888672));
	hotels[26][4].push(new GLatLng(36.11513548688032, -115.19774436950683));
	hotels[26][4].push(new GLatLng(36.11381807346601, -115.19774436950683));
	hotels[26][4].push(new GLatLng(36.11381807346601, -115.19268035888672));
	
	hotels[27][0] = 'Hooters';
	hotels[27][2] = new GLatLng(36.101001, -115.167545);
	hotels[27][3] = {yaw:195, pitch:-15};
	hotels[27][4].push(new GLatLng(36.098804933695156, -115.16678094863891));
	hotels[27][4].push(new GLatLng(36.10036532431443, -115.16680240631103));
	hotels[27][4].push(new GLatLng(36.10036532431443, -115.16847610473633));
	hotels[27][4].push(new GLatLng(36.098804933695156, -115.16847610473633));
	hotels[27][4].push(new GLatLng(36.098804933695156, -115.16678094863891));
	
	hotels[28][0] = 'Bill\'s Gamblin\' Hall and Saloon';
	hotels[28][2] = new GLatLng(36.114737, -115.172716);
	hotels[28][3] = {yaw:53, pitch:-22};		
	hotels[28][4].push(new GLatLng(36.11513548688032, -115.17053604125976));
	hotels[28][4].push(new GLatLng(36.115690180653395, -115.17053604125976));
	hotels[28][4].push(new GLatLng(36.115690180653395, -115.17223119735718));
	hotels[28][4].push(new GLatLng(36.11513548688032, -115.1722526550293));
	hotels[28][4].push(new GLatLng(36.11513548688032, -115.17053604125976));	
 
	hotels[0][5] = '57x34';
	hotels[1][5] = '32x14';
	hotels[2][5] = '48x16';
	hotels[3][5] = '39x13';
	hotels[4][5] = '35x30';
	hotels[5][5] = '38x30';
	hotels[6][5] = '26x14';
	hotels[7][5] = '41x17';
	hotels[8][5] = '36x17';
	hotels[9][5] = '48x16';
	hotels[10][5] = '42x30';
	hotels[11][5] = '76x16';
	hotels[12][5] = '42x15';
	hotels[13][5] = '40x16';
	hotels[14][5] = '70x14';
	hotels[15][5] = '49x15';
	hotels[16][5] = '76x14';
	hotels[17][5] = '54x33';
	hotels[18][5] = '52x15';
	hotels[19][5] = '34x16';
	hotels[20][5] = '42x15';
	hotels[21][5] = '67x16';
	hotels[22][5] = '68x14';
	hotels[23][5] = '36x13';
	hotels[24][5] = '38x14';
	hotels[25][5] = '20x15';
	hotels[26][5] = '32x14';
	hotels[27][5] = '44x14';
	hotels[28][5] = '22x13';
  
	hotels[0][1] = new GLatLng(36.09183481061275, -115.17671585083008) //Mandalay Bay
	hotels[1][1] = new GLatLng(36.09551067396012, -115.17671585083008) //Luxor
	hotels[2][1] = new GLatLng(36.09904766316007, -115.17560005187988) //Excalibur
	hotels[3][1] = new GLatLng(36.10244579693626, -115.17568588256836) //New York New York
	hotels[4][1] = new GLatLng(36.10272318912341, -115.16924858093262) //MGM Grand
	hotels[5][1] = new GLatLng(36.105358366053174, -115.17697334289551) //Monte Carlo
	hotels[6][1] = new GLatLng(36.11215394072147, -115.1700210571289) //Paris
	hotels[7][1] = new GLatLng(36.112292619797, -115.1766300201416) //Bellagio
	hotels[8][1] = new GLatLng(36.1137487353057, -115.16984939575195) //Bally's
	hotels[9][1] = new GLatLng(36.1163835423598, -115.17019271850586) //Flamingo
	hotels[10][1] = new GLatLng(36.11749290835586, -115.17645835876465) //Caesars Palace
	hotels[11][1] = new GLatLng(36.118116919841064, -115.17173767089844) //Imperial Palace
	hotels[12][1] = new GLatLng(36.119434261135545, -115.17010688781738) //Harrah's
	hotels[13][1] = new GLatLng(36.1217915535519, -115.17534255981445) //Mirage
	hotels[14][1] = new GLatLng(36.12066491527094, -115.17109394073486) //Casino Royale
	hotels[15][1] = new GLatLng(36.1219995465436, -115.17027854919433) //Venetian
	hotels[16][1] = new GLatLng(36.1245647481333, -115.17379760742187) //Treasure Island
	hotels[17][1] = new GLatLng(36.10993504220977, -115.1700210571289) //Planet Hollywood
	hotels[18][1] = new GLatLng(36.09890896070051, -115.17045021057129) //Tropicana
	hotels[19][1] = new GLatLng(36.12678323326426, -115.1653003692627) //Wynn
	hotels[20][1] = new GLatLng(36.12401011705408, -115.16924858093262) //Palazzo
	hotels[21][1] = new GLatLng(36.14764779022049, -115.15663146972656) //Stratosphere
	hotels[22][1] = new GLatLng(36.13690427603847, -115.16572952270508) //Circus Circus
	hotels[23][1] = new GLatLng(36.135379270923735, -115.1601505279541) //Riviera
	hotels[24][1] = new GLatLng(36.142172247479216, -115.15654563903808) //Sahara
	hotels[25][1] = new GLatLng(36.118116919841064, -115.18658638000488) //Rio
	hotels[26][1] = new GLatLng(36.114511451702164, -115.19516944885254) //Palms
	hotels[27][1] = new GLatLng(36.09953311984043, -115.16796112060547) //Hooters
	hotels[28][1] = new GLatLng(36.11555150757745, -115.17130851745605) //Bill's Gamblin' Hall & Saloon    
	
    function initialize(chosen) {	 
		panoClient = new GStreetviewClient();      
		map = new GMap2(document.getElementById("map_canvas"));
		myPano = new GStreetviewPanorama(document.getElementById("pano"));
		
		map.addControl(new GSmallMapControl());
		map.setCenter(mapCenter, 14);
		if(chosen == 0){ //when == 1, there is a PHP approved hotel request in the Url to display a certain hotel, so don't load the initial view
			myPano.setLocationAndPOV(currentLatLng, {yaw:currentYaw, pitch:currentPitch});
		}
	
		GEvent.addListener(map, "click", handleMapClick);
		GEvent.addListener(map, "zoomend", handleMapZoom);
		GEvent.addListener(myPano, "error", handleNoFlash); 
		GEvent.addListener(myPano, "initialized", handleInitialized); 
		GEvent.addListener(myPano, "yawchanged", handleYawChange);
		GEvent.addListener(myPano, "pitchchanged", handlePitchChange);

		var guyIcon = new GIcon(G_DEFAULT_ICON);
		guyIcon.image = "http://maps.google.com/intl/en_us/mapfiles/cb/man_arrow-0.png";
		guyIcon.shadow = null;
		guyIcon.transparent = "http://maps.google.com/intl/en_us/mapfiles/cb/man-pick.png";
		guyIcon.imageMap = [26,13, 30,14, 32,28, 27,28, 28,36, 18,35, 18,27, 16,26, 16,20, 16,14, 19,13, 22,8];
		guyIcon.iconSize = new GSize(49, 52);
		guyIcon.iconAnchor = new GPoint(25, 35);  // near base of guy's feet
		guyIcon.infoWindowAnchor = new GPoint(25, 5);  // top of guy's head
		
		guyMarker = new GMarker(currentLatLng, {icon: guyIcon, draggable:true, zIndexProcess: guyOrder, title: "Move me around to explore Las Vegas!"})
			map.addOverlay(guyMarker);	
			GEvent.addListener(guyMarker, "dragend", findView);
			GEvent.addListener(guyMarker, "dragstart", handleDragStart);
		
		fovIcon.image = "http://www.vegashotelhunt.com/images/fieldofviewicon.php?yaw=180";
		fovIcon.transparent = "http://www.vegashotelhunt.com/images/fieldofviewicontrans.php?yaw=180";
		fovIcon.iconSize = new GSize(iconSize, iconSize);
		fovIcon.iconAnchor = new GPoint(iconSize/2, iconSize/2);  // near base of guy's feet
		fovIcon.shadow = null;
		fovMarker = new GMarker(currentLatLng, {icon: fovIcon, clickable: false, autoPan: true, zIndexProcess: fovOrder})
		map.addOverlay(fovMarker);

		for (var i = 0; i < hotelCount; i++) {
			addHotel(hotels[i][0],hotels[i][1],hotels[i][2],hotels[i][3],hotels[i][4],hotels[i][5],i,'1');
		}
	}

	function addHotel(name, mpoint, spoint, hpov, areaarray, iconsize, index, shapetoggle) {

		var hotelIcon = new GIcon();
    	var params = iconsize.split("x");
    	
    	var imagename = name.replace(/ /g, "");
       	imagename = imagename.replace(/\'/g, "")+"Icon.png";
       	
    	hotelIcon.shadow = null;
   		hotelIcon.iconSize = new GSize(params[0],params[1]);
    	hotelIcon.iconAnchor = new GPoint(params[0]/2, params[1]/2);
    	hotelIcon.image = "http://www.vegashotelhunt.com/images/icons/"+imagename;
    	hotelIcon.imageMap = [0,0, params[0],0, params[0],params[1], 0,params[1]];
    	
    	if(index == 11 || index== 15 || index == 20 || index == 27 || index == 14){
    		hotelIcon.iconAnchor = new GPoint(params[0]/12, params[1]/2);
    	}			

		hotelMarker[index] = new GMarker(mpoint, {icon:hotelIcon, zIndexProcess: hotelOrder});
		map.addOverlay(hotelMarker[index]);
		GEvent.addListener(hotelMarker[index], "click", function() {
			myPano.setLocationAndPOV(spoint, hpov);
			removeFovMarker();
        	currentLatLng = spoint;
        	gethinfo(name);
        	selectform.hselect.value = name;
		});
		if(shapetoggle == 1){      
			var hotelShape = new GPolygon(areaarray,'#000000', 1, 1,'#00aa00',0.7);
			map.addOverlay(hotelShape);
				GEvent.addListener(hotelShape, "click", function() {
					myPano.setLocationAndPOV(spoint, hpov);
					removeFovMarker();
					currentLatLng = spoint;
					gethinfo(name);
					selectform.hselect.value = name;
				});
		}
      	return;
    }


	function guyOrder(marker,b){
		return 500;
	}
	function hotelOrder(marker,b){
		return 50;
	}
	function fovOrder(marker,b){
		return 0;
	}	

    function checkPano(panoData) {
		if (panoData.code != 200) {
			if (panoData.code == 600) {
				alert("Please place me directly on a street highlighted in blue!\nI'm very picky about this -- use the X underneath me as a guide.");
				currentLatLng = oldLatLng;
				fixFovMarker();
			}else{alert("There was an error in your request.  Please try again.");}
		}
		else{
			myPano.setLocationAndPOV(panoData.location.latlng);
		}
		return;
	}
 
 	function handleMapClick(overlay, clickLatLng){
 		if(overlay == null){
 			panoClient.getNearestPanorama(clickLatLng, processMapClick);
 		}
 	}
 	function handleMapZoom(start, end){
 		if(end<13 && start>12){ //Remove markers, too zoomed out
			for (var i = 0; i < hotelCount; i++) {
				if(hotelMarker[i]){
					map.removeOverlay(hotelMarker[i]);
					hotelMarker[i] = null;   
	  			}
			} 		
  		}
 		else if(end>12 && start<13){ //Put the markers back
			for (var i = 0; i < hotelCount; i++) {
				addHotel(hotels[i][0],hotels[i][1],hotels[i][2],hotels[i][3],hotels[i][4],hotels[i][5],i,0);
			} 		
 		}
 	}
 	
 	function processMapClick(panoData){
 		if (panoData.code == 200) {
 			currentLatLng = panoData.location.latlng;
 			myPano.setLocationAndPOV(currentLatLng);
			fixFovMarker();	
 		}
 	}
 	
    function handleNoFlash(errorCode) {
      if (errorCode == FLASH_UNAVAILABLE) {
        alert("Error: Flash does not appear to be supported by your browser");
        return;
      }
    }  
       
	function handleInitialized(location) {
		removeFovMarker();
		currentLatLng = location.latlng;
		fixFovMarker();		 
		return;	
	}
	    
    function findView(location) {  
       currentLatLng = guyMarker.getLatLng(); 
       panoClient.getNearestPanorama(currentLatLng, checkPano);    
       if (overlayInstance) {
			map.removeOverlay(overlayInstance);
			overlayInstance = null;
   	   }  
       return;
    }  
    
    function handleDragStart(loction){
		removeFovMarker();
	  	if (!overlayInstance) {      
   			overlayInstance = new GStreetviewOverlay();
   			 map.addOverlay(overlayInstance);
   		}
	  	oldLatLng = guyMarker.getLatLng();
   		return;
    }
    
	function removeFovMarker(){
		if(fovMarker){
			map.removeOverlay(fovMarker);
			fovMarker = null;   
	  	}
	  	return;
	} 
    
    function handleYawChange(yaw){
		removeFovMarker();
		currentYaw = Math.round(yaw);
		fixFovMarker();
   		return;
    } 
    
    function handlePitchChange(pitch){
		currentPitch = Math.round(pitch);
   		return;
    }
     
    function fixFovMarker(){
		removeFovMarker();
		fovIcon.image = "http://www.vegashotelhunt.com/images/fieldofviewicon.php?yaw="+currentYaw+"&random="+Math.random(); 
		fovIcon.transparent = "http://www.vegashotelhunt.com/images/fieldofviewicontrans.php?yaw="+currentYaw+"&random="+Math.random();
		fovMarker = new GMarker(currentLatLng, {icon: fovIcon, clickable: false, autoPan: false, zIndexProcess: fovOrder});
		guyMarker.setLatLng(currentLatLng);
		map.addOverlay(fovMarker);
   		return;
    }
    
	function hotelClick(name){
		name = name.replace(/-/g, " ");
		
		for (var i=0; i < hotelCount; i++) {
			if(hotels[i][0]==name){
				myPano.setLocationAndPOV(hotels[i][2], hotels[i][3]);
				panoClient.getNearestPanorama(hotels[i][2], checkPano);
				currentLatLng = hotels[i][2];
				removeFovMarker();
				
				gethinfo(name);
				map.panTo(currentLatLng, 14);
			}
		}	  
	}
	
	function gethinfo(hinfo)
	{
			var url="/Vegas-Vision/visioninfo.php";
			url=url+"?sid="+Math.random();
			url=url+"&hinfo="+hinfo;
			hinfoRequest=GetXmlHttpObject();
			hinfoRequest.onreadystatechange=function(){		
				if (hinfoRequest.readyState==4){ 
				
					var splitter = "1234WPT4321";
					var longstring = hinfoRequest.responseText;
					var brokenstring=longstring.split(splitter); 
					document.getElementById("title").innerHTML=brokenstring[0];
					document.getElementById("info").innerHTML=brokenstring[1];
				}
			}
			
			hinfoRequest.open("GET",url,true);
			hinfoRequest.send(null);
	}
	
	function GetXmlHttpObject()
	{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
	    {
	    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	  catch (e)
	    {
	    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	  }
	return xmlHttp;
	}
