if (typeof width == 'undefined') { var width="200";} // largeur de la bulle
if (typeof height == 'undefined') { var height="250";} // hauteur de la bulle
if (typeof offsetx == 'undefined') { var offsetx=15;} // distance verticale du curseur
if (typeof offsety == 'undefined') { var offsety=15;} // distance horizontale du curseur

test = 0
//ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
//alert(document.getElementById('InfoBulle'));
ns4 = (document.getElementById&&!document.all)? true:false
//alert("ns:" + ns4)
if (ie4) {
//  test=navigator.userAgent.indexOf('MSIE 6');
  if (navigator.userAgent.indexOf('MSIE 5')>0) {
    ie5 = true;
  } else {
    ie5 = false;}
} else {
  ie5 = false;
}

if (navigator.appVersion.indexOf("MSIE")==17) {
  ie5=true;
  test = 1;
}

var x=0;
var y=0;
var snow=0;
var snow2=0;
var sw=0;
var cnt=0;

var height_tab;
if ( (ns4) || (ie4) ) {
  if (ns4) over = document.getElementById('InfoBulle')
  if (ie4) over = document.getElementById('InfoBulle').style
  document.onmousemove = mouseMove
  if (ns4) document.captureEvents(Event.MOUSEMOVE)
}

function nd() {
  if ( cnt >= 1 ) { sw = 0 };
  if ( (ns4) || (ie4) ) {
    if ( sw == 0 ) {
      snow=0;
      hideObject(over);
    } else {cnt++;}
}}
function formate_text(texte){
	if(texte.substring(0,7)=='REF~SPL'){
		if(texte.indexOf('<hr><font size= 2')!=-1){
			var fin_txt=texte.indexOf('<hr><font size= 2');// suite string:><b>Spécifications:
		}
		else{
			var fin_txt=texte.length;
		}
		texte="<table><tr><td><div><table><tr><td>"+texte.substring(7,fin_txt) + " <font color='#9966FF'>Pour plus de détails, voir fiche technique...</font></td></tr></table>";
		var reg=new RegExp("width= 450" , "g");
		var reg2=new RegExp("width='450'" , "g");
		texte=texte.replace(reg,"");
		texte=texte.replace(reg2,"");
	}
	
return texte;
}

