  function SearchIt() {
	var SearchString=GetObj("SearchBox").value;
	if(SearchString!="") {
	  var SearchForm=GetObj("SearchForm");
	  for (i=0;i<SearchForm.SearchDomain.length;i++) {
		if(SearchForm.SearchDomain[i].checked) {
		  var SearchDomain=SearchForm.SearchDomain[i].value;
		  break;
		  }
		}
	  switch (SearchDomain) {
		case "CU": SearchString="http://www2.carleton.ca/directories/search.php?cx=000425654443457873923%3Au1z9vad_fsq&cof=FORID%3A11&q=";
			    SearchString= SearchString + GetObj("SearchBox").value;
			    SearchString= SearchString + "&sa.x=13&sa.y=10&sa=Submit&operation=1";
			    break;
              case "People": SearchString="http://central.carleton.ca/cgi/cdir/quicksearch?cx=&cof=&Qname=";
				 SearchString= SearchString + GetObj("SearchBox").value;
				 SearchString= SearchString + "&sa.x=23&sa.y=8&sa=Submit&operation=2";
				 break;
		}
	  this.document.location.href=SearchString;
	  }
	return false;
	};

  function GetObj(id) { 
	if(document.getElementById) 
	  return document.getElementById(id); 
	else if(document.all) 
	  return document.all[id]; 
	else if(document.layers) 
	  return document.layers[id]; 
	else
	  return null;
	};

  function keyShortcut(e) {
	var key;
	if(window.event)
	  key = window.event.keyCode;	//IE
	else
	  key = e.which;	//firefox
	if (key == 27) {	//checks for the escape key
	  if (GetObj("MainCurtain").style.display=='block') CloseReferTo();
	  }
	};

  function ToolTipOn(evt,ToolTipName) {
	var WindowWidth=(window.innerWidth!=null?window.innerWidth:document.body.clientWidth!=null?document.body.clientWidth:null);
	var WindowHeight=(window.innerHeight!=null?window.innerHeight:document.body.clientHeight!=null?document.body.clientHeight:null);
	var ToolTip=GetObj(ToolTipName);
	if(WindowWidth==null||WindowHeight==null||ToolTip==null) return false;
	var MouseX=(evt.pageX?evt.pageX:(evt.clientX?evt.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft):null));
	var MouseY=(evt.pageY?evt.pageY:(evt.clientY?evt.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop):null));
	ToolTip.style.left = (MouseX + 10) +"px"; 
	ToolTip.style.top = (MouseY + 10) +"px"
	ToolTip.style.display = "block";
       return true;
	};

  function ToolTipOff(evt,ToolTipName) {
	var ToolTip=GetObj(ToolTipName);
	if(ToolTip)
	  ToolTip.style.display = "none";
	};

  function DoMenu(ev) {
       var e;
	if(!GetObj("MainContent")) return false;		// Don't support a browser that doesn't support getElementById
	var isEx=(document.all?true:false);
	if (!ev) 
         e = window.event;
       else
         e=ev;
       //  if (!e) var e=window.event;
	if (isEx) if(!e.toElement) return false;
	var GoingTo = (isEx?e.toElement.id:e.target.id);           
	var i = GoingTo.lastIndexOf("_");							// Look for "_"   - if there is one, then this is a sub element
	if(i > 0)  GoingTo = GoingTo.substring(0,i);					// Extract the underlying GoingTo Menu name
	var CameFrom=(((isEx?e.fromElement:e.relatedTarget)==null)?"":(isEx?e.fromElement.id:e.relatedTarget.id));         // get source name
	i = CameFrom.lastIndexOf("_");							// Look for "_"   - if there is one, then this is a sub element
	if(i > 0)  CameFrom = CameFrom.substring(0,i);					// Extract the underlying CameFrom Menu name
	if(GoingTo=="") GoingTo="GoingToElement";
	if(CameFrom=="") CameFrom="CameFromElement";
	// source and target might be the same - just moving around within a div - ignore this
	if(((GoingTo.length<CameFrom.length)?(GoingTo==CameFrom.substring(0,GoingTo.length)):(CameFrom==GoingTo.substring(0,CameFrom.length)))) return StopMenu(e, isEx);
	if(e.type=="mouseover") {
         var GT_Key=GetObj(GoingTo+"_key");
	  GT_Key.style.color = '#000000';
	  GT_Key.style.borderLeftColor = '#ffffff';
	  GT_Key.style.borderRightColor = '#ffffff';
	  GT_Key.style.backgroundColor = '#ffffff';
	  GT_Key.style.borderLeftColor = '#d4e3e7';
	  GT_Key.style.borderRightColor = '#d4e3e7';
	  GT_Key.style.backgroundColor = '#d4e3e7';
	  // GT_Key.style.backgroundImage = 'url(/images/menu_bg_w.bmp)';
	  if(GetObj(GoingTo+"_02")!=null) GetObj(GoingTo+"_02").style.visibility = 'visible';
	  GoingTo=GoingTo+"01";  
	  if(GetObj(GoingTo)!=null) GetObj(GoingTo).style.display='block';
	  }
	else {
	  if(!isEx) CameFrom=GoingTo;
	  if(CameFrom.length>6) CameFrom=CameFrom.substring(0,CameFrom.length-2);
         var CF_Key=GetObj(CameFrom+"_key");
	  CF_Key.style.color = '#ffffff';
	  CF_Key.style.borderLeftColor = "#606060";
	  CF_Key.style.borderRightColor = "#000000";
	  CF_Key.style.backgroundColor = '#3f464e';
	  // CF_Key.style.backgroundImage = 'url(/images/menu_bg.bmp)';
	  if(GetObj(CameFrom+"_02")!=null) GetObj(CameFrom+"_02").style.visibility = 'hidden';
	  CameFrom=CameFrom+"01";  
	  if(GetObj(CameFrom)!=null) GetObj(CameFrom).style.display='none'; 
	  }
	return StopMenu(e, isEx);
	};

  function StopMenu (e, isEx) {								// When we exit we can cancel the bubble as whatever the actual element was that fired the 
	if(isEx)										// mouse off event, because we collapsed it down to its parent div the event is bound to have been 
	  e.cancelBubble = true;								// processed..... first element that fires the event processes it
	else  
	  if(e.stopPropagation) e.stopPropagation;
	return false;
	};

  function TurnOnJS() {
	GetObj("SearchRadio").style.visibility="visible";
	GetObj("SearchForm").action="javascript:SearchIt()";
	if(GetObj("ReferEnvelope")) 
	  GetObj("ReferEnvelope").style.visibility="visible";
       if(GetObj("RSSLink")) 
	  GetObj("RSSLink").style.visibility="visible";
	return true;
	};