var imgpath = '/uploads/images/googlemap/';		
var gdata = {		
	whatsnew: [	
		{title:"Blue Ridge Parkway Destination Center",city:"Asheville",url:"http://www.nps.gov/blri",img:"wn_brparkway.jpg",lat:35.564492,lon:-82.489917},
		{title:"Billy Graham Library",city:"Charlotte",url:"http://www.billygraham.org/BGLibrary_Index.asp",img:"wn_billygraham.jpg",lat:35.18847,lon:-80.904694},
		{title:"Daniel Stowe Botanical Garden",city:"Belmont",url:"http://www.dsbg.org/",img:"wn_dsbg.jpg",lat:35.168213,lon:-81.050971},
		{title:"Nasher Museum of Art",city:"Durham",url:"http://www.nasher.duke.edu/",img:"wn_nashermuseum.jpg",lat:36,lon:-78.927539},
		{title:"American Heritage Tours",city:"Wilmington",url:"http://amhtours.com/default.aspx",img:"wn_amerheritage.jpg",lat:34.238805,lon:-77.95045},
		{title:"Airlie Gardens",city:"Wilmington",url:"http://www.airliegardens.org/",img:"wn_airliegardens.jpg",lat:34.218425,lon:-77.830179},
		{title:"Dismal Swamp Canal Welcome Center",city:"South Mills",url:"http://www.dismalswamp.com/",img:"wn_dismalswamp.jpg",lat:36.507963,lon:-76.354787},
		{title:"Carolina Crossroads",city:"Roanoke Rapids",url:"http://www.carolinacrossroads.com/",img:"wn_carcrossroads.jpg",lat:36.405333,lon:-77.636755}
	], 	
	bestbeach: [	
		{title:"Ocracoke Village",city:"Ocracoke",url:"http://www.ocracokevillage.com/",img:"bb_ocracokevillage.jpg",lat:35.112687,lon:-75.975895},
		{title:"Outer Banks",city:"",url:"http://www.outerbanks.org/",img:"bb_outerbanks.jpg",lat:35.910186,lon:-75.596066},
		{title:"Crystal Coast",city:"Morehead City",url:"http://www.crystalcoastnc.org/",img:"bb_crystalcoast.jpg",lat:34.727257,lon:-76.746674},
		{title:"Cape Lookout National Seashore",city:"Harker's Island",url:"http://www.nps.gov/calo/",img:"bb_capelookout.jpg",lat:34.695072,lon:-76.559494},
		{title:"Big Rock Blue Marlin Tournament",city:"Morehead City",url:"http://www.thebigrock.com/",img:"bb_bigrock.jpg",lat:34.727257,lon:-76.746674},
		{title:"North Carolina Aquarium",city:"Pine Knoll Shores",url:"http://www.ncaquariums.com/",img:"bb_ncaquarium.jpg",lat:34.69857,lon:-76.826088},
		{title:"North Carolina Maritime Museum",city:"Beaufort",url:"http://www.ncmaritimemuseum.org/",img:"bb_maritimemuseum.jpg",lat:34.717144,lon:-76.666117},
		{title:"Battleship NORTH CAROLINA",city:"Wilmington",url:"http://www.battleshipnc.com/",img:"bb_battleship.jpg",lat:34.234977,lon:-77.953277},
		{title:"Old Baldy",city:"Bald Head Island",url:"http://www.oldbaldy.org/",img:"bb_oldbaldy.jpg",lat:33.871217,lon:-77.997876},
		{title:"Museum of Coastal Carolina",city:"Ocean Isle Beach",url:"http://www.museumofcc.org",img:"bb_museumcoastalcar.jpg",lat:33.888799,lon:-78.43472},
		{title:"Wrightsville Beach",city:"",url:"http://www.visitwrightsville.com/",img:"bb_wrightsville.jpg",lat:34.214978,lon:-77.790736}
	], 	
	topattractions: [	
		{title:"Biltmore Estate",city:"Asheville",url:"http://www.biltmore.com/",img:"ta_biltmore.jpg",lat:35.541306,lon:-82.553437},
		{title:"Cape Hatteras Lighthouse",city:"Buxton",url:"http://www.nps.gov/caha",img:"ta_chlighthouse.jpg",lat:35.271743,lon:-75.540318},
		{title:"Cape Hatteras National Seashore",city:"Manteo",url:"http://www.nps.gov/caha",img:"ta_chseashore.jpg",lat:35.263422,lon:-75.582064},
		{title:"Blue Ridge Parkway",city:"Asheville",url:"http://www.nps.gov/blri",img:"ta_blueridge.jpg",lat:35.564492,lon:-82.489917},
		{title:"Pinehurst Resort",city:"Pinehurst",url:"http://www.pinehurst.com/",img:"ta_pinehurst.jpg",lat:35.190354,lon:-79.468874},
		{title:"Cherokee Village and Qualla Boundary",city:"Cherokee",url:"http://www.cherokee-nc.com/",img:"ta_cherokee.jpg",lat:35.473268,lon:-83.31427},
		{title:"Wright Brothers National Memorial",city:"Kill Devil Hills",url:"http://www.nps.gov/wrbr",img:"ta_wrightbros.jpg",lat:36.016266,lon:-75.667183},
		{title:"Great Smoky Mountains National Park",city:"Cherokee",url:"http://www.nps.gov/grsm",img:"ta_greatsmkymount.jpg",lat:35.5758,lon:-83.343658},
		{title:"Lowe's Motor Speedway",city:"Concord",url:"http://www.lowesmotorspeedway.com/",img:"ta_lowesmotor.jpg",lat:35.352394,lon:-80.68825}
	], 	
	golf: [	
		{title:"Pinehurst Resort",city:"Pinehurst",url:"http://www.pinehurst.com/",img:"g_pinehurst.jpg",lat:35.190354,lon:-79.468874},
		{title:"The Cliffs at High Carolina",city:"Swannanoa",url:"http://www.cliffscommunities.com/welcome/highcarolina/",img:"g_thecliffs.jpg",lat:35.601963,lon:-82.39775},
		{title:"River Rock Golf Club",city:"Cashiers",url:"http://www.riverrocknc.com/alwaysActive_golf.htm",img:"g_riverrock.jpg",lat:35.114455,lon:-83.101294},
		{title:"Bald Head Island Club",city:"Bald Head Island",url:"http://www.bhiclub.net/",img:"g_baldheadisland.jpg",lat:33.866264,lon:-77.998488},
		{title:"Ocean Ridge Plantation",city:"Sunset Beach",url:"http://www.oceanridge.com/",img:"g_oceanridge.jpg",lat:33.935705,lon:-78.500791},
		{title:"Nags Head Golf Links",city:"Nags Head",url:"http://www.golfouterbanks.com/nagshead-golf.htm",img:"g_nagshead.jpg",lat:35.929319,lon:-75.610743},
		{title:"Sea Scape Golf Links",city:"Kitty Hawk",url:"http://www.seascapegolf.com/",img:"g_seascape.jpg",lat:36.087022,lon:-75.70477},
		{title:"Washington Duke Inn & Golf Club",city:"Durham",url:"http://www.washingtondukeinn.com/",img:"g_washdukeinn.jpg",lat:35.995074,lon:-78.947046},
		{title:"Ballantyne Resort",city:"Charlotte",url:"http://www.ballantyneresort.com/",img:"g_ballantyne.jpg",lat:35.056184,lon:-80.847306},
		{title:"Grove Park Inn Resort & Spa",city:"Asheville",url:"http://www.groveparkinn.com/",img:"g_groveparkinn.jpg",lat:35.619899,lon:-82.5414},
		{title:"Eseeola Lodge at Linville Golf Club",city:"Linville",url:"http://eseeola.com/",img:"g_eseeolalodge.jpg",lat:36.056298,lon:-81.872907}
	], 	
	heritage: [	
		{title:"The Qualla Boundary",city:"Cherokee",url:"http://www.cherokee-nc.com/",img:"ta_cherokee.jpg",lat:35.47521,lon:-83.303833},
		{title:"North Carolina Maritime Museum",city:"Beaufort",url:"http://www.ncmaritimemuseum.org/",img:"bb_maritimemuseum.jpg",lat:34.717144,lon:-76.666117},
		{title:"Graveyard of the Atlantic Museum",city:"Cape Hatteras",url:"http://www.graveyardoftheatlantic.com/",img:"h_graveyard.jpg",lat:35.216235,lon:-75.671399},
		{title:"Cape Hatteras Lighthouse",city:"Cape Hatteras",url:"http://www.outer-banks.com/lighthouses.asp",img:"ta_chlighthouse.jpg",lat:35.246272,lon:-75.532776},
		{title:"Currituck Beach Light Station",city:"Currituck County",url:"http://www.outer-banks.com/lighthouses.asp",img:"h_curritucklh.jpg",lat:36.376209,lon:-75.82679},
		{title:"Bodie Island Light",city:"Nags Head",url:"http://www.outer-banks.com/lighthouses.asp",img:"h_bodielh.jpg",lat:35.595004,lon:-75.467883},
		{title:"Ocracoke Lighthouse",city:"Ocracoke",url:"http://www.outer-banks.com/lighthouses.asp",img:"h_ocracokelh.jpg",lat:35.108438,lon:-75.984907},
		{title:"Cape Lookout Lighthouse",city:"Harker's Island",url:"http://www.outer-banks.com/lighthouses.asp",img:"bb_capelookout.jpg",lat:34.686568,lon:-76.526504},
		{title:"Old Baldy",city:"Bald Head Island",url:"http://www.outer-banks.com/lighthouses.asp",img:"bb_oldbaldy.jpg",lat:33.871485,lon:-77.997828},
		{title:"Guilford Courthouse National Military Park",city:"Greensboro",url:"http://www.nps.gov/guco",img:"h_guilfordcourt.jpg",lat:36.132884,lon:-79.845779},
		{title:"Fort Fisher",city:"Kure Beach",url:"http://www.nchistoricsites.org/fisher/fisher.htm",img:"h_fortfisher.jpg",lat:33.973881,lon:-77.914998},
		{title:"Bentonville Battlefield",city:"Four Oaks",url:"http://www.nchistoricsites.org/Bentonvi/Bentonvi.HTM",img:"h_bentonville.jpg",lat:35.301351,lon:-78.322135},
		{title:"Petty Family Museum ",city:"Randleman",url:"http://www.pettyracing.com/",img:"h_pettymuseum.jpg",lat:35.818487,lon:-79.805833},
		{title:"Lowe's Motor Speedway",city:"Concord",url:"http://www.lowesmotorspeedway.com/",img:"ta_lowesmotor.jpg",lat:35.352394,lon:-80.68825}
	]			
};			


