//Menu Script
	//On Mouse Over change color
function activeCol(docId, style)
{
	toChange=document.getElementById(docId);
	toChange.className = style;
}
// Change color back
function offColor(docId, style) 
{
	toChange=document.getElementById(docId);
	toChange.className = style;
}
// Link URL
function goTo(url) 
{
	window.location = url
}
//Open the menu
function animateOpen( cId, totHeight )
	{
	   	var toExpand = document.getElementById( cId );
		var curHeight = toExpand.style.height == '' ? 0 : parseInt( toExpand.style.height );
		toExpand.style.height = curHeight + 3 + "px";
			if (toExpand.isOpen) // Check to see if it is open already.
			{
				if ( curHeight + 3 < totHeight )
				   setTimeout( 'animateOpen( "' + cId + '", ' + totHeight + ' );', 30 );
			}
	}
//Close the menu
function animateClose( cId )
{
   var toExpand = document.getElementById( cId );
	var curHeight = parseInt( toExpand.style.height );
	toExpand.style.height = curHeight - 3 + "px";

	if (!toExpand.isOpen) //Check to see if it is closed.
	{
		if ( curHeight - 3 >= 0 )
	   		setTimeout( 'animateClose( "' + cId + '" );', 30 );
		if (curHeight - 3 <= 3)
			{
			toExpand.style.display = 'none';
			}
	}
	
}
//Set Variables for expanding the menu

function menuExpand(cId, subCount)
{			
		var toExpand = document.getElementById( cId ); // the element to expand
		toExpand.isOpen = true;			
		var totHeight = subCount * 16; // 16px per subelement
			setTimeout( 'animateOpen( "' + cId + '", ' + totHeight + ' );', 30 );
			toExpand.style.display = 'block';
}
//Set Variables to Collapse Menu
function menuCollapse( cId )
{
	var toExpand = document.getElementById( cId ); // the element to expand
	toExpand.isOpen = false;
	setTimeout( 'animateClose( "' + cId + '" );', 30 );
	//toExpand.style.display = 'none';

}
//Main Function for Opening and Closing Menus
function menuToggle(cId, subCount, isOpen)
{
	toExpand = document.getElementById( cId );
	if (!toExpand.isOpen)
		{
		menuExpand( cId, subCount );
		}
	else
		{
			menuCollapse( cId );
		}
}
function logInToggle( cId, pId )
{
	toExpand = document.getElementById( cId );
	if (!toExpand.isOpen)
		{
			logInExpand( cId, pId );
			toGetFocus = document.getElementById('user');
			toGetFocus.focus();
		}
	else
		{
			logInCollapse( cId, pId );
		}
}
//Set Variables for expanding the menu
function logInExpand(id, pId)
{			
		var toExpand = document.getElementById( id ); // the element to expand
		toExpand.isOpen = true;			
		var totHeight = 25; // 16px per subelement
			setTimeout( 'animateOpen( "' + id + '", ' + totHeight + ' );', 30 );
			toExpand.style.display = 'block';
		linkText = document.getElementById(pId)
		linkText.innerHTML = "Close"
			
}
function logInCollapse( id, pId )
{
	var toExpand = document.getElementById( id ); // the element to expand
	toExpand.isOpen = false;
	setTimeout( 'animateClose( "' + id + '" );', 30 );
	//toExpand.style.display = 'none';
	linkText = document.getElementById(pId)
	linkText.innerHTML = "Log In"
}
