<!--
var directions;
var directionsPanel;
var geocoder;
var map;
var point;
var address = '900 Pierremont Road Shreveport, LA 71106';

function loadMap() 
{
	if (GBrowserIsCompatible())
	{
		map = new GMap2(document.getElementById("map"));
		geocoder = new GClientGeocoder();
		
    	//map.setCenter(new GLatLng(30.413954, -91.099233), 13);
		//map.enableScrollWheelZoom();
		
		//add map type, zoom, and pan controls
		var mapControl = new GMapTypeControl();
		map.addControl(mapControl);
		map.addControl(new GLargeMapControl());
		
		//add icon to location
		//var blueIcon = new GIcon(G_DEFAULT_ICON);
		//var point = new GLatLng(30.413954, -91.099233);
		//map.addOverlay(new GMarker(point));
		
		directionsPanel = document.getElementById("directions");;
		directions = new GDirections(map, directionsPanel);
		GEvent.addListener(directions, "load", onGDirectionsLoad);
        GEvent.addListener(directions, "error", handleErrors);
		
		geocoder.getLocations(address, addToMap);
	}
}

function addToMap(response)
{
  // Retrieve the object
  place = response.Placemark[0];

  // Retrieve the latitude and longitude
  point = new GLatLng(place.Point.coordinates[1],
					  place.Point.coordinates[0]);

  // Center the map on this point
  map.setCenter(point, 13);

  // Create a marker
  //marker = new GMarker(point);

  // Add the marker to map
  //map.addOverlay(marker);
	map.openInfoWindowHtml(map.getCenter(),"<b><font color=\"#FF9900\">JEB DESIGN/BUILD</font></b><br><font color=\"#999999\">900 Pierremont Road, Suite #212<br>Shreveport, LA, 71106 </font><br><a target=\"_blank\" href=\"http://maps.google.com/maps?saddr=&daddr=900+Pierremont+Road,+Suite+212,+Shreveport,+LA+71106\">Get Driving Directions</a>");

 //point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);
	//map.setCenter(point, 5);

  // Add address information to marker
  //marker.openInfoWindowHtml(place.address);
}

var timeID;


function move()
{
	address = '900 Market Street Shreveport, LA 71101';
	point = new GLatLang(place.Point.coordinates[1],place.Point.coordinates[0]);
	map.setCenter(point, 5);
	//if(zoom < 14)
	//{
	//	zoom++;
	//	map.setCenter(point, zoom);
	//	timeID = setTimeout('zoomIn();', 1000);
	//}
}

function setDirections(fromAddress, toAddress)
{
	if(fromAddress != "" && toAddress != "")
	{
		directions.load("from: " + fromAddress + " to: " + toAddress, { "locale": "English" });
		showPrintButton();
	}
	else
	{
		if(fromAddress == "")
		{
			alert("Please enter a starting location.");
		}
		else if(toAddress == "")
		{
			alert("Please enter an ending location.");
		}
	}
}

function handleErrors()
{
   if (directions.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: " + directions.getStatus().code);
   else if (directions.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: " + directions.getStatus().code) 
   else if (directions.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: " + directions.getStatus().code);
//   else if (directions.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + directions.getStatus().code);
	 
   else if (directions.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: " + directions.getStatus().code);

   else if (directions.getStatus().code == G_GEO_BAD_REQUEST)
	 alert("A directions request could not be successfully parsed.\n Error code: " + directions.getStatus().code);
	
   else alert("An unknown error occurred.");
}

function onGDirectionsLoad()
{ 
  // Use this function to access information about the latest load()
  // results.

  // e.g.
  // document.getElementById("getStatus").innerHTML = directions.getStatus().code;
  // and yada yada yada...
}
// -->
