//for the searchwidget

jQuery.fn.labelOver = function(overClass) {
	return this.each(function(){
		var label = jQuery(this);
		var f = label.attr('for');
		if (f) {
			var input = jQuery('#' + f);
			
			this.hide = function() {
			  label.css({ textIndent: -10000 })
			}
			
			this.show = function() {
			  if (input.val() == '') label.css({ textIndent: 0 })
			}

			// handlers
			input.focus(this.hide);
			input.blur(this.show);
		  label.addClass(overClass).click(function(){ input.focus() });
			
			if (input.val() != '') this.hide(); 
		}
	})
}// JavaScript Document

//collapsible navigation

$(document).ready(function() {
					   

$(".sliding_list li").children("*:not(:header)").hide();
	$(".sliding_list_expanded").children("*:not(:header)").show();
		
	$(".sliding_list li :header").css("cursor","pointer").click(function(){
			if ($(this).parent("li").children("*:not(:header)").is(":visible"))
			{
				$(this).parent("li").children("*:not(:header)").slideUp("slow");
			}
			else {		
			//$(this).parent("li").parent("ul").children("li").children("*:not(:header)").slideUp("slow");
			$(this).parent("li").children("*:not(h)").slideDown("slow"); 
			}	
		})  


        
// newbooks hover bubble function        
         
        
        
	
	});

   
$(document).ready(function(){
$("#newbooks_image_holder").hover(function() {
 //alert('test');       
    $(".hover-box").stop(true, true).animate({opacity: "show", top: "0", left:"-220"}, "slow", function(){
        $(".hover-box").hover(function(){
              $(this).stop(true, true).animate({opacity: "show", top: "0" , left:"-220"}, "slow");
        }, function(){
           $(this).animate({opacity: "hide", top: "0", left: "-220"}, "slow");
        });
    
    }); 
}, function() {

     $(".hover-box").animate({opacity: "hide", top: "0", left: "-220"}, "slow");

    });    
 
});     
   
    
    
//searchwidget


$(function() {
	$('#searchwidget').tabs();
	$('#searchwidget_front').tabs();
	$('.over-apply').labelOver('over-apply');
	$('#interior-tabs').tabs();

});


//chat button   


function display_bubble (data) {
          if (data) {
               $("a:contains('Ask A Librarian')").append("<img src='/images/redbubblesmall.png' border='0' style=' margin-top: -7px; margin-left: 2px;'>");
             $("#ask").prepend("<li><a href='http://www.google.com/talk/service/badge/Start?tk=z01q6amlqbsq7pnk9vv5dtovrt7r7lbcjg1nkflq6e6g2b23i87dnm99mck2t1ojafe41qdgrchlc87iu06o6f7jn0ltnfpobg3aciigf36phm1sk15mr4tg21qo5e6cvk11q88842grq2n42m2cb3qlj0n0ll4mdt5b3nanc' id='chat' title='Click here to chat with Reference Desk'>Via IM</a></li>");
          
              }
            else{
             //  $("a:contains('Ask A Librarian')").append("<img src='/images/redbubblesmall.png' border='0' style=' margin-top: -7px; margin-left: 2px;'>");  
             $("#ask").prepend("<li><a href='http://library.lclark.edu/reference/ask/chat.htm'  title='View available IM hours'>Via IM</a></li>");
            
            }  
			    $("#chat").click( function() {
        window.open( $(this).attr('href'),this,'width=300,height=400,scrollbar=no' );
        return false;
    });          
    
          }  

	if (!($.browser.msie&&($.browser.version<=6))) {
    	$(function(){$.getJSON("http://library.lclark.edu/reference/chatstatus.php")});
		}