function controle_champ()
{
	//var exp1=new RegExp("^([a-zA-Z0-9_])([a-zA-Z0-9_\.\-])*\@(([a-zA-Z0-9_\-])+\.)+([a-zA-Z0-9]{2,4})$");
     var msg_info;

     msg_info = "";

 	if(document.sendToContact.votre_email.value == "" )
    {
        msg_info += "- votre e-mail \n";
    }
 	if(document.sendToContact.votre_email.value != "" )
    {
		if (!checkEmailContact())
	    {
	       msg_info += "- E-mail incorrect \n";
	    }
    }

 	if(msg_info != "")
  	{
  		alert("Veuillez remplir ou revoir le champ  : \n" + msg_info);
  		return (false);
  	}
  	return (true);
}

function checkEmailContact() {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.sendToContact.votre_email.value)){
return (true)
}
else return (false)
}

function checkEmail() {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.sendToFriend.votre_email.value)){
return (true)
}
else return (false)
}

function checkEmailAmi() {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.sendToFriend.ami_email.value)){
return (true)
}
else return (false)
}

function envoyer(){
	if (controle_champ()) {
		document.sendToContact.sendedMail.value = "OK";
	  	document.sendToContact.submit();
	}
}


function controleSaisie()
{
	var exp1=new RegExp("^([a-zA-Z0-9_])([a-zA-Z0-9_\.\-])*\@(([a-zA-Z0-9_\-])+\.)+([a-zA-Z0-9]{2,4})$");
     var msg_info;

     msg_info = "";

 	if(document.sendToFriend.votre_email.value == "" )
    {
        msg_info += "- votre e-mail \n";
    }
 	if(document.sendToFriend.votre_email.value != "" )
    {
		if (!checkEmail())
	    {
	        msg_info += "-  Votre E-mail est incorrect \n";
	    }
    }

   if(document.sendToFriend.ami_email.value == "" )
    {
        msg_info += "-  l\' e-mail de votre ami  \n";
    }
 	if(document.sendToFriend.ami_email.value != "" )
    {
		if (!checkEmailAmi())
	    {
	        msg_info += "-   E-mail ami  incorrect \n";
	    }
    }
 	if(msg_info != "")
  	{
  		alert("Veuillez remplir ou revoir le(s) champ(s)  : \n" + msg_info);
  		return (false);
  	}
  	return (true);
}

function poster(){
	if (controleSaisie()) {
		document.sendToFriend.sendedMail.value = "OK";
	  	document.sendToFriend.submit();
	}

}

function open_popup(pUrl)
{
	var widthPopup = Math.max(400,screen.width - 300);
	var heightPopup = Math.max(200,screen.height - 300);
	var top = (screen.height-heightPopup)/2;
	var left = (screen.width-widthPopup)/2;

	var thestyle='status=yes,location=yes,directorie=yes,resizable=yes,scrollbars=yes,menubar=yes,toolbar=yes,top='+top+',left='+left+',width='+widthPopup+',height='+heightPopup;
	var w_page_popup = window.open(pUrl,'dongreffe_popup',thestyle);
	w_page_popup.focus();
}

function OuvrirMiniSite2(url) {
	window.open(url, "MiniSite", "menubar=no, status=no, scrollbars=yes, menubar=no, width=802, height=600");
}

