
//Popup Movie
function popupMovie(url){
	width=360; height=288;
	bx=(((screen.availWidth)/2)-(width/2));
	by=(((screen.availHeight)/2)-(height/2));
	browser=open(url,"movie","toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+width+",height="+height+",top="+by+",left="+bx+",alwaysraised=yes");
}

//Popup Areas
function popupAreas(url){
	width=670; height=526;
	bx=(((screen.availWidth)/2)-(width/2));
	by=(((screen.availHeight)/2)-(height/2));
	browser=open(url,"areas","toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+width+",height="+height+",top="+by+",left="+bx+",alwaysraised=yes");
}

//Fonction TRIM
function trim(monTexte){
	return monTexte.replace(/(^\s*)|(\s*$)/g,''); 
	return monTexte;
}

//Fonction qui vérifie que l'expression est un e-mail
function isMail(expression) {
	var myRegExp = /^.+@.+\..{2,3}$/
	return myRegExp.test(expression);
}

//Check le formulaire de contact
function checkContact (msgS1,msgS2){
	var checkData = 0;
	var checkMail = 0;
	var msgS = "";
	//check prénom
	if(trim(document.formContact.firstname.value)==""){
		document.getElementById("firstname").style.backgroundColor = "#FFCCCC";
		document.getElementById("firstname").style.border = "solid 1px #FF0000";
		checkData = 1;
	} else {
		document.getElementById("firstname").style.backgroundColor = "#FFFFFF";
		document.getElementById("firstname").style.border = "solid 1px #7B9EBD";
	}
	//check nom
	if(trim(document.formContact.name.value)==""){
		document.getElementById("name").style.backgroundColor = "#FFCCCC";
		document.getElementById("name").style.border = "solid 1px #FF0000";
		checkData = 1;
	} else {
		document.getElementById("name").style.backgroundColor = "#FFFFFF";
		document.getElementById("name").style.border = "solid 1px #7B9EBD";
	}
	//check que tel ou e-mail ait été saisi
	if(trim(document.formContact.tel.value)=="" && trim(document.formContact.email.value)==""){
		document.getElementById("tel").style.backgroundColor = "#FFCCCC";
		document.getElementById("tel").style.border = "solid 1px #FF0000";
		document.getElementById("email").style.backgroundColor = "#FFCCCC";
		document.getElementById("email").style.border = "solid 1px #FF0000";
		checkData = 1;
	} else {
		document.getElementById("tel").style.backgroundColor = "#FFFFFF";
		document.getElementById("tel").style.border = "solid 1px #7B9EBD";
		document.getElementById("email").style.backgroundColor = "#FFFFFF";
		document.getElementById("email").style.border = "solid 1px #7B9EBD";
		
		//check téléphone
		/*if(trim(document.formContact.tel.value)==""){
			document.getElementById("tel").style.backgroundColor = "#FFCCCC";
			document.getElementById("tel").style.border = "solid 1px #FF0000";
			checkData = 1;
		} else {
			document.getElementById("tel").style.backgroundColor = "#FFFFFF";
			document.getElementById("tel").style.border = "solid 1px #7B9EBD";
		}*/
		//check Format Email
		if(!isMail(trim(document.formContact.email.value)) && trim(document.formContact.email.value)!=""){
			document.getElementById("email").style.backgroundColor = "#FFCCCC";
			document.getElementById("email").style.border = "solid 1px #FF0000";
			checkMail = 1;
		} else {
			document.getElementById("email").style.backgroundColor = "#FFFFFF";
			document.getElementById("email").style.border = "solid 1px #7B9EBD";
		}
	}
		
	//check commentaire
	if(trim(document.formContact.comment.value)=="" && document.formContact.services.value=="Other"){
		document.getElementById("comment").style.backgroundColor = "#FFCCCC";
		document.getElementById("comment").style.border = "solid 1px #FF0000";
		checkData = 1;
	} else {
		document.getElementById("comment").style.backgroundColor = "#FFFFFF";
		document.getElementById("comment").style.border = "solid 1px #7B9EBD";
	}
	//check code de sécurité
	if(trim(document.formContact.code.value)==""){
		document.getElementById("code").style.backgroundColor = "#FFCCCC";
		document.getElementById("code").style.border = "solid 1px #FF0000";
		checkData = 1;
	} else {
		document.getElementById("code").style.backgroundColor = "#FFFFFF";
		document.getElementById("code").style.border = "solid 1px #7B9EBD";
	}
	if(checkData==1){msgS=msgS1;}
	if(checkMail==1){msgS=msgS+msgS2;}
	if(checkData==1 || checkMail==1){alert(msgS); return false;} else {return true;}
}