
	pausado=0;
	var pausa;
	comercial=1;
	function tv(){
	clearTimeout(pausa);
	temp=setTimeout("ad();",8000);
	}
	function ad(){
	if(comercial==4){comercial=0;}
	comercial=comercial+1;
	//img_abas();
	for (i=1; i<5; 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==4){comercial=0;}
	comercial=comercial+1;
	//img_abas();
	for (i=1; i<5; 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=5;}
	comercial=comercial-1;
	//img_abas();
	for (i=1; i<5; i++)
{
if(i != comercial)
{
document.getElementById('tv_'+i).style.display="none";
}
}
	document.getElementById('tv_'+comercial).style.display="block";
	pausa=setTimeout("tv();",8000);
	}
	
	function chamatv(x){
	clearTimeout(pausa);
	for (i=1; i<5; 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="../desp/tv/pausa1.jpg";	}
	else{pausa=setTimeout("tv();",8000);pausado=0; document.pausa.src="../desp/tv/pausa.jpg";}
	}
	
	function img_abas(){
	if(comercial==1){document.getElementById('aba_1').style.backgroundImage="url('tv/botao_1.jpg')";}
	else{document.getElementById('aba_1').style.backgroundImage="url('tv/botao_1c.jpg')";}
	if(comercial==2){document.getElementById('aba_2').style.backgroundImage="url('tv/botao_2.jpg')";}
	else{document.getElementById('aba_2').style.backgroundImage="url('tv/botao_2c.jpg')";}
	if(comercial==3){document.getElementById('aba_3').style.backgroundImage="url('tv/botao_2.jpg')";}
	else{document.getElementById('aba_3').style.backgroundImage="url('tv/botao_2c.jpg')";}
	if(comercial==4){document.getElementById('aba_4').style.backgroundImage="url('tv/botao_2.jpg')";}
	else{document.getElementById('aba_4').style.backgroundImage="url('tv/botao_2c.jpg')";}
	}
	
	
	function janelas(url,x,y){
	window.open(url,'janela','width=500,height=600,scrollbars=no');
	}

