// JScript source code
//set window event handlers
window.onload = function() {
	if (navigator.appVersion.substr(17,7)=="MSIE 6.") {
		//HACK: left nav logo is not showing correctly via CSS positioning
		//so run this function to set it via script
		resetSideLogo();
	}
	//setheight();
}
window.onresize = function() 
{
	//setheight(); //NOTE: resize is causing IE to crash
	//NOTE: IE6 fires resize at least 3x (for window, HTML element & BODY element at a minimum)
}

//define functions
function closeme(objID)
{
	var curElem = document.getElementById(objID);
	curElem.style.display = "none";
	
}
function showme(objID)
{
	var curElem = document.getElementById(objID);
	curElem.style.display = "";
	
}
function popup(objID) { 
	var curElem = document.getElementById(objID);
	if(curElem) {
		var curElemParent = curElem.parentNode;
		curElemParent.className += " opened"; /*applied to li in CSS; assuming li is parent of click element*/
		curElem.style.display = "block";
		resetSideLogo();
	}
}

function unpop(objID) 
{ 
	var curElem = document.getElementById(objID);
	if(curElem) {
		var curElemParent = curElem.parentNode;
		curElemParent.className = curElemParent.className.replace("opened","");
		curElem.style.display = "none"; 
		resetSideLogo();
	}
}
function resetSideLogo()
{
	//reset logo in left nav so it stays at the bottom when content area expands
	var sideLogoObj = document.getElementById('sideLogo');
	if(sideLogoObj)
	{
		sideLogoObj.style.display = "none";
		sideLogoObj.style.display = "block";
	}
}

function toggleListItem(toggleElem,targetElemID) {
	var rootElem = document.getElementById("levelz");
	if (rootElem) {
		var arrChildDivs = rootElem.getElementsByTagName("div");
		var arrChildLinks = rootElem.getElementsByTagName("a");
		var targetElem = document.getElementById(targetElemID);
		var toggleClassName = "";
		var targetClassName = "";
		if (targetElem && toggleElem) {
			//get class names of relevant selected elements
			toggleClassName = toggleElem.className;
			targetClassName = targetElem.className;
		} else {
			//set default class names (for initial page load)
			toggleClassName = "toggle"; //must match what's in the HTML and CSS
			targetClassName = "detail"; //must match what's in the HTML and CSS
		}
		//extract only the first class name if multiple ones are specified
		if (toggleClassName.indexOf(" ") > 0) {
			toggleClassName = toggleClassName.substring(0,toggleClassName.indexOf(" "));
		}
		if (targetClassName.indexOf(" ") > 0) {
			targetClassName = targetClassName.substring(0,targetClassName.indexOf(" "));
		}
		//toggle off any content container that was previously on
		for (i=0; i<arrChildDivs.length; i++){
			if (arrChildDivs[i].className.indexOf(targetClassName) >= 0) {
				arrChildDivs[i].style.display = "none"; 
			}
		}
		//toggle on any content link that was previously off
		for (i=0; i<arrChildLinks.length; i++){
			if (arrChildLinks[i].className == toggleClassName) {
				arrChildLinks[i].style.display = "inline"; /*to match default display style*/
				resetSideLogo();
			}
			if (targetElem && toggleElem) {
				//toggle on the currently selected content and toggle off the link
				targetElem.style.display = "block"; //IE generates error for "table"
				toggleElem.style.display = "none";
			}
		}
		resetSideLogo();
	}
}

function setheight()
{
	//get HTML elements
	var contentElem = document.getElementById('logo');//change to match ID of contentArea
	var leftNavElem = null;
	if(contentElem){
	    var arrDivs = contentElem.getElementsByTagName('div');
	    for (i=0;i<arrDivs.length;i++){
				if(arrDivs[i].className){
						if(arrDivs[i].className=="secNavigation"){
							leftNavElem = arrDivs[i];
						}
					}
	     }	    	    
        if(leftNavElem){
            leftNavElem.style.height = contentElem.offsetHeight + "px";                            
        }
    }
}

function openDocument(fileName)
{	
	if(fileName != '')
		window.open(fileName);	
}

function pscPopUp() 
{
    window.open("http://www.benefitplanservices.com");
}

function ccPopUp() 
{
    window.open("http://www.balserservices.com/bmall/inet_login.cfm");
}