function checkForm(){
var zipFormat=/^\d{5}$/;
var phoneFormat=/^\d{3}-\d{3}-\d{4}$/;
var emailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

   if(document.forma.fullname.value.length<1) {showErrMsg("You must enter your full name",40);return false;}
   if(document.forma.company.value.length<1) {showErrMsg("You must enter your company name",40);return false;}
   //if(document.forma.address.value.length<1) {showErrMsg("You must enter your addess",50);return false;}
  // if(document.forma.city.value.length<1) {showErrMsg("You must enter your city",50);return false;}
   if(document.forma.user_state.value.length<1) {showErrMsg("You must enter your state",40);return false;}
   //if(document.forma.zip.value.length<1) {showErrMsg("You must enter your zip area code",40);return false;}
   //else if(!document.forma.zip.value.match(zipFormat)){showErrMsg("The zip code format has to be XXXXX",40);return false;} 
   if(document.forma.phone.value.length<1) {showErrMsg("You must enter your phone number",40);return false;}
   else if(!document.forma.phone.value.match(phoneFormat)){showErrMsg("The phone format is XXX-XXX-XXXX",40);return false;} 
   if(document.forma.email.value.length<1) {showErrMsg("You must enter your email address",40);return false;}
   else if(!document.forma.email.value.match(emailFilter)){showErrMsg("The format of your email address is wrong",40);return false;} 
   //if(document.forma.email.value != document.forma.emailconf.value) {showErrMsg("The email addresses does not match",40);return false;} 
   //if(document.forma.businness.value.length<1) {showErrMsg(" Select a businness",70);return false;}

  
   document.forma.submit();
}

function showErrMsg(txt,left){
var pos=getContainerPosition();
var divE=document.createElement("div");
    divE.id="tempDiv";
    divE.style.position="absolute";
    divE.style.zIndex="50";
    divE.style.textAlign="center";
    divE.style.backgroundColor="yellow";
    divE.style.fontWeight="bold";
    divE.style.fontStyle="italic";
    divE.style.top=pos.top+10+"px";
    divE.style.left=pos.left+left+"px";
    divE.style.fontSize="1.2em";
    divE.innerHTML=txt;
    document.body.appendChild(divE); 
    setTimeout("hideErrMsg()",2000);   
}

function hideErrMsg(){
  if(document.getElementById("tempDiv")) document.body.removeChild(document.getElementById("tempDiv"));
}


function getContainerPosition(){
var parent= document.getElementById("formContact");
var leftt=0;
var topp=0;
while(parent){
                    leftt+=parent.offsetLeft;
					topp+=parent.offsetTop;
					parent=parent.offsetParent;
			}
if(navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined"){
                    topp+=document.body.topMargin;
					leftt+=document.body.leftMargin;
					} 			
return {left:leftt,top:topp}
}
