
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 ValidateForm(e){
	var emailID=e;
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }

function afficher_details_youth(bool) {
	
	if(bool==false) {
		document.getElementById('details_youth').style.visibility="hidden" 
		document.getElementById('details_youth').style.height="0px";	
	}
		else { 
			document.getElementById('details_youth').style.visibility="visible";
			document.getElementById('details_youth').style.height="400px";
		}

}
function colorer(bool,div_id) {
	
	//alert(div_id);
	
	if(bool==false) {
		document.getElementById(div_id).style.background='#CC0000';
		document.getElementById(div_id).focus();
	}
	else document.getElementById(div_id).style.background='#ffffff'; 

}


function Valider2()
{
	var i=0;
	
	 if(document.form2.name.value == "" )
															  {
																 
																  colorer(false,'name');
		 														  i++;
															  }
	 if(document.form2.Position.value == "" )
															  {
																 
																  colorer(false,'Position');
		 														  i++;
															  }
	 														  
	 if ( (document.form2.Email.value=="") || (ValidateForm(document.form2.Email)==false)) {
		 
		 colorer(false,'Email');
		  i++;
	  }
	  if(document.form2.presentation.value == "" )
															  {
																 
																  colorer(false,'presentation');
		 														  i++;
															  }
	 if(document.form2.conference_book.value == "" )
															  {
																 
																  colorer(false,'conference_book');
		 														  i++;
															  }															  	 if(document.form2.Telephone.value == "" )
															  {
																 
																  colorer(false,'Telephone');
		 														  i++;
															  }
	if(document.form2.Mailing_address.value == "" )
															  {
																 
																  colorer(false,'Mailing_address');
		 														  i++;
															  }
	if(document.form2.City.value == "" )
															  {
																 
																  colorer(false,'City');
		 														  i++;
															  }
	if(document.form2.Country.value == "" )
															  {
																 
																  colorer(false,'Country');
		 														  i++;
															  }
	if(document.form2.binformation.value == "" )
															  {
																 
																  colorer(false,'binformation');
		 														  i++;
															  }														  



	if(i>0)
	{
	alert('Please fill in the fields listed ');	
	return false;
	}
	else
	{
	alerte('Thank you for registration');
	return true;
	}
}
function Valider() {
	var i=0;
	
	


      if ( (document.form1.email.value=="") || (ValidateForm(document.form1.email)==false)) {
		 colorer(false,'email');
		  i++;
	  }


/*
      if ( document.form1.email.value=="") {
		  colorer(false,'email');
		  i++;
	  }*/

	 if(document.form1.date_of_birth.value == "" )
															  {
	  colorer(false,'date_of_birth');
		  i++;															  
												  }
	 if ( document.form1.firstname.value == "" )
    {
        colorer(false,'firstname');
		  i++;
		
	}
	 if ( document.form1.lastname.value == "" )
    {
        colorer(false,'lastname');
		  i++;
	}
	 if ( document.form1.passportnum.value == "" )
    {
        colorer(false,'passportnum');
		  i++;
	}
	if ( document.form1.issuedby.value == "" )
    {
         colorer(false,'issuedby');
		  i++;
	}
	if(document.form1.issuancedate.value == "") 
															  {
																  colorer(false,'issuancedate');
		  															i++;
															  }
	if(document.form1.expiration_date.value == "" ) 
															  {
																 colorer(false,'expiration_date');
		  															i++;
															  }
	if ( document.form1.position.value == "" )
    {
        colorer(false,'position');
		  i++;
	}		
	if ( document.form1.city.value == "" )
    {
        colorer(false,'city');
		  i++;
	}	
	if ( document.form1.country.value == "" )
    {
        colorer(false,'country');
		  i++;
	}
	if ( document.form1.telephone.value == "" )
    {
		
        colorer(false,'telephone');
		  i++;
	}
	if ( document.form1.postal.value == "" )
    {
		
        colorer(false,'postal');
		  i++;
	}	
	if ( document.form1.payement.value == "" )
    {
        colorer(false,'payement');
		  i++;
	}

	if(document.form1.register[1].checked)
	{
			
			
   if ( (document.form1.email2.value=="") || (ValidateForm(document.form1.email2)==false)) {
		 colorer(false,'email2');
		  i++;
	  }
			  if ( document.form1.firstname2.value == "" )
    			{
        		colorer(false,'firstname2');
		  		i++;
		
				}
			 if ( document.form1.lastname2.value == "" )
   				 {
      		  colorer(false,'lastname2');
			  i++;
				 }
			  	 if ( document.form1.telephone2.value == "" )
    			{
     		   colorer(false,'telephone2');
				i++;
				}
			
	
	
	}
	
	
	if(i>0)
	{
	alert('Please fill in the fields listed ');	
	return false;
	}
	else
	{
	alerte('Thank you for registration');
	return true;
	}
}


