function switchSections()
{
    document.location.href = document.getElementById('siteList').options[document.getElementById('siteList').options.selectedIndex].value;
}
sfHover = function() {
    try
    {
	    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"), "");
		    }
	    }
    }
    catch(err) {}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

function setVis(id, vis, displayNone) {
    if (id != '') {
        if (displayNone == undefined || (displayNone != true && displayNone != false)) {
            displayNone = true;
        }
	    obj = MM_findObj(id);
	    if (obj == undefined) {
	        return;
	    }
	    
	    if(document.getElementById || document.all){//all the modern browsers
		    obj.style.visibility = vis ? "visible" : "hidden";
		    if (displayNone) {
		        obj.style.display = vis ? "block" : "none";
		    }
	    }
	    else if(document.layers){//this is NS4
		    obj.visibility = vis ? "show" : "hide";
		    if (displayNone) {
    		    obj.display = vis ? "block" : "hide";
            }
	    }  
	}
}

function changeVis(id) {
    if (id != '') {

	    obj = MM_findObj(id);
	    if (obj == undefined) {
	        return;
	    }
	    
	    if(document.getElementById || document.all){//all the modern browsers
		    obj.style.display = obj.style.display == "none" ? "block" : "none";
	    }
	    else if(document.layers){//this is NS4
		    obj.display = obj.display == "hide" ? "block" : "hide";
	    }  
	}
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') 
    window.onload = func;
  else 
  {
    window.onload = function() 
    {
      if (oldonload) 
        oldonload();
      func();
    }
  }
}

function OpenChat()
{
    var windowW = 240;
    var windowH = 316;
    window.open('/InstantMessaging.aspx','Chat','width=' + windowW + ',height=' + windowH + ',toolbar=no,menubar=no,resizeable=no,status=no');
}

function OpenForm(formName)
{
    var windowW = 620;
    var windowH = 700;
    switch(formName)
    {
        case 'EmailSignup':
            window.open('Forms/EmailSignup.aspx','FormWindow','width=' + windowW + ',height=' + windowH + ',scrolling=yes');
            break;
        case 'Employment':
            window.open('Forms/Employment.aspx','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        case 'GiftingAppt':
            window.open('Forms/GiftingAppt.aspx','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        case 'NominateAlum':
            window.open('Forms/NominateAlum.aspx','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        case 'Careers':
            window.open('Forms/Employment.aspx','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        case 'ReferAlumni':
            window.open('Forms/ReferStudent.aspx','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        case 'UpdateInfo':
            window.open('Forms/UpdateInfo.aspx','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        case 'VisitDegreeCompletion':
            window.open('Forms/VisitCampus.aspx?Audience=DegreeCompletion','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        case 'VisitGraduate':
            window.open('Forms/VisitCampus.aspx?Audience=Graduate','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        case 'VisitUndergrad':
            window.open('Forms/VisitCampus.aspx?Audience=Undergrad','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        case 'RequestInfoDegreeCompletion':
            window.open('Forms/RequestInfo.aspx?Audience=DegreeCompletion','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        case 'RequestInfoGraduate':
            window.open('Forms/RequestInfo.aspx?Audience=Graduate','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        case 'RequestInfoGeneral':
            window.open('Forms/RequestInfo.aspx?Audience=Undergrad','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        case 'WebsiteFeedback':
            window.open('Forms/WebsiteFeedback.aspx','FormWindow','width=' + windowW + ',height=' + windowH + ',scrollbars=yes');
            break;
        default:
            break;
    }
}

function addBookmark(title, url) {
    if (window.sidebar) { // firefox
          window.sidebar.addPanel(title, url,"");
    } else if( document.all ) { //MSIE
            window.external.AddFavorite( url, title);
    } else {
           alert("Sorry, your browser doesn't support this");
    }
}