var gTop	= 0;
var gRight	= 0;
var gBottom	= 100;
var gLeft	= 0;

var currentMenu = "";

var timers	= new Array();
var sliders	= new Array();
var slideTimers	= new Array();

function showMenu(menuID)
{	
        if(currentMenu != menuID && currentMenu != "")
	{
                clearTimeout(timers[currentMenu]);
                hideMenu(currentMenu);
        }

        if(timers[menuID] > 0)
	{
                clearTimeout(timers[menuID]);
        }

        obj = document.getElementById('menu' + menuID);
	// setClip(obj, gTop, 0, gBottom, gLeft);
        obj.style.display = 'block';

        hobj = document.getElementById('cat' + menuID);
        hobj.className = 'toptextover';
	
	if(currentMenu != menuID)
	{
		clearTimeout(slideTimers[currentMenu]);
		sliders[menuID] = 0;
		sliders[currentMenu] = 0;
		slideTimers[menuID] = setInterval("setClip(document.getElementById(\"menu" + menuID + "\"), gTop, sliders[currentMenu], gBottom, gLeft)", 5);
	}
        currentMenu = menuID;
}

function hideTimer(menuID)
{
        hide = setTimeout("hideMenu('" + menuID + "')", 900);
        timers[menuID] = hide;
}

function hideElement(menuID)
{
        obj = document.getElementById('menu' + menuID);
        obj.style.display = 'none';
	setClip(obj, gTop, 0, gBottom, gLeft);
        hobj = document.getElementById('cat' + menuID);
        hobj.className = 'toptext';
}

function hideMenu(menuID)
{
        timers[menuID] = -1;
        
	clearTimeout(slideTimers[menuID]);
	sliders[menuID] = 0;
	
        hideElement(menuID);
        currentMenu = "";
}

function setClip(obj, top, right, bottom, left)
{	
	if(right < 110)
	{
		if(document.getElementById || document.all)
		{	
			obj.style.clip = "rect(" + top +"%, " + right + "%, " + bottom + "%, " + left + "%)";
		}
		else
		{
			obj.style.clip.left = left;
			obj.style.clip.right = right;
			obj.style.clip.top = top;
			obj.style.clip.bottom = bottom;
		}		
		sliders[currentMenu] = sliders[currentMenu] + Math.floor(5-3*(sliders[currentMenu]/100));		
	}
	else
	{
		clearInterval(slideTimers[currentMenu]);
	}	
}

function showDate() {

			var months=new Array(12);
			
			months[0]  = "January";
			months[1]  = "February";
			months[2]  = "March";
			months[3]  = "April";
			months[4]  = "May";
			months[5]  = "June";
			months[6]  = "July";
			months[7]  = "August";
			months[8]  = "September";
			months[9]  = "October";
			months[10] = "November";
			months[11] = "December";
	
			var time  = new Date();
			var month = months[time.getMonth()];
			var date  = time.getDate();
			var year  = time.getFullYear();
		
			document.write(month + " " + date + ", " + year);
			
}
