﻿/*<![CDATA[*/


 // This is a very modifed version of a function by pradeep 
 // @ http://www.go4expert.com/forums/showthread.php?t=1012
 // Here's the format for this function: 
 // RotateImages([img element id to target],[where to start in the array], [no. or seconds for a rotation]) 
  function RotateImages(whichHolder,Start, Sec)  {
   var ImageHolder1 = document.getElementById('Rotating1');
   var subDir = "img"
   var a = eval("ImageArr"+whichHolder);
   var b = eval("ImageHolder"+whichHolder);
   var duration;
   
   if(!Sec) duration = 5000;
   else duration = Sec * 1000;
   if(Start>=a.length) Start=0;
   
   b.src = subDir+"/"+a[Start];
   window.setTimeout("RotateImages("+whichHolder+","+(Start+1)+","+Sec+")",  duration);
  }
  
  
  var ImageArr1 = new Array("photos-1.jpg", "photos-2.jpg", "photos-3.jpg","photos-4.jpg","photos-5.jpg","photos-6.jpg","photos-7.jpg","photos-8.jpg");
  window.onload = function(){
  var startImage = Math.round(Math.random()* ImageArr1.length);
     RotateImages(1,startImage,15);
  }




/*
 * Props to Jason Tremblay for starting this multisearch thing.
 * @author Jeremiah Fisher
 */
 
/**
 * Cross-browser friendly (I hope) getElement function
 * <NOSEARCHBAR>
 */
function getElement( id) {
 if ( document.getElementById) {
  return document.getElementById( id);
  
 } else {
  return document.all[id];
  
 }
}
/**
 * Allow multiple search destinations
 *
 * @return boolean True if we're searching the default form, false if not (should never get to return in this case)
 */
function doMultiSearch() {
 searchRealmList = getElement( 'searchRealm');
 searchRealm = searchRealmList.options[searchRealmList.options.selectedIndex].value;
 searchQuery = getElement( 'searchQuery').value;
 
 switch ( searchRealm) {
  case "web":
   /* Search the web with google */
   getElement( 'webSearchQuery').value = searchQuery;
   getElement( 'webSearchForm').submit();
   return false;
   break;
   
  case "psu":
   /* Search PSU using the google appliance */
   getElement( 'psuSearchQuery').value = searchQuery;
   getElement( 'psuSearchForm').submit();
   return false;
   break;
  
  case "people":
   /* Search for people using the LDAP CGI */
   getElement( 'peopleSearchQuery').value = '(|(cn=' + searchQuery + ')(cn=*' + searchQuery + '*)(cn=' + searchQuery + ')(cn=*' + searchQuery + ')(edupersonnickname=' + searchQuery + ')(uid=' + searchQuery + '))';
   getElement( 'peopleSearchForm').submit();
   return false;
   break;
   
  case "dept":
   /* Search for departments, also using the LDAP CGI */
   getElement( 'deptSearchQuery').value = '(&(EDUPERSONPRIMARYAFFILIATION=DEPT)(|(PSDEPARTMENT=' + searchQuery + ')(PSDEPARTMENT=*' + searchQuery + '*)(PSDEPARTMENT=' + searchQuery + '*)(PSDEPARTMENT=*' + searchQuery + ')))';
   getElement( 'deptSearchForm').submit();
   return false;
   break;
   
  case "forum":
   /* Search the WSG forum */
   getElement( 'forumSearchQuery').value = searchQuery;
   getElement( 'forumSearchForm').submit();
   return false;
   break;
   
  case "this":
  default:
   /* Search the web style guide, using the google appliance */
   //getElement( 'thisSearchForm').submit();
   return true;
   break;
   
 }
 
}

/*]]>*/
