// fichier script de base 

	var ns4 = document.layers;
	var op5 = (navigator.userAgent.indexOf("Opera 5")!=-1) ||(navigator.userAgent.indexOf("Opera/5")!=-1);
	var op6 = (navigator.userAgent.indexOf("Opera 6")!=-1) ||(navigator.userAgent.indexOf("Opera/6")!=-1);
	var agt=navigator.userAgent.toLowerCase();
	var mac = (agt.indexOf("mac")!=-1);
	var ie = (agt.indexOf("msie") != -1); 
	var mac_ie = mac && ie;


/*----------------------------------------------------------------------------------------------*/
/*--------------------- Change location----------- ---------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/


function chemin(adresse){
 location.href=""+ adresse +"";
 
}


/*----------------------------------------------------------------------------------------------*/
/*--------------------- Affiche popup------------- ---------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/



function showwin(adresse,largeur,hauteur,s){
   	  var pop;
   	  pop = window.open(""+ adresse +"","popup","toolbar=0,location=0,directories=0,menuBar=0,scrollbars="+ s +",resizable=0,width="+ largeur +",height="+ hauteur +",left=450,top=50");
   	  pop.focus();
	}
	
/*----------------------------------------------------------------------------------------------*/
/*--------------------- Update la page------------- --------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/

	
function btnUpdateWindowon(nodeID, langage, sessID){
	
	alert(document.location.href);
	if(ie){
		document.location.href = "https://data.essence.ch/rentesgenevoises/default.asp?nodeId="+ nodeID +"&langage="+ langage +"&sessID="+ sessID +""//document.location.href ;
	}else{
		window.location.reload();
	}
	//
	
}

/*----------------------------------------------------------------------------------------------*/
/*--------------------- Vide un champs de sa valeur --------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/


function masqueTexte(obj){
	
		if(obj.value == "<%=lcase(T354)%>"){
			obj.value = "";
		}
}

/*----------------------------------------------------------------------------------------------*/
/*--------------------- Fonctions de bases ------- ---------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/



function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

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];}
   
}


/*----------------------------------------------------------------------------------------------*/
/*--------------------- Masque affiche les objects ---------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/

function check(id) {
	
	if(document.getElementById(id).style.visibility=='visible') {
		hidden(id);
	} else {
		visible(id);
	}
}
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=-1000;
	document.getElementById(id).style.top=-500;
}
function visible (id) {
	if(navigator.appName == "Microsoft Internet Explorer") {
		document.getElementById(id).style.height='100%';
	} else {
		document.getElementById(id).style.height='';
	}
	document.getElementById(id).style.position='relative';
	document.getElementById(id).style.visibility='visible';
	document.getElementById(id).style.left=0;
	document.getElementById(id).style.top=0;
	
}


/*----------------------------------------------------------------------------------------------*/
/*--------------------- Info bulle---------------- ---------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/


// Example:
// onMouseOver="toolTip('tool tip text here')";
// onMouseOut="toolTip()";
// -or-
// onMouseOver="toolTip('more good stuff', '#FFFF00', 'orange')";
// onMouseOut="toolTip()"; 
/*
MOVE this to the <body>:


*/
var texte = "";
var timer;
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";
function initToolTips()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = moveToMouseLoc;
  }
}
function lanceAide(msg){
	if(lanceAide.arguments.length > 0){
		texte = msg;
		timer = setTimeout("toolTip()", 1000);
	}else{
		texte = "";
		window.clearTimeout(timer);
		toolTip();
	}
	
}

function toolTip(msg, fg, bg)
{
  if(texte == "") // hidetoolTip.arguments.length < 1
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  }
  else // show
  {
  	msg = texte;
    if(!fg) fg = "#B5B466";
    if(!bg) bg = "#FDFDAC";
	
    var content =
    '<table border="0" cellspacing="0" cellpadding="1" bgcolor="' + fg + '"><tr><td>' +
    '<table border="0" cellspacing="0" cellpadding="4" bgcolor="' + bg + 
    '"><tr><td align="left" style="color:#B5B466">' + msg +
    '</td></tr></table></td></tr></table>';
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
	
  }
}
function moveToMouseLoc(e)
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY ;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  
  return true;
}

