$(document).ready(function(){
	// Call the tipsy plugin for all the item with tipsy class								 
	$(".tipsy").tipsy({gravity: 'w', fade: true});
	// set rounded corner, yeah!
	$("#assetPanel, .footerItem").corner("10px");
	$("#recentcomments").corner("bottom 10px");


	// Function to set equal height for any element
	function equalHeight(group) {
		 tallest = 0;
		 group.each(function() {
				thisHeight = $(this).height();
				if(thisHeight > tallest) {
					 tallest = thisHeight;
				}
		 });
		 group.height(tallest);
	} ;
	
	// Call the function on matched class
	equalHeight($(".footerItem"));
	
 // Keep element in view while scrolling (by William Duffy)
		/*var $scrollingDiv = $("#recentcomments"); //store the jQuery reference to our element in a variable
			
			$(window).scroll(function(){			
				$scrollingDiv
					.stop()
					.animate({"marginTop": ($(window).scrollTop() - 800) + "px"}, "slow" );			
			});
		*/	
	/*thanx to http://return-true.com/2010/04/scroll-activated-slide-down-header-with-jquery/comment-page-1/#comment-17274*/	
	var $scrollingDiv = $("#recentcomments");
	$(window).scroll(function() {
		if ($(this).scrollTop() > 900)
  {
  $scrollingDiv.css({'position': 'fixed', 'top': '0px', 'width': '270px', 'z-index': '1'});
	$('.footer').css({'position': 'relative', 'z-index': '2'});
  }	
		else
  {
  $scrollingDiv.css({'position': 'static'});
  }
	});
	
	// Hover effetc on the resources link
	if ($('#assetPanel').length) {
		
		 $("#assetPanel a").append("<em></em>");
			
		
			$("#assetPanel a").hover(function() {
				$(this).find("em").animate({opacity: "show", top: "-75"}, "slow");
				$(this).dequeue();
					var hoverText = $(this).attr("title");
				$(this).find("em").text(hoverText);
			}, function() {
				$(this).find("em").animate({opacity: "hide", top: "-85"}, "fast");
				$(this).dequeue();
			});
			 
 }
	
	





});


