
// JavaScript Document
function radiocheck(div) 
{ 
	if (document.form_contact.detail[div].checked == true)
	{ 
		document.form_contact.detail[div].checked = false;
	}
	else {
		document.form_contact.detail[div].checked = true;	
	}
}

function envoi_news()
{
	if (document.form_news.news.checked == true){
		boolvalide = true;
	}else{
		boolvalide = false;
	}
	if (boolvalide) {
		document.form_news.submit();
	}
}

function envoi_contact2()
{
    var message = "Merci de renseigner les champs suivants : \n \n" ;
	var boolvalide = true;

	/*
	if (!JSC_isNumber_String(document.form_contact2.date_naissance_j.value) || !JSC_isNumber_String(document.form_contact2.date_naissance_m.value) || !JSC_isNumber_String(document.form_contact2.date_naissance_a.value) || document.form_contact2.date_naissance_j.value >31 || document.form_contact2.date_naissance_j.value <1 || document.form_contact2.date_naissance_m.value >12 || document.form_contact2.date_naissance_m.value <1 || document.form_contact2.date_naissance_a.value <1 )
	{
	   message = message + "Attention : date de naissance invalide \n";
	   boolvalide = false;
	}//if

 	*/
	if (boolvalide) {
		document.form_contact2.submit();
	}
	else {alert(message);}
}	
	 
function envoi_contact()
{
    var message = "Votre demande n'est pas transmise pour la ou les raison(s) suivante(s) : \n \n" ;
	var boolvalide = true;

	if (JSC_isEmpty_String(document.form_contact.nom.value))
	{
	   message = message + "Attention : Nom incomplet \n";
	   boolvalide = false;
	}//if
	
	if (JSC_isEmpty_String(document.form_contact.prenom.value))
	{
	   message = message + "Attention : Prenom incomplet \n";
	   boolvalide = false;
	}//if

	/*if (JSC_isEmpty_String(document.form_contact.adresse.value))
	{
	   message = message + "Attention : Adresse incomplet \n";
	   boolvalide = false;
	}//if
	
	if (JSC_isEmpty_String(document.form_contact.code_postal.value))
	{
	   message = message + "Attention : Code postal incomplet \n";
	   boolvalide = false;
	}//if
	if (JSC_isEmpty_String(document.form_contact.ville.value))
	{
	   message = message + "Attention : Ville  incomplet \n";
	   boolvalide = false;
	}//if
	if (JSC_isEmpty_String(document.form_contact.pays.value))
	{
	   message = message + "Attention : Pays incomplet \n";
	   boolvalide = false;
	}//if
	*/
	if (!JSC_isEmail_String(document.form_contact.email.value))
	{
	   message = message + "Attention : Email invalide ou incomplet  \n";
	   boolvalide = false;
	}//if
	
	if ( (!JSC_isTel_String(document.form_contact.tel2.value) || JSC_isEmpty_String(document.form_contact.tel2.value) || !JSC_isTel_String(document.form_contact.tel1.value) || JSC_isEmpty_String(document.form_contact.tel1.value)))
	{
	   message = message + "Attention : Telephone invalide ou incomplet \n";
	   boolvalide = false;
	}// if
		
	
	if (boolvalide) {
		document.form_contact.submit();
	}
	else {alert(message);}
}

function envoi_recommander()
{
    var message = "" ;
	var boolvalide = true;


	if (JSC_isEmpty_String(document.form_recommander.nom.value) || document.form_recommander.nom.value == "Mon nom")
	{
	   message = message + "Attention : vous devez saisir votre nom. \n";
	   boolvalide = false;
	}//if
	
	if (!JSC_isEmail_String(document.form_recommander.email.value))
	{
	   message = message + "Attention : vous devez saisir votre adresse email. \n";
	   boolvalide = false;
	}//if
	
	if (!JSC_isEmail_String(document.form_recommander.email_ami.value))
	{
	   message = message + "Attention : vous devez saisir l\'adresse email de votre ami(e). \n";
	   boolvalide = false;
	}//if

	
		if (boolvalide) {
			document.form_recommander.submit();
		}
		else {alert(message);}
}
	


function JSC_strTrim_String(str) {
	str=str.replace(/^\s+/g,"");
	str=str.replace(/\s+$/g,"");
	return str;
}

