function getStyleObject(objectId) {
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
	return document.all(objectId).style;
   } 
   else if (document.layers && document.layers[objectId]) { 
	return document.layers[objectId];
   } else {
	return false;
   }
}

function changeObjectVisibility(objectId, newVisibility) {
    // first get the object's stylesheet
    var styleObject = getStyleObject(objectId);

    // then if we find a stylesheet, set its visibility
    // as requested
    //
    if (styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	return false;
    }
}

function toggle_window(win_id) {
	var windowBody = win_id+'_body';
	var closeBox = win_id+'_closebox';
	var styleObject = getStyleObject(windowBody);
	
	if (styleObject) {
		
		currentDisplay = styleObject.display;
		if (currentDisplay == 'none') {
			styleObject.display = 'block';
			document.getElementById(closeBox).src = 'images/collapse.gif';
			document.getElementById(closeBox).title = 'Collapse';
		} else {
			styleObject.display = 'none';
			document.getElementById(closeBox).src = 'images/expand.gif';
			document.getElementById(closeBox).title = 'Expand';
		}

		return true;
		} else {
		return false;
		}
}
	
function openPopup(theURL,winName,width,height,scrollbars,resizable) 
{
	var popupWindow;
	var openerX = 0;
	var openerY = 0;
	var openerWidth = 0;
	var openerHeight = 0;

	if( typeof(window.screenX) != 'undefined')
		{
			//Mozilla
			openerX = window.screenX;
			openerY = window.screenY;
		}
	else
		{
			//IE
			openerX = window.screenLeft;
			openerY = window.screenTop;
		}
		
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		openerWidth = window.innerWidth;
		openerHeight = window.innerHeight;
		} 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		openerWidth = document.documentElement.clientWidth;
		openerHeight = document.documentElement.clientHeight;
		} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		openerWidth = document.body.clientWidth;
		openerHeight = document.body.clientHeight;
	}
				
	var winLeft = (openerWidth - width) /2 + openerX;
	var winTop = (openerHeight - height) /2 + openerY;

	features = "width=" + width + ",height=" + height + ",left=" + winLeft + ",top=" + winTop + ",screenX=" + winLeft + ",screenY=" + winTop + ",scrollbars=" + scrollbars + ",resizable=" + resizable;
	popupWindow = window.open(theURL,winName,features);
	popupWindow.focus();
	return false;
}

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

if (window.attachEvent) window.attachEvent("onload", sfHover);