function drc(logo_fichier, title, text, existe_image, path_image,width_img,height_img) {
	var color_title = "#FFFFFF";
	var bgColor_title="#61809F";
	var borderColor_title="#264E75";
	var borderColor_text="#264E75";
	var color_text = "#4F4F4F";
	var bgColor_text="#FFFFFF";
	//var bgColor_text="#BCCCDC";
	if(logo_fichier!=''){
		var logo_pdf="<hr><i>Voir aussi la documentation jointe.</i>&nbsp;&nbsp;&nbsp;&nbsp;<img src='" + logo_fichier + "' style='height:12;width:12;' border='0'>";
	}
	else{
		var logo_pdf='';
	}
	text=formate_text(text);
if (existe_image==1) { //le titre est une image
	txt = "<TABLE WIDTH='250' BORDER='0' CELLPADDING='1' CELLSPACING='0' BGCOLOR='#666666'><TR><TD><TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='0' BGCOLOR='" + bgColor_title + "'><TR><TD style='border: " + borderColor_title + " 1px solid;padding-left:1;padding-right:1;padding-top:2;padding-bottom:2;'><SPAN ID='BASIC'><FONT COLOR='" + color_title + "' >"+title+"</FONT></SPAN></TD></TR></TABLE><TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='0' BGCOLOR='" + bgColor_text + "'><TR><TD style='border-bottom: " + borderColor_text + " 1px solid;border-right: " + borderColor_text + " 1px solid;border-left: " + borderColor_text + " 1px solid;padding-top:5;padding-left:3;padding-right:2;'><SPAN ID='BASIC'><img src='"+path_image+"' align='left' border='0' style='border-color:#61809F;' width='" + width_img + "' height='" + height_img + "'><FONT COLOR='" + color_text + "' SIZE='1'>" + text + logo_pdf + "</FONT></SPAN></TD></TR></TABLE></TD></TR></TABLE>";
}
else {
	txt = "<TABLE WIDTH='250' BORDER='0' CELLPADDING='1' CELLSPACING='0' BGCOLOR='#666666'><TR><TD><TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='0' BGCOLOR='" + bgColor_title + "'><TR><TD style='border: " + borderColor_title + " 1px solid;padding-left:1;padding-right:1;padding-top:2;padding-bottom:2;'><SPAN ID='BASIC'><FONT COLOR='" + color_title + "' >"+title+"</FONT></SPAN></TD></TR></TABLE><TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='0' BGCOLOR='" + bgColor_text + "'><TR><TD style='border-bottom: " + borderColor_text + " 1px solid;border-right: " + borderColor_text + " 1px solid;border-left: " + borderColor_text + " 1px solid;padding-top:5;padding-left:3;padding-right:2;'><SPAN ID='BASIC'><FONT COLOR='" + color_text + "' SIZE='1'>" + text + logo_pdf + "</FONT></SPAN></TD></TR></TABLE></TD></TR></TABLE>";
}
layerWrite(txt);
disp();
}
function drc_arbo(color, title, code_article, titre, famille,sous_famille,path_img) {
	var color_title = "#FFFFFF";
	var bgColor_title="#FFFFFF";
	var borderColor_title="#FFFFFF";
	var borderColor_text=color;
	var color_text = "#FFFFFF";
	var bgColor_text="#FFFFFF";
	//var bgColor_text="#BCCCDC";

var img_famille=path_img +"famille_0_dir.gif";
var img_code=path_img +"code_dir_1.gif";
var format_sous_famille="";
if(sous_famille!=""){
	img_famille=path_img +"famille_1_dir.gif";
	format_sous_famille="<table><tr><td><img src='" + path_img +"sous_famille_dir.gif'></td><td style='vertical-align:bottom;padding-left:2;padding-right:4'>" + sous_famille + "</td></tr></table>";
	img_code=path_img +"code_dir.gif";
}
	var format_titre="<table><tr><td><img src='" + path_img +"titre_dir.gif'></td><td style='vertical-align:bottom;padding-left:2;padding-right:4'>" + titre + "</td></tr></table>";
	var format_famille="<table><tr><td><img src='" + img_famille +"'></td><td style='vertical-align:bottom;padding-left:2;padding-right:4'>" + famille + "</td></tr></table>";
	var format_code_article="<table><tr><td><img src='" + img_code +"'></td><td style='vertical-align:bottom;padding-left:2;padding-right:4'><font color='#000080' size='1'>" + code_article + "</font></td></tr></table>";
	
	var texte="<table><tr><td>" + format_titre + "</td></tr><tr><td>" + format_famille + "</td></tr><tr><td>" + format_sous_famille + "</td></tr><tr><td>" + format_code_article + "</td></tr></table>";
	txt = "<TABLE BORDER='0' CELLPADDING='0' CELLSPACING='0' BGCOLOR='" + bgColor_title + "'><TR><TD><SPAN ID='BASIC'><FONT COLOR='" + color_title + "' ><img src='"+title+"'></FONT></SPAN></TD></TR></TABLE><TABLE BORDER='0' CELLPADDING='0' CELLSPACING='0' BGCOLOR='" + bgColor_text + "'><TR><TD style='border: " + borderColor_text + " 1px solid;padding-left:1;padding-right:1;padding-top:2;padding-bottom:2;'><SPAN ID='BASIC'><FONT COLOR='" + color_text + "' SIZE='1'>" + texte + "</FONT></SPAN></TD></TR></TABLE>";

layerWrite(txt);
disp();
}

function drc_increment(texte) {
	var color_title = "#000000";
	var bgColor_title="#FFFFDD";
	var borderColor_title="#000000";

	txt = "<TABLE BORDER='0' CELLPADDING='0' CELLSPACING='0' BGCOLOR='" + bgColor_title + "'><TR><TD style='border: 1px solid #000000;padding:2'><SPAN ID='BASIC'><FONT COLOR='" + color_title + "' SIZE='1' >" + texte + "</FONT></SPAN></TD></TR></TABLE>";
layerWrite(txt);
disp();

}

function disp() {
  if ( (ns4) || (ie4) ) {
 		if(x > 30 && y > 30){ 	
    	if (snow == 0) {
	  		moveTo(over,x+offsetx,y+offsety);
      	showObject(over);
      	snow=1;
			}
		}	
	}
}