/*----------------------------------------------------------------------------------------------*/
/*--------------------- menu de navigation ------- ---------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/



function hover(obj){
  if(document.all){
    UL = obj.getElementsByTagName('ul');
    if(UL.length > 0){
      sousMenu = UL[0].style;
      if(sousMenu.display == 'none' || sousMenu.display == ''){
        sousMenu.display = 'block';
      }else{
        sousMenu.display = 'none';
      }
    }
  }
}

function setHover(){
	//on controle si le menu existe
  var menuNav = MM_findObj("menu");
	if(menuNav){
	
	  LI = document.getElementById('menu').getElementsByTagName('li');
	  nLI = LI.length;
	  for(i=0; i < nLI; i++){
		LI[i].onmouseover = function(){
		  hover(this);
		}
		LI[i].onmouseout = function(){
		  hover(this);
		}
	  }
	
	}
  
}


/*----------------------------------------------------------------------------------------------*/
/*--------------------- fonction de g�n�ration de flash par javascript -------------------------*/
/*----------------------------------------------------------------------------------------------*/

 	// affiche le controle activeX Flash

	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>'
		
	}
	
	
	
	function CreateControlSECURE(DivID, CLSID, ObjectID, WIDTH, HEIGHT, URL, COLOR, WMODE)
	{
	  var d = document.getElementById(DivID);
	  d.innerHTML = 
		 '<object classid=' + CLSID + ' id=' + ObjectID +' name=' + ObjectID
		+ 'codebase="" ' 
		+ '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="">'
		+ '</EMBED></OBJECT>'
		
	}

/*----------------------------------------------------------------------------------------------*/
/*--------------------- Ajoute ombre sous menu de navigation -----------------------------------*/
/*----------------------------------------------------------------------------------------------*/


	function viewLeftMenu(){
		var divIdName = "menuOmbre";
		var leDivOmbre = MM_findObj(divIdName);
		
		if(!leDivOmbre){
			var leDivOmbre = document.createElement('div');
			leDivOmbre.setAttribute('id',divIdName);
			leDivOmbre.setAttribute('name',divIdName);
			leDivOmbre.innerHTML = '<img id="imgOmbreMenu" name="imgOmbreMenu" src="images/ombre/2011/div_fondMenu.png">';
			document.body.appendChild(leDivOmbre);
		}
		
		
		leDivOmbre.style.visibility = "hidden";
		// div contenant le menu de droite
		var menu = MM_findObj("menu");
		// div contenant le div menu
		var menuContainer = MM_findObj("menuContainer");
		// img dans le menu de droite
		var imgDansDivOmbre = MM_findObj("imgOmbreMenu");
		var wOrigin = getElementWidth("menuContainer");
		var hOrigin = getElementHeight("menu");
		var leftPos = getElementLeft("menuContainer");
		var imageCale = MM_findObj("imageCaleur");
		//image dans colonne de droite
		var imageCaleDroite = MM_findObj("imageCaleurDroite");
		// tblMaster est le tableau de gauche
		var tblMasterHeight = getElementHeight("tblMaster");
		var winHeight = getBodyHeight();
		//alert(tblMasterHeight);
		//alert(hOrigin);
		 
		
		if(tblMasterHeight > winHeight || hOrigin > winHeight){
			//donc le contenu est plus grand que la zone
			if(tblMasterHeight > hOrigin){
				// droite plus petit
				imageCaleDroite.style.height = (tblMasterHeight - hOrigin) + "px";
			}else{
				//gauche plus petit
				imageCale.style.height = (hOrigin - tblMasterHeight) + "px";
			}
		}else{
			//contenu plus petit que la zone
			imageCaleDroite.style.height = (winHeight - hOrigin) + "px";
			imageCale.style.height = (winHeight - tblMasterHeight) + "px";
			
			/*
			if(tblMasterHeight > hOrigin){
				// droite plus petit
				imageCaleDroite.style.height = (winHeight - hOrigin) + "px";
				imageCale.style.height = (winHeight - tblMasterHeight) + "px";
			}else{
				//gauche plus petit
				imageCale.style.height = (hOrigin - tblMasterHeight) + "px";
			}
			*/
		}
		
		
		var hOrigin = getElementHeight("menu");
		var decalageOmbre = 0;
		//menu
		menu.style.position = "absolute";
		menu.style.visibility = "hidden";
		moveXY("menu", leftPos, 0);
		
		//menu.style.top = 0;
		//ombre
		//si c'est ie
		if(ie){
			//debugeWrite("ie");
			leDivOmbre.className = "ie_ombre";
			//on force le style du div dessous
			//on masque l'image dans le div
			imgDansDivOmbre.style.visibility = "hidden";
			
		}
		imgDansDivOmbre.style.width = (wOrigin+decalageOmbre) +"px";
		imgDansDivOmbre.style.height = (hOrigin+decalageOmbre)+"px";
		//on place l'object ombre au d&eacute;part
		//
		
		leDivOmbre.style.position = "absolute";
		moveXY("menuOmbre", leftPos - 4, 0);
		menu.style.visibility = "visible";
		leDivOmbre.style.visibility = "visible";
		leDivOmbre.style.width = (wOrigin+decalageOmbre)+"px";
		leDivOmbre.style.height = (hOrigin+decalageOmbre)+"px";
		
		
		
		
	
	}
	
	//window.onresize = viewLeftMenu;


