/**
 * Superslider - Easy to slide
 *   http://st8.la
 *
 * Developed by Mauricio Camillo
 * Copyright (c) 2010 Mauricio Camillo
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 */

function Superslider(container,ul_id,ul_idthumb,arrows,speed){var timer_troca;var timer_fadein;var timer_roda;var estanaphoto=1;var imageList=new Array();$("#"+ul_id+" > li").each(function(index){imageList[index]={href:$(this).find('a[class*=photolink]').attr("href"),image:$(this).find('img').attr("src"),text:$(this).find('.bottomtext').html(),thumb:$(this).find('.thumbs').html()};if(ul_idthumb!=0){$("#"+ul_idthumb).append("<li><a class='thumbs' href='#' rel='"+(index+1)+"'><img src='"+imageList[index].thumb+"' alt='' /></a></li>");}});var imageListSize=imageList.length;function fadeout(){$("#"+container).find(".bottomtext").animate({bottom:"-50px"},1000);$("#"+container).find(".photolink").animate({opacity:"0"},1000);}function fadein(){$("#"+container).find(".bottomtext").css({'bottom':'-50px'});$("#"+container).find(".photolink").animate({opacity:"1"},1000);$("#"+container).find(".bottomtext").animate({bottom:"0"},1000);}function troca(){if(ul_idthumb!=0){mudaThumb();}if($('.controllink[href='+container+']').length>0){mudaLink();}var elemento=imageList[estanaphoto-1];$("#"+container).find(".photolink").attr("href",elemento.href);$("#"+container).find(".image").attr("src",elemento.image);$("#"+container).find(".bottomtext").html(elemento.text);}function rodaphoto(){fadeout();if(estanaphoto>=imageListSize){estanaphoto=1;}else{estanaphoto++;}timer_troca=setTimeout(troca,1000);timer_fadein=setTimeout(fadein,1000);}function rodaphotoabaixo(){fadeout();if(estanaphoto<=1){estanaphoto=imageListSize;}else{estanaphoto--;}timer_troca=setTimeout(troca,1000);timer_fadein=setTimeout(fadein,1000);}function mudaThumb(){$("#"+ul_idthumb).find(".thumbs").animate({opacity:"0.3"},600);$("#"+ul_idthumb).find(".thumbs[rel|="+estanaphoto+"]").animate({opacity:"1"},600);}function mudaLink(){if($('.controllink[href='+container+']').length>0){$('.controllink[href='+container+']').removeClass('linkativo');$('.controllink[href='+container+'][rel='+estanaphoto+']').addClass('linkativo');}}if(arrows!=0){var arrowshtml="<span class='seta_esquerda'></span><span class='seta_direita'></span>";}else{var arrowshtml="";}$("#"+container).html("<a href='"+imageList[0].href+"' class='photolink loading' target='_blank'><img class='image' src='"+imageList[0].image+"' border='0' alt='' /></a><span class='bottomtext'>"+imageList[0].text+"</span>"+arrowshtml);if(ul_idthumb!=0){mudaThumb();}if($('.controllink[href='+container+']').length>0){mudaLink()}if(speed!=0){timer_roda=setInterval(rodaphoto,speed);}if(ul_idthumb!=0){$("#"+ul_idthumb).find(".thumbs").click(function(e){e.stopPropagation();e.preventDefault();if(speed!=0){clearInterval(timer_roda);}fadeout();estanaphoto=$(this).attr("rel");timer_troca=setTimeout(troca,1000);timer_fadein=setTimeout(fadein,1000);if(speed!=0){timer_roda=setInterval(rodaphoto,speed);}});}if(arrows!=0){$(".seta_esquerda,.seta_direita").mouseover(function(){$(this).css("opacity","1");}).mouseout(function(){$(this).css("opacity","0");});$("#"+container).find(".seta_esquerda").click(function(){if(speed!=0){clearInterval(timer_roda);}rodaphotoabaixo();if(speed!=0){timer_roda=setInterval(rodaphoto,speed);}});$("#"+container).find(".seta_direita").click(function(){if(speed!=0){clearInterval(timer_roda);}rodaphoto();if(speed!=0){timer_roda=setInterval(rodaphoto,speed);}});}if($('.controllink[href='+container+']').length>0){$('.controllink[href='+container+']').click(function(e){e.stopPropagation();e.preventDefault();if(speed!=0){clearInterval(timer_roda);}fadeout();estanaphoto=$(this).attr("rel");timer_troca=setTimeout(troca,1000);timer_fadein=setTimeout(fadein,1000);});}}