function JSC_isEmpty_String(str) {
	return (JSC_strTrim_String(str).length==0);
}

function JSC_isTel_String(str)	{
	if (str.search(/[^0-9\(\)+\-. ]/gi)!=-1)                                    // Y a-t-il des caractères autres que "0" à "9", "(", ")", "+", "-", " " et "." ?
		return false;                                                           // -> ce n'est pas un numéro de téléphone
	else
		return true;
}

function JSC_isNumber_String(str,hasComma) {
	str=JSC_strTrim_String(str);                                                // Enlevons les espaces inutiles !
	intFCT_virgules=0;                                                          // Nombre de séparateurs décimaux trouvés

	// On accepte les caractères "+" et "-" uniquement en début de chaîne
	if (str.charAt(0)=="-" || str.charAt(0)=="+")
		str=str.substring(1,str.length);                                        // On se débarasse du signe

	for (i=0 ; i<str.length ; i++)
		if (str.charAt(i)=="." || (hasComma && str.charAt(i)==","))
			intFCT_virgules++;                                                  // Et un séparateur décimal, un !
		else
			if (str.charAt(i)<"0" || str.charAt(i)>"9")                         // Pas numérique ?
				return false;                                                   // -> ce n'est pas un nombre
	if (intFCT_virgules>1)                                                      // Plus d'un séparateur décimal ?
		return false;                                                           // -> ce n'est pas un nombre
	return true;
}

function JSC_isEmail_String(str) {
	if (str.indexOf("'")!=-1)                                                   // "'" refusé
		return false;
	if (str.indexOf(" ")!=-1)                                                   // " " refusé
		return false;
	if (str.indexOf('"')!=-1)                                                   // '"' refusé
		return false;
	if (str.indexOf("#")!=-1)                                                   // "#" refusé
		return false;
	if (str.indexOf("(")!=-1)                                                   // "(" refusé
		return false;
	if (str.indexOf(")")!=-1)                                                   // ")" refusé
		return false;
	if (str.indexOf("/")!=-1)                                                   // "/" refusé
		return false;
	if (str.indexOf("\\")!=-1)                                                  // "\" refusé
		return false;
	if (str.indexOf("?")!=-1)                                                   // "?" refusé
		return false;
	if (str.indexOf(":")!=-1)                                                   // ":" refusé
		return false;
	if (str.indexOf(";")!=-1)                                                   // ";" refusé
		return false;
	if (str.indexOf("+")!=-1)                                                   // "+" refusé
		return false;
	if (str.indexOf("=")!=-1)                                                   // "=" refusé
		return false;
	if (str.indexOf("<")!=-1)                                                   // "<" refusé
		return false;
	if (str.indexOf(">")!=-1)                                                   // ">" refusé
		return false;
	if (str.indexOf("*")!=-1)                                                   // "*" refusé
		return false;
	if (str.indexOf("%")!=-1)                                                   // "%" refusé
		return false;
	if (str.indexOf("&")!=-1)                                                   // "&" refusé
		return false;
	if (str.indexOf(".@")!=-1)                                                  // "*.@*" refusé
		return false;
	if (str.indexOf("@.")!=-1)                                                  // "*@.*" refusé
		return false;
	if (".@".indexOf(str.charAt(0))!=-1)                                        // "@*" et ".*" refusés
		return false;
	if (".@".indexOf(str.charAt(str.length-1))!=-1)                             // "*@" et "*." refusés
		return false;
	if (str.search(/@.*@/g)!=-1)                                                // "*@*@*" et "*@@*" refusés
		return false;
	if (str.indexOf("..")!=-1)                                                  // "*..*" refusé
		return false;
	if (str.search(/@.*\./g)==-1)                                               // On refuse s'il n'y a pas de point à droite de "@"
		return false;
	if (str.length>5+str.lastIndexOf("."))                                      // On refuse les extensions de plus de 4 caractères
		return false;
	str=str.substr(str.lastIndexOf("."),5);
	return (str.length>1 && !JSC_isNumber_String(str,false));
	}

<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->



<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function recup_news()
{
	if (document.form.news_.checked == true){
	document.form.news.value = 1;
	}else{
	document.form.news.value = 0;
	}
}





