// 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 ie7 = (document.all && !window.opera && window.XMLHttpRequest);
	var mac_ie = mac && ie;
	
		
	
	
	
	
	
			
	


/*----------------------------------------------------------------------------------------------*/
/*--------------------- Change location----------- ---------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/


function chemin(adresse){
 location.href=""+ adresse +"";
 
}



/*----------------------------------------------------------------------------------------------*/
/*--------------------- Affiche propri�t�e ------------- ---------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/


	function afficheProperties(obj){
		
		 var texte = "Propri�t�s de :\n";
		 for(i in obj){
		 //if(i.indexOf("Height") != - 1 || i.indexOf("Width") != - 1){
		 	texte+= i +" = "+ obj[i] + "          ";
	  	//}
	  }
	  alert(texte);
	}




/*----------------------------------------------------------------------------------------------*/
/*--------------------- 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=1,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);
		
	}
	if(getTableHeight){
		getTableHeight();
	}
}
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=-1500;
}
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;
	
}




/*----------------------------------------------------------------------------------------------*/
/*--------------------- 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);
		}
	  }
	
	}
  
}





/*----------------------------------------------------------------------------------------------*/
/*--------------------- gestion menu de produits liste deroulante-------------------------------*/
/*----------------------------------------------------------------------------------------------*/

 var phone = "()- 0123456789";
 var numb = "0123456789";
 var alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'. 0123456789- ";
 var dateType = "/.0123456789-";
            

//on r�cup�re l'evenement keycode pour envoye le formulaire -----------------------------------------

//function d'envoie du formulaire sur le enter
function lanceSurEnter(){
	  //alert("keyCode xxx : " + window.event.keyCode);
	  if(ie || ie7){
		  //on evite les alert quand il y a un champs de text dans la page
		  //alert(document.location);
		  var addr = new String(document.location);
		  
		  if (event.keyCode == 13 && addr.indexOf("contact.asp") == -1 && addr.indexOf("survey") == -1 && addr.indexOf("articles") == -1) {
			// alert(document.rechercheFRM.recherche.value);
			//on lance la fonction de recherche
			openProductFromSelectList('recherche', document.rechercheFRM.recherche.value);
			return; 
		  }
	  }
}

document.onkeypress = lanceSurEnter;

		
function res(t,v){

	var w = "";
	for (i=0; i < t.value.length; i++) {
		x = t.value.charAt(i);
		if (v.indexOf(x,0) != -1){
		w += x;
		 
		}
		
	}
	t.value = w;
	
}



//envoie le fromulaire
function openProductFromSelectList(leType, valeur){
	//alert(leType + " - " + valeur )
	var editEnCours = MM_findObj("dbName");
	var textfieldF = MM_findObj("textfield");
	
	if (leType == "recherche"){
		if(valeur != "" && valeur.toUpperCase() != "SEARCH" && valeur.length > 2 ){
			//on reaffiche le texte dans le champs
			//document.rechercheFRM.recherche.value = valeur;
			//alert(valeur);
			document.rechercheFRM.submit();
			//document.location.href = "search.asp?langage="+ langage +"&cat=search&appli=0&numProd=0&criteres="+ valeur +"";
		}else{
			if(!editEnCours || !textfieldF){
				//alert("Please fill in a text !\nMinimum 3 characters.");
			}
			
			document.rechercheFRM.recherche.value = "";
		}
		
	}else{
		if(valeur != ""){
			np = valeur.split("|")[0];
			ap = valeur.split("|")[1];
			location.href = "products.asp?langage="+ langage +"&cat=prod&appli="+ ap +"&numProd="+ np +"";
		}else{
			alert("Please select a product on combo box !");
		}
		
	}

}





/*----------------------------------------------------------------------------------------------*/
/*--------------------- uptimes envoie le formulaire  liste d�roulante droite-------------------*/
/*----------------------------------------------------------------------------------------------*/



function envoieFormulaire(laValeur){
	if(laValeur != ""){
	//alert(leChampForm +" : "+ leChampsDB)
	//on donne une valeur au champs travail
	document.location.href = "uptimes.asp?langage="+ langage +"&cat=uptimes&numProd="+ laValeur;
	}else{
		alert("Select uptimes number on combo box");
	}
}



/*----------------------------------------------------------------------------------------------*/
/*--------------------- Affiche le titre de l'article s�lectionn� ------------------------------*/
/*----------------------------------------------------------------------------------------------*/

var ancienLien = -1;

function vaAuLink(leLien){
	//on boucle sur tous les liens
	
	changeClass(leLien, 'content_colonne_left_selected');
	if(ancienLien != -1){
		changeClass(ancienLien, 'content_colonne_left');
	}
	//alert(eval("document.all." + leLien).name)
	//on boucle sur tous les liens
	ancienLien = leLien;
}



/*----------------------------------------------------------------------------------------------*/
/*--------------------- encodeE-mail adresse------ ---------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/

	
	function emlMail(obj,prenom,nom)
	 {
		 var pnt=".";
		 var rbs="@";
		 obj.href="mailto:"+prenom+rbs+nom;
	 
	 
	 }
	 


/*----------------------------------------------------------------------------------------------*/
/*--------------------- Vide contenu champs search ---------------------------------------------*/
/*----------------------------------------------------------------------------------------------*/


function videContenu(champs, contenu){
	
	if(champs.value == contenu){
		champs.value = "";
	}

}

/*----------------------------------------------------------------------------------------------*/
/*--------------------- Affiche les crit�res recherche�s depuis la page search ------------------*/
/*----------------------------------------------------------------------------------------------*/



function afficheCriteres(criteres){
	
	if(criteres.length > 0 ){
		//<[^>]*>
		
		var reg=new RegExp("(<.*>[^<]*)("+ criteres +")([^>]*</.*>)+", "gi");
		//var reg=new RegExp("("+ criteres +")", "gi");
		document.body.innerHTML = document.body.innerHTML.replace(reg, "$1<span style='background-color:#FEDDDF'><b>$2</b></span>$3");
		//setHover();
		
	}
	
}


function afficheCriteresRouge(criteres){
	
	if(criteres.length > 2 ){
		//<[^>]*>
		
		var reg=new RegExp("(<.*>[^<]*)("+ criteres +")([^>]*</.*>)+", "gi");
		//var reg=new RegExp("("+ criteres +")", "gi");
		document.body.innerHTML = document.body.innerHTML.replace(reg, "$1<span style='background-color:#FEDDDF'><b>$2</b></span>$3");
		//setHover();
		
	}
	
}


///  methode pour les pdf virewe

function openFull(p,n) {

        var r   = null;
		r = window.open(p,n,'width='+screen.width+',height='+screen.height+',top='+0+',left='+0+','+'scrollbars=no,toolbar=no,location=no,status=no,menubar=no,resizable=yes,dependent=no');

        if(r!=null && window.focus)
			r.window.focus(); 
		};

	
///    Shadow box


function getShadowBox(sloganTxt){
		
		var options = {
			overlayColor:	'#ffffff',
			flashBgColor:	'#ffffff',
			overlayOpacity:	0.4,
			displayNav:		true,
			enableKeys:		true,
			animate:        false
		};
		Shadowbox.init(options);
		
		Shadowbox.open({
			player:			'html',
			title:      	'',
			content:   		sloganTxt ,
			
			width:      	getElementWidth('tblSlogan'),
			height:     	getElementHeight('tblSlogan')
			
			
			
		});
		//on lance le timer sur l'élement
		setTimeout("Shadowbox.close()", 10000);
}














