// JavaScript Document

	function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
 		 return true					
	}


 function copy()
  {

 if(document.fr.rad.value==""){
   document.fr.rad.value="1";	
   document.fr.radio_on.checked=true;	
   document.fr.b_coy_name.value  	 = document.fr.coy_name.value;
   document.fr.b_designation.value 	 = document.fr.designation.value;
   document.fr.b_name_invoice.value  = document.fr.name_registering.value;
   document.fr.b_address1.value 	 = document.fr.address1.value;
   document.fr.b_address2.value	 	 = document.fr.address2.value;
   document.fr.b_city.value			 = document.fr.city.value;
   document.fr.b_postal_code.value	 = document.fr.postal_code.value;
   document.fr.b_phone.value		 = document.fr.phone.value;
   document.fr.b_fax.value 	 		 = document.fr.fax.value;
   document.fr.b_email.value   		 = document.fr.email.value;
   document.fr.b_country_code.value  = document.fr.country_code.value;
   document.fr.b_area_code.value   	 = document.fr.area_code.value;
   }else{
	   document.fr.rad.value="";	 
       document.fr.radio_on.checked=false;	
	   document.fr.b_coy_name.value  	 = "";
	   document.fr.b_designation.value 	 = "";
	   document.fr.b_name_invoice.value  = "";
	   document.fr.b_address1.value 	 = "";
	   document.fr.b_address2.value	 	 = "";
	   document.fr.b_city.value			 = "";
	   document.fr.b_postal_code.value	 = "";
	   document.fr.b_phone.value		 = "";
	   document.fr.b_fax.value 	 		 = "";
	   document.fr.b_email.value   		 = "";
	   document.fr.b_country_code.value  = "";
	   document.fr.b_area_code.value   	 = "";
	   }
    
  } 


function checkEmail() {

var me = document.fr;
	

if(me.coy_name.value==""){
	alert('ERROR: Invalid company name');
     me.coy_name.focus();
     return false;	
	}

if(me.name_registering.value==""){
	alert('ERROR: Name of the Person registering is required');
     me.name_registering.focus();
     return false;	
	}
if(me.designation.value==""){
	alert('ERROR: Designation or designation officer is required');
     me.designation.focus();
     return false;	
	}
if(me.address1.value==""){
	alert('ERROR: Address is required');
     me.address1.focus();
     return false;	
	}
if(me.city.value==""){
	alert('ERROR: City is required');
     me.city.focus();
     return false;	
	}

if(me.postal_code.value==""){
	alert('ERROR: Postal Code is required');
     me.postal_code.focus();
     return false;	
	}

if(me.phone.value==""){
	alert('ERROR: Phone number is required');
     me.phone.focus();
     return false;	
	}
 
  
if(me.am_name.value==""){
	alert('ERROR: Name of approving manager  is required');
     me.am_name.focus();
     return false;	
	}
if(me.am_coy.value==""){
	alert('ERROR:  Company name of approving manager  is required');
     me.am_coy.focus();
     return false;	
	}
if(me.am_designation.value==""){
	alert('ERROR:  Designation of approving manager  is required');
     me.am_designation.focus();
     return false;	
	}


if(me.am_phone.value==""){
	alert('ERROR: Phone number is required');
     me.am_phone.focus();
     return false;	
	}




if(me.b_coy_name.value==""){
	alert('ERROR: Name of the Billing Company');
     me.b_coy_name.focus();
     return false;	
	}

if(me.b_name_invoice.value==""){
	alert('ERROR: Name of the Person to Billing Invoice is required');
     me.b_name_invoice.focus();
     return false;	
	}
if(me.designation.value==""){
	alert('ERROR: Designation or designation officer is required');
     me.designation.focus();
     return false;	
	}
if(me.b_address1.value==""){
	alert('ERROR: Billing Address is required');
     me.address1.focus();
     return false;	
	}
if(me.b_city.value==""){
	alert('ERROR: Billing City is required');
     me.city.focus();
     return false;	
	}

if(me.b_postal_code.value==""){
	alert('ERROR: Billing  Postal Code is required');
     me.postal_code.focus();
     return false;	
	}
 	
if(me.b_phone.value==""){
	alert('ERROR: Billing Phone number is required');
     me.phone.focus();
     return false;	
	}
 
if(me.Name1.value==""){
	alert('ERROR: Participant name is required');
     me.Name1.focus();
     return false;	
	}
if(me.Designation1.value==""){
	alert('ERROR: Participant Designation is required');
     me.Designation1.focus();
     return false;	
	}
if(me.rEmail1.value==""){
	alert('ERROR: Participant phone is required');
     me.rEmail1.focus();
     return false;	
	}



if(me.pName1.value==""){
	alert('ERROR: Participant name is required');
     me.pName1.focus();
     return false;	
	}
if(me.pDesignation1.value==""){
	alert('ERROR: Participant Designation is required');
     me.pDesignation1.focus();
     return false;	
	}
if(me.prEmail1.value==""){
	alert('ERROR: Participant phone is required');
     me.prEmail1.focus();
     return false;	
	}



      
 if(echeck(me.email.value)==false)
    {
     me.email.value=""
     me.email.focus();
     return false;	
    }
   if(echeck(me.a_email.value)==false)
    {
     me.a_email.value=""
     me.a_email.focus();
     return false;	
    }
  if(echeck(me.b_email.value)==false)
    {
     me.b_email.value=""
     me.b_email.focus();
     return false;	
    }
  if(echeck(me.rEmail1.value)==false)
    {
     me.rEmail1.value=""
     me.rEmail1.focus();
     return false;	
    }

return true;
}

