$(document).ready(function() {
   $("#trail img, #menu img, .hit img, #modules img, .suggestion img").filter(function (){
	   return $(this).attr("class").match(/.*Small$/);
       }).tooltip({ 
      bodyHandler: function() { 
       return "<img class='"+$(this).attr("class").replace("Small","")+"'src='/clear.cache.gif'/> "+this.tooltipText; 
   }, 
   showURL: false
   });

   $("#trail a, #menu a, .hit a, #modules a").tooltip({ 
	   showURL: false
 	   });
	
   $(".hit img").filter(function (){
	   return !$(this).attr("class").match(/.*Small$/);
       }).tooltip({ 
      bodyHandler: function() { 
       return "<img class='"+$(this).attr("class")+"'src='/clear.cache.gif'/> "+this.tooltipText; 
   }, 
   showURL: false
   });

   $(".suggestion a").tooltip({
	   bodyHandler: function(){
	   return $(this).next('div')[0].innerHTML;
   },
	   showURL: false
 	   });

   $(".authorityText a").tooltip({
	   bodyHandler: function(){
	   return $(this).next('div')[0].innerHTML;
   },
	   showURL: false
 	   });
   
   $("#moreInfo").click(function () {
       if ($("#infoBox").is(":hidden")) {
           $("#moreInfo").hide();  
         $("#infoBox").slideDown("normal");
       } 
     });

   $("span.moreLink").click(function () {
       if ($(this).next("span.moreText").is(":hidden")) {
           $(this).hide();  
           $(this).next("span.moreText").toggle();
       } 
     });

   
   $("div.helpButton a").click(function () {
   var popup = window.open(this.href.replace('help?','help?popup&'),'help','location=no,menubar=no,toolbar=no,scrollbars=yes,status=no,height=600,width=400,resizable=yes'); 
    if (popup) popup.focus();
    return false;
   });


   $("#iconHelp").click(function () {
   var popup = window.open(this.href.replace('help?','help?popup&'),'help','location=no,menubar=no,toolbar=no,scrollbars=yes,status=no,height=600,width=400,resizable=yes'); 
    if (popup) popup.focus();
    return false;
   });

   $("a.popup").click(function () {
	   var popup = window.open(this.href.replace('help?','help?popup&'),'help','location=no,menubar=no,toolbar=no,scrollbars=yes,status=no,height=600,width=400,resizable=yes'); 
	    if (popup) popup.focus();
	    return false;
	   });

   
   $("#nodeFilterToggle").click(function () {
	     if ($("#nodeFilters").is(":hidden")) {
	       $("#nodeFilters").slideDown("normal");
	       $("#filterSlide").attr("class","slideUp");  
	     } else {
	       $("#nodeFilters").slideUp("normal");
	       $("#filterSlide").attr("class","slideDown");  
	     }
	   });

   $(".ellipse").click(function () {
		  $(this).hide();
          $(this).next('span').show();
	   });
   
});

