
	pausado=0;
	var pausa;
	comercial=1;
	function tv(){
	clearTimeout(pausa);
	temp=setTimeout("ad();",8000);
	}
	function ad(){
	if(comercial==3){comercial=0;}
	comercial=comercial+1;
	img_abas();
	for (i=1; i<4; i++)
{
if(i != comercial)
{
document.getElementById('tv_'+i).style.display="none";
}
}
	document.getElementById('tv_'+comercial).style.display="block";
	tv();
	}
	tv();
	
	
	function avanca(){
	clearTimeout(pausa);
	if(comercial==3){comercial=0;}
	comercial=comercial+1;
	img_abas();
	for (i=1; i<4; i++)
{
if(i != comercial)
{
document.getElementById('tv_'+i).style.display="none";
}
}
	document.getElementById('tv_'+comercial).style.display="block";
	//pausa=setTimeout("tv();",1000);
	if(pausado==0){pausa=setTimeout("tv();",8000);pausado=0;}
	}
		
	
	function retorna(){
	clearTimeout(pausa);
	if(comercial==1){comercial=4;}
	comercial=comercial-1;
	img_abas();
	for (i=1; i<4; i++)
{
if(i != comercial)
{
document.getElementById('tv_'+i).style.display="none";
}
}
	document.getElementById('tv_'+comercial).style.display="block";
	if(pausado==0){pausa=setTimeout("tv();",8000);pausado=0;}
	}
	
	
	
	
	
	
	
	
	
	
	
	function chamatv(x){
	clearTimeout(pausa);
	for (i=1; i<4; i++)
{
if(i != x)
{
document.getElementById('tv_'+i).style.display="none";
}
}
	document.getElementById('tv_'+x).style.display="block";
	comercial=x;
	img_abas();
	//pausa=setTimeout("tv();",1000);
	if(pausado==0){pausa=setTimeout("tv();",8000);pausado=0;}
	}
	
	
	function pausar(){
	if(pausado==0){	
	clearTimeout(temp);
	pausado=1;
	document.pausa.src="tv/img/pausa1.jpg";	
	}
	else{
	pausa=setTimeout("tv();",100);
	pausado=0; 
	document.pausa.src="tv/img/pausa.jpg";}
	}
	
	function img_abas(){
	if(comercial==1){document.getElementById('aba_1').style.backgroundImage="url('/static/aberto/guiadoinvestidor/tv/img/botao_1.jpg')";}
	else{document.getElementById('aba_1').style.backgroundImage="url('/static/aberto/guiadoinvestidor/tv/img/botao_1c.jpg')";}
	if(comercial==2){document.getElementById('aba_2').style.backgroundImage="url('/static/aberto/guiadoinvestidor/tv/img/botao_2.jpg')";}
	else{document.getElementById('aba_2').style.backgroundImage="url('/static/aberto/guiadoinvestidor/tv/img/botao_2c.jpg')";}
	if(comercial==3){document.getElementById('aba_3').style.backgroundImage="url('/static/aberto/guiadoinvestidor/tv/img/botao_2.jpg')";}
	else{document.getElementById('aba_3').style.backgroundImage="url('/static/aberto/guiadoinvestidor/tv/img/botao_2c.jpg')";}
	//if(comercial==4){document.getElementById('aba_4').style.backgroundImage="url('/static/aberto/guiadoinvestidor/tv/botao_2.jpg')";}
	//else{document.getElementById('aba_4').style.backgroundImage="url('/static/aberto/guiadoinvestidor/tv/botao_2c.jpg')";}
	}
	
