<!--
/*!
 **************************************************
 * Copyright 2010 - Danny Carmical
 * http://luckykind.com
 **************************************************/



jQuery(document).ready(function() {
	var featured = jQuery('#slider-featured ul');
	var nav = jQuery('#slider-nav ul li a');
	var arrow = jQuery('#slider-nav-arrow');
	var border = jQuery('#slider-nav-border');
	var arrowPos = 40;
	var borderPos = 0;
	var featuredPos = 0;
	var currentNav = 1;
	var whichNav = 1;
	var scroll;
	
	jQuery('#featured1 img').addClass('current-nav-border');
	
	nav.bind('click', function(){
		clearInterval(scroll);
		whichNav = +jQuery(this).attr('id').substring(8,9);
		slideNext(whichNav);			
		return false;
	});

	function slideNext(thisNav){
		if(!thisNav) {
			if(whichNav < 3) {
				whichNav++;
			} else {
				whichNav = 1;
			}
		}
		
		if(whichNav > currentNav) {
			border.fadeOut(200);
			borderPos += 120 * (whichNav - currentNav);
			arrowPos += 120 * (whichNav - currentNav);
			featuredPos -= 365 * (whichNav - currentNav);
			arrow.stop().animate({
				top : arrowPos
			}, 400, function() {
				featured.stop().animate({
					top : featuredPos
				}, 400);
				border.stop().css('top', borderPos).fadeIn(200);				
			});			
			currentNav = whichNav;
		}

		if(whichNav < currentNav) {
			border.fadeOut(200);
			borderPos -= 120 * (currentNav - whichNav);
			arrowPos -= 120 * (currentNav - whichNav);
			featuredPos += 365 * (currentNav - whichNav);
			arrow.stop().animate({
				top : arrowPos
			}, 400, function() {
				featured.stop().animate({
					top : featuredPos
				}, 400);
				border.stop().css('top', borderPos).fadeIn(200);				
			});
			currentNav = whichNav;
		}
		
	}
	
	jQuery(function() {
			scroll = setInterval(slideNext, 5000);		
	});
});

-->	
