CurMenuItem = 0;
CurSubMenu = 0;
CurSubSubMenu = 0;
Color1 = "01A001"
var CurrSessNB = 0;

function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	//added
	this.ie4mac=this.ie4 && navigator.userAgent.indexOf("Mac")>-1
	this.ie5mac=this.ie5 && navigator.userAgent.indexOf("Mac")>-1
	this.ie55=(this.ver.indexOf("MSIE 5.5")>-1 && this.dom)?1:0; 
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5 || this.ie5mac)
	return this
}

bw=new checkBrowser()

fromY=-5////How much from the actual mouse Y should the description box appear?
fromX=5////How much from the actual mouse Y should the description box appear?

//Capturing mousemove
var descx,descy;
function popmousemove(e){descx=bw.ns4?e.pageX:event.x; descy=bw.ns4?e.pageY:event.y}

var isLoaded;

//Initiates page

function init()
{
	SetSessionNb();
	popupInit();
	initSubmenu();
}

function popupInit(){
    if(bw.ns4)document.captureEvents(Event.MOUSEMOVE)
    document.onmousemove=popmousemove;
    isLoaded=true;
}	

function afficheCouche(numeroCouche,Y,X)
{
   	if(isLoaded)
	{
		if(bw.ie5) Y=Y+document.body.scrollTop
		document.all[numeroCouche].style.top = Y;
		document.all[numeroCouche].style.left = X;
		document.all[numeroCouche].style.visibility = "visible";
   	}
}
function setvisible(numerocouche)
{
	alert('yo');document.all[numeroCouche].style.visibility = "visible";
}

function cacheCouche(numeroCouche)
{
	document.all[numeroCouche].style.visibility="hidden";
}
function montreCouche(numeroCouche)
{
	document.all[numeroCouche].style.visibility="visible";
}
function BgColorCouche(numeroCouche,color)
{
	document.all[numeroCouche].style.backgroundColor=color;
}

function ColorCouche(numeroCouche,color)
{
	document.all[numeroCouche].style.color=color;
}

function SetCursor(numeroCouche,cursor)
{
	document.all[numeroCouche].style.cursor=cursor;
}

function onCouche(numeroCouche)
{
	SetCouche(numeroCouche,'#01A001','#ffffff','hand');
}

function outCouche(numeroCouche)
{
	SetCouche(numeroCouche,'#ffffff','#02046B','hand');
}

function SetCouche(numeroCouche,bgcolor,color,cursor)
{
	BgColorCouche(numeroCouche,bgcolor);
	ColorCouche(numeroCouche,color);
	SetCursor(numeroCouche,cursor);
}

function SetSubMenu(SubMenuNb)
{
	ReinitMenu();
	CurSubMenu=SubMenuNb;
	name='arrow' + SubMenuNb;
	document.images[name].src = path +'images/arrow1R.gif'
	ColorCouche('menu' + SubMenuNb,"#00FF00");
	afficheCouche('submenu' + SubMenuNb, descy+fromY,descx+fromX );
}

function ReinitMenu()
{
	HideMenu()
	HideSubMenu()
}
function HideMenu()
{
	if (CurSubMenu!= 0)
	{
		name='arrow' + CurSubMenu;
		document.images[name].src = path +'images/arrow1.gif'
		ColorCouche('menu' + CurSubMenu ,"#FFFFFF");
		cacheCouche('submenu' + CurSubMenu );
		CurSubMenu=0;
		CurMenuItem=0;
	}
}
function HideSubMenu()
{
	if (CurSubSubMenu!= 0)
	{
		name='arrow' + CurSubSubMenu;
		document.images[name].src = path +'images/arrow2.gif'
		ColorCouche('menu' + CurSubSubMenu,"#FFFFFF");
		cacheCouche('submenu' + CurSubSubMenu );
		CurSubSubMenu=0;
	}
}
function SetSubSubMenu(SubSubMenuNb)
{
	CurSubSubMenu=SubSubMenuNb;
	name='arrow' + SubSubMenuNb;
	document.images[name].src = path +'images/arrow2R.gif'
	ColorCouche('menu' + SubSubMenuNb,"#00FF00");
	afficheCouche('submenu' + SubSubMenuNb,descy+fromY, descx+fromX );
}

function SetSubMenuEntry(SubMenuNb,Item,Bool)
{
	HideSubMenu();
	if ((CurMenuItem != 0) && (CurMenuItem != Item)) 	{
		ResetSubMenuEntry(SubMenuNb,CurMenuItem);
	}
	SetSubMenuEntry0(SubMenuNb,Item);
	if (Bool == 'True') SetSubMenuEntry1(SubMenuNb,Item);
	CurMenuItem=Item;
}
function SetSubMenuEntry0(SubMenuNb,Item)
{	
	name='puce' + SubMenuNb + 'x' + Item ;
	document.images[name].src = path +'images/puceNr.gif'
	onCouche('menu' + SubMenuNb + 'x' + Item );
	ColorCouche('menu' + SubMenuNb + 'x' + Item  ,"#FFFFFF");
}
function SetSubMenuEntry1(SubMenuNb,Item)
{
	cacheCouche('submenu' + SubMenuNb + 'x' + Item );
	name='arrow' + SubMenuNb + 'x' + Item;
	document.images[name].src = path +'images/arrow2.gif'
}
function ResetSubMenuEntry(SubMenuNb,Item)
{
	name='arrow' + SubMenuNb + 'x' + Item;
	document.images[name].src = path + 'images/arrow2_.gif'
	ResetSubMenuEntry0(SubMenuNb,Item);
	CurMenuItem=0;
}
function ResetSubMenuEntry0(SubMenuNb,Item)
{
	name='puce' + SubMenuNb + 'x' + Item;
	document.images[name].src = path + 'images/puceN.gif'
	outCouche('menu' + SubMenuNb + 'x' + Item );
}

function popup(page,name,width,height){

if(page!="none")
{

width=width+50
newWindow = window.open(page,name,'toolbar=no,location=no,scrollbars=yes,menubar=no,top=40,left=40,width='+width+',height='+height+' ');
newWindow.focus()
	}
}

function MembersOnly(adresse)
{
	if (CurrSessNB != 0)
	{
		
		document.location=adresse + "?SN=" + CurrSessNB;
	}
	else
	{
		document.location=adresse ;
	}
}

function createSessionNb()
{
	var madate= new Date();
	return((madate.getHours()*60)+madate.getMinutes());
}

function getSessionNb()
{
	var thispage=window.location.href
	if (thispage.lastIndexOf('?SN=') != -1)
	{	
		return(thispage.substring(thispage.lastIndexOf('?SN=')+4,thispage.length));
	}
	else
	{
		return(0)
	}
}

function CheckSessionNb()
{
	var SessionNB=getSessionNb()
	
	if (SessionNB != 0)
	{	
		var NewsessionNB=createSessionNb();
		if (NewsessionNB - SessionNB < 20)
		{
			return(true)
		}
		else
		{
			return(false)
		}
	}
	else
	{
		return(false)
	}
}

function SetSessionNb()
{
if (CurrSessNB == 0) {CurrSessNB = getSessionNb();}
}