// JavaScript Document

function remName(a, b){
if(a.value==b){
a.value='';
}else if(a.value==''){
a.value=b;
}else{
a.value=a.value;
}
}
 
function chkName(a, b){
if(a.value==''){
a.value=b;
}else{
a.value=a.value;
}
}

function MM_validateForm() { //v4.0
  if (document.getElementById){
   var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

   var oMyForm = document.contact;
// regular expression patterns
   var validemail     = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
   var validphone     = /^[\d_ \.\-]{11,}$/;
   
   if (oMyForm.fname.value == "First Name") 
   {errors+='- Please provide a First Name.\n';}
   if (oMyForm.lname.value == "Last Name") 
   {errors+='- Please provide a Last Name.\n';}
   if (oMyForm.address1.value == "Address 1") 
   {errors+='- Please provide a Street Address (Address 1).\n';}
   if (oMyForm.city.value == "City") 
   {errors+='- Please provide a City.\n';}
   if (oMyForm.state.value == "State") 
   {errors+='- Please provide a State.\n';}
   if (oMyForm.zip.value == "Zip") 
   {errors+='- Please provide a Zip.\n';}
   if(!validphone.test(oMyForm.phone.value))
   {errors+='- Please provide a valid Phone Number with area code.\n';}
   if (oMyForm.email.value != "Email") {

	 if(!validemail.test(oMyForm.email.value))
	 {errors+='- Please provide a valid Email address.\n';}
   }
   if (oMyForm.comments.value == "Comment") 
   {errors+='- Please provide some information in the Comments area.\n';}
   
   oMyForm.realname.value = oMyForm.fname.value+' '+oMyForm.lname.value;

// show errors or submit form
   if (errors){alert('The following error(s) occurred:\n'+errors);}
   document.MM_returnValue = (errors == '');
} }

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}