// JavaScript Document
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("topnav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}

window.onload=startList;
//=====================================================================
//=====================================================================
function trimchar(inputStr, needle){
	  if (needle.length){
	  while(''+inputStr.charAt(0)==needle){inputStr=inputStr.substring(1,inputStr.length);}
	  while(''+inputStr.charAt(inputStr.length-1)==needle){ inputStr=inputStr.substring(0,inputStr.length-1); }
	   }
	  return inputStr;
  }
  
//===========================
function validEmail (fld) {
	 var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	 if(reg.test(fld.value) == false) {
		 alert("Invalid Email Address");
		 fld.focus();
		 return false;
		 }
	 else { return true; }
  }
//===========================
function validURL(fld, Msge){
	var reg= /^http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}$/;
    if(reg.test(fld.value)==false){
	alert("Invalid Web Address!\n"+"Must start with http://"); fld.focus();	return false;
	}
	else{return true; }
	
  }
//===========================
function isEmpty(fld, Msge){
  fld.value=trimchar(fld.value,"\n");
  fld.value=trimchar(fld.value," ");
  if(fld.value==''){alert(Msge); fld.focus(); return true; } 
  else { return false; }  
  }
  
//===========================
function validcontact(frm){
if(isEmpty(frm.fullname, 'Please enter your name')){return false; }
else if(isEmpty(frm.email, 'Please enter your email address')){return false; }
else if(!validEmail(frm.email)){return false; }
else if(!validURL(frm.website, 'Please enter your website address')){return false; }
else if(isEmpty(frm.comments, 'How may we help you?')){return false; }	
return true	

}
