// www.pixele.fr //
url = "http://www.hourvari.com/";

/* DHTML */
function fadeIn(opacity){
	if (document.getElementById) {
		obj = document.getElementById('confirm');
		obj.style.display = "";
		if (opacity <= 100){
			setOpacity(opacity);
			opacity += 4;
			window.setTimeout("fadeIn("+opacity+")", 2);}
		}}

function fadeOut(opacity){
	if (document.getElementById) {
		obj = document.getElementById('confirm');
		if (opacity >= 0){
			setOpacity(opacity);
			opacity -= 4;
			window.setTimeout("fadeOut("+opacity+")", 2);}
		else{obj.style.display = "none";}
		}}

function setOpacity(opacity) {
	obj = document.getElementById('confirm');
	opacity = (opacity == 100)?99.999:opacity;
	obj.style.filter = "alpha(opacity="+opacity+")";
	obj.style.KHTMLOpacity = opacity/100;
	obj.style.MozOpacity = opacity/100;
	obj.style.opacity = opacity/100;
}


function sendData(data, page, action, cible){
	if(document.all){var XhrObj = new ActiveXObject("Microsoft.XMLHTTP");}else{var XhrObj = new XMLHttpRequest();}
	var content = document.getElementById(cible);
	if(data == 'null'){XhrObj.open("GET", page);}
	else{XhrObj.open("GET", page+"?"+data);}
	XhrObj.onreadystatechange = function(){if(XhrObj.readyState == 4 && XhrObj.status == 200){
		content.innerHTML = XhrObj.responseText;
		if(action == "confirm" ){
			fadeIn(0);
			}
		else if(action == "redir"){
			location.reload(); 
			}
	}}    
	XhrObj.send(null);
	}

function Cart(id){
		qte = document.add.v_qte.value;
		size = document.add.v_size.value;
		color = document.add.v_color.value;
		l = document.add.l.value;
		sendData("l="+l+"&v_art="+id+"&v_qte="+qte+"&v_size="+size+"&v_color="+color+"&increment=1", url+"inc/_panier.php" , "confirm","cart");
	}

function Upd(id,qte,size,color){
	sendData("v_art="+id+"&v_qte="+qte+"&v_size="+size+"&v_color="+color+"&display=no", url+"inc/_panier.php" , "redir","cart");
	}

function Del(id){
	sendData("del="+id+"&display=no", url+"inc/_panier.php" , "redir" , "cart");
	}

function sameadress(){
	document.f_adr.liv_nom.value = document.f_adr.nom.value;
	document.f_adr.liv_prenom.value = document.f_adr.prenom.value;
	document.f_adr.liv_civilite.selectedIndex = document.f_adr.civilite.selectedIndex;
	document.f_adr.liv_adresse.value = document.f_adr.adresse.value;
	document.f_adr.liv_adresse2.value = document.f_adr.adresse2.value;
	document.f_adr.liv_code_postal.value = document.f_adr.code_postal.value;
	document.f_adr.liv_ville.value = document.f_adr.ville.value;
	document.f_adr.liv_pays.selectedIndex = document.f_adr.pays.selectedIndex;
	document.f_adr.liv_tel.value = document.f_adr.tel.value;
	document.f_adr.liv_tel2.value = document.f_adr.tel2.value;
}

function lire(page){
	hauteur = screen.height - 80;	
	var w=window.open('cat_papier.php?page='+page,"catalogue_hourvari",'width=847 height='+hauteur+',top=200,left=525, scrollbars=yes, resizable=no');
    w.document.close();
    w.focus();
}

function OuvrirVisible(page,height,width,top,left) {
    var w=window.open(page+".php","pop1","width="+width+",height="+height+",top="+top+",left="+left+", scrollbars=yes, resizable=no");
    w.document.close();
    w.focus();
}

function listeproduits(page){
	window.opener.location.href= url+"extrait_catalogue/"+page;
	window.opener.focus();
}