//begin for the menu
var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;
var timeout = 0;
var timeoutArray = new Array();
var menuArray = new Array();
var childOffsetTop = 0;
//end for the menu


function rollover(whichimg,overimg)
{
	eval('document.images["' + whichimg + '"].src = "' + overimg + '"');
}
function openMediaPlayer(url)
{
	win = window.open(url, "krMediaPlayer", "width=395,height=400,toolbar=no,menubar=no,statusbar=no,scrolling=no,resizable=no",true);
	win.focus();
}
function getSource()
{
	return '<img src=\"images/home_pic' + getRandom() + '.jpg\" height=\"115\" width=\"351\"/>'
}
function getRandom() 
{
	return Math.floor(Math.random() * 5) + 1;
}
function openWindow(gohere)
{
	window.open(gohere,"window1",config="width=700,height=400,resizable=yes,toolbar=yes,scrollbars=yes,menubar=yes,location=no,top=0,left=0");
}

function openDialog(gohere)
{
	window.open(gohere,"window1",config="width=700,height=400,resizable=yes,toolbar=no,scrollbars=yes,menubar=yes,location=no,top=0,left=0");
}

function openTaleoDialog(gohere)
{
	window.open(gohere,"window1",config="width=800,height=600,resizable=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,top=0,left=0");
}

function openPrintable(gohere)
{
	window.open(gohere,"print",config="width=700,height=400,resizable=yes,toolbar=no,scrollbars=yes,menubar=yes,top=0,left=0");
}
function show(id)
{
	clearTimeout(timeout);					
	hideAll();	
	
	if (ns4) document.layers[id].visibility = "show"
	else if (ie4) document.all[id].style.visibility = "visible"
	else if(!document.all && document.getElementById) document.getElementById(id).style.visibility = "visible"	
	
	menuArray[menuArray.length] = id;	
}
function ShowMidSubMenu(id, parent)
{		
	child = document.getElementById(id);
	if(childOffsetTop == 0)
	{
		childOffsetTop = child.offsetTop;			
	}	
	if(ie4)
		child.style.top  = childOffsetTop - child.offsetHeight + 2;
	else
		child.style.top = childOffsetTop  - (child.offsetHeight + 20);
	show(id);
}
function ActiveTab(id)
{	
	parentDiv = document.getElementById(id);
	if(parentDiv != null)
	{		
		parentDiv.className = "ActiveTopMenuClass";	
	}
}
function DeactiveTab(id)
{
	parentDiv = document.getElementById(id);
	if(parentDiv != null)
	{
		parentDiv.className = "TopMenuClass";
	}
}
function hideAll()
{
	for (var i=0;i<menuArray.length;i++)
		{
		var arrayString = new String(menuArray[i]);
		if (arrayString == "undefined") continue;
		
		hide2(menuArray[i]);
	}
	menuArray = new Array();
}
function hide(id)
{	
	timeout = setTimeout("hide2('" + id + "')", 100);
}
function hide2(id)
{			
	if (ns4) document.layers[id].visibility = "hide"
	else if (ie4) document.all[id].style.visibility = "hidden"
	else if(!document.all && document.getElementById) document.getElementById(id).style.visibility = "hidden"	
}
function OnMenuMouseOver(id)
{
	ActiveTab("cell" + id);
	ActiveTab("menu" + id);
}
function OnMenuMouseOut(id)
{
	DeactiveTab("cell" + id);
	DeactiveTab("menu" + id);
}
function ShowSubMenu(id)
{
	var menuTimeout = timeoutArray[id];
	if(menuTimeout != null)
	{
		clearTimeout(menuTimeout);
	}
	show("div" + id)
	ActiveTab("cell" + id);
	ActiveTab("menu" + id);
}
function HideSubMenu(id)
{
	hide("div" + id);
	timeoutArray[id] = setTimeout("HideMenu('" + id + "')", 100);
}
function HideMenu(id)
{
	DeactiveTab("cell" + id);
	DeactiveTab("menu" + id);
}
document.onclick = hideAll;