fav = function()
{
	var title = document.title;
	var url = window.location;
	if (window.sidebar)
	{
		window.sidebar.addPanel(title, url, "");
	}
	else if (window.external)
	{
		window.external.AddFavorite(url, title);
	}
	else if (window.opera && window.print)
	{
		var mbm = document.createElement('a');
		mbm.setAttribute('rel','sidebar');
		mbm.setAttribute('href',url);
		mbm.setAttribute('title',title);
		mbm.click();
	}
}

$(document).ready(function() {
	// create custom animation algorithm for jQuery called "bouncy" 
	$.easing.bouncy = function (x, t, b, c, d) { 
		var s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; 
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; 
	} 
 
	// create custom tooltip effect for jQuery Tooltip 
	$.tools.tooltip.addEffect("bouncy", 
		// opening animation 
		function(done) { 
			this.getTip().animate({top: '+=15'}, 500, 'bouncy', done).show(); 
		}, 
	 
		// closing animation 
		function(done) { 
			this.getTip().animate({top: '-=15'}, 500, 'bouncy', function()  { 
				$(this).hide(); 
				done.call(); 
			}); 
		} 
	);

	/**
	 * soon
	 */
	$("#nav li.disable a").tooltip({ tip: '#demotip', effect: 'bouncy'});
	$("#nav li.disable a").click(function() { return false; });
	
	
	/**
	 * animated scroll
	 */
	$('a[href*=#]').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}, 500);
				return false;
			}
		}
	});	
});