var homePos = 1; //nth-child starts at 1, silly jquery :)
var homeItemCnt = null; //will hold the amount of li's to loop through

function moveNextHome() {
	jQuery("ul.fader li:nth-child("+homePos+")").fadeOut("fast");
	var oldPos = homePos;
	homePos++;
	
	if(homePos > homeItemCnt) {
		homePos = 1;
	}
	jQuery("ul.fader li:nth-child("+oldPos+")").queue(function() {
			jQuery("ul.fader li:nth-child("+homePos+")").css("marginLeft", "0px");
			jQuery("ul.fader li:nth-child("+homePos+")").fadeIn("slow");
			jQuery(this).dequeue();
	});
}

function movePrevHome() {
	jQuery("ul.fader li:nth-child("+homePos+")").fadeOut("fast");
	var oldPos = homePos;
	homePos--;
	
	if(homePos < 1) {
		homePos = homeItemCnt;
	}
	jQuery("ul.fader li:nth-child("+oldPos+")").queue(function() {
			jQuery("ul.fader li:nth-child("+homePos+")").css("marginLeft", "0px");
			jQuery("ul.fader li:nth-child("+homePos+")").fadeIn("slow");
			jQuery(this).dequeue();
	});
}

jQuery("document").ready(function () {
		homeItemCnt = jQuery("ul.fader").children().size();
		
		jQuery("div.faderNav a.next").click(function() {
				moveNextHome();
				return false;	
		});
		jQuery("div.faderNav a.prev").click(function() {
				movePrevHome();
				return false;	
		});		
});