/* Drop-down Navigation
---------------------------------------------------------- */
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); 

/* Initialize Functions on window.onload Event
---------------------------------------------------------- */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

/* Drop Down List navigation
    (used by the global locations list in the header)
---------------------------------------------------------- */
function goto_dropdown_selection(entered) {
	with (entered) 	{
  	ref = options[selectedIndex].value; 
  	splitcharacter = ref.lastIndexOf("&"); 

	  if (splitcharacter != -1) {
  	  loc = ref.substring(0, splitcharacter); 
  	  target = ref.substring(splitcharacter + 1, 1000).toLowerCase();
	  }
    else {
      loc = ref;
      target = "_self";
      }

  	lowloc = loc.toLowerCase();
  	
  	if (lowloc == "false" || lowloc == "") {
	    return;
	    }
	  else if (target == "_self") {
  	  document.location = loc;
	    } 
	  else if (target == "_top") {
  	  top.location=loc;
	    } 
	  else if (target == "_blank") {
  	  window.open(loc);
	    } 
	  else if (target == "_parent") {
  	  parent.location = loc;
	    }
	  else {
  	  parent.frames[target].location = loc;
	    } 
	  }
	}	
	
/* Legacy Spawn Window 
---------------------------------------------------------------------- */
	
var spawnWin = null
var winCount = 0
var winName = "spawnWin"

function openSpawn(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
	var d_winLeft = 20
	var d_winTop = 20 
	winName = "spawnWin" + winCount++ 
	closePopWin()
	if (openSpawn.arguments.length>= 4)
		winFeatures = "," + winFeatures
	else
		winFeatures = ""
	if (openSpawn.arguments.length == 6)
		winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
	else
		winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
		spawnWin = window.open(winURL, winName, "width=" + winWidth + ",height=" + winHeight + winFeatures)
	self.name = "parent"
}

/* Win Features
toolbar,scrollbars,location,statusbar,menubar,resizable
*/

function closePopWin(){
	if (navigator.appName != "Microsoft Internet Explorer" || parseInt(navigator.appVersion)>=4) 
	if (spawnWin != null) if(!spawnWin.closed) spawnWin.close()
}

function getLocation(winWidth, winHeight, winLeft, winTop){
	return ""
}

function getLocation(winWidth, winHeight, winLeft, winTop){
	var winLocation = ""
	if (winLeft < 0) winLeft = screen.width - winWidth + winLeft
	if (winTop < 0) winTop = screen.height - winHeight + winTop
	if (winTop == "cen") winTop = (screen.height - winHeight)/2
	if (winLeft == "cen") winLeft = (screen.width - winWidth)/2
	if (winLeft>0 & winTop>0) winLocation =  ",screenX=" + winLeft + ",left=" + winLeft + ",screenY=" + winTop + ",top=" + winTop
	else winLocation = ""
	return winLocation
}

