/*************************************/
/*
* rollover sur le bouton fermer
**/
function closeSwp(n)
{
	switch(n)
	{
		case 0:
			document.getElementById("x").className = "linkorange";
			document.getElementById("f").className = "linkwhite";
			break;
		case 1:
			document.getElementById("x").className = "linkwhite";
			document.getElementById("f").className = "linkorange";
			break;
		default:
			return;
	}
}

function transRoll(o,n)
{
	switch(n)
	{
		case 0:
			o.className = "linkwhite";
			break;
		case 1:
			o.className = "linkorange";
			break;
		default:
			return; 
	}
	return;
}
/*************************************/
function bkmNav()
{
	this.max = new Number(6);
	this.rub = new Number(0);
	this.srub = new Number(0);

	this.init= function(n)
	{
		this.rub=n;
		this.srub=0;
		alert(this.rub);
	}

	this.setRub=function(n)
	{
		this.init(n);
	}

	this.nextRub=function()
	{
		if(this.rub<(this.max-1))
			this.rub++;
	}

	this.previousRub=function()
	{
		if(this.rub>=1)
			this.rub--;
	}

	return this;
}
/*************************************/
var bNav = new bkmNav();
/*************************************/
function swapNav(id,vis)
{
	if(currentRub!=id)
	{
		if( vis==true) 
		{
			document.getElementById('navItem'+id).className='navon';
			document.images["nav_"+id].src = "img/nav/nav"+id+"_1.gif";
		}
		else
		{
			document.images["nav_"+id].src = "img/nav/nav"+id+"_0.gif";
			document.getElementById('navItem'+id).className='nav';
		}
	}
	return;
}

function swapSnav(id,vis)
{
//	alert(oSMenu);
	if(oSLevel!=id)
	{
		if( vis==true) 
		{
			document.images["simg_"+id].src = "img/nav/snav_1.gif";
			document.getElementById("smenu_"+id).className="snavlinkover";
//			alert(document.getElementById("smenu_"+id).className);
		}
		else
		{
			document.images["simg_"+id].src = "img/nav/snav_0.gif";
			document.getElementById("smenu_"+id).className="snavlink";
		}
	}
	return;
}

function accWin(url,n,w,h)
{
	if(document.all)
	{
		var winY = self.screenTop;
		var winX = self.screenLeft;
		var winW = self.document.body.offsetWidth;
	}
	else
	{
		var winY = self.screenY ;
		var winX = self.screenX ;
		var winW = self.innerWidth ;
	}
	var posY = winY+90;
	var posX = Math.round(winX+ winW/2-w/2);
	var w = window.open(url,n,"width="+w+",height="+h+",scrollbars=no,top="+posY+",left="+posX);
}


function oWin(url,n,w,h)
{
	if(document.all)
	{
		var winY = self.screenTop;
		var winX = self.screenLeft;
		var winW = self.document.body.offsetWidth;
	}
	else
	{
		var winY = self.screenY ;
		var winX = self.screenX ;
		var winW = self.innerWidth ;
	}
	var posY = winY+90;
	var posX = Math.round(winX+ winW/2-w/2);
	var w = window.open(url,n,"width="+w+",height="+h+",scrollbars=no,top="+posY+",left="+posX);
}

/*************************************/

function popInfo(n)
{
	this.x = new Number(0);
	this.y = new Number(0);
	this.vis = new Boolean(false);
	this.name = new String(n);
	this.obj; // le calque d'affichage

	this.init = function(d)
	{
		this.obj = d;
		if(document.all)
			self.document.body.onmousemove=grabMouse;
		else
			self.onmousemove=grabMouse;
		this.hide();
	}

	this.write = function(txt)
	{
		if(this.vis == false)
		{
			if(document.getElementById(this.obj))
				document.getElementById(this.obj).innerHTML= "<table border='0' height='100%' cellpadding='0' cellspacing='0' background='img/bg/bg_info.gif'><tr><td valign='top'>&nbsp;"+txt+"&nbsp;</td></tr></table>";
			this.show();
		}
		return;
	}
	
	this.move = function()
	{

		if(document.getElementById(this.obj))
		{
			document.getElementById(this.obj).style.left = x+"px";
			document.getElementById(this.obj).style.top = y+"px";
		}

	}


	this.show = function()
	{
		window.status = "show";
		this.move();
		this.vis = true;
		if(document.getElementById(this.obj))
			document.getElementById(this.obj).style.display = 'block';
	}

	this.hide = function()
	{
		if(document.getElementById(this.obj))
			document.getElementById(this.obj).style.display = 'none';
		this.vis = false;
	}

//	this.grabMouse = _grabMouse;

}

var x=0;
var y=0;

function grabMouse(evt)
{
	var str="";
	if(document.all)
	{
		x = top.event.clientX+15;
		y = top.event.clientY-15;
	}
	else
	{
		x = evt.clientX+15;
		y = evt.clientY-15;
	}
	if(isNaN(x))
		x=0;
	if(isNaN(y))
		y=0;
//	window.status = x+" "+y;
	if(bInfo.vis==true)
	{
		bInfo.move();
	}
	return evt;
}

/*************************************/
var bInfo = new popInfo("bInfo");
/*************************************/
function resizeAll(evt)
{
	if(self.document.body.offsetWidth%2==1)
		self.resizeBy(-1,0);
}


