//JavaScript library for Cenetric, Inc. website...

//this function will handle the display of a submenu on the navigation bar...
function showSubMenu(mainid, subid)
{
	//first, make sure that the primary navigation button remains highlighted...
	document.getElementById(mainid).style.backgroundPosition = "left -31px";
	//document.getElementById(mainid).style.background-position-y = "-31px";
	
	//next, show the submenu itself...
	if(document.getElementById(subid).style.display='none')
	{
		document.getElementById(subid).style.display = "block";
	}
}

//hide the submenu...
function hideSubMenu(mainid, subid)
{
	//first, remove the highlight on the main navigation button...
	document.getElementById(mainid).style.backgroundPosition = "left top";
	//document.getElementById(mainid).style.background-position-y = "-31px";
	
	//next, hide the submenu itself...
	document.getElementById(subid).style.display = "none";
}

//highlight form table rows....
function highlightRow(obj) {
	document.getElementById(obj).className='highlightRow';
}

function normalRow(obj) {
	document.getElementById(obj).className='none';
}

//this function will open a centered popup window...
function winpopcenter(href, name, w, h, stat, scrl, resz) {
    var winl = (screen.width - w) / 2;
    var wint = (screen.height - h) / 2;

    window.open(href, name, 'width=' + w + ',height=' + h + ',top=' + wint + ',left=' + winl + ',status=' + stat + ',scrollbars=' + scrl + ',resizable=' + resz + '');
}

//NEW SUB-MENU NAVIGATION SCRIPTS 05/03/2009
var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;

//open hidden layer
function mopen(id) {
	//cancel close timer
	mcancelclosetime();
	
	//close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	
	//get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';
}

//close showed layer
function mclose() {
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

//go close timer
function mclosetime() {
	closetimer = window.setTimeout(mclose, timeout);
}

//cancel close timer
function mcancelclosetime() {
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

//close layer when click out
document.onclick = mclose;
