
// framebuster
if (window!= top)top.location.href=location.href;

// getElementById
function getEl(el){
  return document.getElementById(el);
};

//top nav
var active;
var activeMenu;
active = function(id) {
var nav = document.getElementById(id);
if (!nav){ return;}
var e = nav.getElementsByTagName("li");
for (var i=0; i<e.length; i++) {
	e[i].onmouseover=function() {
     if (activeMenu){activeMenu.onmouseout();}
     activeMenu = this;
		this.className+=" active";}
	e[i].onmouseout=function() {
		this.className=this.className.replace(/active/g, '');}
	}
	navFocus(id,true);
};

//focus nav on tab
var navFocus;
navFocus = function(id,mouseOverMenu){
 var subnav = document.getElementById(id);
  if (!subnav){return;}  
  var list = subnav.getElementsByTagName("a");
  for (var i = 0; i < list.length; i++){
     var e = list[i];
     if (e.parentNode.parentNode.id == id){
	  if (mouseOverMenu){
	    e.onfocus = function(){this.parentNode.onmouseover();}
	  }
	  else {
	    e.onfocus = function(){this.parentNode.onclick();}
	  }
     }
   }
if (list.length == 0){return;}
  var lastSub = list[list.length-1];
  if (lastSub.parentNode.parentNode.id == id){return;}
   lastSub.onblur = function(){
    this.parentNode.parentNode.parentNode.onmouseout();
   }
};


//DOM loader
function init() {
	if (arguments.callee.done) return;
	arguments.callee.done = true;		
	if (getEl('navigation'))active('nav');		
	if (getEl('navigationhomepage'))active('nav');		
};

/*@end @*/
window.onload = init;
