atv.init.scroller = function(){
	/* Init */
	if($("#carousel .panelWrapper .panel.active ul").length > 1){
		$("#carousel .panelWrapper > a").show();
	} else {
		$("#carousel .panelWrapper > a").hide();
	}

	/* Hide the panels */
	$("#carousel .panel").each(function(i){
		$(this).find("ul").each(function(n){
			$(this).attr("pos",n);
		});
	});

	$("#carousel a.next").click(function(){
		var from = $("#carousel .panelWrapper  .panel.active ul.active");
		var toIndex = 0;
		var fromIndex = parseInt(from.attr("pos"),10);
		if(fromIndex + 1 < $("#carousel .panelWrapper .panel.active ul").length){
			toIndex = fromIndex + 1;
		}
		var to = $("#carousel div.panelWrapper  div.panel.active ul:eq("+toIndex+")");
		to.css("left","894px").animate({left: "0px"}, 1000, "swing", function(){
			$(this).addClass("active");
		});
		from.animate({left:"-894px"}, 1000, "swing", function(){
			$(this).removeClass("active");
		});
		return false;
	});

	$("#carousel a.back").click(function(){
		var from = $("#carousel .panelWrapper  .panel.active ul.active");
		var toIndex = parseInt(from.attr("pos"),10)-1;
		
		if(toIndex == -1){
			toIndex = $("#carousel .panelWrapper .panel.active ul").length-1;
		}
		var to = $("#carousel .panelWrapper .panel.active ul:eq("+toIndex+")");

		to.css("left","-894px").show().animate({left: "0px"}, 1000, "swing", function(){
			$(this).addClass("active");
		});
		from.animate({left:"894px"}, 1000, "swing", function(){
			$(this).removeClass("active");
		});

		return false;
	});

	$("#carousel .panelWrapper .panel ul li a").mouseover(function(){
		$(this).parent('li').addClass('mo');
	}).mouseout(function(){
		$(this).parent('li').removeClass('mo');
	});
};

