﻿//Basic Map
	//<![CDATA[
		var map;
	    var gdir;
	    var geocoder = null;
	    var geoCoder = new GClientGeocoder();
  //	    var mapPoints = new Array();
  //mapPoints.push(new oMapLocation("club","AcroSports Gymnastics","718 Professional Drive N","Shreveport","LA","71105","3187983547","3187983549","www.acrosports-la.com/","gohardinc@aol.com"));
  		function load() 
	    {
	      if (GBrowserIsCompatible()) 
	      {
	        map = new GMap2(document.getElementById("map"));
	        map.addControl(new GLargeMapControl());
	        map.addControl(new GMapTypeControl());
			
			map.setCenter(new GLatLng(31.3161,-92.4719), 7);
	        
			mapPoints.each(function(h)
			{
				h.setMap(map);
				geoCoder.getLatLng(h.getFullAddress(), function(point){h.setPoint(point)});
			});              
	      }
	    }
      
       function setDirections(fromAddress, toAddress, locale, zoomout) 
       {
       		
			map = new GMap2(document.getElementById("map"));
	        map.addControl(new GSmallMapControl());
	        map.addControl(new GMapTypeControl());
			gdir = new GDirections(map, document.getElementById("directions"));
			GEvent.addListener(gdir, "load", onGDirectionsLoad);
			GEvent.addListener(gdir, "error", handleErrors);	        
			gdir.load("from: " + fromAddress + " to: " + toAddress, { "locale": locale });
	   }

	    function handleErrors()
	    {
	       document.getElementById('map_head').style.width = '710px';
		   document.getElementById('dir_head').style.display= 'none';
		   document.getElementById('map').style.width="710px";
		   document.getElementById('directions').style.display = 'none';
		   load();
		   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
		     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
		   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
		     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
		   
		   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
		     alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

		   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
		     alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);
	
		   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
		     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
		    
		   else alert("An unknown error occurred.");
		   
		   
			   
		}
	function GetDirectionsNew(from,to,zoomOut)
	{
		
		document.getElementById('map_head').style.width = '353px';
		document.getElementById('dir_head').style.display= 'block';
		document.getElementById('map').style.width="353px";
		document.getElementById('directions').style.display = 'block';
		
        setDirections(from, to, 'en_US');
        //if (form == 'Arena2Hotel' || form == 'Hotel2Arena')
        if (zoomOut)
			GEvent.addListener(map, "load", function() { map.zoomOut(); });
	}
	
	function back2big()
	{
		document.getElementById('map_head').style.width = '710px';
		document.getElementById('dir_head').style.display= 'none';
		document.getElementById('map').style.width="710px";
		document.getElementById('directions').style.display = 'none';
		gdir.clear();
		load();
		
	}
	function onGDirectionsLoad()
	{ 
		// Use this function to access information about the latest load()
	}
	GSearch.setOnLoadCallback(load);
	//]]>
