var ancien="";
var nbr_chambre_avant=1;
var nbr_chambre_avant_hot=1;
function getHTTPObject() {
	var xmlhttp;
	if (navigator.appName=="Microsoft Internet Explorer")
		var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		//il faut remplacer "Microsoft.XMLHTTP" par "Msxml2.XMLHTTP.5.0" pour eviter l'erreur system : 1072896748 
		//pour les actentuï¿½es : test rï¿½ussi est validï¿½		
	else 	
		var xmlhttp = new XMLHttpRequest();  

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
      } catch (e) {
      	xmlhttp = false;
      }
    }
  return xmlhttp;
}
var http = getHTTPObject();

var marked_row = new Array;

function setCheckboxColumn(theCheckbox){
    if (document.getElementById(theCheckbox)) {
        document.getElementById(theCheckbox).checked = (document.getElementById(theCheckbox).checked ? false : true);
        if (document.getElementById(theCheckbox + 'r')) {
            document.getElementById(theCheckbox + 'r').checked = document.getElementById(theCheckbox).checked;
        }
    } else {
        if (document.getElementById(theCheckbox + 'r')) {
            document.getElementById(theCheckbox + 'r').checked = (document.getElementById(theCheckbox +'r').checked ? false : true);
            if (document.getElementById(theCheckbox)) {
                document.getElementById(theCheckbox).checked = document.getElementById(theCheckbox + 'r').checked;
            }
        }
    }
}



function messages(champs,libelle){
	if (document.getElementById(champs).value==""){
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML="Le champs "+libelle+" ne doit pas être une chaine vide"
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}
}

function messages_panier(champs,message,textasli){
	if (document.getElementById(champs).value==""){
		document.getElementById('id_message_panier').innerHTML=message
		document.getElementById(champs).value=''
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_message_panier').innerHTML=textasli
		return true
	}
}

var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
function checkmail(champs,libelle){
	if ( !filter.test(document.getElementById(champs).value) ){
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML="L'adresse email du champ "+libelle+" n'est pas valide "
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}
}


function adad(champs,libelle){
	if (isNaN(document.getElementById(champs).value)){
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML="Le champs "+libelle+" n'est pas une valuer numï¿½rique !"
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}
}

function checkdate(champs,libelle){
	if(!isDate(document.getElementById(champs).value)  ) {
		document.getElementById('id_validation').style.visibility='visible'
		document.getElementById('id_validation').innerHTML="Le format de la "+libelle+" n'est pas valide (ex: 31-02-2007)"
		document.getElementById(champs).focus()
		return false
	}else{
		document.getElementById('id_validation').style.visibility='hidden'
		return true
	}
}

function changeImages(name,image) {
	document.images[name].src=image
}

function dato(date,sep){
	var elem = date.split(sep); 
	jour = elem[0]; 
	mois = elem[1]; 
	annee = elem[2]; 
	return annee+"/"+mois+"/"+jour
}

