	var last_tab = -1;
	var play_flag = 0;
	var txt = "";
	function changeIframe(n)
		{		
			if (n != last_tab){
				if (last_tab == -1){last_tab =0;}
				if (rotation == how_many_rotation){play_flag = 1;}
				
				txt = (n+1) +"/"+ tabtitle.length;
				document.getElementById('Panel_tabs').innerHTML = '<IFRAME name="mainPanel" SRC="'+tabLinks[n]+'" width="536" height="328" frameborder="0" style="border: 1px solid #1A4066;" alt="" scrolling="no"></IFRAME>';
				if(showtabs == "yes"){
					//Change to unselected color	
					document.getElementById('Ltab' + last_tab).style.background = "#f2f2f2 url(http://media.tbo.com/assets/_shared/tab_upperleft.gif) no-repeat";
					document.getElementById('ahref' + last_tab).style.color = "#000099";						
					document.getElementById('Rtab' + last_tab).style.background = "#f2f2f2 url(http://media.tbo.com/assets/_shared/tab_upperright.gif) no-repeat";		
					//Change to selected color
					document.getElementById('Ltab' + n).style.background = "#7591ac url(http://media.tbo.com/assets/_shared/tab_upperleft.gif) no-repeat";	
					document.getElementById('ahref' + n).style.color = "#FFF";
					document.getElementById('Rtab' + n).style.background = "#7591ac url(http://media.tbo.com/assets/_shared/tab_upperright.gif) no-repeat";	
				}
											
				last_tab = n;
			}
		}
		function tabchangeIframe(n)
		{
			changeIframe(n);Stop();
		}
		function tabtxt()
		{
			return txt;
		}
		
	//Starting function	
	function pannel_start(showtabs,startingtab){
		var tabbody="";
		for(i=0;i<tabtitle.length;i++){
			if(i==0){tabbody= '<div class="tab_left_content" id=Ltab'+i+' ><a href="javascript:tabchangeIframe('+i+')" id="ahref'+i+'" class="tabtext">'+tabtitle[i]+'</a></div><div class="tab_right_content" id=Rtab'+i+' ></div>';}
			else{tabbody += '<div style="float: left; height: 20px; width: 2px"></div><div class="tab_left_content" id=Ltab'+i+' ><a href="javascript:tabchangeIframe('+i+')" id="ahref'+i+'" class="tabtext">'+tabtitle[i]+'</a></div><div class="tab_right_content" id=Rtab'+i+' ></div>';}				
		}
		if(showtabs == "yes"){document.getElementById('tab_contaner').innerHTML = tabbody;}						
		changeIframe(startingtab);
		Start();
	}
	function arrowdown()
		{			
			var next_frame = last_tab;var array_length = tabtitle.length -1;
			if (next_frame == 0){next_frame = array_length;}else{next_frame--}
			changeIframe(next_frame);
			Stop();
		}
	function arrowup()
		{			
			var next_frame = last_tab;var array_length = tabtitle.length -1;
			if (next_frame == array_length){next_frame =0;}else{next_frame++}
			changeIframe(next_frame);
			Stop();
		}
	function pausedown()
		{		
			if (play_flag == 0){play_flag = 1;Stop();}
			else{play_flag = 0;Start();}
			return play_flag;
		}
function playbutton()
		{				
			return play_flag;
		}
		
		
		
	//global Var	
	var timerID = 0;
	var tStart  = null;	
	var rotation = 0;		
	var how_many_rotation = set_rotation * tabtitle.length;
	function timerup()
		{				
		        rotation++;                
				var next_frame = last_tab;
				var array_length = tabtitle.length -1;
				if (next_frame == array_length){next_frame =0;}
				else{next_frame++}
				changeIframe(next_frame);							
		}
		function UpdateTimer() {
			   	
			   if(timerID) { clearTimeout(timerID); clockID  = 0; }if(!tStart) {tStart   = new Date();}
			   var  tDate = new Date();var tDiff = tDate.getTime() - tStart.getTime(); 
			   tDate.setTime(tDiff); 
			    if (tDate.getSeconds() == set_rotation_time){				
					timerup();
					Reset();
				}
				
				if (rotation != how_many_rotation){timerID = setTimeout("UpdateTimer()", 1000);}	
		}
		function Start() {
			tStart   = new Date();
			timerID  = setTimeout("UpdateTimer()", 1000);
			rotation = 0;	
			play_flag = 0;
			}
		function Stop() {
			if(timerID) {clearTimeout(timerID); timerID  = 0;}
			tStart = null;
			play_flag = 1;			
			}
		function Reset() {
			tStart = null;
			}
	
	//initalize
	pannel_start(showtabs,startingtab);	