/* Tooltip from CSS Globe written by Alen Grakalic (http://cssglobe.com) */
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 50;
		yOffset = -70;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<div class='itooltip'><p>"+ this.t +"</p></div>");
		$(".itooltip")
			.css("top",(e.pageY + xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn(300);		
    },
	function(){
		this.title = this.t;		
		$(".itooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$(".itooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

$(document).ready(function(){
	tooltip();
});



/* http://www.learningjquery.com/2007/09/animated-scrolling-with-jquery-12 */
$(document).ready(function(){
  $('a.back-top').click(function() {
	if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	&& location.hostname == this.hostname) {
	  var $target = $(this.hash);
	  $target = $target.length && $target
	  || $('[name=' + this.hash.slice(1) +']');
	  if ($target.length) {
		var targetOffset = $target.offset().top;
		$('html,body')
		.animate({scrollTop: targetOffset}, 700);
	   return false;
	  }
	}
  });
});