//Form
$(document).ready(function(){
  $("label").inFieldLabels();
});

$(document).ready(function(){
	$("#contactForm").validate();
	$("#sejaparceiroForm").validate();
});

//Slide Show
jQuery('.slideshow').cycle({
    fx: 'fade',
    speed: 1000,
    timeout: 8000,
    pager: '#nav',
    pagerAnchorBuilder: function(idx, slide) { 
        return '<li><a href="#">'+(idx+1)+'</a></li>';
    }, 
    after: function() {
    	var title = $(this).attr('alt');        		
    	$('.productTitle').html(title);
    	$('.title').html(title); 	 			     	  		
	}      
    	
});

$('.pause-button').click(function() { 
	$('.slideshow').cycle('pause'); 
	$('.pause-button').fadeOut(0, $('.play-button').fadeIn());
});

$('.play-button').click(function() { 
	$('.slideshow').cycle('resume'); 
	$('.play-button').fadeOut(0, $('.pause-button').fadeIn());
});


/*
jQuery('.menuAmbientes').cycle({
	fx: 'scrollHorz', 
    speed: 1000, 
    timeout: 0, 
    //pager:  '.nav-menuAmbientes',
   	prev: '#prev',  
    next: '#next'
});
*/


	jQuery('.nav-menuAmbientes a').live('click', function(){ // if not using wp-page-numbers, change this to correct ID
		var link = jQuery(this).attr('href');
		// #main is the ID of the outer div wrapping your posts
		jQuery('#main').html('<div class="loading"></div>');
		// #entries is the ID of the inner div wrapping your posts
		jQuery('#main').fadeOut(500).load(link+' #entries')	
	});
	




//Fancybox - Big photo dos produtos
$(document).ready(function() {
	$("a#produto").fancybox({
		'overlayShow'	: true,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
});


//Iluminação - Imagens Destaque
jQuery(function(){
	
	$("#shadow").css("height", $(document).height()).hide();
    $(".lightSwitcher").click(function(){
        $("#shadow").toggle();
        if ($("#shadow").is(":hidden"))
            $(this).html("Apagar a luz").removeClass("turnedOff");
                        
        else
            $(this).html("Acender a luz").addClass("turnedOff");
            $('.pageProduto').css({ 'z-index': '101'});
            $('#tituloProduto').css({ 'z-index': '102'});
            $('header').css({ 'z-index': '1'});            
    }); 	

});


//Thumbnails effect
jQuery(function(){
	$('.previewItem a:first-child').append('<span>view details</span>');
	$('.previewItem a').hover(function(){
		$(this).find('img').stop().animate({opacity:0.1},900,'easeInOutExpo');
		$(this).find('span:first').stop().animate({opacity:1,top:'28px'},600,'easeInOutExpo')
		;},
		
		function(){
			$(this).find('img').stop().animate({opacity:1},1500,'easeInOutCubic');
			$(this).find('span:first').stop().animate({opacity:0,top:'0px'},600,'easeInOutExpo',
			function(){$(this).css('top','-28px');
		});
	});
});





