    //<![CDATA[

	var lat, lng, zoom;
	lat = 34.13551;
	lng = -117.96201;
	zoom = 16;
    var map;
    var gdir;
    var geocoder = null;
    var addressMarker;

  function dela_map() {

    if (GBrowserIsCompatible()) {

      map = new GMap2(document.getElementById("map_canvas"));

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);

        var gps_loc=setMap();

	var test = gps_loc.split(",");

        map.setCenter(new GLatLng(test[0],test[1]), zoom);
map.setMapType(G_HYBRID_MAP);

//      map.setCenter(new GLatLng(37.4419, -122.1419), 10);


	var point = new GLatLng(test[0],test[1]);
	map.addOverlay(new GMarker(point));
    }
  }

	function load(){

if(document.getElementById("loc")){
//alert('HELLO');
var dv = document.getElementById('map_canvas');
              var  loc=document.getElementById("loc").value;
dv.innerHTML='<iframe src="/maps.php?loc='+loc+'" height="500" width="680" frameborder="0" scrolling="no" style="overflow:hidden; border:0px;margin:0px; padding:0px" name="m_frame" id="m_frame"></iframe>';

}

	}

    function load_bak() {

var dv = document.getElementById('map_canvas');
dv.innerHTML='<iframe src="/maps.php?loc=1" height="500" width="675" scrolling="no" style="overflow:hidden; border:0px" name="m_frame" id="m_frame"></iframe>';
      if (GBrowserIsCompatible()) {
//alert('hello world');
        var map = new GMap2(document.getElementById("map"),
{ size: new GSize(625,525)});
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);
	var gps_loc=setMap();

var test = gps_loc.split(",");

        map.setCenter(new GLatLng(test[0],test[1]), zoom);
//        map.setCenter(new GLatLng(34.135,-117.962), 13);
       // map.setCenter(new GLatLng(lat, lng), zoom);

//map.checkResize();
//map.setMapType(G_SATELLITE_MAP);
  //var point = new GLatLng(34.134,-117.96201);
  var point = new GLatLng(test[0],test[1]);

map.addOverlay(new GMarker(point));
//mapa=document.getElementById('map_canvas');
//mapa.style.border='1px';
//mapa.style.borderColor='#000000';
//mapa.style.borderStyle='solid';
//map.setMapType(G_SATELLITE_MAP);
      }
    }

	function update_map(){
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(lat, lng), zoom);
	}

	function setMap(){
		loc=document.getElementById("loc").value;
//alert(loc);
		var gps = new Array();

		gps[0]='34.1340,-117.962';
		gps[1]='34.1335,-117.9625';
		gps[2]='34.083964,-117.488825';
		gps[3]='32.91210,-117.11336';
		gps[4]='32.38130,-96.09097';

		var gps_loc = gps[loc];
		return(gps_loc);		
	}

	function setLocations(loc_id){

		var addr=new Array();
		addr[0]="1520 Flower Avenue, Duarte, CA 91010";
		addr[1]='1870 Business Center Drive, Duarte, CA 91010';
		addr[2]='9350 Cherry Avenue, Fontana, CA 92335';
		addr[3]='10695 Treena Street, San Diego, CA 92131';
		addr[4]='1103 S. 3rd Street, Mabank, TX 75147';
		var address = addr[loc_id];
		return (address);
	}

	function setDirections(){

//d = document;
//f = d.frames ? d.frames['m_frame'] : d.getElementById('m_frame');
//p = f.document || f.contentWindow.document;

//p.setDirections_parent();
if (window.frames.m_frame) {
window.frames.m_frame.setDirections_parent();
}

	}

        function setDirections_parent(){
		parent_form=parent.document.getElementById('dir_form');
//		alert(parent_form.address1.value);
                address1= parent_form.address1.value;
                city= parent_form.city.value;
                state= parent_form.state.value;
                zip= parent_form.zip.value;
                loc= parent_form.loc.value;
        var fromAddressChk=address1 + city + state + zip;
        var fromAddress=address1 + ',' + city + ',' + state + ',' + zip;
if(!fromAddressChk){
alert('Please enter a valid address');
return false;
}
        //var fromAddress='glendora';
        //var toAddress='1520 Flower Avenue, Duarte, CA 91010';
        var toAddress=setLocations(loc);
        var locale='en_US';

        var map_info_container = document.getElementById('maps-right');

        var initialize_sec = '<div id="directions" style="float:left; width:250px;overflow:scroll"></div>';
        initialize_sec += '<div id="map_canvas" style="float:left;width:500px; height:525px;"></div>';

//        map_info_container.innerHTML = initialize_sec;

        var map = document.getElementById('map_canvas');
        var dir = document.getElementById('directions');
        var map_r = document.getElementById('maps-right');
        dir.style.cssFloat='left';
        dir.style.visibility='visible';
        dir.style.overflow='scroll';
        dir.style.width='275px';
        dir.style.height='500px';
        map.style.width='425px';
        map.style.height='500px';
        map.style.cssFloat='left';
//      map.style.border='1px solid #000000';
//alert('hello world');
        map_r.style.width='800px';
//        if ( ie6 ){
//        map_r.style.marginLeft='-30px';
//        } else {
//        map_r.style.marginLeft='-5px';
//        }


        // map_i.innerHTML='Hello World';


      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });

        }


	function setDirections_frame(){
		address1= document.getElementById('address1').value;
		city= document.getElementById('city').value;
		state= document.getElementById('state').value;
		zip= document.getElementById('zip').value;
		loc= document.getElementById('loc').value;
	var fromAddressChk=address1 + city + state + zip;
	var fromAddress=address1 + ',' + city + ',' + state + ',' + zip;
if(!fromAddressChk){
alert('Please enter a valid address');
return false;
}
	//var fromAddress='glendora';
	//var toAddress='1520 Flower Avenue, Duarte, CA 91010';
	var toAddress=setLocations(loc);
	var locale='en_US';

	var map_info_container = document.getElementById('maps-right');

	var initialize_sec = '<div id="directions" style="float:left; width:250px;overflow:scroll"></div>';
	initialize_sec += '<div id="map_canvas" style="float:left;width:500px; height:525px;"></div>';

	map_info_container.innerHTML = initialize_sec;

	var map = document.getElementById('map_canvas');
	var dir = document.getElementById('directions');
	var map_r = document.getElementById('maps-right');
	dir.style.cssFloat='left';
	dir.style.visibility='visible';
	dir.style.overflow='scroll';
	dir.style.width='275px';
	dir.style.height='525px';
	map.style.width='475px';
	map.style.height='525px';
	map.style.cssFloat='left';
//	map.style.border='1px solid #000000';
//alert('hello world');
	map_r.style.width='800px';
	if ( ie6 ){
	map_r.style.marginLeft='-30px';
	} else {
	map_r.style.marginLeft='-5px';
	}
	

	// map_i.innerHTML='Hello World';


      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });

	}

    function handleErrors(){
	   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_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: " + 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 onGDirectionsLoad(){ 
      // Use this function to access information about the latest load()
      // results.

      // e.g.
      // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	  // and yada yada yada...
	}

    //]]>
