//<!-- TOOLS.JS V2 20/sep/2002 -->
//	Updated by HG 2nd July 2002
//  Updated by Jeremie A. 20th Sept 2002
//	- support XHTML
//	- support IE
/**************************** barre de navigation du haut *********************************************/
function ShowMenu(cible)
 {
	HideMenu();
	zeDiv = "smenu"+cible;
	SetProp(zeDiv,"visibility","'visible'");
	//alert("putting effaceur...");
	PutEffaceur(zeDiv);		
	//alert("setting prop...");
	SetProp("effaceur","visibility","'visible'");		
	return 0;
 }
 
function HideMenu()
 {
	var zeDiv = null;
	SetProp("effaceur","visibility","'hidden'");	
	for(i=2;i<7;i++)
	 {
		zeDiv = "smenu"+i;
		SetProp(zeDiv,"visibility","'hidden'");
	 }
	return 0;
 }
 
function  PutEffaceur(obj)
{
	if( (document.layers && !document.layers[obj]) || ( document.all && !document.all[obj] ) || (document.getElementById && !document.getElementById(obj) ))
		return 1;
	if(document.layers){
		var zeLeft = getProp(obj,"left");// posLeft ;
		var zeTop = getProp(obj,"top");// posTop ; 
	}
	else{
		var zeLeft = getProp(obj,"left").replace("px","") ; // posLeft ;
		var zeTop = getProp(obj,"top").replace("px","") ;// posTop ; 
	}  

	if (zeDiv=="smenu6") //smenu6 = latest menu (increase number if you add menu)
		SetProp("effaceur","left",(zeLeft-52));	 
	else
		SetProp("effaceur","left",(zeLeft-30));	 
	
	SetProp("effaceur","top",zeTop);	 
	
	return 0;	 
 }
 
/*************************************************************************/
function SetProp(cible,prop,val)
 {
 	if (parseInt(navigator.appVersion) < 5) {
		if(document.all && document.all[cible]) {
			eval("document.all['"+cible+"'].style."+prop+" = "+val+";");
		}
		else if (document.layers && document.layers[cible]) {
			//alert (val);
			eval("document.layers['"+cible+"']."+prop+" = "+val+";");
		}
	}	
	else {
		//if(prop=="left" || prop=="top") 
			//val = "'" + val+"px"+"'";
		//alert (val);
		eval("document.getElementById('"+ cible+ "').style."+ prop +" = "+ val +";");
	}
	return 0;
 }
 
 function getProp(cible,prop)
  {
  	if (parseInt(navigator.appVersion) < 5) {
 	if(document.all && document.all[cible])
 		return eval("document.all['"+cible+"'].style."+prop+";");
 	else if (document.layers && document.layers[cible])
 		return eval("document.layers['"+cible+"']."+prop+";");
 		}
 	else 
 		return eval("document.getElementById('"+cible+"').style."+prop+";");
 	
 	return 0;
 }

/* SwapImg(obj) : rollover d'image, parametre : document.images.nom_de_l_image	*/
var nomRubriqueStrat;
var nomRubrique;



function SwapImg(obj)
 {
	if(obj.name==nomRubrique || obj.name==nomRubriqueStrat)
			return 1;
			
	var zePic = ""+obj.src;
	
	if(zePic.indexOf('_up') != -1)
		zePic=zePic.replace("_up.jpg","_ov.jpg");
	else	
		zePic=zePic.replace("_ov.jpg","_up.jpg");
	obj.src = zePic;
	return 0;
 } 
 
/*	choix dans la liste des rubriques de la home	*/ 
function ChangePage(obj)
 {
	var newLink = obj[obj.selectedIndex].value;
	window.location = newLink;
	return 0;
 } 
 
function NsResize()
 {
	zeLoc = ""+self.location;
	if(zeLoc.indexOf("#")>=0)
		zeLoc = zeLoc.substring(0,(zeLoc.length-1));
	self.location = zeLoc;
 } 


function Extract_Page_Name()
{
	var nom_fic = document.location.pathname;
	nom_fic = nom_fic.substring(nom_fic.lastIndexOf("/"),nom_fic.length);
	if (nom_fic.length < 2) 
		nom_fic = "index";
	else 
		nom_fic = nom_fic.substring(1,nom_fic.indexOf("."));
	return nom_fic;
}



function Change_siteName ()
{
	path_=document.location.pathname;
	path_ = path_.substring(0,path_.lastIndexOf("/"));
	path_= (path_.split("/")).join("."); 
	if (path_.substr(0, 1)==".")	
	   path_ = path_.substring(1,path_.length);	   
	if (path_.substr(path_.length-1, path_.length)==".")	
	   path_ = path_.substring(0,path_.length-1);  
	path_ = path_+"."+Extract_Page_Name();
	if (document.location.hostname != "www.gemplus.com")
		path_ = document.location.hostname+"."+path_;

	return path_;
}



 


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_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_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;
}

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];}
}

