// JavaScript Document

//-------------------------------------------------------------------------------
// Préchargement des images
//-------------------------------------------------------------------------------


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//-------------------------------------------------------------------------------
// Notice légale
//-------------------------------------------------------------------------------
function showCPR(s)
{
            var y = new Date().getYear();
            if (y<1900) y+=1900;
            if (s!=y)
                        document.write(s + " - " + y);
            else
                        document.write(y);
}


//-------------------------------------------------------------------------------
// Fonction Opacité
//-------------------------------------------------------------------------------
function setOpacity(obj, opacity) 
{
	  opacity = (opacity == 100)?99.999:opacity;
	  // IE/Win
	  obj.style.filter = "alpha(opacity:"+opacity+")";
	  // Safari<1.2, Konqueror
	  obj.style.KHTMLOpacity = opacity/100;
	  // Older Mozilla and Firefox
	  obj.style.MozOpacity = opacity/100;
	  // Safari 1.2, newer Firefox and Mozilla, CSS3
	  obj.style.opacity = opacity/100;
}

//-------------------------------------------------------------------------------
// Fonction Captcha()
//-------------------------------------------------------------------------------
function RefreshCaptcha() {
	var i = new Image();
	var d = new Date();
	//var captcha = $("#Captcha").get(0);
	var captcha = document.getElementById("Captcha");
	
	i.src = 'include/modCaptcha.asp?Type=4&Dt=' + d.getHours().toString() + d.getMinutes().toString() + d.getSeconds().toString() ;
	captcha.src =  i.src;
}

//-------------------------------------------------------------------------------
// Fonction formulaire
//-------------------------------------------------------------------------------
function isEmail(obj) {
       if (obj.value.indexOf(" ") + "" == "-1"
       && obj.value.indexOf("@") + "" != "-1"
       && (obj.value.lastIndexOf(".") > obj.value.indexOf("@"))
       && obj.value != "") return true;
       else return false;
}

function isCP(obj) {
	if (isNaN(obj.value)==false && obj.value.length==5)  return true;
	else return false;
}

function TestParam(Form)
{
	if (Form['eNom'].value == "") { alert("Merci de saisir votre nom") ; Form['eNom'].focus(); return false; }
	if (Form['ePrenom'].value == "") { alert("Merci de saisir votre prénom") ; Form['ePrenom'].focus(); return false; }
	if (Form.eEmail.value == "")
		{ alert("Merci d'indiquer votre adresse e-mail"); Form.eEmail.focus(); return; }
	if (!isEmail(Form.eEmail))
		{ alert("Merci de renseigner correctement votre adresse e-mail"); Form.eEmail.focus(); return; }
	if (Form['eMessage'].value == "") { alert("Merci de saisir votre message") ; Form['eMessage'].focus(); return false; }
	if (Form['eCaptcha'].value == "") { alert("Merci de saisir les 5 caractères de l'image") ; Form['eCaptcha'].focus(); return false; }
	Form.action ="mailto.asp";
	return true;
}

//------------------------------------------------------------------------------------
// Fonction CacheMail
//------------------------------------------------------------------------------------
function CacheMail(mail,domain) {
	this.location = 'mailto:' + mail + '@'+ domain;
}