function JSC_strTrim_String(str) {
	str=str.replace(/^\s+/g,"");
	str=str.replace(/\s+$/g,"");
	return str;
}

function JSC_isEmpty_String(str) {
	return (JSC_strTrim_String(str).length==0);
}

function JSC_isTel_String(str)	{
	if (str.search(/[^0-9\(\)+\-. ]/gi)!=-1)                                    // Y a-t-il des caractères autres que "0" à "9", "(", ")", "+", "-", " " et "." ?
		return false;                                                           // -> ce n'est pas un numéro de téléphone
	else
		return true;
}

function JSC_isNumber_String(str,hasComma) {
	str=JSC_strTrim_String(str);                                                // Enlevons les espaces inutiles !
	intFCT_virgules=0;                                                          // Nombre de séparateurs décimaux trouvés

	// On accepte les caractères "+" et "-" uniquement en début de chaîne
	if (str.charAt(0)=="-" || str.charAt(0)=="+")
		str=str.substring(1,str.length);                                        // On se débarasse du signe

	for (i=0 ; i<str.length ; i++)
		if (str.charAt(i)=="." || (hasComma && str.charAt(i)==","))
			intFCT_virgules++;                                                  // Et un séparateur décimal, un !
		else
			if (str.charAt(i)<"0" || str.charAt(i)>"9")                         // Pas numérique ?
				return false;                                                   // -> ce n'est pas un nombre
	if (intFCT_virgules>1)                                                      // Plus d'un séparateur décimal ?
		return false;                                                           // -> ce n'est pas un nombre
	return true;
}

function JSC_isEmail_String(str) {
	if (str.indexOf("'")!=-1)                                                   // "'" refusé
		return false;
	if (str.indexOf(" ")!=-1)                                                   // " " refusé
		return false;
	if (str.indexOf('"')!=-1)                                                   // '"' refusé
		return false;
	if (str.indexOf("#")!=-1)                                                   // "#" refusé
		return false;
	if (str.indexOf("(")!=-1)                                                   // "(" refusé
		return false;
	if (str.indexOf(")")!=-1)                                                   // ")" refusé
		return false;
	if (str.indexOf("/")!=-1)                                                   // "/" refusé
		return false;
	if (str.indexOf("\\")!=-1)                                                  // "\" refusé
		return false;
	if (str.indexOf("?")!=-1)                                                   // "?" refusé
		return false;
	if (str.indexOf(":")!=-1)                                                   // ":" refusé
		return false;
	if (str.indexOf(";")!=-1)                                                   // ";" refusé
		return false;
	if (str.indexOf("+")!=-1)                                                   // "+" refusé
		return false;
	if (str.indexOf("=")!=-1)                                                   // "=" refusé
		return false;
	if (str.indexOf("<")!=-1)                                                   // "<" refusé
		return false;
	if (str.indexOf(">")!=-1)                                                   // ">" refusé
		return false;
	if (str.indexOf("*")!=-1)                                                   // "*" refusé
		return false;
	if (str.indexOf("%")!=-1)                                                   // "%" refusé
		return false;
	if (str.indexOf("&")!=-1)                                                   // "&" refusé
		return false;
	if (str.indexOf(".@")!=-1)                                                  // "*.@*" refusé
		return false;
	if (str.indexOf("@.")!=-1)                                                  // "*@.*" refusé
		return false;
	if (".@".indexOf(str.charAt(0))!=-1)                                        // "@*" et ".*" refusés
		return false;
	if (".@".indexOf(str.charAt(str.length-1))!=-1)                             // "*@" et "*." refusés
		return false;
	if (str.search(/@.*@/g)!=-1)                                                // "*@*@*" et "*@@*" refusés
		return false;
	if (str.indexOf("..")!=-1)                                                  // "*..*" refusé
		return false;
	if (str.search(/@.*\./g)==-1)                                               // On refuse s'il n'y a pas de point à droite de "@"
		return false;
	if (str.length>5+str.lastIndexOf("."))                                      // On refuse les extensions de plus de 4 caractères
		return false;
	str=str.substr(str.lastIndexOf("."),5);
	return (str.length>1 && !JSC_isNumber_String(str,false));
	}

 
