// JavaScript Document
var ShowMap = new function()
{
	this.mapObj = null;
	this.map = null;
	this.googlePopUp=null;
	this.howToGetHere = null;
	this.textField = null;
	this.googleForm = null;
	this.goBtn = null;
	this.Init = function()
	{
		var self = ShowMap;
		self.map = document.getElementById("GMap");
		
		self.mapObj = new GMap2(self.map);
		self.mapObj.setCenter(new GLatLng(30.433076,-97.771567), 13,G_NORMAL_MAP );
		self.mapObj.addControl(new GLargeMapControl());  
  	   // self.mapObj.addControl(new GMapTypeControl());
        self.mapObj.addControl(new GScaleControl());
		self.googlePopUp = document.createElement('div');
		self.googlePopUp.id = "GooglePopUp";
		self.googlePopUp.align = "left";
		
		self.mapObj.openInfoWindow(new GLatLng(30.433076,-97.771567),self.googlePopUp);
        self.googlePopUp.style.visibility="visible";
		//self.howToGetHere = document.getElementById('HowToGetHere');
		
		self.textField = document.createElement("input");
		self.textField.id="textFieldId";
	    //self.textField.className="MyForm";
	    self.textField.type="text";
	    self.textField.name="startAddress";
	   // self.textField.size = "100";
	    self.textField.value="Enter your address here.";
	    self.textField.onfocus=function(){
			if(this.value=="Enter your address here.")
	              self.textField.value ="";} // end function
		
		self.googleForm = document.createElement("form");
		self.googleForm.id="GoogleForm";
        self.googleForm.method="post";
        self.googleForm.onsubmit = function(){
        urlLink = "http://maps.google.com/maps?saddr=" + self.textField.value + "&daddr=8650 Spicewood Springs Rd. Austin, TX";
        this.action = "javascript:newGoogleWindow(urlLink)";
		}
		self.goBtn = document.createElement("input");
        self.goBtn.type="submit";
        self.goBtn.name="Submit";
        self.goBtn.id = "SubmitId";
        self.goBtn.className="MapBtn"
        self.goBtn.value="Go";
		
		address = document.createElement('div');
		address.id = "MapAddress";
		address.align = "center";
		address.className = "NormalTxt";
		address.innerHTML = '8650 Spicewood Springs Rd #109<br/> Austin, TX 78759';
				
		MapDiv = document.createElement('div');
		MapDiv.id = "GoogleMapDiv";
		MapDiv.appendChild(self.textField);
		MapDiv.appendChild(address);
		MapDiv.appendChild(self.goBtn);
		
		self.googleForm.appendChild(MapDiv);
		self.googlePopUp.appendChild(self.googleForm);
		
  }
		
} // end class

function newGoogleWindow(url)
{
window.open(url,'','menubar=1,resizable=1,width=1000,height=600');
}	
