function ValidateForm(formname){
     var phonenum1=document.sendaddr.phone1.value;
     var phonenum2=document.sendaddr.phone2.value;
     var phonenum3=document.sendaddr.phone3.value;
    
     var phone4=phonenum1.length + phonenum2.length + phonenum3.length;

//	alert(phone4);
     var zipnum=document.sendaddr.zipcode.value;
     if (document.sendaddr.name.value ==""){
        alert("Please Enter The Name");
        document.sendaddr.name.focus();
        return false;
    }
      if (document.sendaddr.addr1.value ==""){
        alert("Please Enter The Address");
        document.sendaddr.addr1.focus();
        return false;
    }
    if (document.sendaddr.city.value ==""){
        alert("Please Enter The City Name");
        document.sendaddr.city.focus();
        return false;
    }

   if (document.sendaddr.state.value ==""){
        alert("Please Enter The Province");
        document.sendaddr.state.focus();
        return false;
    }

    if (document.sendaddr.zipcode.value =="")
    {
        alert("Please Enter The Postal Code");
        document.sendaddr.zipcode.focus();
        return false;
    }

    if(Validator(zipnum)==false)
	{
        document.sendaddr.zipcode.value="";
        document.sendaddr.zipcode.focus();
        return false;
      }
    if(document.sendaddr.phone1.value=="")
    {
        alert("Please Enter The Phone Number");
        document.sendaddr.phone1.focus();
        return false;
    }
    if(checknumber(phonenum1)==false){

        document.sendaddr.phone1.value="";
        document.sendaddr.phone1.focus();
        return false;

      }
      if(document.sendaddr.phone2.value=="")
    {
        alert("Please Enter The Phone Number");
        document.sendaddr.phone2.focus();
        return false;
    }
    if(checknumber(phonenum2)==false){

        document.sendaddr.phone2.value="";
        document.sendaddr.phone2.focus();
        return false;

    }
   if(document.sendaddr.phone3.value=="")
    {
        alert("Please Enter The Phone Number");
        document.sendaddr.phone3.focus();
        return false;
    }
    
    if(checknumber(phonenum3)==false){

        document.sendaddr.phone3.value="";
        document.sendaddr.phone3.focus();
        return false;

      }
	if(phoneValidator(phone4)==false)
    	{
        document.sendaddr.phone1.value="";
        document.sendaddr.phone2.value="";
        document.sendaddr.phone3.value="";
        document.sendaddr.phone1.focus();
        return false;
      }
	return true;
	
    }
function checknumber(checknum){
var x=checknum;
var anum=/(^\d+$)|(^\d+\.\d+$)/
if (anum.test(x))
return true;
else{
alert("Please input a valid number!")
return false;
}
}

function Validator(checklength)
{
  a=checklength.replace(" ","");
  

// Check the length of the value of the element named text_name
// from the form named form_name if it's < 3 and > 10 characters
// display a message asking for different input
if ((a.length < 5) || (a.length > 6))
{
// Build alert box message showing how many characters entered
mesg = "You have entered " + checklength.length + " digit Number(s)\n"
mesg = mesg + "Valid entries is 5 or 6 digit Numbers.\n"
mesg = mesg + "Please verify your input and submit again."
alert(mesg);
// Place the cursor on the field for revision
//form_name.text_name.focus();
// return false to stop further processing
return false;
}
// If text_name is not null continue processing
return true;
}


function phoneValidator(checklength)
{

// Check the length of the value of the element named text_name
// from the form named form_name if it's < 3 and > 10 characters
// display a message asking for different input
if ((checklength < 10))
{
// Build alert box message showing how many characters entered
mesg = "You have entered " + checklength + " digit Number(s)\n"
mesg = mesg + "Valid entries is 10 digit Numbers.\n"
mesg = mesg + "Please verify your input and submit again."
alert(mesg);
// Place the cursor on the field for revision
//form_name.text_name.focus();
// return false to stop further processing
return false;
}
// If text_name is not null continue processing
return true;
}

