$(document).ready(function(){
$("div.controller:eq("+n+")").attr("id","cont-selected");//this says find the 
$("#cont-selected").css("background-position","0px -18px");	
$(".c-plus").click(function(){
moveCarouselleft(); 
});
$(".c-minus").click(function(){
moveCarouselright(); 
});
$("div.controller").click(function(){
$("#cont-selected").css("background-position","0px 0px");
$("#cont-selected").removeAttr("id");
var contIndex = $("div.controller").index(this);
var frameIndexpos = contIndex * $(".inner-content").outerWidth();
var contPos = '-'+frameIndexpos;
var contLeftmove = {};
n=contIndex;
contLeftmove ['left']= contPos;
$(".inner-container").animate(contLeftmove,500);
$(this).attr("id","cont-selected");
$("#cont-selected").css("background-position","0px -18px");
$(".inner-container").clearQueue();
});
});
function moveCarouselleft(){
var nMax = $("div.content").size();
var contWidth = $(".inner-content").outerWidth();
if (n<=(nMax-2)){
n=n+1;// this calculates what the next position of the carousel should be
var contPos = (n * contWidth); // this calculates how far the content is from the viewing window
contPos = '-'+contPos; // this says "put a minus sign infront of the contPos number
var contLeftmove = {};
contLeftmove ['left']= contPos; // this puts the contPos content into ['left]=xx
$(".inner-container").animate(contLeftmove,500);
$("#cont-selected").css("background-position","0px 0px");
$("#cont-selected").removeAttr("id");
$("div.controller:eq("+n+")").attr("id","cont-selected");//this says find the 
$("#cont-selected").css("background-position","0px -18px");
$(".inner-container").clearQueue();
}
else {
n=0;
$(".inner-container").animate({left: '0'},500);
$("#cont-selected").css("background-position","0px 0px");
$("#cont-selected").removeAttr("id");
$("div.controller:eq("+n+")").attr("id","cont-selected");//this says find the 
$("#cont-selected").css("background-position","0px -18px");
$(".inner-container").clearQueue();
}
}
function moveCarouselright(){
var nMax = $("div.content").size();
var contWidth = $(".inner-content").outerWidth();
if (n>=(nMax-2)){
n=n-1;// this calculates what the next position of the carousel should be
var contPos = (n * contWidth); // this calculates how far the content is from the viewing window
contPos = '-'+contPos; // this says "put a minus sign infront of the contPos number
var contLeftmove = {};
contLeftmove ['left']= contPos; // this puts the contPos content into ['left]=xx
$(".inner-container").animate(contLeftmove,500);
$("#cont-selected").css("background-position","0px 0px");
$("#cont-selected").removeAttr("id");
$("div.controller:eq("+n+")").attr("id","cont-selected");//this says find the 
$("#cont-selected").css("background-position","0px -18px");
$(".inner-container").clearQueue();
}
else {
n=0;
$(".inner-container").animate({left: '0'},500);
$("#cont-selected").css("background-position","0px 0px");
$("#cont-selected").removeAttr("id");
$("div.controller:eq("+n+")").attr("id","cont-selected");//this says find the 
$("#cont-selected").css("background-position","0px -18px");
$(".inner-container").clearQueue();
}
}
var n=0;
var t;
function timeCount()
{
moveCarouselleft();
t=setTimeout("timeCount()",6000);
}
timeCount();