function initialize_map(e) 
{
	var pins = gdata[this.dkey]; // this.key is a bound object // Event.observe(window, 'load',initialize_map.bindAsEventListener(obj));
	var width  = (this.dwidth==null)? 595 : this.dwidth ;
	var height = (this.dheight==null)? 450 : this.dheight ;
	var cp_lat = (this.dlat==null)? 35.746512259918504 : this.dlat ;
	var cp_lon = (this.dlon==null)? -80 : this.dlon ;
	var zoom   = (this.dzoom==null)? 6 : this.dzoom ;

	if( GBrowserIsCompatible() )
	{
		function createMarker(pin) 
		{
			var latlng = new GLatLng(pin.lat, pin.lon);
			var marker = new GMarker(latlng);
			GEvent.addListener(marker,"click", function() {
				var myHtml = "<div class=\"google-info-win\"><a href=\""+ pin.url +"\">";
				myHtml += "<img src=\""+ imgpath + pin.img +"\" target=\"_blank\" /></a>";
				myHtml += "<p><a href=\""+ pin.url +"\" target=\"_blank\">"+ pin.title +", "+ pin.city +", NC</a></p></div>";
				map.openInfoWindowHtml(latlng, myHtml);
			});
			return marker;
		}
		var map = new GMap2(document.getElementById("google-mapbox"),{ size: new GSize(width,height) });
		map.removeMapType(G_HYBRID_MAP);
		map.setCenter(new GLatLng(cp_lat,cp_lon), zoom); //-79.837646484375
		map.addControl(new GLargeMapControl());
		var mapControl = new GMapTypeControl();
		map.addControl(mapControl);
		if( pins!=undefined )
		{
			for (var i = 0; i < pins.length; i++) 
			{
				map.addOverlay(createMarker(pins[i]));
			}
		}
	}
}
