// JavaScript Document
//<![CDATA[
    $(document).ready(function() {
      $("a.menu").mouseover(function () { 
			if ($('#menu1').hasClass('current')) {
        	$("#menu1").removeClass("current");
			}
			if ($('#menu2').hasClass('current')) {
        	$("#menu2").removeClass("current");
			}
			if ($('#menu3').hasClass('current')) {
        	$("#menu3").removeClass("current");
			}
			if ($('#menu4').hasClass('current')) {
        	$("#menu4").removeClass("current");
			}
			if ($('#menu5').hasClass('current')) {
        	$("#menu5").removeClass("current");
			}
			
	 $("#menu").mouseleave(
	 function() {
		 $(this).removeClass("hovering");
	 });
	 
			/*$(this).addClass("current");*/
			menuHistory = $(this);
			listHistory = $(this).parent();
		});		  

      function addMega(){
		if($(this).parent().hasClass("hovering")){
			$(this).children("div.boxy").css("display", "block");
		}
		else{
			$(this).children("div.boxy").slideDown(200);			
		}
		$(menuHistory).addClass("current");
		$(this).parent().addClass("hovering");
        }
		
      function removeMega(){		
		if(!$(this).parent().hasClass("hovering")){
			$(this).children("div.boxy").slideUp(200);
		}
		else{
			$(this).children("div.boxy").css("display", "none");
		}
		$(menuHistory).removeClass("current");
        }		
	
		
    var megaConfig = {
         interval: 170,
         sensitivity: 4,
         over: addMega,
         timeout: 350,
		 out: removeMega
    }; 
	
    $("li.mega").hoverIntent(megaConfig);

});

  function popup(url) 
	{
	 var width  = 230;
	 var height = 300;
	 var left   = (screen.width  - width)/2;
	 var top    = (screen.height - height)/2;
	 var params = 'width='+width+', height='+height;
	 params += ', top='+top+', left='+left;
	// params += ', directories=no';
	 params += ', location=no';
	 params += ', menubar=no';
	 params += ', resizable=no';
	 params += ', scrollbars=no';
	 params += ', status=no';
	 params += ', toolbar=no';
	 newwin=window.open(url,'Chat_With_A_Librarian', params);
	 if (window.focus) {newwin.focus()}
	 return false;
	}

//]]>

				
/*		// Track main menu clicks
		$("#researchSubMenu a").click(function(event){
			laupusPageTracker._trackEvent('Main Menu', 'Research', this.text);
		});

		$("#servicesSubMenu a").click(function(event){
			laupusPageTracker._trackEvent('Main Menu', 'Services', this.text);
		});

		$("#aboutUsSubMenu a").click(function(event){
			laupusPageTracker._trackEvent('Main Menu', 'About Us', this.text);
		});
	
		// Track electronic resource clicks
		// To give the script time to run, preventDefault is used to suppress the link, the event is recorded, and then the link is followed after a 500 ms delay.
		$("a.electronicResourceLink").click(function(event){
			var currentURL = document.URL;
			
			event.preventDefault();
			laupusPageTracker._trackEvent('Electronic Resource', this.text, currentURL);
			setTimeout('document.location = "' + this.href + '"', 500);
		});
	
		// One Search Auto-suggest; powered by freebase (http://www.freebase.com/docs/suggest)
		$("#srchtxt").suggest({
  			"soft": true
		});
*/



