var menuDropped=null;
var menuTimeOut=null;
var picWidth=120;
var leftspacing=120;
var BarTemp = null;

if (screen.width>1000) leftspacing=280;

function menuGetItem(obj) {
	if (obj.all)                              return obj.all.tags('div')[0];
	if (obj.getElementsByTagName) return obj.getElementsByTagName('div')[0];
}

function menuItemOver(obj) {
	obj=menuGetItem(obj);
	menuCancelTimeOut();
	obj.className="menuItemOver";
	window.status=obj.title;
}
function menuItemOut(obj) {
	obj=menuGetItem(obj);
	menuPullUpTimeOut();
	obj.className="menuItem";
	window.status="";
}
function menuBarOver(obj) {
	obj.className="menuBarOver";
	window.status=obj.title;
}

function menuBarOut(obj) {
	if (!menuDropped) obj.className="Bar"; else BarTemp=obj;
	window.status="";
}

function menuBarClick(obj) {
	if (obj.className!='menuBarOver') exit;
	if (obj.href) document.location=obj.href;
	if (obj.getAttribute('href')) document.location=obj.getAttribute('href');
}
function menuItemClick(obj) {
	obj=menuGetItem(obj);
	menuCancelTimeOut();
	menuPullUp();
	if (obj.href) document.location=obj.href;
	if (obj.getAttribute('href')) document.location=obj.getAttribute('href');
}
function menuDropDown(obj) {
	//menuCancelTimeOut();
	//obj=menuGetItem(obj);
	//if (menuDropped!=obj) menuPullUp();
	//obj.style.display="block";
	//menuDropped=obj;
}
function menuPullUp() {
	if (menuDropped) menuDropped.style.display="none";
	menuDropped=null;
	if (BarTemp) BarTemp.className="Bar";
	BarTemp=null;
}
function menuCancelTimeOut() {
	if (menuTimeOut) {
		clearTimeout(menuTimeOut);
		menuTimeOut=null;
	}
}
function menuPullUpTimeOut()
{
	menuCancelTimeOut();
	menuTimeOut=setTimeout("menuPullUp()",100);
}
function menuBar(items) {
	document.write('<div class="menuBar"><table border="0" cellpadding="0" cellspacing="0"><tr>');
	for (var i=0;i<items.length;i++) document.write(items[i]);
	document.write('</tr></table></div><div class="menuBarContainer"></div>');
	document.onclick=menuPullUp;
}
function menuBarItem(nr,img,alt, link,items) {
	var width=(nr-1)*picWidth+leftspacing;
	if(items[0])
	{
		var rv='<td valign="top"><div class="Bar"  style="left:'+width+'" href="'+link+'" onclick="menuBarClick(this)" onmouseover="menuBarOver(this);menuDropDown(this)" onmouseout="menuBarOut(this);menuPullUpTimeOut()">'+alt+'<div  class="menuBarOut"><table border="0" cellpadding="0" cellspacing="0" width="100%">';
	}
	else
	{
		var rv='<td valign="top"><div class="Bar" style="left:'+width+'" title="'+alt+'" href="'+link+'" onmouseover="menuBarOver(this)" onmouseout="menuBarOut(this)" onclick="menuBarClick(this)">'+alt+'<div class="menuBarOut"><table border="0" cellpadding="0" cellspacing="0" width="100%">';
	}		
	for (var i=0;i<items.length;i++) rv+=items[i];
	return rv+'</table></div></div></td>';
}
function menuItem(title,href)	{
	return '<tr><td onmouseover="menuItemOver(this)" onmouseout="menuItemOut(this)" onclick="menuItemClick(this)" width="100%"><div class="menuItem" title="'+title+'" href="'+href+'">'+title+'</div></td></tr>';
}

