
var bookmark = {
  init : function (){
    if(window.sidebar || (window.opera && window.print) || document.all)
    {
      document.getElementById("bookmark").style.display = "inline";
      YAHOO.util.Event.on("bookmark", "click", bookmark.execute);
    }
  },
  execute : function (e){
    YAHOO.util.Event.preventDefault(e);
    if (window.sidebar) // firefox
    	window.sidebar.addPanel(document.title, window.location.href, "");
    else if(window.opera && window.print){ // opera
    	var elem = document.createElement('a');
    	elem.setAttribute('href',window.location.href);
    	elem.setAttribute('title',document.title);
    	elem.setAttribute('rel','sidebar');
    	elem.click();
    }
    else if(document.all)// ie
    	window.external.AddFavorite(window.location.href, document.title);
  }
}

var sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
		    selectBoxes.hide()
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
		    selectBoxes.show()
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
selectBoxes = {
    hide : function(){
        var elems = YAHOO.util.Dom.getElementsByClassName("hideOnMenu")
        for (i=0;i<elems.length;i++) {
            elems[i].style.visibility='hidden';
	    }
    },
    show : function(){
        var elems = YAHOO.util.Dom.getElementsByClassName("hideOnMenu")
        for (i=0;i<elems.length;i++) {
            elems[i].style.visibility='visible';
	    }
    }
}
if (window.attachEvent){
    //window.attachEvent is only available in IE, so
    //this won't run in firefox (where its not needed)
    YAHOO.util.Event.onAvailable("nav", sfHover);
}

YAHOO.util.Event.onAvailable("bookmark", bookmark.init);


