// JavaScript Doc.


// Prechargement image + swap image
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// Recherche d'élement
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


// Création du contour ombré autour des bloc de texte
function calculeTailleDiv(leTblSrc, LeLayerDestination){
	//alert("fonction appellée");
	//alert("leTblSrc : "+ leTblSrc + "\rLeLayerDestination : "+  LeLayerDestination);
	//pointeur
	var letbl = MM_findObj(leTblSrc);
	//alert(letbl + "\r"+ navigator.appName.indexOf("Internet Explorer") + "\r"+ navigator.appVersion.indexOf("Win") + "\r");
	if(letbl){
		//alert("tbl is object");
		if(navigator.appName.indexOf("Internet Explorer") != - 1 && navigator.appVersion.indexOf("Win") != -1){
			//pour PC
			//alert("PC");
			//on récupère la dimension du tableau
			
			var widthTbl = letbl.scrollWidth;
			var heightTbl = letbl.scrollHeight;
			
			// on l'attribue au layer
			var leLayer = MM_findObj(LeLayerDestination); 
			leLayer.style.width = widthTbl + 3; 
			leLayer.style.height = heightTbl + 10;
			//alert(widthTbl + "\r"+ heightTbl + "\r"+ leLayer + "\r");
			/*
			var msg = "";
			for(i in rightBorder){
				//if(i.indexOf("name") != - 1 ){
					msg += i +" : " + rightBorder[i] +" --- ";
				//}
			}
			*/
		}else{
			// pour les autres
			//alert(navigator.appName);
			letbl.className = "bordureTblOtherPc";
		}
	}else{
		//alert("pas object");
	}
}

// Survol de la navigation - swap image
function changeBck (imgSrc, obj, cellGauche, cellDroite){
	//alert(obj.background)
	obj.background = imgSrc;
	}
//
//
// Affiche/masque les menus deroulants de la page d'accueil des produits.
//
var calquePrecedent = "";
var relAbs ="";
var	posX = 0;
var	posY = 0;
var relAbs ="";
//
//
//
function check(id,posX,posY,relAbs) {
		
	 if(posX == undefined){
		posX = 0;
		posY = 0;
	 }
	  if(relAbs == undefined){
		relAbs = 'relative';
		
	 }
 
	 //alert("check " + posX + " " + posY + " " + relAbs);
	 if(document.getElementById(id).style.visibility=='visible') {
	  hidden(id);
	 } else {
	  if (calquePrecedent != "") {
	  hidden (calquePrecedent)  
	  }
	  calquePrecedent = id;
	  visible(id,posX,posY,relAbs);
	 }
}



function hidden (id) {
	 document.getElementById(id).style.position='absolute';
	 document.getElementById(id).style.height='1';
	 document.getElementById(id).style.visibility='hidden';
	 document.getElementById(id).style.left=-2000;
	 document.getElementById(id).style.top=-100;
}




function visible (id,posX,posY,relAbs) {
	
 
	 if(navigator.appName == "Microsoft Internet Explorer") {
	  document.getElementById(id).style.height='100%';
	 } else {
	  document.getElementById(id).style.height='';
	 }
	 
	 /*
	 var msg = "a";
	 var obj = document.getElementById(id).style;
	 for(i in obj){
		 msg += i + " : "+ obj[i] + "\r";
		 }
	 //alert(msg);
	 */
	 // positionnement
	 document.getElementById(id).style.position=relAbs;
	 document.getElementById(id).style.visibility='visible';
	 document.getElementById(id).style.left=posX;
	 document.getElementById(id).style.top=posY;
	 //alert("visible " + posX + " " + posY + " " + relAbs + " " + document.getElementById(id).style.left);


}

//
function masqueTexte(obj){
	
		if(obj.value == "Required" || obj.value == ""){
			obj.value = "";
			obj.style.backgroundColor = "#ffffff";
			//alert(obj.name)
		}
	}

//on controle la hauteur de l'cran pour les utilisateurs en 800x600
function ascenceur(){
	if(screen.availHeight < 780){
	document.body.scroll = "yes"
	//on met les ascenceurs sur le docuemnt
}
}

