// ==================================================================
// CN dhtml menu
// intellia/laurent vitalis
// Modified  for the  CN Web site  redesign 2001 by  Kevin Dineen, CN  2001/01/12  
// Modified for the Domino platform by Martin Bergeron, CN 2001/01/26
// ==================================================================

function init()
	{
	init_layer("sections","sub1","sub2","sub3","sub4");
	sections.show();
	}

subwindows = new Array()
subwindows[1] = new Array(0,0,0,0)
subwindows[2] = new Array(0,0,0,0,0)
subwindows[3] = new Array(0,0,0,0)
subwindows[4] = new Array(0,0,0)

speed = 100;

wait = 0;
waitb = 0;

// ==================================================================

function over(id)
	{
	if(arguments.length==1)
		{	
		for(i=1;i<5;i++)
			{
			if(i!=id) eval("sub" + i + ".hide();");
			}
		eval("sub" + id + ".show()");
		wait = 1;
		}
		
	if(arguments.length==2)
		{
		wait = 1;
		eval("sub" + id + ".document.bt" + id + "_" + arguments[1] + ".src =\"/"+ db_name + "img/$file/" + language + "_sh_" + id + "_" + arguments[1] + "_ro.gif\"");
		if(subwindows[id][arguments[1]])
			{
			eval("sub" + id + arguments[1] + ".show()");
			waitb = 1;
			}
		}

	if(arguments.length==3)
		{
		eval("sub" + id + ".document.bt" + id + "_" + arguments[1] + ".src =\"/"+ db_name + "img/$file/" + language + "_sh_" + id + "_" + arguments[1] + "_ro.gif\"");
		eval("sub" + id + arguments[1] + ".document.bt" + id + "_" + arguments[1] + "_" + arguments[2] + ".src =\"/"+ db_name + "img/$file/" + language + "_sh_" + id + "_" + arguments[1] + "_" + arguments[2] + "_ro.gif\"");
		wait = 1;
		waitb = 1;
		}
	}

// ==================================================================

function out(id)
	{
	if(arguments.length==1)
		{
		eval("delay" + id + " = setTimeout('close_section(" + id + ");',speed)");
		wait = 0;
		}
	if(arguments.length==2)
		{
		eval("sub" + id + ".document.bt" + id + "_" + arguments[1] + ".src =\"/"+ db_name + "img/$file/" + language + "_sh_" + id + "_" + arguments[1] + "_of.gif\"");
		if(subwindows[id][arguments[1]])
			{
			eval("delay" + id + arguments[1] + " = setTimeout('close_subsection(" + id + "," + arguments[1] + ");',speed)");
			}
		eval("delay" + id + " = setTimeout('close_section(" + id + ");',speed)");
		wait = 0;
		waitb = 0;
		}
	if(arguments.length==3)
		{
		eval("sub" + id + arguments[1] + ".document.bt" + id + "_" + arguments[1] + "_" + arguments[2] + ".src =\"/"+ db_name + "img/$file/" + language + "_sh_" + id + "_" + arguments[1] + "_" + arguments[2] + "_of.gif\"");
		eval("delay" + id + " = setTimeout('close_section(" + id + ");',speed)");
		eval("delay" + id + arguments[1] + " = setTimeout('close_subsection(" + id + "," + arguments[1] + ");',speed)");
		wait = 0;
		waitb = 0;
		}
	}

// ==================================================================

function close_section(sec)
	{
	if(!wait)
		{
		eval("sub" + sec + ".hide();");
		}
	}

function close_subsection(sec,sub)
	{
	if(!waitb)
		{
		eval("sub" + sec + sub + ".hide();");
		eval("sub" + sec + ".document.bt" + sec + "_" + sub + ".src =\"/"+ db_name + "img/$file/" + language + "_sh_" + sec + "_" + sub + "_of.gif\"");
		}
	}

// ==================================================================
// cross browser dhtml library
// intellia/laurent vitalis
//
// set_x(x)                           change the horizontal position to x
// set_y(y)                           change the vertical position to y
// set_z(z)                           change the z-axis position to z
// set_visibility(bool)               change the visibility
//
// show()                             show the layer
// hide()                             hide the layer
//
// get_x()                            returns the horizontal position
// get_y()                            returns the vertical position
// get_visibility()                   returns the visibility status
// get_width()                        returns the content width
// get_height()                       returns the content height
//
// html(content)                      change the content of the layer
//
// get_screen_width()                 returns the screen width
//
// ==================================================================

function init_layer()
	{
	for(l=0;l<arguments.length;l++)
		{
		if(document.layers)
			{
			eval(arguments[l] + "=document." + arguments[l]);
			}
		eval("div = " + arguments[l]);
		div.set_x = set_x;
		div.set_y = set_y;
		div.set_z = set_z;
		div.set_visibility = set_visibility;

		div.show = show;
		div.hide = hide;

		div.get_x = get_x;
		div.get_y = get_y;
		div.get_visibility = get_visibility;
		div.get_height = get_height;
		div.get_width = get_width;

		div.html = html;
		}
	}

function set_x(x)
	{
	if(document.layers)	this.left = x;
	else 				this.style.pixelLeft = x;
	}

function set_y(y)
	{
	if(document.layers) this.top = y;
	else 				this.style.pixelTop = y;
	}

function set_z(z)
	{
	if(document.layers) this.zIndex = z;
	else 				this.style.zIndex = z;
	}

function get_x()
	{
	return (document.layers) ? this.left : this.style.pixelLeft;
	}

function get_y()
	{
	if(document.layers) return(this.top);
	else 				return(this.style.pixelTop);
	}

function show()
	{
	if(document.layers) this.visibility="visible";
	else 				this.style.visibility="visible";
	}

function hide()
	{
	if(document.layers) this.visibility="hidden";
	else 				this.style.visibility="hidden";
	}

function move(xa,ya,xb,yb,step,steps)
	{
	this.sety(ya-(step*(ya-yb))/steps);
	this.setx(xa-(step*(xa-xb))/steps);
	}

function get_height()
	{
	if(document.layers)	return this.document.height;
	else 				return this.scrollHeight;
	}

function get_width()
	{
	if(document.layers)	return this.document.width;
	else 				return this.scrollWidth;
	}

function html(content)
	{
	if(document.layers)
		{
		this.document.open();
		this.document.write(content);
		this.document.close();
		}
	else
		{
		this.innerHTML = content;
		}
	}

function get_visibility()
	{
	if(document.layers) result = (this.visibility=="show") ? 1 : 0;
	else 				result = (this.style.visibility == "visible") ? 1 : 0;
	return result
	}

function set_visibility(status)
	{
	if(document.layers) this.visibility = (status) ? "show" : "hide";
	else				this.visibility = (status) ? "visible" : "hidden";
	}

function get_screen_width()
	{
	return (document.layers) ? innerWidth : document.body.clientWidth;
	}
