
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 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(lang)
{
	var i=0;
	
	 if(document.form2.nom.value == "" )
															  {
																 
																  colorer(false,'nom');
		 														  i++;
															  }
	 if(document.form2.prenom.value == "" )
															  {
																 
																  colorer(false,'prenom');
		 														  i++;
															  }
				
				
	if(document.form2.age.value == "" )
															  {
																 
																  colorer(false,'age');
		 														  i++;
															  }	
															  
															  
	if(document.form2.profession.value == "" )
															  {
																 
																  colorer(false,'profession');
		 														  i++;
															  }	
															  
	
	if(document.form2.adresse_perso.value == "" )
															  {
																 
																  colorer(false,'adresse_perso');
		 														  i++;
															  }	
															  
	if(document.form2.tel_prof.value == "" )
															  {
																 
																  colorer(false,'tel_prof');
		 														  i++;
															  }															  
	
															  
	 														  
	 if ( (document.form2.email.value=="") || (ValidateForm(document.form2.email)==false)) {
		 
		 colorer(false,'email');
		  i++;
	  }
	  
	  
	 



	if(i>0)
	{
			
		
		switch (lang)
			{
			case "fr":alert('Veuillez remplir les champs obligatoires');  break;
			case "en":alert('Please fill in the fields listed ');  break;
			case "ar": msg=String.fromCharCode(1575, 1604, 1605, 1585, 1580, 1608,1605, 1604, 1569,1575, 1604, 1582, 1575, 1606, 1575, 1578,1575, 1604, 1590, 1585, 1608, 1585, 1610, 1577);

                       alert(msg);
			
			  break;
			default: alert('Veuillez remplir les champs obligatoires');
			} 
		
		
		
		
	return false;
	}
	else
	{
	alerte('Thank you for registration');
	return true;
	}
}



