var temp


/*
	NOTES:
	javascript.js = codes js généraux
	
	g() = document.getElementById()
	charger() = window.location.href
	temp## = indique une variable temporaire
	r = rollover
*/

function g(ceci)
{
	return(document.getElementById(ceci));
}

function r(ceci)
{
	if(leMenuActif!=ceci.id) {ceci.src=String(ceci.src).replace('.png','-r.png')}
	ceci.src=String(ceci.src).replace('-r-r.png','-r.png')
}

function ro(ceci)
{
	if(leMenuActif!=ceci.id) ceci.src=String(ceci.src).replace(/-r/g,'') 
}


	//PRELOAD
var image1 = new Image();image1.src="menu1r.png"
var image2 = new Image();image2.src="menu2r.png"
var image3 = new Image();image3.src="menu3r.png"
var image4 = new Image();image4.src="menu4r.png"
var image5 = new Image();image5.src="menu5r.png"
var image6 = new Image();image6.src="menu6r.png"
var image7 = new Image();image7.src="menu7r.png"
var image8 = new Image();image8.src="menu8r.png"

var h=0
var w=0
function getSizes()
{
	if(!window.innerWidth)
	{
		if(!(document.documentElement.clientWidth == 0))
		{
			w = document.documentElement.clientWidth;
			h = document.documentElement.clientHeight;
		}
		else
		{
			w = document.body.clientWidth;
			h = document.body.clientHeight;
		}
	}
	else
	{
		w = window.innerWidth;
		h = window.innerHeight;
	}
}




function findPosY(obj)
{
var curtop = 0;
if(obj.offsetParent)
	while(1)
	{
	  curtop += obj.offsetTop;
	  if(!obj.offsetParent)
		break;
	  obj = obj.offsetParent;
	}
else if(obj.y)
	curtop += obj.y;
return curtop;
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}



/* --- ---------------  */

var leMenuActif
var leSMenuActif

var timesm1
function sm1()
{
	r(g('menu2'))
	clearTimeout(timesm1)
	g('sm1').style.left=findPosX(g('menu2'))+6+'px'
	g('sm1').style.top=findPosY(g('menu2'))+22+'px'
	
	g('sm2').style.left=-1000+'px'
	g('sm3').style.left=-1000+'px'
}

function sm1o()
{
	 timesm1 =setTimeout('sm1otimed()',300)
}

function sm1otimed()
{
	ro(g('menu2'))

	g('sm1').style.left=-1000+'px'
	clearTimeout(timesm1);
}

var timesm2
function sm2()
{
	r(g('menu5'))
	clearTimeout(timesm2)
	g('sm2').style.left=findPosX(g('menu5'))+6+'px'
	g('sm2').style.top=findPosY(g('menu5'))+22+'px'
	
	g('sm1').style.left=-1000+'px'
	g('sm3').style.left=-1000+'px'
}

function sm2o()
{
	 timesm2 =setTimeout('sm2otimed()',300)
}

function sm2otimed()
{
	ro(g('menu5'))

	g('sm2').style.left=-1000+'px'
	clearTimeout(timesm2);
}


var timesm3
function sm3()
{
	r(g('menu3'))
	clearTimeout(timesm3)
	g('sm3').style.left=findPosX(g('menu3'))+6+'px'
	g('sm3').style.top=findPosY(g('menu3'))+22+'px'
	
	g('sm1').style.left=-1000+'px'
	g('sm2').style.left=-1000+'px'
}

function sm3o()
{
	 timesm3 =setTimeout('sm3otimed()',300)
}

function sm3otimed()
{
	ro(g('menu3'))

	g('sm3').style.left=-1000+'px'
	clearTimeout(timesm3);
}
