// Purpose : Swap buttons in the frame "buttons".
function PressButton( sButtonName )
{ 
  var images = top.buttons.document.images
	for ( var i = 0; i < top.arrMenuItems.length; i++ ) 
	{
		if ( top.arrMenuItems[i][0] == sButtonName )
		{
			if (images)
			{
				images[i].src = top.arrMenuItems[i][3]
			}
			top.pressedItem = i
		}
		else 
		{
			if (images)
			{
				images[i].src = top.arrMenuItems[i][2]
			}
		}
	}
	return true
}
//Swap images on LeftNav frame
function onPressLeftNav( nButton ) 
{
	
	var images = top.contents.document.images
	var pressedPrevious = top.pressedLeftNav
	if ( pressedPrevious < top.arrLeftNavItems.length )
	{
		if (images)
		{
			images[pressedPrevious].src = top.arrLeftNavItems[pressedPrevious][2]
		}
	}
	if (images)
	{
		images[nButton].src = top.arrLeftNavItems[nButton][3]
	}
	top.pressedLeftNav = nButton	
	return true
}
function onPressButton( nButton, site_code ) 
{ 
	var images = top.buttons.document.images;
	var button_pressed = top.arrMenuItems[nButton][0];
	
	if (images)
	{
		images[nButton].src = top.arrMenuItems[nButton][3];
		images[top.pressedItem].src = top.arrMenuItems[top.pressedItem][2];
	}		
		
	top.pressedItem = nButton;
	site_code = site_code.toUpperCase();
	if( site_code == 'DISCOVER')
	{
		ReleaseLeftNavButton()
	}	
	
	if( button_pressed == 'LOGOUT')
	{
	    var ClientDate = new Date();
        var m, d, y;
        var hh, mi, ss;
		var dt, tm;

        if(ClientDate.getDate() < 10)
                d = "0" + ClientDate.getDate();
        else
                d = ClientDate.getDate();

        m = ClientDate.getMonth()+1;
        if(m < 10)
                m = "0" + m;

        y = ClientDate.getFullYear();

        if(ClientDate.getHours() < 10)
                hh = "0" + ClientDate.getHours();
        else
                hh = ClientDate.getHours();

        if(ClientDate.getMinutes() < 10)
                mi = "0" + ClientDate.getMinutes();
        else
                mi = ClientDate.getMinutes();

        if(ClientDate.getSeconds() < 10)
                ss = "0" + ClientDate.getSeconds();
        else
                ss = ClientDate.getSeconds();

        dt = d + "/" + m  + "/" + y;
		tm = hh + ":" + mi + ":" + ss;
		parent.frames[parent.frames.length - 1].location.href = "../../Pages/Asp/Logout.asp?DateOut=" + escape(dt) + "&TimeOut=" + escape(tm);
	}
	else
	{
		parent.frames[parent.frames.length - 1].location.href = top.arrMenuItems[nButton][1];
	}	
}
// Purpose : Swap buttons in the frame "buttons".
function ReleaseLeftNavButton()
{ 
	var images = top.contents.document.images

	var pressedPrevious = top.pressedLeftNav
	if ( pressedPrevious < top.arrLeftNavItems.length )
	{
		if (images)
		{	
			images[pressedPrevious].src = top.arrLeftNavItems[pressedPrevious][2]
		}
	}
	top.pressedLeftNav = 10
}
