    
document.onmousemove = followmouse;

var xcoord, ycoord;
var currentMenu = null;

function followmouse(e)
{
	if (typeof e != "undefined")
	{
		xcoord = e.pageX;
		ycoord = e.pageY;
	}
	else if (typeof window.event !="undefined")
	{
		xcoord = truebody().scrollLeft + event.clientX
		ycoord = truebody().scrollTop+event.clientY;
		
		//xcoord = event.clientX;
		//ycoord = event.clientY;
	}	
}

function truebody()
{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function onMainNavOver(obj)
{
	obj.className += " mouseover";	
}

function onMainNavOut(obj)
{
	obj.className = "";//obj.className.replace(new RegExp(" mouseover\\b"), "");	
}

function showFloatingMenu(obj)
{
	if(currentMenu != null)
	{
		hide(currentMenu);
		currentMenu = null;
	}
		
	var x = getObj("f" + obj.id);
	if(x != null)
	{
	    x.className = "floatingmenu bordered";
	    currentMenu = x;
    	
	    x.style.left = (xcoord - 15) + "px";
	    x.style.top = (ycoord + 5) + "px";	
	}
}

function hideFloatingMenu(obj)
{
	var x = getObj("f" + obj.id);
	if(x != null)
	{	
	    x.className = "hidden";
	    currentMenu = null;
	}
}

function hide(obj)
{
	obj.className = "hidden";
}


function hideCurrentMenu()
{
	if(currentMenu != null)
	{
		hide(currentMenu);
		currentMenu = null;
	}
}

function showmenu(obj)
{
	obj.className += " mouseover";
	var ulobjs = obj.getElementsByTagName("ul");
	ulobjs[0].className += " mouseover";
}

function hidemenu(obj)
{
	//obj.className = "";
	obj.className = obj.className.replace(new RegExp(" mouseover\\b"), "");	
	var ulobjs = obj.getElementsByTagName("ul");
	ulobjs[0].className = ulobjs[0].className.replace(new RegExp(" mouseover\\b"), "");	
	//ulobjs[0].className = "";
}




var DHTML = (document.getElementById || document.all || document.layers);

function getObj(name)
{
    if (document.getElementById)
    {
        return document.getElementById(name);
	    //this.obj = document.getElementById(name);
	    //this.style = document.getElementById(name).style;
    }
    else if (document.all)
    {
        return document.all[name];
	    //this.obj = document.all[name];
	    //this.style = document.all[name].style;
    }
    else if (document.layers)
    {
        return document.layers[name];
	    //this.obj = document.layers[name];
	    //this.style = document.layers[name];
    }
}
/*
function show(name, flag)
{
	if (!DHTML) 
		return;
	
	var x = new getObj(name);
	x.style.visibility = (flag) ? 'hidden' : 'visible'
}

function moveY(name, amount)
{
	if (!DHTML) 
		return;
		
	var x = new getObj(name);
	x.style.top += amount;
}

function moveX(name, amount)
{
	if (!DHTML) 
		return;
		
	var x = new getObj(name);
	x.style.left += amount;
}

function changeCol(name, col)
{
	if (!DHTML) 
		return;
		
	var x = new getObj(name);
	x.style.color = col;
}
*/
//var iid = 0;
/*function showmenu(obj)
{
	//var x1 = findPosX(obj);
	var ulobjs = obj.getElementsByTagName("ul");
	ulobjs[0].className += " mouseover";
	//var x2 = findPosX(ulobjs[0]);
	
	//ulobjs[0].style.left = abs(x2 - x1);// + 'px';
	//alert('x ' + ulobjs[0].style.left);
	//var x = findPosX(obj);
	//ulobjs[0].style.left = x +'px';
	//iid = setInterval(movemenu(ulobjs[0],x), 1000); 
	//alert('x ' + x);
	//alert("ulobjs - " + ulobjs[0].id + " - " + ulobjs[0].style.left);
	//setTimeout('movemenu(' + ulobjs[0] + ', ' + x + ')', 4800);
	//iid = setTimeout(movemenu(ulobjs[0],x), 1000); 
//	alert("ulobjs - " + ulobjs[0].id + " - " + ulobjs[0].style.left);
//	ulobjs[0].style.left = 100;

}
*/


function movemenu(obj, endpos)
{	
	alert("endpos " + endpos);
	//alert("obj - " + obj.id + " - " + obj.style.left);
	var x = findPosX(obj);
	if(x < endpos)
	{	
		alert("x1 " + x);
		x += 1;
		obj.style.left = x + 'px';
		x = findPosX(obj);
		//setTimeout('movemenu(' + obj + ', ' + endpos + ')', 4800);	
	}
}

function mouseovermenu()
{
	this.className = "mouseover";
}

function mouseoutmenu()
{
	this.className = "";
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft;
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function getPosX(obj)
{
	if (obj.offsetParent)
		return obj.offsetLeft
	else if (obj.x)
		return obj.x;
	else
		return 0;
}

function getPosY(obj)
{
	if (obj.offsetParent)
		return obj.offsetTop
	else if (obj.y)
		return obj.y;
	else
		return 0;
}


/*
function pausecomp(millis) 
{
	date = new Date();
	var curDate = null;

	do { var curDate = new Date(); } 
	while(curDate - date < millis);
} 

var obj = null;

function changeClass1()
{
	obj = this;
	this.className = "changeclass";
	this.align = "left";
	this.color = "#FFFFFF";
	setTimeout("changeClass2()", 800);	
	this.style.backgroundImage = "none";
}

function changeClass2()
{
	obj.className = "changeclass";
	obj.align = "right";
	obj.style.backgroundImage = "none";
}
*/
