// JavaScript Document
var ie5=document.all && !window.opera
var ns6=document.getElementById

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()

function makeObj(obj,nest){
	nest=(!nest) ? "":'document.'+nest+'.'		
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;		
	return this
}

function makeFadeObj()
{
	this.obj=null;
	this.fade=0;
	this.delta_fade=0;
	this.loaded=true;
	this.max_opacity=100;
	return this;
}

function makeFadeObjHidden()
{
	this.obj=null;
	this.fade=0;
	this.delta_fade=0;
	this.loaded=false;
	this.max_opacity=100;
	return this;
}

function showmenu(menu)
{
	if (!document.all&&!document.getElementById)
		return
	menu.delta_fade=sub_menu_fade_speed;
	menu.obj.css.visibility="visible"
	return false
}

function hidemenus(){
	for (i=0;i<nb_menus;i++)
	{
		submenu[i].delta_fade=-sub_menu_fade_speed;
	}
}

if (ie5||ns6)
	document.onclick=hidemenus
	
id_navbar_min=3;
id_navbar_max=21;
function preInit()
{
	submenu=new Array();
	nb_menus=1;
	for (i=0;i<nb_menus;i++)
	{
		submenu[i]=new makeFadeObj();
	}

	navbar_obj=new Array();
	for (i=id_navbar_min;i<=id_navbar_max;i+=2)
	{
		navbar_obj[i]=new makeFadeObj();
	}
	email_obj=new makeFadeObj();
	language_obj=new makeFadeObj();
}

sFadePeriod = 20; 
fade_step=5;
display_counter=5;
initial_wait=0;

nb_hps=6;
final_opacity_submenu=80;
hp_fade_speed=9;
sub_menu_fade_speed=19;
back_fade_speed=5;

function update_fade_obj(obj)
{
	if (obj.loaded && (((obj.fade<obj.max_opacity) && (obj.delta_fade>0)) || (obj.fade>0) && (obj.delta_fade<0)))
	{
		obj.fade=obj.fade+obj.delta_fade;
		if (obj.fade<0)	obj.fade=0;
		if (obj.fade>obj.max_opacity) obj.fade=obj.max_opacity;
		if (obj.hide && (obj.fade==0) && (obj.delta_fade<0))
			obj.obj.css.visibility="hidden";
		else
			obj.obj.css.visibility = "visible";
			
		obj.obj.css.filter="alpha(opacity="+obj.fade+")";
		obj.obj.css.opacity=obj.fade/100;

		obj.loaded=true;
		
		return true;
	}
	
	return !obj.loaded;
}

fades=new Array();

function HpTimer()
{
	timer_again = false;
	for (x in fades)
	{
		timer_again = update_fade_obj(fades[x]) || timer_again;
	}

	if (timer_again)
	    tim_hp = setTimeout("HpTimer()",sFadePeriod);
}

function init_fade_obj(fade_obj,id,hide)
{
	fade_obj.obj=new makeObj(id,'');
	fade_obj.obj.css.filter="alpha(opacity=0)";
	fade_obj.obj.css.opacity=0;
	fade_obj.hide=hide;
	
	fades.push(fade_obj);
}

preInit();


