$(function(){

	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
		
	$('a[rel=external]').attr('target','_blank');
		
	$('ul.wallpapers_block li').hover(function(){
			$(this).find('img').animate({top:'164px'},{queue:false,duration:500});
		}, function(){
			$(this).find('img').animate({top:'7px'},{queue:false,duration:500});
	});
	
	slideShow(5000);	
		
	/* ANIM TOP HEADER FOR COLORS */	
	$("h2#colors a").click(function(){
		$("#header-top").stop().slideDown("slow");
			/* $("h2#colors a").stop().css({ backgroundPosition : "-61px -44px" }); */
		return false;
	});
		
	$("#header-top").click(function(){
		$(this).slideUp("slow");
		/* $("h2#colors a").stop().css({ backgroundPosition : "0 -44px" }); */
		return false;
	});
		
	$("#wrapper-header-top").click(function(){
		$("#header-top").stop().slideUp("slow");
		/* $("h2#colors a").stop().css({ backgroundPosition : "0 -44px" }); */
		return false;
	});
	
	/* STYLSHEET SWITCHING */
	$.stylesheetInit();
			$('#toggler').bind(
				'click',
				function(e)
				{
					$.stylesheetToggle();
					return false;
				}
			);
			
	$('.styleswitch').bind(
				'click',
				function(e)
				{
					$.stylesheetSwitch(this.getAttribute('rel'));
					return false;
				}
			);
	
	/* HOME FOOTER TEMP ANIM */
	$('#home-banners .bottom-links').hover(function(){
				$(this).stop().animate({ 'marginTop' : 2},250);
			},function(){
				$(this).stop().animate({ 'marginTop' : 10},250);
			}).find('#home-banners .bottom-links').css('marginTop',10);
	
	/* ANIM LINHA TEMPO TEMP - CHANGE ASAP */
  $("#content-main-02").hide();
  $("#content-main-03").hide();
  $("#content-main-04").hide();
  $("#content-main-05").hide();
  $("#content-main-06").hide();
  $("#content-main-07").hide();
  $("#content-main-08").hide();
  $("#content-main-09").hide();
  $("#content-main-10").hide();
  $("#content-main-11").hide();
   
   //Get all the LI from the tabMenu UL  
   $('#nav-details > li').click(function(){  
           
     //perform the actions when it's not selected  
     if (!$(this).hasClass('selected')) {      
   
     //remove the selected class from all LI      
     $('#nav-details > li').removeClass('selected');  
       
     //After cleared all the LI, reassign the class to the selected tab  
     $(this).addClass('selected');  
       
     //Hide all the DIV in .boxBody  
     $('#linha-container div').slideUp('1000');  
       
     //Look for the right DIV index based on the Navigation UL index  
     $('#linha-container div:eq(' + $('#nav-details > li').index(this) + ')').slideDown('1500');  
       
    }  
   
   }).mouseover(function() {  
   
     //Add and remove class, Personally I dont think this is the right way to do it,   
     //if you have better ideas to toggle it, please comment      
     $(this).addClass('mouseover');  
     $(this).removeClass('mouseout');     
       
   }).mouseout(function() {   
       
     //Add and remove class  
     $(this).addClass('mouseout');  
     $(this).removeClass('mouseover');      
       
   });  
   
     
   //Mouseover with animate Effect for Category menu list  :)  
   $('.boxBody category li').mouseover(function() {  
   
     //Change background color and animate the padding  
     $(this).css('backgroundColor','888');  
     $(this).children().animate({paddingLeft:"20px"}, {queue:false, duration:300});  
   }).mouseout(function() {  
       
     //Change background color and animate the padding  
     $(this).css('backgroundColor','');  
     $(this).children().animate({paddingLeft:"0"}, {queue:false, duration:300});  
   });    
       
   //Mouseover effect for Posts, Comments, Famous Posts and Random Posts menu list.  
   $('.boxBody li').click(function(){  
     window.location = $(this).find("a").attr("href");  
   }).mouseover(function() {  
     $(this).css('backgroundColor','888');  
   }).mouseout(function() {  
     $(this).css('backgroundColor','');  
   });     
         
});

function slideShow(speed) {
		$('ul.slideshow li').css({opacity: 0.0});
		$('ul.slideshow li:first').css({opacity: 1.0});	
		var timer = setInterval('gallery()',speed);	
		}

		function gallery() {
		var current = ($('ul.slideshow li.show')?  $('ul.slideshow li.show') : $('#ul.slideshow li:first'));
		var next = ((current.next().length) ? ((current.next().attr('id') == 'slideshow-caption')? $('ul.slideshow li:first') :current.next()) : $('ul.slideshow li:first'));
		next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
		current.animate({opacity: 0.0}, 1000).removeClass('show');
		}