function addEvent(object, evType, func, useCapture){
    if(object.addEventListener){
        object.addEventListener(evType, func, useCapture);
    } else if(object.attachEvent){
        object.attachEvent("on" + evType, func);
    }
}

function AtributeClick(){
addEvent(document.getElementById("voltar"), "click", function(){ NPSlide("next"); }, false);
addEvent(document.getElementById("ir"), "click", function(){ NPSlide("voltar"); }, false);
addEvent(document.getElementById("bnt_pp"), "click", function(){ PlayPauseSlide(); }, false);
}

function AutoPlay(){
Intervalo = setTimeout("AutoPlay()",tempoParaTroca*1000);
if(Swicth == "ON"){
NPSlide("next");
}
}

function PlayPauseSlide(){
var bnt_pp = document.getElementById("bnt_pp");
if(Swicth == "OFF"){
Swicth = "ON";
bnt_pp.src = "imagens/pause.gif";
}else{
Swicth = "OFF";
bnt_pp.src = "imagens/play.gif";
}
}

function NPSlide(tipo){
try{
var Pops = document.getElementById("pop").getElementsByTagName("li");
if(tipo=="next"){
numero++;
} else if(tipo=="voltar"){
numero--;
}

numero =  (numero<=-1)?(numero=Pops.length-1):(numero>=Pops.length)?(0):(numero);

for(var i=0;i<Pops.length;i++){
	if(numero==i){
	Pops[i].className = "a";
	} else {
	Pops[i].className = "";
	}
}

}catch(ee){
	return false;
}
	return true;
}

var Intervalo = "";
var numero = -1;
var Swicth = "ON";
var tempoParaTroca = 5;

function Ampliar(){
var ttt=document.getElementById('amplia');
if(ttt.style.width=="auto"){
ttt.style.width='120px';
ttt.style.height='120px';
}else{
ttt.style.width='auto';
ttt.style.height='auto';
}
}

function TrocaIMG(url){
var ttt=document.getElementById('amplia');
ttt.src="imagens/load.gif";
ttt.src=url;
return false;
}

window.onload = function(){
	var Str = String(window.location);
	Str = Str.split("/");
	Str = Str[Str.length-1];
	
	if(Str=="index.php" || Str==""){
	AtributeClick();
	AutoPlay();
	}
}