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 address")
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail address");
	   document.EvtRegister.Email1.focus();
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	   alert("Invalid E-mail address");
	   document.EvtRegister.Email1.focus();
	    return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
	    alert("Invalid E-mail address");
	    document.EvtRegister.Email1.focus();
	    return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    alert("Invalid E-mail address");
	    document.EvtRegister.Email1.focus();
	    return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
	   alert("Invalid E-mail address");
	   document.EvtRegister.Email1.focus();
	    return false
	 }
		
	 if (str.indexOf(" ")!=-1){
	    alert("Invalid E-mail address");
	    document.EvtRegister.Email1.focus();
	    return false
	 }

 return true;	 					
}



function Validation()
    {
      with(document.EvtRegister)
        {
          if(Name1.value.length ==0)
            {            
             alert("Name cant be null");
             Name1.focus();
             return false;
            }             
            
           //if(Function1.value.length ==0)
//            {            
//             alert("Function cant be null");
//             Function1.focus();
//             return false;
//            }  
            
           if(Email1.value.length ==0)
            {            
             alert("Email cant be null");
             Email1.focus();
             return false;
            } 
          
               str=Email1.value;
           if(!echeck(str))
             {
             Email1.focus();
             return false;
             }
            
              
//            if(Lang1.value.length ==0)
 //           {            
//             alert("Please select the language.");
//             Lang1.focus();
//             return false;
//            }  
            
            if(Company.value.length ==0)
            {            
             alert("Please enter the Company.");
             Company.focus();
             return false;
            }        
            
          //  if(Address.value.length ==0)
//            {            
//             alert("Please Enter the Address.");
//             Address.focus();
//             return false;
//            }   
            
             //if(Zip.value.length ==0)
//            {            
//             alert("Please Enter the Zipcode.");
//             Zip.focus();
//             return false;
//            }   
            
            // if(City.value.length ==0)
//            {            
//             alert("Please Enter the City.");
//             City.focus();
//             return false;
//            }          
//            
         
 
           if(Phone.value.length ==0)
            {            
             alert("Please Enter the Phoneno.");
             Phone.focus();
             return false;
            }   
            
            //if(Fax.value.length ==0)
//            {            
//             alert("Please Enter the Faxno.");
//             Fax.focus();
//             return false;
//            }   
             
             //if((!Registration[0].checked)&&(!Registration[1].checked))
//            {   
//                  
//             alert("Please select one option.");             
//             return false;
//            }  
           
          // if((Registration[0].checked)||(Registrationafternoon.checked))
//              {
//              if((!Invitation[0].checked)&&(!Invitation[1].checked))
//               {            
//                alert("Please select one option about the Invittion.");             
//                return false;
//               }              
//             }            
        }   
   } 
    
   
   // function check()
//      {
//          document.EvtRegister.lunch.disabled=false; 
//          document.EvtRegister.Champagne.disabled=false;
//          document.EvtRegister.Invitation[0].disabled = false;  
//          document.EvtRegister.Invitation[1].disabled = false;  
//      
//       with(document.EvtRegister)
//        {
//      if((Registration[1].checked)&&(!Registrationafternoon.checked)&&(!Registration[0].checked))
//        {
//         
//          document.EvtRegister.lunch.disabled=true; 
//          document.EvtRegister.Champagne.disabled=true;
//          Invitation[0].disabled = true;  
//          Invitation[1].disabled = true;   
//        }
//        else
//          {
//          document.EvtRegister.lunch.disabled=false; 
//          document.EvtRegister.Champagne.disabled=false;
//          Invitation[0].disabled = false;  
//          Invitation[1].disabled = false;              
//          }
//        
//        
//        }
//      
//      }
	  
//------------Clear all answers for the questions--------------------------------------------

function clearBtn(){
 with (document.EvtRegister) {
 if (Ques[1].checked ) {
   // for (i=0; i<6 ; i++) original
   for (i=0; i<2 ; i++)
   {
     Ans[i].checked = false
     Ans[i].disabled = true
   }
  }
  if (Ques[0].checked ) {
   //for (i=0; i<6 ; i++) original
   for (i=0; i<2 ; i++)
   {
     Ans[i].disabled = false
   }
  }
    
 }
}	  