// JavaScript Document

$(document).ready(function(){
  $('#header #links li:last-child').css({'background':'none','padding-right':'0'});
  
// MENU  
  /*$('#menu li').mouseenter(function() {
    $(this).children('ul').slideDown();
  }).mouseleave(function(){
    $(this).children('ul').hide();
  });*/
  
// BANNER
  $('#banner ul').carouFredSel({
	  items: 1,
	  scroll: {
		  fx: 'crossfade',
		  duration: 800
	  },
	  pagination  : "#nav"
  });
  
// DISTRIBUIDORES / LOGOS  
  $('#logos ul').carouFredSel({
	  direction: "up",
	  items: 1
  });
	
// PRODUTOS RELACIONADOS	
	$('#relacionados ul').carouFredSel({
	  direction: "left",
	  items: 3,
		prev: '.prev_rel',
		next: '.next_rel',		
		circular: false,
		auto: false
  });

// PROMOCOES
  $('#list_promo ul').carouFredSel({
	  items: 1,
	  auto: false,
	  scroll: {
		  duration: 800
	  },
	  circular: false,
	  next: '.proxima'
  });
  
// CAROUSEL
  $('#carousel ul').carouFredSel({
	circular: false,
	prev: '.prev',
	next: '.next',
	scroll: 2,
	align: false,
	auto: false
  });

  $('#lateral_produtos ul').carouFredSel({
	auto: false,	  
	circular: false,
	direction: "up",	
	next: '.down',
	items: 4,
	align: false,
	scroll: 2
  });
  
  $('#galeria_prod div').carouFredSel({	  
	circular: false,
	next: '.next_galeria',	
	prev: '.prev_galeria',
	items: 3,
	align: false,
	auto: false,
	scroll: 2
  });
  
// PLACEHOLDER  
  $('.limpadados').each(function(){
	var dados = $(this).attr("placeholder");
	$(this).val(dados).each(function(){  
		$(this).focus(function(){
		  if ($(this).val() == $(this).attr("placeholder")){
			$(this).val('');
		  }
		}).blur(function(){
		  if ($(this).val() == '' ){
			$(this).val($(this).attr("placeholder"));
		  }
	  });	
	});	
  });	
  
// PRODUTO
  $("a[rel=galeria]").fancybox();
  $(".fancybox").fancybox({
	  'titlePosition'	:	'inside'
  });

// MASCARA TELEFONE
  $('.telefone').mask('(99) 9999-9999');
  
// FECHAR MODAL
  $('.fechar').click(function(){
	  $(this).parent().hide();
  });
	
$(".youtube").click(function() {
	$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	'wmode'		: 'transparent',
					'allowfullscreen'	: 'true'
			}
		});

	return false;
});
	
});