function mouseMove(e) {
if(top_ten==0){

  if (ns4) {x=e.pageX; y=e.pageY;}
  if (ie4) {x=event.x; y=event.y;}
  if (ie5) {
  	x=event.x+document.body.scrollLeft;
	y=event.y+document.body.scrollTop;
  	test=1;
  }
  if (snow) {moveTo(over,x+offsetx,y+offsety);}
}
else{
	mouseMove_tt;
}
}

function cClick() {
  hideObject(over);
  sw=0;
}

function layerWrite(txt) {
  if (ns4) {
    var lyr = document.getElementById('InfoBulle')
    lyr.innerHTML = txt
  } else if (ie4) document.all["InfoBulle"].innerHTML = txt
}

function showObject(obj) {
	//alert(obj.visibility);
  if (ns4) obj.visibility = "visible"
  else if (ie4) obj.visibility = "visible"
}

function hideObject(obj) {
  if (ns4) obj.visibility = "hidden"
  if (ns4) {
    var lyr = document.getElementById('InfoBulle')
    lyr.innerHTML = ""
  }
  else if (ie4) obj.visibility = "hidden"
}

function moveTo(obj,xL,yL) {
	if(ns4){
	obj.style.top= yL;
	obj.style.left= xL;
}
else{
  obj.left = xL
  obj.top = yL
}
}

//infobulle top-ten
function drc_tt(title, text, existe_image, path_image, position, width_img,height_img) {
	var bgCcolor_tt="#264E75";
	var color_title = "#FFFFFF";
	var bgColor_title="#61809F";
	var borderColor_tt="#264E75";
	var borderColor_title="#61809F";
	//var borderColor_text="#61809F";
	var color_text = "#4F4F4F";
	//var bgColor_text="#BCCCDC";
	text=formate_text(text);
	if(text.length<=250){height_tab=125;}
	if((text.length>250)&&(text.length<=460)){height_tab=200;}
	if(text.length>460){height_tab=300;}
	if(text.length>600){text=(text.substring(0,600)+"<b>...</b>");}
if (existe_image==1) { //le titre est une image
	txt = "<TABLE WIDTH='250' BORDER='0' CELLPADDING='1' CELLSPACING='0' BGCOLOR='#666666' style='border: 1px solid " + borderColor_tt + ";'><TR><TD><table width='100%' bgcolor='" + bgCcolor_tt + "'><tr><td align='center'><font color='#FFFFFF' size='2' face='Arial'>N° " + position + " au Top 10 de la semaine</font></td></tr></table><TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='1' bgcolor='" + bgColor_title + "'><TR><TD align='center' style='border:" + borderColor_title + " 1px solid;'><SPAN ID='BASIC'><FONT SIZE='1' COLOR='" + color_title + "' ><small>"+title+"</small></FONT></SPAN></TD></TR></TABLE><TABLE WIDTH='100%' HEIGHT='"+height_tab+"' BORDER='0' CELLPADDING='0' CELLSPACING='1' BGCOLOR='#FFFFFF'><TR><TD><SPAN ID='BASIC'><img src='"+path_image+"' align='left' border='0' width='" + width_img + "' height='" + height_img + "'><FONT COLOR='" + color_text + "' SIZE='1'>"+text+"</FONT></SPAN></TD></TR></TABLE></TD></TR></TABLE>";
}
else {
	txt = "<TABLE WIDTH='250' BORDER='0' CELLPADDING='1' CELLSPACING='0' BGCOLOR='#666666' style='border: 1px solid " + borderColor_tt + ";'><TR><TD><table width='100%' bgcolor='" + bgCcolor_tt + "'><tr><td align='center'><font color='#FFFFFF' size='2' face='Arial'>N° " + position + " au Top 10 de la semaine</font></td></tr></table><TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='1' BGCOLOR='" + bgColor_title + "'><TR><TD align='center' style='border:" + borderColor_title + " 1px solid;'><SPAN ID='BASIC'><FONT SIZE='1' COLOR='" + color_title + "' ><small>"+title+"</small></FONT></SPAN></TD></TR></TABLE><TABLE WIDTH='100%' HEIGHT='"+height_tab+"' BORDER='0' CELLPADDING='0' CELLSPACING='1' BGCOLOR='#FFFFFF'><TR><TD><SPAN ID='BASIC'><FONT COLOR='" + color_text + "' SIZE='1'>"+text+"</FONT></SPAN></TD></TR></TABLE></TD></TR></TABLE>";
}

layerWrite(txt);
disp_tt();
}

