// JavaScript Document//-->

function visiblemenu()
{
document.getElementById("sous_menu1").style.display="";
}

function hidemenu()
{
document.getElementById("sous_menu1").style.display="none";

}


function show_details (id)
{
var tab = new Array ("suite","suite2","suite3","suite4","suite5","suite6","suite7","suite8","suite9","suite10","suite11");
if (document.getElementById(id).style.display == 'none')
	{
	document.getElementById(id).style.display = "block";
     for(i=0;i<tab.length;i++)
		{
		if ((tab[i] != id) && document.getElementById(tab[i]) )
 		document.getElementById(tab[i]).style.display = "none";
		}
	}
else
document.getElementById(id).style.display = "none";
}

function afficher_texte(id,texte){
	    for(i=1;i <= id ;i++){
		txt='texte_'+i;
		document.getElementById(txt).style.display='none';
		}
		document.getElementById(texte).style.display='block';
	}
	
function afficher_texte_eclai(id,titre){
	    for(i=1;i <= id ;i++){
		txt='titre2_'+i;
		document.getElementById(txt).style.display='none';
		}
		document.getElementById(titre).style.display='block';
	}

	
function change_image(img_) {
      var monImage = new Image();
      monImage.src = img_;
      window.document.image.src = monImage.src;
}

/*------------Formulaire contact -----------*/
function verifForm(langue) {
	var msg_err = "";

	var nom_prenom=document.form.nom_prenom.value;
	var email=document.form.email.value;
	var telephone=document.form.telephone.value;
	var message=document.form.message.value;
	
	if (nom_prenom == "" || email == "" || telephone== "" || message == ""){
		if(langue=='fr'){msg_err+='Vérifiez les champs obligatoires! Merci.\n';}
	    if(langue=='en'){msg_err+='Verify the obligatory fields !.\n';}
	    if(langue=='ar'){msg_err+='Verify the obligatory fields !.\n';}
	}else{
		if (!is_phone(document.form.telephone.value)){
			if(langue=='fr'){msg_err+='Veuillez entrer un numéro de téléphone valide! \n';}
			if(langue=='en'){msg_err+='Please enter a valid phone number!\n';}
			if(langue=='ar'){msg_err+='Please enter a valid phone number!\n';}
		}
		if(!is_mail(document.form.email.value)){
				if(langue=='fr'){msg_err+='Veuillez entrer une adresse e-mail valide!'; }
				if(langue=='en'){msg_err+='Please enter a valid e-mail address!'; }
				if(langue=='ar'){msg_err+='Please enter a valid e-mail address!'; }
		}
	}
	if(msg_err=="")
	document.form.submit();
	else
	alert(msg_err);
}

function verifForm_recrut(langue) {
	var msg_err = "";
	
	var nom_prenom=document.recrutform.nom_prenom.value;
	var email=document.recrutform.email.value;
	var telephone=document.recrutform.telephone.value;
	var cv=document.recrutform.cv.value;
	
	if (nom_prenom == "" || email == "" || telephone== "" || cv == ""){
		if(langue=='fr'){msg_err+='Vérifiez les champs obligatoires! Merci.\n';}
	    if(langue=='en'){msg_err+='Verify the obligatory fields !.\n';}
	    if(langue=='ar'){msg_err+='Verify the obligatory fields !.\n';}
	}else{
		if (!is_phone(document.recrutform.telephone.value)){
			if(langue=='fr'){msg_err+='Veuillez entrer un numéro de téléphone valide! \n';}
			if(langue=='en'){msg_err+='Please enter a valid phone number!\n';}
			if(langue=='ar'){msg_err+='Please enter a valid phone number!\n';}
		}
		if(!is_mail(document.recrutform.email.value)){
				if(langue=='fr'){msg_err+='Veuillez entrer une adresse e-mail valide!'; }
				if(langue=='en'){msg_err+='Please enter a valid e-mail address!'; }
				if(langue=='ar'){msg_err+='Please enter a valid e-mail address!'; }
		}
	}
	
	if(msg_err=="")
	document.recrutform.submit();
	else
	alert(msg_err);
}

function is_phone(tel){
	if (isNaN(tel))
	   return false;
    else
	   return true;
}

function is_mail(adresse){
   if (adresse.match(/^([a-z0-9-]+(?:[.][a-z0-9-]+)*)@((?:[a-z0-9-]+[.])*[a-z0-9-]{0,66})[.]([a-z]{2,6}(?:[.][a-z]{2})?)$/i))
      return true;
   else
      return false;
}
 function function1(){
        document.all.myMarquee.stop();
    }

function function2(){
        document.all.myMarquee.start();
    }
	

function submitform(langue) {
    	if  (document.sub_form.email_addr.value==''){
			if(langue=='fr'){alert('Vérifiez les champs obligatoires! Merci.\n');}
	        if(langue=='en'){alert('Verify the obligatory fields !.\n');}
	        if(langue=='ar'){alert('Verify the obligatory fields !\n');}
		}

 else {
if ( ((document.sub_form.email_addr.value.indexOf('@',1))==-1)||(document.sub_form.email_addr.value.indexOf('.',1))==-1 ){
  			if(langue=='fr'){alert('Veuillez entrer une adresse e-mail valide!');}
			if(langue=='en'){alert('Please enter a valid e-mail address!');}
			if(langue=='ar'){alert('Please enter a valid e-mail address');}
					
			}
  				else {
             window.open("", "formPopup", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,height=200,width=500,toolbar=no", true); 
                    document.sub_form.target='formPopup';
  					document.sub_form.submit();
                 
				 }
  		}
  }	

/*---------------------------------*/