
function over(imName, imAct) { /* a function to swap images */
    myIm = document.getElementById(imName);
    newIm = eval(imName + imAct);
    myIm.src = newIm.src;
}

function changeClass(obj,dir,cl) { 
/* change the class either by adding [dir == 1] or taking away 'Hov' [dir ==2]
if dir = 0 just change to new class name cl, otherwise cl isn't passed */
    if (obj != null || dir != null) { 
        var end = obj.className.substr(obj.className.length-3, obj.className.length-1);
        if (dir == 1 && end != 'Hov') { /* add 'Hov' to the end */
            obj.className = obj.className + 'Hov';
        } else if (dir == 2 && end == 'Hov') { /* strip off last 3 chars 'Hov' */
            obj.className = obj.className.substr(0,obj.className.length-3);
        } else if  (dir == 0) { 
            myObj = document.getElementById(obj);
            myObj.className = cl;
        }
    }
}

/* sub nav div's get hidden 1/3 of a sec after you roll off */
var timerID = false;
function startTimer() { 
	stopTimer();
	timerID = setTimeout("showSubNav(0,0)", 500);
}
function stopTimer() { 
	clearTimeout(timerID);
}
function showSubNav(num) { /* show and hide our sub nav piece */
    subNav(num);
    if (num == 0) { document.getElementById('subNav').style.visibility = 'hidden'; }
    else { document.getElementById('subNav').style.visibility = 'visible'; }
}

/* a few variables/functions that are used in multiple spots */
var aStuff = ' onmouseover="changeClass(this.parentNode,1);" onmouseout="changeClass(this.parentNode,2);"';
var liSubStuff = ' class="subNavLi" onmouseover="changeClass(this,1);" onmouseout="changeClass(this,2);"'
function subNav(num) { 
    if (num != 0) {
    var subNavText = '';
    var minWidth = 1; /* minumum width for the drop down, controlled by a spacer image, get width by category image */
        subNavText = subNavText + '<ul>';
        if (num == 1) { 
            subNavText = subNavText + '<li' + liSubStuff + ' onclick="location.href=\'http://www.healthpointpa.com/category/category/hottopic/\';"><a href="http://www.healthpointpa.com/category/category/hottopic/"' + aStuff + '>Hot Topics</a></li>';
            subNavText = subNavText + '<li' + liSubStuff + ' onclick="location.href=\'http://www.healthpointpa.com/category/news/pa-budget-news/\';"><a href="http://www.healthpointpa.com/category/news/pa-budget-news/"' + aStuff + '>Budget News</a></li>';
            subNavLeft = '122px';
            minWidth = 104; /* image width - padding */
        }
        if (num == 2) { 
            subNavText = subNavText + '<li' + liSubStuff + ' onclick="location.href=\'http://www.healthpointpa.com/category/issues/access-issues/\';"><a href="http://www.healthpointpa.com/category/issues/access-issues/"' + aStuff + '>Access</a></li>';
            subNavText = subNavText + '<li' + liSubStuff + ' onclick="location.href=\'http://www.healthpointpa.com/category/issues/prevention-issues/\';"><a href="http://www.healthpointpa.com/category/issues/prevention-issues/"' + aStuff + '>Prevention</a></li>';
            subNavText = subNavText + '<li' + liSubStuff + ' onclick="location.href=\'http://www.healthpointpa.com/category/issues/research-issues/\';"><a href="http://www.healthpointpa.com/category/issues/research-issues/"' + aStuff + '>Research</a></li>';
            subNavText = subNavText + '<li' + liSubStuff + ' onclick="location.href=\'http://www.healthpointpa.com/category/issues/treatments-issues/\';"><a href="http://www.healthpointpa.com/category/issues/treatments-issues/"' + aStuff + '>Treatments</a></li>';
			subNavLeft = '276px';
            minWidth = 80; /* image width - padding */
        }
        if (num == 3) { 
            subNavText = subNavText + '<li' + liSubStuff + ' onclick="location.href=\'http://www.healthpointpa.com/category/state-gov/legislation-state-gov/\';"><a href="http://www.healthpointpa.com/category/state-gov/legislation-state-gov/"' + aStuff + '>State Legislation</a></li>';
            subNavText = subNavText + '<li' + liSubStuff + ' onclick="location.href=\'http://www.healthpointpa.com/category/state-gov/state-agency-action/\';"><a href="http://www.healthpointpa.com/category/state-gov/state-agency-action/"' + aStuff + '>State Agency Action</a></li>';
            subNavText = subNavText + '<li' + liSubStuff + ' onclick="location.href=\'http://www.healthpointpa.com/category/state-gov/regulation-state-gov/\';"><a href="http://www.healthpointpa.com/category/state-gov/regulation-state-gov/"' + aStuff + '>State Regulation</a></li>';
            subNavText = subNavText + '<li' + liSubStuff + ' onclick="location.href=\'http://www.healthpointpa.com/category/state-gov/state-gov-wrapup/\';"><a href="http://www.healthpointpa.com/category/state-gov/state-gov-wrapup/"' + aStuff + '>Capitol Weekly Wrap</a></li>';
            subNavText = subNavText + '<li' + liSubStuff + ' onclick="location.href=\'http://www.healthpointpa.com/category/state-gov/philly-flavor-state-gov/\';"><a href="http://www.healthpointpa.com/category/state-gov/philly-flavor-state-gov/"' + aStuff + '>Philly Flavor</a></li>';
            subNavText = subNavText + '<li' + liSubStuff + ' onclick="location.href=\'http://www.healthpointpa.com/category/state-gov/federal-watch-state-gov/\';"><a href="http://www.healthpointpa.com/category/state-gov/federal-watch-state-gov/"' + aStuff + '>Federal Watch</a></li>';
            subNavLeft = '346px';
            minWidth = 100; /* image width - padding */
        }
        subNavText = subNavText + '<img src="http://www.healthpointpa.com/images/spacer.gif" width="' + minWidth + '" height="1" alt="" border="0" style="height: 1;" /></ul>';
        document.getElementById('subNav').style.left = subNavLeft;
    } else { subNavText = ' '; }
    document.getElementById('subNav').innerHTML = subNavText;
}