jQuery(function($){
				


		
		//stop the click on the links
		$('ul#nav li').click(function(e){
			e.preventDefault();
			var link = e.target;
			link.blur();
		});


// --------- GLOBAL



// --------- PORTFOLIO
	// border color animation on portfolio thumbnails

	
	//Target bindings
	var $modTarget = $('#news_scroller');
	//this one is important, many browsers don't reset scroll on refreshes
	$modTarget.scrollTo(0);

	// PORTFOLIO NAV FUNCTIONALITY - PAGINATION
	$('#pagination li:first a').addClass('selected');
	$('#pagination li a').click(function() {
		$('#pagination li a').removeClass('selected');
		$(this).addClass('selected');
		// get the portfolio item # to sroll to from end of pagination href*3
		var scrollPos = ($(this).attr('href')).slice(-1)*900;
		$modTarget.scrollTo(scrollPos + 'px', 760, {axis:'y', easing:'easeInOutExpo'});
		// set prev/next to .off at end of pagination
		if (scrollPos == 0) { // if 1st page
			$('#nav .prev').addClass('off');
		} else {
			$('#nav .prev').removeClass('off');
		}
		// alert(scrollPos + ' and ' + items);
		if (items-scroll_to < 4) { // if 3 or less item left it's last page
			$('#nav .next').addClass('off');
		} else {
			$('#nav .next').removeClass('off');
		}
	});

	// PORTFOLIO NAV FUNCTIONALITY - PREV/NEXT

	// default state of prev is "off"
	$('#nav .prev').addClass('off');
	// PREV
	$('#nav .prev').click(function() {
		$modTarget.scrollTo('-=444', 750, {axis:'y', easing:'easeInOutExpo'});
		// remove current .selected and add to next one if there's one
		if($('#pagination li a.selected').parent().prev().length) {
			$('#pagination li a.selected')
			.removeClass('selected')
			.parent().prev().children().addClass('selected');
		}
		// if there's no more pagination after the .selected page, can't click on next...
		if (!$('#pagination li a.selected').parent().prev().length) {
			$(this).addClass('off');
		}
		// just in case, we .next active
		$('#nav li.next').removeClass('off');
	});
	
	// NEXT
	$('#nav .next').click(function() {
		// remove current .selected and add to next one if there's one
		if($('#pagination li a.selected').parent().next().length) {
			$('#pagination li a.selected')
			.removeClass('selected')
			.parent().next().children().addClass('selected');
			$modTarget.scrollTo('+=444', 750, {axis:'y', easing:'easeInOutExpo'});
		}
		// if there's no more pagination after the .selected page, can't click on next...
		if (!$('#pagination li a.selected').parent().next().length) {
			$(this).addClass('off');
		}
		// just in case, we make .prev active
		$('#nav li.prev').removeClass('off');
	});

});

