
var LoadingMessage = "Loading Map....<p />Please Wait.";
var latitude = -37.678966;
var longitude = 145.013815;
var hashEmail =  "&#104;&#97;&#105;&#114;&#64;&#116;&#114;&#101;&#115;&#115;&#46;&#99;&#111;&#109;&#46;&#97;&#117;";
var hashCode = "&#97;&#98;&#99;&#100;&#101;&#102;&#103;&#104;&#105;&#106;&#107;&#108;&#109;&#110;&#99;&#111;&#112;&#113;&#114;&#115;&#116;&#117;&#118;&#119;&#120;&#121;&#122;";
var zoomLevel = 15; /*15*/
var MapId = "HighStreetLocationGoogleMap";
var html_script_insert = "<script src='http://maps.google.com/maps?file=api&v=1&key=ABQIAAAApgfsqa5SrUIk1W6h2tt5JRSKvd6lwNnlZtJjMr5mRLGzWeXPlRRLbP_VkZ46SFmenC8ypLHUE8L1fg' type='text/javascript'></script>";
var GM_KEY_TEST = "ABQIAAAApgfsqa5SrUIk1W6h2tt5JRRRGx1OtVOuS6-rEM4OCwA0FN0mARSsQvtygxlNwxEE03JmCpy8HNFPFQ";/*bjax.net/tress*/
var GM_KEY_LIVE = "ABQIAAAApgfsqa5SrUIk1W6h2tt5JRSKvd6lwNnlZtJjMr5mRLGzWeXPlRRLbP_VkZ46SFmenC8ypLHUE8L1fg";/*tress.com.au*/
var GOOGLE_MAPS_API_KEY = GM_KEY_LIVE;

var GOOGLE_KEY_OWNER = "http://www.tress.com.au"; //and all sub sites of this directory
var mapWidth = '500px';
var mapHeight = '500px';
var toLocation =  '245 High St,Thomastown Victoria 3074';


function showDir(o) {

		 if(o==1) {
		 	  val = 'block';
		 }
		 else {
		 	  val = 'none';
	     }
		 
	 	 document.getElementById("hide").style.display=val;
}

function clearList() {
		 document.getElementById("routid").innerHTML= "";
}

function find() {
	
	if (!GBrowserIsCompatible()) {
	   alert('Browser Not Compatible'); 
	}
	else {
	
	   	/*  Setup Visual Map Size/Dimensions */
		document.getElementById(MapId).style.width = mapWidth;
		document.getElementById(MapId).style.height = mapHeight;
		document.getElementById(MapId).style.cssFloat = 'right';
		 
	   	/*  Setup Visual Map Size/Dimensions */
		var map = new GMap2(document.getElementById(MapId));
		map.setCenter(new GLatLng(latitude, longitude), 15);
		
		/*  Setup ToolTip */
		map.openInfoWindow(map.getCenter(),document.createTextNode("Tress Hair Studio"));
		map.addControl(new GLargeMapControl());
			
		 
		/*  Setup ToolTip */
      	var directionsPanel = document.getElementById("routid");
        document.getElementById("routid").style.cssFloat = 'left';
        document.getElementById("routid").style.width = '300px';
      	directions = new GDirections(map, directionsPanel);
      	directions.load(getFromLocation() + " to " + toLocation);
			  
	}
	

}


/**
 * Function : getFromLocation() 
 * 
 * @return <String> The String concatenation of the Users Location
 *
 */
 function getFromLocation() {

 		        return document.forms.gapi.txtStreet.value  + ' ' + 
					   document.forms.gapi.txtSuburb.value  + ' ' + 
					   document.forms.gapi.txtPostCode.value  + ' ' +  
					   document.forms.gapi.cboState.value + ' ' + 
					   document.forms.gapi.cboCountry.value;

 }


function go() {
 
		
		var link = 'http://maps.google.com.au/maps?saddr={' +  getFromLocation() + '}&daddr={' + toLocation + '}';
		
		alert(link); 
		window.location = link;

}

function onPageLoad() {
	
	  if (GBrowserIsCompatible()) {
              var map = new GMap2(document.getElementById("map"));
               map.setCenter(new GLatLng(37.4419, -122.1419), 13);
      }
	
	getMap(MapId,zoomLevel,latitude,longitude,LoadingMessage,mapWidth,mapHeight);
	

}

 
function getMap(id,zoom,lat,long,msg,w,h) {
      		
      
     document.getElementById(id).innerHTML = msg;
     document.getElementById(id).style.width = w;
     document.getElementById(id).style.height = h;
			  
     if (GBrowserIsCompatible()) {
      		var map = new GMap2(document.getElementById(id));
      		map.setCenter(new GLatLng(lat, long), zoom);
      		map.openInfoWindow(map.getCenter(),document.createTextNode("Tress Hair Studio"));
      			
     }
      
      		  
}

