// JavaScript Document


// Radio Button Validation
// copyright Stephen Chapman, 15th Nov 2004,14th Sep 2005
// you may copy this function but please keep the copyright notice with it
function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}
                  
				  
				  
function validate()
{
 var frm=document.form1;
 var btn = valButton(frm.iam);

if (btn == null) {
	
	alert("Please choose any one option for 'I am a:'");
	return false;
}

 if(frm.name.value=='')
 {
	 alert('Please enter the name');
	 frm.name.focus();
	 return false;
	 
 }
 if(btn != "Individual")
 {
  if(frm.company.value=='')
 {
	 alert('Please enter the company name');
	 frm.company.focus();
	 return false;
	 
 }
 }
 
  if(frm.addr1.value=='')
 {
	 alert('Please enter your address');
	 frm.addr1.focus();
	 return false;
	 
 }
 
   if(frm.city.value=='')
 {
	 alert('Please enter your Town/City');
	 frm.city.focus();
	 return false;
	 
 }
 
 
  
   if(frm.state.value=='')
 {
	 alert('Please enter your County/state');
	 frm.state.focus();
	 return false;
	 
 }
 
 
 
  
   if(frm.postcode.value=='')
 {
	 alert('Please enter your postal code');
	 frm.postcode.focus();
	 return false;
	 
 }
 
    if(frm.country.value=='')
 {
	 alert('Please enter your country');
	 frm.country.focus();
	 return false;
	 
 }
 
 
 
 if(frm.email.value=='')
 {
	 alert('Please enter the email address');
	 frm.email.focus();
	 return false;
	 
 }
 
 if(!CheckEmailAddr(frm.email.value,"Email"))
		{
			alert("Please enter the valid email address");
			frm.email.focus();
			frm.email.value='';
			return false;
		}
 
 
 
 
  if(frm.areacode.value=='')
 {
	 alert('Please enter your area code');
	 frm.areacode.focus();
	 return false;
	 
 }
 
  if(!CheckNumber(frm.areacode.value,"Area code"))
			{			     
			 frm.areacode.focus();
				return false;
			}
 
 
     if(frm.telephone.value=='')
 {
	 alert('Please enter your telephone number');
	 frm.telephone.focus();
	 return false;
	 
 }
 
 if(!CheckNumber(frm.telephone.value,"Telephone number"))
			{			     
			 frm.telephone.focus();
				return false;
			}
			
			


    if(frm.message.value=='')
 {
	 alert('Please enter your message');
	 frm.message.focus();
	 return false;
	 
 }
    if(frm.findus.value=='')
 {
	 alert("Please enter about 'How did you find us?'");
	 frm.findus.focus();
	 return false;
	 
 }

return true;
 
}