function disp_tt() {
  if ( (ns4) || (ie4) ) {
    if (snow == 0) {
    	
	//  moveTo(over,x+offsetx,y+offsety);
     // showObject(over);
     // snow=1;
      
      var ecran_haut=window.document.body.scrollTop+window.document.body.clientHeight;
      var ecran_larg=window.document.body.scrollLeft+window.document.body.clientWidth;
      //var bul_haut=document.getElementById("InfoBulle").style.top;
      //var bul_bas=parseInt(bul_haut.substring(0,bul_haut.length-2))+100;}
      //var bul_gauche=document.getElementById("InfoBulle").style.left;
      //var bul_droit=parseInt(bul_gauche.substring(0,bul_gauche.length-2))+250;

//var posx=x+offsetx;
var posy=y+offsety;
//var posx=700;
//if(bul_bas>=ecran_haut){posy=ecran_haut-100;}
//if(bul_droit>=ecran_larg){posx=ecran_larg-255;}

//if((x+265)>=ecran_larg){posx=x-265;}

if(height_tab==125){
	if((y+150)>=ecran_haut){posy=ecran_haut-150;}
}
if(height_tab==200){
	if((y+225)>=ecran_haut){posy=ecran_haut-225;}
}
if(height_tab==300){
	if((y+340)>=ecran_haut){posy=ecran_haut-340;}
}
var posx=560;
  	moveTo(over,posx,posy);
      
       // moveTo(over,x+offsetx,y+offsety);
	
	showObject(over);
      snow=1;
      //alert("ecran: " + ecran_haut + " -haut: "+ haut + "\necran: " + ecran_larg + " -gauche: " + gauche);

}}}

function mouseMove_tt(e) {
	
  if (ns4) {x=e.pageX; y=e.pageY;}
  if (ie4) {x=event.x; y=event.y;}
  if (ie5) {
  	x=event.x+document.body.scrollLeft;
	y=event.y+document.body.scrollTop;
	
  	test=1;
  }
  if (snow) {
      var ecran_haut=window.document.body.scrollTop+window.document.body.clientHeight;
      var ecran_larg=window.document.body.scrollLeft+window.document.body.clientWidth;
      //var bul_haut=document.getElementById("InfoBulle").style.top;
      //var bul_bas=parseInt(bul_haut.substring(0,bul_haut.length-2))+100;
      //var bul_gauche=document.getElementById("InfoBulle").style.left;
      //var bul_droit=parseInt(bul_gauche.substring(0,bul_gauche.length-2))+250;

var posx=x+offsetx;
var posy=y+offsety;
//if(bul_bas>=ecran_haut){posy=ecran_haut-100;}
//if(bul_droit>=ecran_larg){posx=ecran_larg-255;}
if((x+265)>=ecran_larg){posx=x-265;}

if(height_tab==125){
	if((y+150)>=ecran_haut){posy=ecran_haut-150;}
}
if(height_tab==200){
	if((y+225)>=ecran_haut){posy=ecran_haut-225;}
}
if(height_tab==300){
	if((y+340)>=ecran_haut){posy=ecran_haut-340;}
}
  	moveTo(over,posx,posy);

  }
}

