/* CONFIGURAÇÕES */
var tempo = 10000 /* (for the global slide - milesecounds) */
var pause_button = 5000 /* (time for the pause button - milesecounds) */
var elemento_atual = '1';
var elemento = '2';

/* AUTOSTART */
var intervalo = self.setInterval("highlight()",tempo);

/* HIGHLIGHT BY LEANDRO BERG */
function highlight(){
	MM_swapImgRestore();
	if(elemento == '4'){
		jQuery(".highlight").hide();
		jQuery(".highlight-1").fadeIn("slow");
		jQuery("#3").attr("src", bloginfo['template_directory']+"/imagens/global/3.png");
		jQuery("#1").attr("src", bloginfo['template_directory']+"/imagens/global/1_hover.png");
		elemento = '2';
		elemento_atual = '1';
	}else{
		jQuery(".highlight").hide();
		jQuery(".highlight-"+elemento).fadeIn("slow");
		jQuery("#"+elemento_atual).attr("src", bloginfo['template_directory']+"/imagens/global/"+elemento_atual+".png");
		elemento_atual++;
		elemento++;
		jQuery("#"+elemento_atual).attr("src", bloginfo['template_directory']+"/imagens/global/"+elemento_atual+"_hover.png");
	}
}

/* START FUNCTION */
function startHighlight(){
	intervalo = self.setInterval("highlight()",tempo);
	jQuery("#pause").attr("href","javascript:stopHighlight()");
	jQuery("#pause img").attr("src", bloginfo['template_directory']+"/imagens/home/pause.gif");
	jQuery("#continue").attr("href","javascript:void(0)");
	jQuery("#continue img").attr("src", bloginfo['template_directory']+"/imagens/home/continuar_hover.gif");
}

/* STOP FUNCTION */
function stopHighlight(){
	intervalo = window.clearInterval(intervalo);
	jQuery("#pause").attr("href","javascript:void(0)");
	jQuery("#pause img").attr("src", bloginfo['template_directory']+"/imagens/home/pause_hover.gif");
	jQuery("#continue").attr("href","javascript:startHighlight()");
	jQuery("#continue img").attr("src", bloginfo['template_directory']+"/imagens/home/continuar.gif");
}

/* CHANGE HIGHLIGHT THOUGH NUMBER IMAGES'S LINK */
jQuery(document).ready(function(){
	jQuery(".bg-numbers li").click(function(){
		intervalo = window.clearInterval(intervalo);
		jQuery(".highlight").hide();
		jQuery(".highlight-"+jQuery("img",this).attr('id')).fadeIn("slow");
		elemento = jQuery("img",this).attr('id');
		jQuery("#"+elemento_atual).attr("src", bloginfo['template_directory']+"/imagens/global/"+elemento_atual+".png");
		jQuery("#"+elemento).attr("src", bloginfo['template_directory']+"/imagens/global/"+elemento+"_hover.png");
		elemento_atual = elemento;
		elemento_atual--;
		setTimeout("startHighlight()",pause_button);
	});
});