/*----------------------------------------------------------------------------------------------*/
/*--------------------- Affiche le produits depuis un clic dans un news ------------------------*/
/*----------------------------------------------------------------------------------------------*/



// affiche la page correspondante au produit depuis une news

	function AfficheProduits(produit){
		var path = "";
		var parentLocation;
		//alert(produit);
		switch(produit){
			
			case "eolia":
				path = "dental_products_b.asp?familly=303"
				break;
			case "Mx_DMX":
				path = "dental_products_b.asp?familly=282"
				break;
			case "Prolab":
				path = "dental_products_b.asp?familly=288"
				break;
			case "optimaMx":
				path = "dental_products_b.asp?familly=252"
				break;
			case "PMMicro":
				path = "surgery_products_b.asp?familly=308"
				break;
			case "optima_mx_int":
				path = "dental_products_b.asp?familly=282"
				break;
		}
		if(parent){
			var p = parent.location.toString();
			parentLocation = p.substr(0, p.lastIndexOf("/"));
			parent.location = parentLocation +"/"+ path
		}else{
			if(opener){
				var p = opener.location.toString();
				parentLocation = p.substr(0, p.lastIndexOf("/"));
				opener.location = parentLocation +"/"+ path
			}else{
				var p = document.location.toString();
				parentLocation = p.substr(0, p.lastIndexOf("/"));
				document.location.href = parentLocation +"/"+ path
			}
			//
		}
		
	}
	

/*----------------------------------------------------------------------------------------------*/
/*--------------------- 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>



/*----------------------------------------------------------------------------------------------*/
/*--------------------- Message informatif (Animation de maintenance)---------------------------*/
/*----------------------------------------------------------------------------------------------*/

function playAnim(){
	//alert("playAnim");
	document.getElementById("info1").style.visibility = "hidden";
	document.getElementById("info2").style.visibility = "hidden";

}

function timerFinMessage(){
   	timeoutID = setTimeout("playAnim()",15000);
}

/*----------------------------------------------------------------------------------------------*/
/*--------------------- Active le caddy ---------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/


function caddy(){
	
	var caddy = MM_findObj("caddyColDroite");
	if(caddy){
		loadCaddy();
	}
}

	
	

