	var position = 0;
	var paused = false;
	var canclick = true;
	var max = 0;
	function auto_play() {
		setTimeout(continue_play,6000);
	}
	function continue_play() {
		if (paused) { 
			setTimeout(continue_play,6000);
			paused = false;
		} else {
			if ((position + 1)>=max) {
				 setTimeout(reset,2000);
			} else {
				move_right();
				setTimeout(continue_play,6000);
			}
		}
	}
	function reset() {
		document.getElementById('rotation_heading').innerHTML = document.getElementById('banner_txt_0').innerHTML
		document.getElementById('button_' + (position)).className = "";
		document.getElementById('button_0').className = "selected";
		var t = new Tween(document.getElementById('container').style,'left',Tween.strongEaseIn,position * -778,0,2,'px');
		t.start();
		position = 0;
		auto_play();
	}

	function move_to(button,x) {
		if (canclick == true) {
			canclick = false;
			document.getElementById('rotation_heading').innerHTML = document.getElementById('banner_txt_' + x).innerHTML
			document.getElementById('button_' + (position)).className = "";
			button.className = "selected";
			var t = new Tween(document.getElementById('container').style,'left',Tween.strongEaseIn,position * -778,(x) * -778,2,'px');
			t.onMotionFinished = function(){canclick = true}
			t.start();
			paused = true;
			position = x;
		}
	}
	
	function move_right() {
		if (canclick == true) {
			if ((position + 1) < max) {
				canclick = false;
				document.getElementById('rotation_heading').innerHTML = document.getElementById('banner_txt_' + (position + 1)).innerHTML
				document.getElementById('button_' + (position)).className = "";
				document.getElementById('button_' + (position + 1)).className = "selected";
				var t = new Tween(document.getElementById('container').style,'left',Tween.strongEaseIn,position * -778,(position + 1) * -778,2,'px');
				t.onMotionFinished = function(){canclick = true}
				t.start();
				position++;
			} else {
				canclick = false;
				document.getElementById('rotation_heading').innerHTML = document.getElementById('banner_txt_' + (0)).innerHTML
				document.getElementById('button_' + (position)).className = "";
				document.getElementById('button_' + (0)).className = "selected";
				var t = new Tween(document.getElementById('container').style,'left',Tween.strongEaseIn,position * -778,(0) * -778,2,'px');
				t.onMotionFinished = function(){canclick = true}
				t.start();
				position = 0;
			}
		}
		
	}
	function move_left() {
		if (canclick == true) {
			if ((position - 1) >= 0) {
				canclick = false;
				document.getElementById('rotation_heading').innerHTML = document.getElementById('banner_txt_' + (position - 1)).innerHTML
				document.getElementById('button_' + (position)).className = "";
				document.getElementById('button_' + (position - 1)).className = "selected";
				var t = new Tween(document.getElementById('container').style,'left',Tween.strongEaseIn,position * -778,(position - 1) * -778,2,'px');
				t.onMotionFinished = function(){canclick = true}
				t.start();
				position--;
			} else {
				canclick = false;
				document.getElementById('rotation_heading').innerHTML = document.getElementById('banner_txt_' + (max - 1)).innerHTML
				document.getElementById('button_' + (position)).className = "";
				document.getElementById('button_' + (max - 1)).className = "selected";
				var t = new Tween(document.getElementById('container').style,'left',Tween.strongEaseIn,position * -778,(max - 1) * -778,2,'px');
				t.onMotionFinished = function(){canclick = true}
				t.start();
				position = max-1;
			}
		}
	}
	
