/*
    TimerT - Um timer para exibição de slideshow em jquery
    2011  teles maciel

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
$(document).ready(function(){
		slider();
		var int=self.setInterval("slider()",5000);	
});//</jQuery>


function slider(){

	// esconde todas as imagens dentro do slider
	$(".slider img").hide();

	$(".slider").each(function(){
		//guarda a primeira imagem do vetor de imagens escondidas
		primeiro = $(this).find("img:first");

		if($(this).find(".slide").length==0){
			// cria uma div slide no começo do slider	 
			$(this).prepend("<div class='slide'></div>");
			//cria um paragrafo dentro do slide		
			//$("<p class='legenda'>"+$(primeiro).attr("title")+"</p>").appendTo($(this).find(".slide"));
		}else{
			//cria um paragrafo dentro do slide		
			//$(this).find("p.legenda").html($(primeiro).attr("title"));
		}//if-else

		//atribui o fundo da div slide como sendo a primeira imagem do vetor de imagens escondidas
		$(this).find(".slide").css("background","url('"+$(primeiro).attr("src")+"') center");
		$(this).find(".slide").css("cursor","pointer");
		$(this).find(".slide").css("float","left");
		//atribui o fundo da div slide como sendo a primeira imagem do vetor de imagens escondidas
		//pega uma cópia da primeira imagem e joga no final do vetor de imagens escondidas	
		$(primeiro).clone().appendTo($(this));
		//remove a primeira imagem
		$(primeiro).remove();
	});//each



}


