//Nav Bar

window.onload = list;
function list()
{
   var mylinks = document.getElementsByTagName('li');
   for (var i=0;i<mylinks.length;i++) {
	   //if(mylinks[i].getAttribute("title") == "highlight")
	   //{
			mylinks[i].onmouseover = function() { this.className = "on"; }; 
			mylinks[i].onmouseout = function() { this.className = ""; }; 
	  // }
   }
}
function clearme()
{
   var mylinks = document.getElementsByClassName('on');
   for (var i=0;i<mylinks.length;i++) {
	   //if(mylinks[i].getAttribute("title") == "highlight")
	   //{
			this.className = "";
	  // }
   }
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function onHover(elementName) 
{ 
	clearme();
	tag = document.getElementById(elementName); 
	if (tag) 
		tag.className = 'on'; 
	return false; 
} 
function onHoverOut(elementName) 
{ 
	tag = document.getElementById(elementName); 
	if (tag) 
		tag.className = 'off'; 
	return false; 
} 


//email

function validate(){
		var email=this.emailForm.email.value;
		var name=this.emailForm.name.value;
		//var subject=this.emailForm.sub.value;
		//alert(subject);
		//alert(name);
		//alert(email);
		if(name==null || name==""){
			alert("Name is required.");
			this.emailForm.name.focus();
			return false;
		}
		if(email==null || email==""){
			alert("E-Mail address is required.");
			this.emailForm.email.focus();
			return false;
		
		}

		//if( subject=="0"){
		//	alert("Please select a subject.");
		//	this.emailForm.sub.focus();
		//	return false;
		//}

		return true;
	}

function submitForm(){
	if(validate()){
		emailForm.submit();
	}
}


// Google Map

//<![CDATA[

    var map = null;
    var geocoder = null;

	// Creates a marker at the given point with the given number label
	function createMarker(point, number) {
	  var marker = new GMarker(point);
	  GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml("Marker #<b>" + number + "</b>");
	  });
	  return marker;
	}



	function createAndInitializeMap(){
		geocoder=new GClientGeocoder();
		map = new GMap2(document.getElementById('map'));
//getLatLng("1511 Genoa-Red Bluff Rd, Pasadena, TX 77504");
		centerLatLngAddress(29.630486,-95.173499,13);

		//now add store markers
		//Hamilton
		var point1=new GLatLng(29.630486,-95.173499);
		
		var marker=new GMarker(point1);
		
		map.addOverlay(marker);


		addControls();
	}

	function getLatLng(address){
		geocoder.getLatLng(address,function(point){alert(address+' == '+point);});
	}

	

	function centerLatLngAddress(lat,lng,scale){
		map.setCenter(new GLatLng(lat,lng), scale); 
	}

    function centerAddress(address,scale) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, scale);
              //var marker = new GMarker(point);
              //map.addOverlay(marker);
              //marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }

	function addControls(){
		map.addControl(new GSmallMapControl());
		//map.addControl(new GMapTypeControl());
	}

	//function showAddress(lat,lng,address) {
	//	var point=new GLatLng(29.853901,-95.644890);
     //         map.setCenter(point, 13);
     //         var marker = new GMarker(point);
              //map.addOverlay(marker);
              //marker.openInfoWindowHtml(address);
     //      }

	function loadAllMarkers(){
		showAddress(29.630486,-95.173499,'1511 Genoa-Red Bluff Rd, Pasadena, TX');
	}



    //]]>