function EnvoieAsofinco(){
bar= textecomptant[document.getElementById("dim").value];
foo = bar.indexOf('&',0)
bar = bar.substring(0,foo);
foo = 'https://financement.transcred.com/sofgate.asp?q6=020L74&p0=PRODUIT&p4=' + bar ;
foo = "window.open('" + foo +"')";
eval(foo);
}


function mailclient(){
foo = window.location.href;
theURL = 'contact_ami.php?action=1&add=' + foo ;

winName = 'Ami';
features =  'width=415,height=505';
window.open(theURL,winName,features);
} 

function affichage(){
if(typeof affiche == 'undefined' ){ 
affiche="non";
} 
lediv=document.getElementById("suite");
if(affiche=="non"){
affiche="oui";
lediv.style.visibility="visible";
}
else{ 
affiche="non"; 
lediv.style.visibility="hidden";
}
}

function affichage2(){
// alert(typeof affiche);
if(typeof affiche == 'undefined' ){ 
// alert('Variable affiche indéfinie'); 
affiche="non";
} 
lediv=document.getElementById("livraison");
// alert('lediv=' + lediv.style.visibility);
if(affiche=="non"){
affiche="oui";
lediv.style.visibility="visible";
}
else{ 
affiche="non"; 
lediv.style.visibility="hidden";
}
}


function Pop(url, nom, larg, haut) {
	var midWidth=(((window.top.screen.width)/2)-larg/2);
	var midHeight=(((window.top.screen.height)/2)-haut/2);
	var win_param=("left=" + midWidth + ",top=" + midHeight +",toolbar=no,location=no,directories=no,status=yes,alwaysRaised=yes,dependant=no,menubar=no,scrollbars=yes,resizable=yes,width=" + larg + ",height=" + haut + "");
	window.open(url, nom, win_param);
}
function DivStatus(nom){
	var divID = nom;
	if ( document.getElementById && document.getElementById( divID ) ) {
		Pdiv = document.getElementById( divID );
		PcH = true;
	}
	else if ( document.all && document.all[ divID ] ){
			Pdiv = document.all[ divID ];
			PcH = true;
	}
	else if ( document.layers && document.layers[ divID ] ){
			Pdiv = document.layers[ divID ];
			PcH = true;
	}
	else {
		PcH = false;
	}
	if ( PcH ){
		Pdiv.className = ( Pdiv.className == 'cachediv' ) ? 'montrediv' : 'cachediv';
	}
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

userAgent = window.navigator.userAgent;
browserVers = parseInt(userAgent.charAt(userAgent.indexOf("/")+1),10);
mustInitImg = true;

function initImgID() {
	di = document.images; 
	if (mustInitImg && di) { 
		for (var i=0; i<di.length; i++) { 
			if (!di[i].id) di[i].id=di[i].name; 
		} 
		mustInitImg = false;
	}
}

function findElement(n,ly) {
	d = document;
	if (browserVers < 4)
		return d[n];
	if ((browserVers >= 6) && (d.getElementById)) {
		initImgID; 
		return(d.getElementById(n))
	}; 
	var cd = ly ? ly.document : d;
	var elem = cd[n];
	if (!elem) {
		for (var i=0;i<cd.layers.length;i++) {
			elem = findElement(n,cd.layers[i]);
			if (elem) return elem;
		}
	}
	return elem;
}

function changeImages() {
	d = document;
	if (d.images) {
		var img;
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			img = null;
			if (d.layers) {img = findElement(changeImages.arguments[i],0);}
			else {img = d.images[changeImages.arguments[i]];}
			if (img) {img.src = changeImages.arguments[i+1];}
		}
	}
}

var preloadFlag = false;
var check = new Array();

function preloadImages() {
	if (document.images) {
		over_literie = newImage(/*URL*/'imgs/interface/b_literie_on.gif');
		over_salon = newImage(/*URL*/'imgs/interface/b_salon_on.gif');
		over_access = newImage(/*URL*/'imgs/interface/b_access_on.gif');
		over_affair = newImage(/*URL*/'imgs/interface/b_affair_on.gif');
		over_magasins = newImage(/*URL*/'imgs/interface/b_magasins_on.gif');
		over_conv = newImage(/*URL*/'imgs/interface/b_conv_on.gif');
		over_destock = newImage(/*URL*/'imgs/interface/b_destok_on.gif');
		over_panier = newImage(/*URL*/'imgs/interface/b_panier_on.gif');
		preloadFlag = true;
	}
}

function popupcentree(page,largeur,hauteur,options){
	var top=(screen.height-hauteur)/2;
	var left=(screen.width-largeur)/2;
	window.open(page,"Meuble","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}



function comparatif(soustype,sousmenu) { 
	var coche;
	var adresse;
	var cpt;
	coche="";
	cpt = 0;
	
	for (i=0; i<check.length; i++){
		if (document.getElementById(check[i]).checked){
			if (cpt >0) {
				coche=coche+",";
			}
			cpt=1;
			coche=coche+document.getElementById(check[i]).value;
		}
	}
	if (coche!=""){
		window.open("comparatif-literie.php?id="+coche+"&soustype="+soustype+"&sousmenu="+sousmenu,"popup","top=0,left=0,width=800,height=430,menubar=no,scrollbars=yes,statusbar=yes,resizable=yes");
	}
}


function voirproduit(lien){
	window.opener.location.href = lien; 
}

var idBulleT;
var chrono = null;
var delai = "500";
 
function afficheBulle(idBulle, parent)
{
  var bulle = document.getElementById(idBulle);
  var offset;
  var exp = new RegExp("^td_","gi");
 
  if (chrono!=null)
  {
     clearTimeout(chrono);
     cacheBulleT();
  }
 bulle.style.left = 200+"px"; 
  bulle.style.display = "block";
//  alert('top= ' + bulle.offsetTop);
/*apparemment on entre pas ds le if ci-dessous donc force affichage de la bulle gauche 200 px en bas  */
  if (exp.test(idBulle)==false)
  {
    if (parent.offsetLeft-bulle.offsetWidth<0)
       offset = 0;
    else
       offset = -bulle.offsetWidth;
  
    bulle.style.left = parent.offsetLeft+offset+"px"; 

  }
  
  
  // test pour livraison
  if (idBulle=="td_bulle9") {
  if(typeof affichebullelivraison == 'undefined' ){ 
// alert('Variable affiche indéfinie'); 
affichebullelivraison=1;			// deja affiche
  
  var bulle2 = document.getElementById('td_bulle9');
  var foo =  bulle2.offsetTop ;
  foo = foo -100;
  bulle2.style.top = foo ;

}  
  }
  
}
 
function cacheBulleT()
{
  document.getElementById(idBulleT).style.display = "none";
  chrono = null;
}
 
function cacheBulle(idBulle)
{
  idBulleT = idBulle;
  chrono = setTimeout("cacheBulleT()",delai);
 
  //document.getElementById(idBulle).style.display = "none";
}
 
function mouseOverBulle()
{
  clearTimeout(chrono);
  chrono = null;
}
 
function mouseOutBulle()
{
   chrono = setTimeout("cacheBulleT()",delai);
}
 


