// JavaScript Document

$du = jQuery.noConflict()

$du(document).ready(function(){
	
	$du(".anchorLink").anchorAnimate()
	
	$du( '#navigation ul li:last-child' ).css( 'margin-right', '0' );
	$du( '#navigation ul li ul li:last-child a' ).css( 'border-bottom', 'none' );
	
	$du( '.toggleLink' ).bind( 'click', function() {
		
		if( $du(this).text() == 'Read more' )
		{
			$du(this).siblings( '.toggle' ).slideDown( 450 );
			$du(this).text( 'Show less' );
		}
		else
		{
			$du(this).siblings( '.toggle' ).slideUp( 450 );
			$du(this).text( 'Read more' );	
		}
		
	});
	
	$du( '.menu li:last-child' ).css( 'margin-right', '0' );
			
})

jQuery.fn.anchorAnimate = function(settings) {

 	settings = jQuery.extend({
		speed : 1100
	}, settings);	
	
	return this.each(function(){
		var caller = this
		$du(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $du(caller).attr("href")
			
			var destination = $du(elementClick).offset().top;
			$du("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				
			});
		  	return false;
		})
	})
}
