<!--
function trim(str){
	return str.replace(/^\s+/, '').replace(/\s+$/, '');
}
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_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_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 MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function displayWindow(theURL,winName,width,height,features) {
    var window_width = width;
    var window_height = height;
    var newfeatures= features;
    var window_top = (screen.height-window_height)/2;
    var window_left = (screen.width-window_width)/2;
    newWindow=window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',' + newfeatures + '');
    newWindow.focus();
}
function emailCheck (emailStr) {
	var emailStr = emailStr.toLowerCase();
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
		alert("Adresse e-mail invalide.");
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			alert("Adresse e-mail invalide.");
			return false;
	   }
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			alert("Adresse e-mail invalide.");
			return false;
	   }
	}
	if (user.match(userPat)==null) {
		alert("Adresse e-mail invalide.");
		return false;
	}
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("Adresse e-mail invalide.");
				return false;
		   }
		}
		return true;
	}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			alert("Adresse e-mail invalide.");
			return false;
	   }
	}
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
		alert("Adresse e-mail invalide.");
		return false;
	}
	if (len<2) {
		alert("Adresse e-mail invalide.");
		return false;
	}
	return true;
}
function isAlpha( str ) {
	if (str+"" == "undefined" || str+"" == "null" || str+"" == ""){
		return false;
	}
	var isValid = true;
	str += ""; 
	for (i = 0; i < str.length; i++) {
		if ( !( ((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) || ((str.charAt(i) >= "A") && (str.charAt(i) <= "Z")) ) ) {
			alert("Merci de saisir des lettres (sans accent) pour rechercher un expert par nom,\nsinon contactez notre Numéro Vert au 0 800 397 378.\n");
			isValid = false;
			break;
		}
	} 
	return isValid;
} 
function isDate(d) {
	if (d == ""){
		return false;
	}
	e = new RegExp("^[0-9]{1,2}\/[0-9]{1,2}\/([0-9]{2}|[0-9]{4})$");
	if (!e.test(d)){
		return false;
	}
	j = parseInt(d.split("/")[0], 10); // jour
	m = parseInt(d.split("/")[1], 10); // mois
	a = parseInt(d.split("/")[2], 10); // année

	// Si l'année n'est composée que de 2 chiffres on complète automatiquement
	if (a < 1000) {
		if (a < 89)	a+=2000; // Si a < 89 alors on ajoute 2000 sinon on ajoute 1900
		else a+=1900;
	}

	// Définition du dernier jour de février
	// Année bissextile si annnée divisible par 4 et que ce n'est pas un siècle, ou bien si divisible par 400
	if (a%4 == 0 && a%100 !=0 || a%400 == 0) fev = 29;
	else fev = 28;

	// Nombre de jours pour chaque mois
	nbJours = new Array(31,fev,31,30,31,30,31,31,30,31,30,31);

	// Enfin, retourne vrai si le jour est bien entre 1 et le bon nombre de jours, idem pour les mois, sinon retourn faux
	return ( m >= 1 && m <=12 && j >= 1 && j <= nbJours[m-1] );
}

function checkLoginPro(){
	if(trim(document.loginProForm.login.value) == ""){
		alert("Vous devez saisir un identifiant");	
		return false;
	}else if(trim(document.loginProForm.pwd.value) == ""){
		alert("Vous devez saisir un mot de passe");
		return false;
	}else{
		return true;	
	}
}
function checkCP(leform){
	if(document[leform].code_postal.value.length < 5){
		alert ('Vous devez entrer un code postal composé de 5 chiffres.');
		return false;
	}else{
		var x=document[leform].code_postal.value
		var anum=/(^\d+$)|(^\d+\.\d+$)/
		if (anum.test(x) && x > 999 && x < 97500){
			testresult=true
		}else{
			alert("Vous devez entrer un code postal composé de 5 chiffres.\r (01000 à 97499)")
			testresult=false
		}
		return (testresult)
	}	
}

function format(valeur,decimal,separateur, money) {
	if(!money) money = "";
	// formate un chiffre avec 'decimal' chiffres après la virgule et un separateur
	var deci=Math.round( Math.pow(10,decimal)*(Math.abs(valeur)-Math.floor(Math.abs(valeur)))) ; 
	var val=Math.floor(Math.abs(valeur));
	if ((decimal==0)||(deci==Math.pow(10,decimal))) {val=Math.floor(Math.abs(valeur)); deci=0;}
	var val_format=val+"";
	var nb=val_format.length;
	for (var i=1;i<4;i++) {
		if (val>=Math.pow(10,(3*i))) {
			val_format=val_format.substring(0,nb-(3*i))+separateur+val_format.substring(nb-(3*i));
		}
	}
	if (decimal>0) {
		var decim=""; 
		for (var j=0;j<(decimal-deci.toString().length);j++) {decim+="0";}
		deci=decim+deci.toString();
		val_format=val_format+"."+deci;
	}
	if (parseFloat(valeur)<0) {val_format="-"+val_format;}
	return val_format + " " + money;
}

function check15ans(formulaire, champ1, champ2, etat){
	if(etat == "on"){
		document.getElementById([formulaire])[champ1][0].checked = true;
		document.getElementById([formulaire])[champ1][0].disabled = false;	
		document.getElementById([formulaire])[champ1][1].disabled = false;
		document.getElementById([formulaire])[champ2][0].checked = true;
		document.getElementById([formulaire])[champ2][0].disabled = false;	
		document.getElementById([formulaire])[champ2][1].disabled = false;	
	}else{
		document.getElementById([formulaire])[champ1][1].checked = true;
		document.getElementById([formulaire])[champ1][0].disabled = true;
		document.getElementById([formulaire])[champ1][1].disabled = true;
		document.getElementById([formulaire])[champ2][1].checked = true;
		document.getElementById([formulaire])[champ2][0].disabled = true;
		document.getElementById([formulaire])[champ2][1].disabled = true;
	}
}

// used by extranet
function checkTypeBesoin(){
	var sel = document.formOdmStep1.type_besoin.options[document.formOdmStep1.type_besoin.selectedIndex].value;
	if(sel == 2){
		$('sub-form').style.visibility = "hidden";
		$('datepc-transac').style.visibility = "hidden";
		$('datepc-locat').style.visibility = "visible";
	}else{
		$('sub-form').style.visibility = "visible";
		$('datepc-transac').style.visibility = "visible";
		$('datepc-locat').style.visibility = "hidden";
	}
}
function etoile(type_bien){
	if(type_bien == '1'){
		$('etage').innerHTML = "*";
	}else{
		$('etage').innerHTML = "";
	}
}
function fenetreCent(url,nom,largeur,hauteur,options) {
	var haut=(screen.height-hauteur)/2;
	var Gauche=(screen.width-largeur)/2;
	fencent=window.open(url,nom,"top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options);
}

//-->