function isDate(d) {
	var reg=new RegExp("/", "g");
	d=d.replace(reg,"-")
	// Cette fonction permet de vï¿½rifier la validitï¿½ d'une date au format jj/mm/aa ou jj/mm/aaaa
	// Par Romuald
	
	if (d == "") // si la variable est vide on retourne faux
		return false;
	
	e = new RegExp("^[0-9]{1,2}\-[0-9]{1,2}\-([0-9]{2}|[0-9]{4})$");
	
	if (!e.test(d)) // On teste l'expression rï¿½guliï¿½re pour valider la forme de la date
		return false; // Si pas bon, retourne faux

	// On sï¿½pare la date en 3 variables pour vï¿½rification, parseInt() converti du texte en entier
	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 mailtooo(email,titre){
	chaine_mail = "mailto:"+email+"?subject=" + titre;      
	chaine_mail += "&body="; 
	chaine_mail += ""; location.href = chaine_mail;     
} 


function combo_text(champs){
	return document.getElementById(champs).options[document.getElementById(champs).selectedIndex].text	
}

function combo_remove(champs){
    var x=document.getElementById(champs)
    x.remove(x.selectedIndex)	
}

function chawaib(chaine){
	var chawa=new RegExp("'", "g");
	return chaine.replace(chawa,"\'")
}

function obj(objet){
	return document.getElementById(objet)
}

function cacher(objet){
	document.getElementById(objet).style.visibility='hidden';	
	document.getElementById(objet).style.display='none';
}
function montrer(objet){
	document.getElementById(objet).style.visibility='visible';	
	document.getElementById(objet).style.display='block';
}

function remplacer(chaine1,chaine2,champs){
	var reg=new RegExp(chaine1, "g");	
	return document.getElementById(champs).value.replace(reg,chaine2)
}

function cible(page){
	document.location=page
}



function imprime_zone(titre, zone) {
	// Dï¿½finie la zone ï¿½ imprimer
	var zi = document.getElementById(zone).innerHTML;
	// Ouvre une nouvelle fenetre
	var f = window.open("", "ZoneImpr", "height=500, width=600,toolbar=0, menubar=0, scrollbars=1, resizable=1,status=0, location=0, left=10, top=10");	
	// Ajoute les Donnï¿½es
	f.document.title = titre;
	f.document.body.innerHTML += " " + zi + "	";
	// Imprime et ferme la fenetre
	f.window.print();
	f.window.close();
	return true;
} 	

function popup(ref,pc,po,larg,haut,left,top) { 
	w=open("",'contenu','weigth=toolbar=no,scrollbars=no,resizable=no, width='+larg+', height='+haut+', left='+left+', top='+top+',scrollbars=1,res­izable=1'); 
	w.document.write("<HTML><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' /><link href='styles/styles.css' rel='stylesheet' type='text/css' /><head><script>"+

function popup_agrandir(ref,larg,haut,left,top) { 
	y=open("",'ok','weigth=toolbar=no,scrollbars=no,resizable=no, width='+larg+', height='+haut+', left='+left+', top='+top+',scrollbars=1,res­izable=1'); 
	y.document.write("<HTML><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' /><link href='styles/styles.css' rel='stylesheet' type='text/css' /><BODY topmargin='0px' bottommargin='0px' leftmargin='0px' rightmargin='0px' style='background:#fff'><img src='images/grandes/"+ref+".png' />"); 		
	y.document.write("</BODY></HTML>"); 
	y.document.close(); 
	
}+"</script></head><BODY topmargin='0px' bottommargin='0px' leftmargin='0px' rightmargin='0px' style='background:#fff' onblur=\"window.close();\"><table style='width:794px;' border=0 cellspacing=0 cellpadding=0><tr><td style='width:167px' valign=top><div class=article>Ref. : N&deg;	"+ref+"</div><div class=article onclick=\"popup_agrandir('"+ref+"',"+larg+","+haut+","+left+","+top+")\" style='cursor:pointer; margin-top:1px;font-size:13px' >Agrandir la photo</div></td><td style='width:460px' align=center><img onclick=\"popup_agrandir('"+ref+"',"+larg+","+haut+","+left+","+top+")\" src='images/article/"+ref+".png' style='border:8px solid #F9DBE7;cursor:pointer'/></td><td style='width:167px' valign=top><div class=article_inf>Poids collier : "+pc+" gr</div><div class=article_inf style='margin-top:1px'>Poids B.O : "+po+" gr</div></td></tr></table>"); 		
	w.document.write("</BODY></HTML>"); 
	w.document.close(); 
} 


function popup_pres(ref,larg,haut,left,top) { 
	y=open("",'amm','weigth=toolbar=no,scrollbars=no,resizable=no, width='+larg+', height='+haut+', left='+left+', top='+top+',scrollbars=1,res­izable=1'); 
	y.document.write("<HTML><meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1' /><link href='styles/styles.css' rel='stylesheet' type='text/css' /><BODY topmargin='0px' bottommargin='0px' leftmargin='0px' rightmargin='0px' style='background:#fff'><img src='images/presentoire/"+ref+".jpg' />"); 		
	y.document.write("</BODY></HTML>"); 
	y.document.close(); 
}
// JavaScript Document
