var expandHeight = 185;                                                                 // height that the container should expand to
var expandForShare = 330;                                                               // height that the container should expand to to compensate for the share icons
var expandSpeed = 300;                                                                  // speed that the container should expand, faster speed seems more user friendly


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                              NO NEED TO EDIT BELOW THIS LINE
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


$(document).ready(function(){                                                           // do the following when the document loads

    $(".n6").hover(function() { 
      $("#sh_tools").css("z-index","-100");                                             // Special code to hide
    },function() {                                                                      // Special code to hide
  		$("#sh_tools").css("z-index","1");                                             // Special code to hide
  	});

    var shrinkTo = $("#sh_tools").height();                                             // grab the height value of sh_tools so you know what size to shrink back to                        

    $("#sh_tools").hover(function() {                                                   // trigger when the icon div is hovered
  		$("#sh_tools").animate({height: expandHeight + "px"}, expandSpeed );              // expand the container to display text
  		$("#explainTools #pop2 tr:nth-child(1)").hide();                                  // hide the first TR of the share common file, not needed
  		//$('html, body').animate({ scrollTop: 60000 }, 50); 
  	},function() {
  		$("#sh_tools").animate({height: shrinkTo}, expandSpeed );                         // shrink the container to hide the text fields
  		$("#explainTools #pop2 tr:nth-child(1)").show();                                  // show the first TR of the share common file. Without this you will remove TR's until there are none left
  	});


  	$("#SH_tools_table td").hover(function() {                                          // trigger when an specific icon is hovered
  	  var currentItem = "p" + $(this).attr('id');                                       // set the id for the paragraph you want displayed
  	  
  	  if( currentItem == "pshare" ){                                                    // check to see if the share icon is being hovered
  	    
  	    $("#sh_tools").animate({height: expandForShare + "px"}, expandSpeed );          // expand the container to fit the share icons in place
  	    $("#explainTools #pop2").show();                                                // show the share container
  	    $("#explainTools p").show();                                                    // show the share text
  	    
  	  }else{
  	    
        $("#explainTools #pop2").hide();                                                // hide the share container if you are not on the share icon 
          if ($("#sh_tools").height() == expandForShare){                               // check for the height of the container to see if it was expanded 
    	      $("#sh_tools").animate({height: expandHeight + "px"}, expandSpeed );        // shrink the share container back to the original size. 
    	    }
    	    
  	  }
  	  
  	  if( currentItem == "psearch" ){
  	      $("#shSearchForm").show(); 
  	    }else{
  	      $("#shSearchForm").hide(); 
  	    }
  	  
  	  $("#explainTools p").hide();                                                      // hide all paragraphs within the explainTools div
  		$("#explainTools #" + currentItem).show();                                        // show the paragraph that you want displayed. 
  	},function() {
  		                                                                                  // do nothing on mouse out
  	});

});


