jQuery(function($){

//custom easing	
	$.easing.custom = function (x, t, b, c, d, s) {
		if (s == undefined) s = 0;
		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;
	}
 

	$('#clouds').smoothDivScroll({
         	autoScroll: "always", 
         	autoScrollDirection: "endlessloopright", 
         	autoScrollStep: 1,
			autoScrollInterval: 100
		});	


	$(".home_banner").slides({
		generatePagination: false,
		fadeEasing: 'custom',
		play: 8000,
		effect: 'fade',
		fadeSpeed: 3500,
		crossfade: true
	});
	
	$(".news .newsFeed").slides({
		generatePagination: true,
		paginationClass: 'feed_nav',
		slideEasing: 'custom',
		hoverPause: true,
		play: 7000,
		effect: 'slide',
		pause: 1000
	});
	
	$(".projects .newsFeed").slides({
		generatePagination: true,
		paginationClass: 'feed_nav',
		fadeEasing: 'custom',
		hoverPause: true,
		play: 7200,
		effect: 'slide',
		pause: 1000
	});


//	$(".projects .newsFeed").scrollable({circular: true}).navigator({navi:'.nav_projects'}).autoscroll(7200);
	
	

//Home page scoller

if ($(".scrollable").length == 1){
	
	$(".news .newsFeed").scrollable({easing: 'custom', circular: true, speed: 500}).navigator({navi:'.nav_news'}).autoscroll(4000);

	$(".projects .newsFeed").scrollable({easing: 'custom', circular: true, speed: 500}).navigator({navi:'.nav_projects'}).autoscroll(4000);
	
}


$(".slides_container div p").truncatable({limit: 130});

$(".featured_list div p").truncatable({limit: 220});


	$('.subNav > li:first-child').hover(function(){
		$('.rmSlide').slideDown('fast');
		
	}, function () {
		$('.rmSlide').slideUp('fast');
	});
	
});



//URL 'current' state for list links (collection items)
var path = window.location.pathname,
pathArray = path.split( '/' ),
level = pathArray[0];

if ( $('.Cat_List').length != 0 ){
	$('.Cat_List a[href="'+path+'"]').addClass('active')
	$('.subNav a[href="/'+pathArray[1]+'"]').addClass('active')
}else{
	$('.subNav a[href="'+path+'"]').addClass('active')
}



var link = $('.download_pdf a').attr('href')
if( link == ""){
	$('.download_pdf').hide();
}

