var leftPosition = 0;
var maxPosition = 0;

//this variable monitors whether the pause button has been pressed
var pause = false;
var time = 0;

function init(maxWidth){
	left = document.getElementById( 'slide-nav-back' );
	right = document.getElementById( 'slide-nav-forward' );
	specials = document.getElementById( 'slide-inner' );
	
	//set maxPosition
	maxPosition = maxWidth;
	
	specials.style.left = "0px";
}
function previous(){
	//stop any timer that has started.
	clearTimeout ( nextTimer );
	
	
	//check to see if there is a previous special.
	if(leftPosition==0){
		//if not then do nothing
		return;
	}//if
	
	
	leftPosition = leftPosition + 275;
	
	left_tween = new Tween(specials.style,'left',Tween.regularEaseInOut,parseInt(specials.style.left),leftPosition,2,'px');
	left_tween.start();
	
	//start the Timer over again
	startTimer();
}
function next(){
	//stop any timer that has started.
	clearTimeout ( nextTimer );

	
	//check to see if there is a next special.
	if(leftPosition==(maxPosition + 275)){
		//if not then send back to first
		leftPosition = 0;
	}//if
	else{
		//if there is, proceed to the next special
		leftPosition = leftPosition - 275;
	}
	
	
	
	right_tween = new Tween(specials.style,'left',Tween.regularEaseInOut,parseInt(specials.style.left),leftPosition,2,'px');
	right_tween.start();
	
	//start the Timer over again
	startTimer();
}
function startTimer(){
	//start time for 5 seconds
	if(pause==false){
		nextTimer = setTimeout ( "next()", 5000 );
	}//if

}//function

function togglePause(){
	if(pause==true){
		pause = false;	
		//start the Timer over again
		startTimer();
	}//if
	else{
		pause = true;
		clearTimeout ( nextTimer );
	}//else
}//function
