$(document).ready(function(){


/*=================================*/
/*Funções do box news*/

	$("#cadastrar").click(function(){
		
		var email = $("#email").val();
		if(email !="" && email !="e-mail"){
		
		$("#resposta").load('grava_email.php',{email_post:email},function(){
			
			$("#email").val("");
		
		});
		
		}else{
			
			alert("Preencha seu e-mail corretamente");
		
		}
			
		return false;
	})
	
	$("#remover").click(function(){
		
		var email = $("#email").val();
		if(email !="" && email !="e-mail"){
		
		$("#resposta").load('deleta_email.php',{email_post:email},function(){
			
			$("#email").val("");
		
		});
		
		}else{
			
			alert("Preencha seu e-mail corretamente");
		
		}
			
		return false;
	})
	
	$("#email").focusin(function(){
		
		var value = $(this).val();
		
		if(value == "e-mail"){
		
			$(this).val("")
			
		}
	
	})
	$("#newsletter #email").focusout(function(){
		
		var value = $(this).val();
		
		if(value == ""){
		
			$(this).val("e-mail")
			
		}
	
	})
	
	$('form .data').datepicker({
		
		"dayNamesMin": ['Do','Se','Te','Qa','Qi','Sx','Sa'],
		"monthNames":  ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
		"dateFormat":  'dd/mm/yy'
	
	});
	$('form .fone').mask('(99)9999-9999');
	$('form .cep').mask('99999-999')
	
	
	
	
	/*--------------*/
	/*FUNÇÃO DA DESCRIÇÃO DAS MINIATURAS*/
	
	$('#box_desc_mini').hide();
	
	$('.mini_desc').mousemove(function(e){
		
		var txt = $(this).find('a').attr('alt');
		
		var distancia = 1;
		
		var top = e.pageY;
		var left = e.pageX + 2;
		
		$('#box_desc_mini').css({'top':top});
		$('#box_desc_mini').css({'left':left});
		
		$('#box_desc_mini').css({'opacity':0.8});
		
		$('#box_desc_mini').text(txt);
		
		
		$('#box_desc_mini').show();
	
	})
	
	$('.mini_desc').mouseleave(function(e){
		
		$('#box_desc_mini').hide();
	
	})
	
	

});





// Set up Sliders
// **************
$(function(){

	$('#slider2').anythingSlider({
		startPanel			: false,
		delay				: 12000,
		autoPlay			: true,
		resizeContents      : false, // If true, solitary images/objects in the panel will expand to fit the viewport
		navigationSize      : 0,     // Set this to the maximum number of visible navigation tabs; false to disable
		navigationFormatter : function(index, panel){ // Format navigation labels with text
			return ['Recipe', 'Quote', 'Image', 'Quote #2', 'Image #2'][index - 1];
		},
		onSlideComplete: function(slider) {
			// keep the current navigation tab in view
			slider.navWindow( slider.currentPage );
		},
	});

});
