var setTabIndex = function(){
		$(".ColorSelected").removeClass("ColorSelected");
		$(".TWICS").eq(parseInt($(".TWITab").tabSwitch('index'))).addClass("ColorSelected");
}

$(function(){
	$(".TWITab").tabSwitch('create',{type:"scroll", height: 204, width: 573});
	
	$('.TWITab').tabSwitch('startAuto',{interval: 10000},function(){
		setTabIndex();
	});

	$(".TWICS").click(function(){
		var Obj=$(this);
		$(".TWITab").tabSwitch('moveTo',{index: $(".TWICS").index(this)},setTabIndex);
	});
	
//		$('.TWICS').click(function(e){
//			$('.TWITab').tabSwitch('moveTo',{index: parseInt($(this).attr("rel"))});
//			e.preventDefault();
//		});
		

	$('.Nav').click(function(e){
			$('.TWITab').tabSwitch('moveStep',{step: parseInt($(this).attr("rel"))});
			e.preventDefault();
		});
	
});
