function chiffres(event) {
	// Compatibilité IE / Firefox
	if(!event&&window.event) {
		event=window.event;
	}
	// IE
	if(event.keyCode < 48 || event.keyCode > 57) {
		event.returnValue = false;
		event.cancelBubble = true;
	}
	// DOM
	if(event.which < 48 || event.which > 57) {
		event.preventDefault();
		event.stopPropagation();
	}
}

function menu_show() {
    for (i=0;i<menu_show.arguments.length;i++) {
    document.getElementById(menu_show.arguments[i]).style.visibility='visible';}
}
function menu_hide() {
    for (i=0;i<menu_hide.arguments.length;i++) {
    document.getElementById(menu_hide.arguments[i]).style.visibility='hidden';}
}
function menu_msg(msg) {
    alert(msg);
}

function menuderoulant(cadre,selection){ 

eval(cadre+".location='"+selection.options[selection.selectedIndex].value+"'"); 

} 


		
	function chiffres(event) {
		// Compatibilité IE / Firefox
		if(!event&&window.event) {
			event=window.event;
		}
		// IE
		if(event.keyCode < 48 || event.keyCode > 57) {
			event.returnValue = false;
			event.cancelBubble = true;
		}
		// DOM
		if(event.which < 48 || event.which > 57) {
			event.preventDefault();
			event.stopPropagation();
		}
	}

	function Verifier_Numero_Telephone(num_tel)
	{
		// Definition du motif a matcher
		var regex = new RegExp(/^(01|02|03|04|05|06|08)[0-9]{8}/gi);
		
		// Definition de la variable booleene match
		var match = false;
		
		// Test sur le motif
		if(regex.test(num_tel))
		{
			match = true;
		}
		  else
		{
			document.forms[0].Telephone.focus();match = false;
		}
		
		// On renvoie match
		//if(match==true)	{ document.forms[0].submit(); 							return match;	}
		//else			{ alert("Le numéro de téléphone n'est pas valide !");	return false;	}
		return match;
	}

	function Verif()
	{
		//var i = 1;

		if 		(document.forms[0].Sujet.value == "")	{ i=0;  alert("Le Champ 'Sujet' est  obligatoire !");    document.forms[0].Sujet.focus(); return false;    }
		else if 		(document.forms[0].Message.value == "")	{ i=0;  alert("Le Champ 'Message' est  obligatoire !");    document.forms[0].Message.focus(); return false;    }
		else 
		{ 		
				document.forms[0].submit(); 
		}			

	}






function checkEmail(emailAddr) {
 // Cette fonction vérifie la bon format d'une adresse e-mail.
 // Comme :
 // user@domain.com ou user.perso@domain.com
 
 var i;
 
  if (emailAddr.length==0) {
  return false;
 }
 
 
 
 // Recherche de @
 i = emailAddr.indexOf("@");
 if (i == -1) {
  return false;
 }
 
 // Séparation du nom de l'utilisateur et du nom de domaine.
 var username = emailAddr.substring(0, i);
 var domain = emailAddr.substring(i + 1, emailAddr.length)
 
 // Recherche des espaces au début du nom de l'utilisateur.
 i = 0;
 while ((username.substring(i, i + 1) == " ") && (i < username.length)) {
  i++;
 }
 // Les enlève s'il en trouve.
 if (i > 0) {
  username = username.substring(i, username.length);
 }
 
 // Recherche d'espaces à la fin du nom de domaine.
 i = domain.length - 1;
 while ((domain.substring(i, i + 1) == " ") && (i >= 0)) {
  i--;
 }
 // Les enlève s'il en trouve.
 if (i < (domain.length - 1)) {
  domain = domain.substring(0, i + 1);
 }
 
 // Vérifie que le nom de l'utilisateur et du domaine ne soit pas vide.
 if ((username == "") || (domain == "")) {
  return false;
 }
 
 // Vérifie s'il n'y a pas de caractères interdits dans le nom de l'utilisateur.
 var ch;
 for (i = 0; i < username.length; i++) {
  ch = (username.substring(i, i + 1)).toLowerCase();
  if (!(((ch >= "a") && (ch <= "z")) || 
   ((ch >= "0") && (ch <= "9")) ||
   (ch == "_") || (ch == "-") || (ch == "."))) {
    return false;
  }
 }
 
 // Vérifie s'il n'y a pas de caractères interdits dans le nom de domaine
 for (i = 0; i < domain.length; i++) {
  ch = (domain.substring(i, i + 1)).toLowerCase();
  if (!(((ch >= "a") && (ch <= "z")) || 
   ((ch >= "0") && (ch <= "9")) ||
   (ch == "_") || (ch == "-") || (ch == "."))) {
    return false;
  }
 }
 
// Ajouter ci-dessous de nouveaux noms de domaine.
// Voir tous les noms de domaine sur http://www.toulouse-renaissance.net/c_outils/c-nom-domaine.htm
//
var aSuffix = new Array("com","net","int","aero","biz","museum","name","info","coop","pro","eu","edu","org","gov","mil","bj","dz","de","ad","be","ca","bf","bi","cm","cf","cg","cd","ci","dj","fr","ga","gp","gf","lu","mg","ml","ma","mq","mr","mc","nc","pf","re","pm","sn","ch","td","tf","tn");
 var bFoundSuffix = false;
 i = 0;
 while (i < aSuffix.length) {
  if (("." + aSuffix[i]) == domain.substring(domain.length - aSuffix[i].length - 1, domain.length)) {
   return true;
  }
  i++;
 }
 // Si le nom de domaine est inconnu  : return false
 return false;
 
} 
 
 
function emailOK(emailAddr) {
 if (!(checkEmail(emailAddr))) {
  return false;
 }
 else return true;
}


function ValidMail(mail_address)
{
	return mail_address.match(/^([\w]+)@([\w]+)\.([\w]+)$/);
}




function decomposer(chaine){
	var ma_liste = chaine.split("") ;
	for(i=0;i<ma_liste.length;i++){ 
	if(ma_liste[i]==' ')ma_liste[i]='';
	document.write('<img src="img/lettre_'+ma_liste[i]+'.gif">');
	};
}




	function Verif_commande(monform)
	{
	alert(monform.mode_paiement_id.value);
		if 		(document.monform.mode_paiement_id.value == "")	{ i=0;  alert("Le Mode de paiement est  obligatoire !");    document.mode_paiement_id.mode_paiement_id.focus(); return false;    }
		else 	if 		(monform.client_facturation.value == "")	{ i=0;  alert("L adresse de facturation est  obligatoire !");    monform.client_facturation.focus(); return false;    }
		else 	if 		(monform.client_livraison.value == "")	{ i=0;  alert("L adresse de livraison est  obligatoire !");    monform.client_livraison.focus(); return false;    }
		else 	{ alert('OK'); return true ;	}

	}




