handleGDirErrors=function(){geo_err[G_GEO_SUCCESS]="Success";geo_err[G_GEO_MISSING_ADDRESS]="Missing Address: The address was either missing or had no value.";geo_err[G_GEO_UNKNOWN_ADDRESS]="Unknown Address:  No corresponding geographic location could be found for the specified address.";geo_err[G_GEO_UNAVAILABLE_ADDRESS]="Unavailable Address:  The geocode for the given address cannot be returned due to legal or contractual reasons.";geo_err[G_GEO_BAD_KEY]="Bad Key: The API key is either invalid or does not match the domain for which it was given";geo_err[G_GEO_TOO_MANY_QUERIES]="Too Many Queries: The daily geocoding quota for this site has been exceeded.";geo_err[G_GEO_SERVER_ERROR]="Server error: The geocoding request could not be successfully processed.";geo_err[G_GEO_BAD_REQUEST]="Please check the format of your addresses.\n Error code: "+gdir.getStatus().code;alert(geo_err[gdir.getStatus().code]?geo_err[gdir.getStatus().code]:"An unknown error occurred.");}
showDir=function(){if(gdir.summary)$('gmap_directions').innerHTML="Distance: "+gdir.getDistance().html+", Time: "+gdir.getDuration().html+". <a href='#' onclick='getDir();return false;'><img src='/images/green_r_arrow.png'> Click here for step by step directions</a>";$('gmap_directions').show();}
getDir=function(options){fromAddress=$('fromWrapper').down().value.strip();toAddress=$('toWrapper').down().value.strip();if(!fromAddress||!toAddress){alert("One or more of your addresses is empty.");return false;}
gdir.summary=options&&options.summary?options.summary:false;gdir.load("from: "+fromAddress+" to: "+toAddress,{"locale":"en_US"});}
printDirections=function(){var nw=window.open('','printwin','left=100,top=100,scrollbars=yes,width=700,height=800');nw.document.open();nw.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><style type="text/css">\nbody{background-color:#ffffff;}\n</style><title>Print Page</title></head><body>\n');nw.document.write('<div style="float: left;"><a href="javascript:window.print();">Print</a></div>');nw.document.write('<div style="float: right;"><a href="javascript:window.close();">Close</a></div>');nw.document.write('<div style="clear: both;">&nbsp;</div>');nw.document.write('<div style="width: 95%; height: 375px; overflow: hidden; position: relative;" id="canvas"><div id="canvas_child">'+$("gmap_canvas").innerHTML+'</div></div>');nw.document.write('<div style="width: 95%; position: relative;">'+'<b>Total:</b> '+gdir.getSummaryHtml()+'</div>');nw.document.write('<div style="width: 95%; font-family: verdana,tahoma,sans-serif; font-size: 10pt; position: relative;">'+$("gmap_directions").innerHTML+'</div>');nw.document.write('</body></html>');nw.document.close();if(!Prototype.Browser.IE){nw.document.getElementById('canvas').removeChild(nw.document.getElementById('canvas_child'));nw.document.getElementById('canvas').appendChild($("gmap_canvas").cloneNode(true));}}
loadMaps=function(){google.load("maps","2.x");google.setOnLoadCallback(mapsLoaded);}
mapsLoaded=function(){if(GBrowserIsCompatible()){client=new GStreetviewClient();pano=null;map=null;gdir=null;geocoder=null;geo_err=[];defaultZoom=14;var crossLayer=new GTileLayer(new GCopyrightCollection(""),0,15);crossLayer.getTileUrl=function(tile,zoom){return"./include/tile_crosshairs.png";}
crossLayer.isPng=function(){return true;}
map=new GMap2($("gmap_canvas"));geocoder=new GClientGeocoder(new GGeocodeCache());map.addControl(new GSmallMapControl());var mapControl=new GHierarchicalMapTypeControl();mapControl.clearRelationships();mapControl.addRelationship(G_SATELLITE_MAP,G_HYBRID_MAP,"Labels",false);map.addControl(mapControl);gdir=new GDirections(map,$("gmap_directions"));exAddress="36 Baltimore Pike, Glen Mills, PA";$('otherAddress').title='body=[{e.g. '+exAddress+'}]'
$('hollowAddress').value=exAddress;geocoder.getLatLng(exAddress,function(point){if(point){map.setCenter(point,defaultZoom);var marker=new GMarker(point);map.addOverlay(marker);}});GEvent.addListener(gdir,"error",handleGDirErrors);GEvent.addListener(gdir,"addoverlay",showDir);Event.observe($('otherAddress'),'keyup',function(e){if(e.keyCode==Event.KEY_RETURN)getDir();});Event.observe(window,'unload',GUnload);}}
document.write("<script src='http://www.google.com/jsapi?key=ABQIAAAAhhJlylP2QSC3DgitMl8sExRu-tCX6ak0hBfPhQ7CULyR4boxbRSbNbOd1c-2my5VI7Vgb3MpRM0Psg&callback=loadMaps'><\/script>");