//Help IE with the menu's li:hover class
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);

//quicknav
function setNav(id,navStyle) {
    var bVersion = parseInt(navigator.appVersion);
    var bName = navigator.appName;

            if ((bName.indexOf('Netscape')>-1 &&  bVersion  >4) ||(bName.indexOf('Explorer')>-1 && bVersion >=4)){
                var myObj = document.getElementById(id);
                myObj.className=navStyle;
               }
}

//Show and hide elements
function show(id) {
     if (document.getElementById(id).style.display == 'none') {
          document.getElementById(id).style.display = '';
     }
}

function hide(id) {
          document.getElementById(id).style.display = 'none';
}

//Search the site
function goSearch() {
        
	// catch empty search
	var nonEmpty = /\w+/;
	nonEmpty.test(document.searchbox.qt.value);
	if(!nonEmpty.test(document.searchbox.qt.value)) {
	 alert('Please supply a search term.');
		 return;
	}
	// NOTE: Replace www.bu.edu/your-site-here in the declaration below
	// with the actual web address to your site
	if (document.searchbox.q[0].checked) {
	 var searchurl="http://search.bu.edu/dept/query.html?qp=url:www.bu.edu/newmedia&qt="
	+document.searchbox.qt.value+"&col=main";
		 }  
	if (document.searchbox.q[1].checked) {
	 var searchurl="http://search.bu.edu/query.html?qt="+document.searchbox.qt.value+"&col=main+briefs+searchot+faculty+bumc+internal+ece";
		 }
	if (document.searchbox.q[2].checked) {
	 var searchurl="http://www.bu.edu/phpbin/webph/index.php?search_for="+document.searchbox.qt.value;
		 }
		 window.location.href = searchurl;
		 return false;
	}