/* ########################################################################### *
/* ***** SafARI  ************************************************************* *
/* ########################################################################### *
 * ##### DOCUMENT NAME:  custom.js
 * ##### DOCUMENT INFO: 
 * ##### Original v1.0: 11/03/2008 (George Hiley)
/* ########################################################################### *

/* ########################################################################### *
/* ***** INDEX *************************************************************** *
/* ########################################################################### *
/* ##### INITIALISATION
/* ########################################################################### */

/* ########################################################################### *
/* ##### INITIALISATION
/* ########################################################################### */

$(document).ready(init_global);

function init_global()
{
	// Misc
	init_anchorSmoothScroll();
}



////////////////////////////////////
// MISCELLANEOUS GLOBAL SCRIPTS
////////////////////////////////////

// Smooth scroll to in page anchors
function init_anchorSmoothScroll()
{
	// Enable only if browser is NOT ie
	if (jQuery.browser.msie == false)
	{
		var nodes = $('a[href*=#]');
		for(var i = 0; i < nodes.length; i++) 
		{
			if ($(nodes[i]).attr("href") != "#")
			{
				$(nodes[i]).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}, 1000);
						 return false;
						}
					}
				});
			}
		}
	}
}
