function GetCommune(siteurl,pays,cm,cp){var xhr_object=null;if(window.XMLHttpRequest)
xhr_object=new XMLHttpRequest();else if(window.ActiveXObject)
xhr_object=new ActiveXObject("Microsoft.XMLHTTP");else{alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");return;}
xhr_object.open("GET",siteurl+"inc/ajax_communes.php?pays="+pays+"&cm="+cm+"&cp="+cp,true);xhr_object.onreadystatechange=function(){var leConteneur=document.getElementById('listereference');if(xhr_object.readyState==4){if(xhr_object.status==200){leConteneur.innerHTML=xhr_object.responseText;}}else if(xhr_object.readyState==3){leConteneur.innerHTML="....";}}
xhr_object.send(null);}
function GetCommune2(siteurl,pays,cm,cp){var xhr_object2=null;if(window.XMLHttpRequest)
xhr_object2=new XMLHttpRequest();else if(window.ActiveXObject)
xhr_object2=new ActiveXObject("Microsoft.XMLHTTP");else{alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");return;}
xhr_object2.open("GET",siteurl+"inc/ajax_communes.php?type=l&pays="+pays+"&cm="+cm+"&cp="+cp,true);xhr_object2.onreadystatechange=function(){var leConteneur2=document.getElementById('listereference2');if(xhr_object2.readyState==4){if(xhr_object2.status==200){leConteneur2.innerHTML=xhr_object2.responseText;}}else if(xhr_object2.readyState==3){leConteneur2.innerHTML="....";}}
xhr_object2.send(null);}
function GetSSProd(siteurl,reference,dur){var xhr_object=null;if(window.XMLHttpRequest)
xhr_object=new XMLHttpRequest();else if(window.ActiveXObject)
xhr_object=new ActiveXObject("Microsoft.XMLHTTP");else{alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");return;}
data="reference="+reference+"&dur="+dur;xhr_object.open("POST",siteurl+"inc/ajax_ss_prod.php",true);xhr_object.onreadystatechange=function(){if(xhr_object.readyState==4){var leConteneur=document.getElementById('ssprod');leConteneur.innerHTML=xhr_object.responseText;}}
xhr_object.setRequestHeader("Content-type","application/x-www-form-urlencoded");xhr_object.send(data);}
function gotofunc(url)
{location=url;}
function openWindow(name,width,height,url){win=window.open(url,name,"toolbar=0,location=0,top=0,left=0,status=0,menubar=0,scrollbars=0,resizable=1,width="+width+",height="+height);win.moveTo(screen.width/2-(width/2),screen.height/2-(height/2));win.screenX=screen.width/2-(width/2);win.screenY=screen.height/2-(height/2);}
function openWindow2(name,width,height,url){win=window.open(url,name,"toolbar=0,location=0,top=0,left=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+width+",height="+height);win.moveTo(screen.width/2-(width/2),screen.height/2-(height/2));win.screenX=screen.width/2-(width/2);win.screenY=screen.height/2-(height/2);}
function montre(id){var d=document.getElementById(id);if(d){tp=d.style.display;if(tp=='none'){d.style.display='block';}else{d.style.display='none';}}}
function ChangeOnglet(id,url){var temp='img_pack_'+id;var ima=document.getElementById(temp);var d=document.getElementById(id);if(d){tp=d.style.display;if(tp=='none'){ima.src=url+'_close.gif';}else{ima.src=url+'_open.gif';}}}
function ChangePrix2(prix){document.getElementById('price').innerHTML=FormatCurrency(prix);}
function ChangePrixPublic(prix){if(prix>0)
document.getElementById('prix_public').innerHTML='<br />(Prix public '+FormatCurrency(prix)+'&euro;)';else
document.getElementById('prix_public').innerHTML='';}
function FormatCurrency(FIGURE){if(!FIGURE||FIGURE==""){FIGURE="0.00";}
var strTemp=FIGURE.toString();while(strTemp.indexOf(",")>-1){strTemp=strTemp.replace(",","");}
strTemp=parseFloat(strTemp);FIGURE=FIGURE.toString();var Place=FIGURE.indexOf(".");if(Place>-1){if((FIGURE.length-Place)==2){FIGURE+="0";}}
else{FIGURE+=".00";}
return FIGURE;}
function ConfirmDelete(id,url){urlto=url+'?delref='+id;if(confirm("Etes-vous sur?"))gotofunc(urlto);}
function CommuteAffichage(Bloc_visible){if(Bloc_visible==0)
{document.getElementById("bloc_AdresseLivraison").style.display="none";}
else
{document.getElementById("bloc_AdresseLivraison").style.display="block";}}
function chgphoto(url){document.getElementById("photoref").src=url;}
function EcrireCoul(res)
{window.document.getElementById('col').value=res;window.document.getElementById('field').value=res;}
function MM_openBrWindow(theURL,winName,features,Twidth,Theight){features2='status=no,resizable=no,scrollbars=no,width=800,height=600';features+=',width='+Twidth+',height='+Theight;if(window.screen){var left=(screen.width-Twidth)/2;var heigth=(screen.height-Theight)/2;features+=',left='+left+',top='+heigth;}
window.open(theURL,winName,features);}
function GetSommiers(siteurl,search,ref){var leConteneur=document.getElementById('packsommiers');if(leConteneur){leConteneur.innerHTML='<img src="/images/barreprog.gif" alt="" />';var xhr_object=null;if(window.XMLHttpRequest)
xhr_object=new XMLHttpRequest();else if(window.ActiveXObject)
xhr_object=new ActiveXObject("Microsoft.XMLHTTP");else{alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");return;}
xhr_object.open("GET",siteurl+"inc/inc_ficheproduit_pack_ajax.php?ref="+ref+"&src="+search,true);xhr_object.onreadystatechange=function(){if(xhr_object.readyState==4){var leConteneur=document.getElementById('packsommiers');leConteneur.innerHTML=xhr_object.responseText;}}
xhr_object.send(null);}}
function DeChecked(n){for(i=0;i<6;i=i+1){conteneur='addsommier_'+i;Chckbox=document.getElementById(conteneur);if(i!=n&&Chckbox)Chckbox.checked=false;}}

var ie5 = (document.getElementById && document.all);
var ns6 = (!document.all && document.getElementById);

function openProd(id){
	if(ie5 || ns6){
		dragWind = document.getElementById('prod_1');
		if(id==1){
			dragWind.style.visibility = "visible";
			document.getElementById('prod_onglet_d').style.backgroundImage = 'url("/images/prod_onglet_d.gif")';
		}else{
			dragWind.style.visibility = "hidden";
			document.getElementById('prod_onglet_d').style.backgroundImage = 'url("/images/prod_onglet_d_2.gif")';
		}
		dragWind = document.getElementById('prod_2');
		if(id==2){
			dragWind.style.visibility = "visible";
			document.getElementById('prod_onglet_c').style.backgroundImage = 'url("/images/prod_onglet_c.gif")';
		}else{
			dragWind.style.visibility = "hidden";
			if(document.getElementById('prod_onglet_c')) document.getElementById('prod_onglet_c').style.backgroundImage = 'url("/images/prod_onglet_c_2.gif")';
		}
		dragWind = document.getElementById('prod_3');
		if(id==3){
			dragWind.style.visibility = "visible";
			document.getElementById('prod_onglet_a').style.backgroundImage = 'url("/images/prod_onglet_a.gif")';
		}else{
			dragWind.style.visibility = "hidden";
			document.getElementById('prod_onglet_a').style.backgroundImage = 'url("/images/prod_onglet_a_2.gif")';
		}
		dragWind = document.getElementById('prod_4');
		if(id==4){
			dragWind.style.visibility = "visible";
			document.getElementById('prod_onglet_e').style.backgroundImage = 'url("/images/prod_onglet_e.gif")';
		}else{
			dragWind.style.visibility = "hidden";
			document.getElementById('prod_onglet_e').style.backgroundImage = 'url("/images/prod_onglet_e_2.gif")';
		}
	}
}
function openOngl(id){
	if(ie5 || ns6){
		dragWind = document.getElementById('prod_1');
		if(id==1){
			dragWind.style.visibility = "visible";
			document.getElementById('lex_onglet_a').style.backgroundImage = 'url("/images/lex_01.gif")';
		}else{
			dragWind.style.visibility = "hidden";
			document.getElementById('lex_onglet_a').style.backgroundImage = 'url("/images/lex_01_2.gif")';
		}
		dragWind = document.getElementById('prod_2');
		if(id==2){
			dragWind.style.visibility = "visible";
			document.getElementById('lex_onglet_b').style.backgroundImage = 'url("/images/lex_02_2.gif")';
		}else{
			dragWind.style.visibility = "hidden";
			if(document.getElementById('lex_onglet_b')) document.getElementById('lex_onglet_b').style.backgroundImage = 'url("/images/lex_02.gif")';
		}
		dragWind = document.getElementById('prod_3');
	}
}


function Compare(siteurl,ref){
//alert(ref);
	var chk = document.getElementById('comp_'+ref);
	if(chk){
		if(chk.checked) chk.checked=0;
		else chk.checked=1;
	}
	var leConteneur=document.getElementById('compare');
	var xhr_object = null;
	var search = "";
	leConteneur.innerHTML='<img src="/images/catprog.gif" width="800" height="46" alt="" />';
	leConteneur.style.visibility="visible";
	if(window.XMLHttpRequest) // Firefox
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	return;
	}
	search = search + 'reference=' + ref;
//	alert(siteurl+"inc/inc_compare.php?"+search);
	xhr_object.open("GET", siteurl+"inc/inc_compare.php?"+search, true);
		xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4){
			leConteneur.innerHTML=xhr_object.responseText;
		}
	}
	xhr_object.send(null);
	
	array_page_size = getPageSize();
	array_page_scroll = getPageScroll();
	leConteneur.style.top = array_page_scroll[1]+margin_top+'px';
	if((parseInt(leConteneur.style.width)/2))
		leConteneur.style.left = array_page_size[0]/2-(parseInt(leConteneur.style.width)/2)+'px';
	else
		leConteneur.style.left = margin_left+'px';
}
function closecompare(){
	var leConteneur=document.getElementById('compare');
	leConteneur.style.visibility="hidden";
}
