//	Default Javascript functions

<!--

// Opens a new window
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//reloads the window if Nav4 resized
function MM_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

// Show and Hide Layers
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}

//-->



//	Header Javascript functions

<!--

// Redirect Search
function redirectSearch() {
  var search_type = "people";
  if(document.redirect_search.search_type.options[document.redirect_search.search_type.selectedIndex].value) {
   search_type = document.redirect_search.search_type.options[document.redirect_search.search_type.selectedIndex].value
  }
  if(search_type == "students") {
   window.open("http://www.library.siue.edu/irs/forms/stdfind.html", "_self");
   return(false);
  }  
  else if(search_type == "siuegoogle") {
   if (document.redirect_search.whitepages.value) {
   url = "http://www.google.com/u/siue";
   query_string = "hl=en&btnG=Google+Search&q="+escape(document.redirect_search.whitepages.value);
   window.open(url+"?"+query_string, "_self");
   }
   return(false);
  } 
   else if(search_type == "employees") {
	window.open("http://www.library.siue.edu/irs/forms/empfind.html", "_self");
  return(false);
  }
  else if(search_type == "offices") {
	window.open("http://www.siue.edu/IRS/dirofc.html", "_self");
  return(false);
  }
  else {
   if (document.redirect_search.whitepages.value) {
   url = "http://www.google.com/search";
   query_string = "?hl=en&lr=&ie=ISO-8859-1&q="+escape(document.redirect_search.whitepages.value);
   window.open(url+"?"+query_string, "_blank");
   return(false);
   }
  }
}
//-->



//	Homepage Javascript functions

<!--

	var randomBox = Math.floor(Math.random() * 10);
	var randomSubbox = Math.floor(Math.random() * 8);

//When a user clicks on the previous button it finds which random story is displayed and changes out to the previous story
function JB_previous() {
	
	if (randomBox == 0) {
		randomBox=9;
	    document.getElementById('main_engineering').style.display="none";
		JB_random();
	}
	else if (randomBox == 1) {
		randomBox=0;
	    document.getElementById('main_pharmacy').style.display="none";
		JB_random();
	}
	else if (randomBox == 2) {
		randomBox=1;
	    document.getElementById('main_nursing').style.display="none";
		JB_random();
	}
	else if (randomBox == 3) {
		randomBox=2;
	    document.getElementById('main_library').style.display="none";
		JB_random();
	}
	else if (randomBox == 4) {
		randomBox=3;
	    document.getElementById('main_graduatestudies').style.display="none";
		JB_random();
	}
	else if (randomBox == 5) {
		randomBox=4;
	    document.getElementById('main_education').style.display="none";
		JB_random();
	}
	else if (randomBox == 6) {
		randomBox=5;
		document.getElementById('main_dental').style.display="none";
		JB_random();
	}
	else if (randomBox == 7) {
		randomBox=6;
	    document.getElementById('main_business').style.display="none";
		JB_random();
	}
	else if (randomBox == 8) {
		randomBox=7;
	    document.getElementById('main_athletics').style.display="none";
		JB_random();
	}
	else if(randomBox == 9) {
		randomBox=8;
	    document.getElementById('main_artsandsciences').style.display="none";
		JB_random();
	}
}

//When a user clicks on the next button it finds which random story is displayed and changes out to the next story
function JB_next() {
	
	if (randomBox == 0) {
		randomBox=1;
	    document.getElementById('main_engineering').style.display="none";
		JB_random();
	}
	else if (randomBox == 1) {
		randomBox=2;
	    document.getElementById('main_pharmacy').style.display="none";
		JB_random();
	}
	else if (randomBox == 2) {
		randomBox=3;
	    document.getElementById('main_nursing').style.display="none";
		JB_random();
	}
	else if (randomBox == 3) {
		randomBox=4;
	    document.getElementById('main_library').style.display="none";
		JB_random();
	}
	else if (randomBox == 4) {
		randomBox=5;
	    document.getElementById('main_graduatestudies').style.display="none";
		JB_random();
	}
	else if (randomBox == 5) {
		randomBox=6;
	    document.getElementById('main_education').style.display="none";
		JB_random();
	}
	else if (randomBox == 6) {
		randomBox=7;
		document.getElementById('main_dental').style.display="none";
		JB_random();
	}
	else if (randomBox == 7) {
		randomBox=8;
	    document.getElementById('main_business').style.display="none";
		JB_random();
	}
	else if (randomBox == 8) {
		randomBox=9;
	    document.getElementById('main_athletics').style.display="none";
		JB_random();
	}
	else if(randomBox == 9) {
		randomBox=0;
	    document.getElementById('main_artsandsciences').style.display="none";
		JB_random();
	}
}

//When a user loads the page a random story is displayed
function JB_random() {
	
	if (randomBox == 0) {
	    document.getElementById('main_engineering').style.display="block";
	}
	else if (randomBox == 1) {
	    document.getElementById('main_pharmacy').style.display="block";
	}
	else if (randomBox == 2) {
	    document.getElementById('main_nursing').style.display="block";
	}
	else if (randomBox == 3) {
	    document.getElementById('main_library').style.display="block";
	}
	else if (randomBox == 4) {
	    document.getElementById('main_graduatestudies').style.display="block";
	}
	else if (randomBox == 5) {
	    document.getElementById('main_education').style.display="block";
	}
	else if (randomBox == 6) {
	    document.getElementById('main_dental').style.display="block";
	}
	else if (randomBox == 7) {
	    document.getElementById('main_business').style.display="block";
	}
	else if (randomBox == 8) {
	    document.getElementById('main_athletics').style.display="block";
	}
	else if(randomBox == 9) {
	    document.getElementById('main_artsandsciences').style.display="block";
	}
	
	if (randomSubbox == 0) {
	    document.getElementById('mattt').style.display="block";
	}
	else if (randomSubbox == 1) {
	    document.getElementById('sarahl').style.display="block";
	}
	else if (randomSubbox == 2) {
	    document.getElementById('tyeastf').style.display="block";
	}
	else if (randomSubbox == 3) {
	    document.getElementById('kellyd').style.display="block";
	}
	else if (randomSubbox == 4) {
	    document.getElementById('mathiasa').style.display="block";
	}
	else if (randomSubbox == 5) {
	    document.getElementById('jamieh').style.display="block";
	}
	else if (randomSubbox == 6) {
	    document.getElementById('scotth').style.display="block";
	}
	else if (randomSubbox == 7) {
	    document.getElementById('chelseyb').style.display="block";
	}
		

}

// Hide and Unhide Select Form **bug in IE with layers falling behind SELECT forms
function hideSelect() {
  if (document.all) {
    document.redirect_search.search_type.style.visibility="hidden";
  }
}

function unhideSelect() {
  if (document.all) {
	  document.redirect_search.search_type.style.visibility="visible";
  }
}


//-->