function Dom(chaine) {
	return document.getElementById(chaine);
}
function Afficher(chaine) {
	document.getElementById(chaine).style.display='block';
}
function Cacher(chaine) {
	document.getElementById(chaine).style.display='none';
}
function Focus(chaine) {
	if(document.getElementById(chaine))
		document.getElementById(chaine).focus();
}
function openUrl(param,titre,width,height){
	var w;
	w = window.open(param,titre,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+width+',height='+height); 
	w.focus();
}

function openZoom(photo) {
	Afficher('iframeZoom');
	Dom('iframeZoom').setAttribute('src','');
	Dom('iframeZoom').setAttribute('src','iframeZoom.asp?photo='+photo);
}

function is_cp(valeur){
	if (valeur.length!=5) return false;
	var i;
	for (i=0;i<valeur.length;i++)
		if (i==1)
			if (valeur.charAt(0)==2){
				if (!((valeur.charAt(i).toUpperCase()=='A')||(valeur.charAt(i).toUpperCase()=='B')||(is_numeric(valeur.charAt(i)))))
					return false;
			}else
				if (!is_numeric(valeur.charAt(i))) return false;
		else
			if (!is_numeric(valeur.charAt(i))) return false;
	return true;
}

function openPhoto(photo) {
	var w;
	w = window.open('pop_photo.asp?img='+photo,'photo','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=300,height=300'); 
	w.focus();
}

function openSite(param,titre){
	var w;
	w = window.open(param,titre,'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=1000,height=610'); 
	w.focus();
}

function FormatNumber(nbre,nbdec) {
	tmp_nbre = nbre.toString().replace(",",".");
	var nb=(Math.round(tmp_nbre*Math.pow(10,nbdec))/Math.pow(10,nbdec)).toString();
	var n=0;
	if(nb.split('.')[1]==null) {
		nb+='.';	
		while(n<nbdec){nb+='0';n++;}
	}
	else {
		var i=nbdec-nb.split('.')[1].length;	
		while(n<i){nb+='0';n++;}
	}
	tmp_nb = nb.toString().replace(".",",");
	return tmp_nb;
}

function is_numeric(valeur){
 for (i=0;i<valeur.length;i++)
   if ((valeur.charAt(i)<'0') || (valeur.charAt(i)>'9')) return false;
 return true;
}

function is_mail(email) {
	var arobase = email.indexOf("@"); var point = email.lastIndexOf(".")
	if((arobase < 1)||(point + 2 > email.length)||(point < arobase+1)) return false
    if (email.indexOf(" ")!='-1') return false;
    return true
}

function is_tel(valeur){
	if (valeur.length!=14) return false;
	j = 0;
	for (i=0;i<valeur.length;i++) {if (valeur.charAt(i)==' ') j=j+1;}
	if (j != 4) return false;
	if ((isNaN(valeur.substr(0,2)))||(isNaN(valeur.substr(3,2)))||(isNaN(valeur.substr(6,2)))||(isNaN(valeur.substr(9,2)))||(isNaN(valeur.substr(12,2)))) return false;
	if((valeur.substr(2,1) !=" ") && (valeur.substr(5,1) !=" ") && (valeur.substr(8,1) !=" ") && (valeur.substr(11,1) !=" ")) return false;
	if ((valeur.charAt(0)!='0') || (valeur.charAt(1)<'1') ) return false;
	return true;
}