//------------------------------------------------------------------
// infobulle pour le SAV
function drc_sav(title, text, existe_image, path_image, num_rma_main, width_img,height_img) {
	var bgCcolor_tt="#264E75";
	var color_title = "#FFFFFF";
	var bgColor_title="#61809F";
	var borderColor_tt="#264E75";
	var borderColor_title="#61809F";
	//var borderColor_text="#61809F";
	var color_text = "#4F4F4F";
	//var bgColor_text="#BCCCDC";
	text=formate_text(text);
	if(text.length<=250){height_tab=125;}
	if((text.length>250)&&(text.length<=460)){height_tab=200;}
	if(text.length>460){height_tab=300;}
	if(text.length>600){text=(text.substring(0,600)+"<b>...</b>");}
/*
if (existe_image==1) { //le titre est une image
	txt = "<TABLE WIDTH='250' BORDER='0' CELLPADDING='1' CELLSPACING='0' BGCOLOR='#666666' style='border: 1px solid " + borderColor_tt + ";'><TR><TD><table width='100%' bgcolor='" + bgCcolor_tt + "'><tr><td align='center'><font color='#FFFFFF' size='2' face='Arial'>" + num_rma_main + "</font></td></tr></table><TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='1' bgcolor='" + bgColor_title + "'><TR><TD align='center' style='border:" + borderColor_title + " 1px solid;'><SPAN ID='BASIC'><FONT SIZE='1' COLOR='" + color_title + "' ><small>"+title+"</small></FONT></SPAN></TD></TR></TABLE><TABLE WIDTH='100%' HEIGHT='"+height_tab+"' BORDER='0' CELLPADDING='0' CELLSPACING='1' BGCOLOR='#FFFFFF'><TR><TD><SPAN ID='BASIC'><img src='"+path_image+"' align='left' border='0' width='" + width_img + "' height='" + height_img + "'><FONT COLOR='" + color_text + "' SIZE='1'>"+text+"</FONT></SPAN></TD></TR></TABLE></TD></TR></TABLE>";
}
else {
	txt = "<TABLE WIDTH='250' BORDER='0' CELLPADDING='1' CELLSPACING='0' BGCOLOR='#666666' style='border: 1px solid " + borderColor_tt + ";'><TR><TD><table width='100%' bgcolor='" + bgCcolor_tt + "'><tr><td align='center'><font color='#FFFFFF' size='2' face='Arial'>N° " + position + " au Top 10 de la semaine</font></td></tr></table><TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='1' BGCOLOR='" + bgColor_title + "'><TR><TD align='center' style='border:" + borderColor_title + " 1px solid;'><SPAN ID='BASIC'><FONT SIZE='1' COLOR='" + color_title + "' ><small>"+title+"</small></FONT></SPAN></TD></TR></TABLE><TABLE WIDTH='100%' HEIGHT='"+height_tab+"' BORDER='0' CELLPADDING='0' CELLSPACING='1' BGCOLOR='#FFFFFF'><TR><TD><SPAN ID='BASIC'><FONT COLOR='" + color_text + "' SIZE='1'>"+text+"</FONT></SPAN></TD></TR></TABLE></TD></TR></TABLE>";
}
*/
//txt = "<TABLE WIDTH='250' BORDER='0' CELLPADDING='1' CELLSPACING='0' BGCOLOR='#666666' style='border: 1px solid " + borderColor_tt + ";'><TR><TD><table width='100%' bgcolor='" + bgCcolor_tt + "'><tr><td align='center'><font color='#FFFFFF' size='2' face='Arial'>" + num_rma_main + "</font></td></tr></table><TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='1' bgcolor='" + bgColor_title + "'><TR><TD align='center' style='border:" + borderColor_title + " 1px solid;'><SPAN ID='BASIC'><FONT SIZE='1' COLOR='" + color_title + "' ><small>"+title+"</small></FONT></SPAN></TD></TR></TABLE><TABLE WIDTH='100%' HEIGHT='"+height_tab+"' BORDER='0' CELLPADDING='0' CELLSPACING='1' BGCOLOR='#FFFFFF'><TR><TD align='left' ><img src='"+path_image+"' border='0' width='" + width_img + "' height='" + height_img + "'></TD><td width='50%'><FONT COLOR='" + color_text + "' SIZE='1'>"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";

	txt = "<TABLE WIDTH='250' BORDER='0' CELLPADDING='1' CELLSPACING='0' BGCOLOR='#666666' style='border: 1px solid " + borderColor_tt + ";'><TR><TD><table width='100%' bgcolor='" + bgCcolor_tt + "'><tr><td align='center'><font color='#FFFFFF' size='2' face='Arial'>" + num_rma_main + "</font></td></tr></table><TABLE WIDTH='100%' BORDER='0' CELLPADDING='0' CELLSPACING='1' bgcolor='" + bgColor_title + "'><TR><TD align='center' style='border:" + borderColor_title + " 1px solid;'><SPAN ID='BASIC'><FONT SIZE='1' COLOR='" + color_title + "' ><small>"+title+"</small></FONT></SPAN></TD></TR></TABLE><TABLE WIDTH='100%' HEIGHT='"+height_tab+"' BORDER='0' CELLPADDING='0' CELLSPACING='1' BGCOLOR='#FFFFFF'><TR><TD><img src='"+path_image+"' align='left' border='0' width='" + width_img + "' height='" + height_img + "'></td><td style='padding-bottom:5px; padding-left:5px;padding-right:5px'><FONT COLOR='" + color_text + "' SIZE='1'>"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";

layerWrite(txt);
disp_tt();
}