var pop;
function showwin(adresse,largeur,hauteur,s){
   	  
   	  pop = window.open(""+ adresse +"","popup","toolbar=0,location=0,directories=0,menuBar=0,scrollbars="+ s +",resizable=1,width="+ largeur +",height="+ hauteur +",left=450,top=150");
   	  if(pop!=undefined)  pop.focus();
	}
	

function showwinProductFinder(adresse,largeur,hauteur,s){
		pop1 = window.open(""+ adresse +"","popup1","toolbar=1,location=0,directories=0,menuBar=0,scrollbars="+ s +",resizable=1,width="+ largeur +",height="+ hauteur +",left=30,top=50");
   	    if(pop1){
	    	pop1.focus();
		}
	}


var ancienLien = -1;
function vaAuLink(leLien){
	//on boucle sur tous les liens
	var td = MM_findObj("lien"+ leLien);
	if(td){
		td.style.background = "#EBF1F7";
		if(ancienLien != -1){
			var td = MM_findObj("lien"+ ancienLien).style.background = "none";
		}
		
	}
	
	//alert(eval("document.all." + leLien).name)
	//on boucle sur tous les liens
	ancienLien = leLien;
}


// ****************************************************************************************************************
// SEARCH
// ****************************************************************************************************************

function videContenu(champs, contenu){
	if(champs.value == contenu){
		champs.value = "";
	}
}

//envoie le fromulaire
function envoieFormulaire(leType, valeur){
	//alert(leType + " - " + valeur )
	if(leType == "recherche"){
		if(valeur.length < 6){
				alert("Please fill in a text !\nMinimum 6 characters.");
				document.rechercheProd.prodStr.focus();
			}else{
				document.rechercheProd.submit();
				document.rechercheProd.prodStr.value = "";
		}
	}else{
		if(leType == "recherche1"){
			if(valeur.length < 6){
				alert("Please fill in a text !\nMinimum 6 characters.");
			}else{
				document.rechercheProd1.submit();
				document.rechercheProd1.prodStr1.value = "";
			}
		}else{
			return false
		}
		
	}
		
}

// ****************************************************************************************************************
// Ecrit les plugin flash propre en evitant le bloquage IE
// ****************************************************************************************************************


	function CreateControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, URL, COLOR, WMODE)
	{
	  var d = document.getElementById(DivID);
	  d.innerHTML = 
		 '<object classid=' + CLSID + ' id=' + ObjectID +' name=' + ObjectID
		+ 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ' 
		+ 'width=' + WIDTH + ' height=' + HEIGHT + '><PARAM NAME=movie VALUE=' + URL + '>' 
		+ '<PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=' + COLOR + '><PARAM NAME="wmode" value=' + WMODE + '>' 
		+ '<EMBED src=' + URL + ' ' 
		+ 'QUALITY=high BGCOLOR=' + COLOR + ' WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' WMODE=' + WMODE + ' ' 
		+ 'TYPE="application/x-shockwave-flash" ' 
		+ 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
		+ '</EMBED></OBJECT>'
		
	}


// ****************************************************************************************************************
// Affiche Product Finder
// ****************************************************************************************************************

function affiche_productFinder(){
	alert("affiche Product Finder")
}



// ****************************************************************************
// fonction du controle de chargement de la page
// ****************************************************************************

function cacheOff()
			{
				
				cach.visibility = "hidden";
			}





function afficheSousLayer(layers, pos){
	
	
	var xTbl =  getElementLeft("tb"+pos) ;
	var yTbl =  getElementTop("tb"+pos)+ (getElementHeight("tb"+pos) + 2);
	moveXY(layers, xTbl, yTbl);
	var div = MM_findObj(layers);
	div.style.width = getElementWidth("tb"+pos) + "px";
	
}



/*----------------------------------------------------------------------------------------------*/
/*--------------------- encodeE-mail adresse------ ---------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/

	
	function emlMail(obj,prenom,nom)
	 {
		 var pnt=".";
		 var rbs="@";
		 obj.href="mailto:"+prenom+rbs+nom;
	 
	 
	 }
 
     //<a href="" target="_self" onClick="eml(this,'gion','columberg')";>contact</a>













