/* Animated Scrolling with jQuery by I Love Copy And Paste
 * http://ilovecopyandpaste.com
 *
 * Copyright (c) 2009 I Love Copy And Paste
 * Licensed under CC ANC 3.0 Unported
 * http://creativecommons.org/licenses/by-nc/3.0/
 *
 * Last Revision May 20 (3)
 */
$(document).ready(function()
{	
	$('a[href*=#]').click(function() // Run function on any link with a hash
	{
		if (location.pathname == this.pathname) // Check if location pathname is sames as that of target
		{
			try
			{
				var $target = $(this.hash); // Get hash from href
				var $offset = $target.offset().top; // Set offset to offset of the hash
			}
			catch(err) // Hash has no target specified
			{
				var $offset = '0'; // Just give it a target offset
			}

			$('html,body').animate({scrollTop: $offset}, 'slow'); // Animate!
			return false;
		}
	});
});
