
//var nomDomaine = '81.25.194.33/abc-meubles/'
//var nomDomaine = 'pegase/abc-meubles/'
var nomDomaine = 'www.abc-meubles.com/'
var pathSite = 'http://' + nomDomaine
var pathImages = pathSite + 'fr/images/'
var pathImagesBoutique = pathSite + '/fr/boutique/meubles/images/'

function openPopup(theURL,winName,features) {
  var w=window.open(theURL,winName,features);
    w.document.close();
    w.focus();
}

function ZommPhoto(src,h,w){
	wPopup=window.open(src,'Zoom','left=5,top=5,height='+h+',width='+w+',location=no,scrollbars=auto,resizable=yes,menubar=no,status=no,toolbar=no')
	wPopup.focus();
}

function ConfirmeSuppression(str){
	var msg = false;
	msg = confirm('Supprimer définitivement '+str+' ?')
	if(msg==false){document.body.cursor='default';return false;}
	else{document.body.style.cursor='wait';return true;}
}

function RemplaceConfigurateur(c, ref){
	//c	= cas dans le fichier ajax
	//ref = choix fait avec le configurateur
	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;
	}	
	hrefAjax = pathSite+'asp/boutique/ajax.asp'
	xhr_object.open("POST", hrefAjax, false);  
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//alert('Choix=Front&Cas='+c+'&ref='+ref)	
//document.write(hrefAjax+'?'+'Choix=Front&Cas='+c+'&Ref='+ref)
	xhr_object.send('Choix=Front&Cas='+c+'&Ref='+ref);
	if(xhr_object.readyState == 4){
		var ListeAjax = xhr_object.responseText.split('/')
		var ListeAjax_0 = ListeAjax[0].split(',');	
		var ListeAjax_1 = ListeAjax[1];	

		//var ListeAjax = xhr_object.responseText.split(',')
 	}
	if(ListeAjax!=''){
		sc=""
		for(j=0;j<ListeAjax_0.length;j++){ 
			sc = sc + String.fromCharCode(ListeAjax_0[j])
		}		
		document.getElementById('produit').innerHTML = sc;
		document.forms.formulaire.elements.ProduitId.value = ListeAjax_1;		
	}
	else{
		alert('Ce produit n\a pas été créé')
	}
}
function RemplaceTableau(c, t, tab, nb){
	//c	= cas dans le fichier ajax
	//t	= liste qui declanche le changement
	//tab	= tableau
	//nb	= nb d'img
	tab.length = 0;	
	for(var i=0;i<nb;i++){
		document.images['phototheque_'+i].src =	pathImages +'clear.gif';	
	}
	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;
	}
	
	hrefAjax = pathSite+'asp/boutique/ajax.asp'
	
//alert(hrefAjax)	
	xhr_object.open("POST", hrefAjax, false);  
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//alert('Choix='+c+'&Cas='+t.name+'&id='+t.value)	
	xhr_object.send('Choix='+c+'&Cas='+t.name+'&id='+t.value);
	if(xhr_object.readyState == 4){
		var ListeAjax = xhr_object.responseText.split(',')

 	}
//alert(ListeAjax)
 	if(ListeAjax==''){
 		ListeAjax.length=1
 		ListeAjax[0]='f_remplacement.gif'
 	} 	
 	
	document.images.photoproduit.src = pathImagesBoutique + ListeAjax[0];
	tab.length = ListeAjax.length;
	for(var i=0;i<ListeAjax.length;i++){
		tab[i]=ListeAjax[i];
	}
	for(var i=0;i<nb;i++){
		if(i<ListeAjax.length){
			document.images['phototheque_'+i].src = pathImagesBoutique + ListeAjax[i];
		}
	}
}

