<!--
//<![CDATA[

//-------This page and code copyright Don Pickerel 2006 ---------------

			
    var point;
    var geocoder;

		// Creates a marker at the given point with the given number label
	function createBMarker(spoint, place,tab2) 
		{
			// Our info window content
			var infoTabs = 
			[
				new GInfoWindowTab("Battlefield",place),
				new GInfoWindowTab("Weather","Coming Soon"),
			];
			// Create our "tiny" marker icon
			var icon = new GIcon();
			icon.image = "http://www.northcarolinatourist.com/assets/graphics/battle1.png";
			icon.shadow = "http://www.northcarolinatourist.com/assets/graphics/battles1.png";
			icon.iconSize = new GSize(56,31);
			icon.shadowSize = new GSize(20,14);
			icon.iconAnchor = new GPoint(6, 20);
			icon.infoWindowAnchor = new GPoint(5, 1);   
			var htmls=[place, tab2,"Coming Soon"];
			var labels = ["Battlefield","Visit","Weather"];
		  var marker = new GMarker(spoint,icon);
		  GEvent.addListener(marker, "click", function() 
			{
          		// adjust the width so that the info window is large enough for this many tabs
          		if (htmls.length > 2) 
		  		{
            		htmls[0] = '<div style="width:'+htmls.length*88+'px">' + htmls[0] + '</div>';
          		}
          		var tabs = [];
          		for (var i=0; i<htmls.length; i++) 
		  		{
            		tabs.push(new GInfoWindowTab(labels[i],htmls[i]));
          		}
          		marker.openInfoWindowTabsHtml(tabs);
        	});
		  return marker;
		}


// ---------------- Yadkin wineries --------------------------
	function battlefield_markers(mwhich)
	{
		var i,j;

		switch (mwhich)
		{
			case 1:
			i="<a href=\"/Battlefields/Guilford_Courthouse/Guilford.php\">Guilford Courthouse</a>";
			j="2332 New Garden Road<br />Greensboro, NC 27410-2355<br />(336) 288-1776";
point = new GLatLng(36.131110,-79.848680);
			map.addOverlay(createBMarker(point, i,j));		
			break;
			case 2:
			i="<a href=\"/Battlefields/MooresCreek/MooresCreek.php\">Moores Creek</a>";
			j="29044 Nc Highway 210<br />Currie, NC 28435<br />(910) 283-5591";
point = new GLatLng(34.458569,-78.108236);
			map.addOverlay(createBMarker(point, i,j));		
			break;
			case 3:
			i="<a href=\"/Battlefields/Bentonville/Bentonville.php\">Bentonville Battlefield</a>";
			j="5466 Harper House Rd<br />Four Oaks, NC 27524<br />Phone: (910) 594-0789 ";
point = new GLatLng(35.301513,-78.321643);
			map.addOverlay(createBMarker(point, i,j));		
			break;

		}
		return point;		
		
	}
   function add_battlefieldmarker() 
   	{

			var y;

			for (y=1;y<=3;y++)
			{
			battlefield_markers(y);
			}
	}
   	
    function load_battlefields() 
	{
        map.setCenter(new GLatLng(35.460669951495305, -79.5849609375), 7);
		map.openInfoWindowHtml(map.getCenter(),"<a href=\"http://www.northcarolinatourist.com/Battlefields\" target=\"_blank\">North Carolina Battlefields</a><br />Each cannon represents a battlefield.<br /> Click on the cannon to get more information.  <br />Click anywhere and drag to move map. <br />Click the X top right to close this window.");
		add_battlefieldmarker();
     // geocoder = new GClientGeocoder();

    }

    function load_allBattlefields() 
	{

		add_battlefieldmarker();
	}

	function pointo_to_battlefields()
	{
		var string_wine,ipoint, npoint,winenum,which_wine;
		var wdone=0;
		box = document.wineryf.whichwine;
		string_wine = box.options[box.selectedIndex].value;
		which_wine = parseInt(string_wine);

		if(which_wine == 0 ) {
        map.setCenter(new GLatLng(35.460669951495305, -79.5849609375), 7);
		return;
		}

		if(which_wine <99 ) {
		npoint = coastal_markers(which_wine);}

		if(which_wine > 300) {
		which_wine = which_wine - 300; 
		npoint = mountain_markers(which_wine);}
		
		if(which_wine > 200) {
		which_wine = which_wine - 200; 
		npoint = yadkin_markers(which_wine);}

		if(which_wine > 100) {
		which_wine = which_wine - 100; 
		npoint = piedmont_markers(which_wine);}

		map.setZoom(7);
		
		window.setTimeout(function() {
		map.panTo(npoint);
			}, 1000);


		window.setTimeout(function() {
		map.setZoom(11);
		map.panTo(npoint);
			}, 3000);


		window.setTimeout(function() {
		map.setZoom(15);
		map.panTo(npoint);
			}, 5000);


	}
	
 