$(document).ready(function() {
	var flashvars = {
		'xml': '/common/xml/banners.xml',
		'path': '/common/img/webdoor/'
	};
	var params = {'wmode': 'transparent'};
	swfobject.embedSWF("/common/swf/home/webdoor.swf", "webdoor", "476", "455", "9.0.0", "expressInstall.swf", flashvars, params);
	Cufon.replace('.folheto h2, .folheto h3, .blog h2');
	
	$('#gallery-cookies').movingBoxes({
		startPanel   : 2, 
		width        : 370,    
		speed        : 800, 
		panelWidth   : 0.40,  
		imageRatio   : 4/5   
	});
	
	$('#gallery-pasta').movingBoxes({
		startPanel   : 2,      
		speed        : 800, 
		width        : 370,   
		panelWidth   : 0.40,    
		imageRatio   : 4/5
	});
	
	// FORM NEWSLETTER
	jQuery("#frmNewsletter").validate({
		showErrors: function () { },
		rules: {
			ccNome: "required",
			ccEmail: { required: true, email: true }
		},
		messages: {
			ccNome: "",
			ccEmail: ""
		}
	});
	
	// FORM NEWSLETTER, AJAX POST
	$('#infos div form ul li a').attr('href', '#').click(function(evt){
		evt.preventDefault();
		
		if (!jQuery("#ccNome").valid()) { 
			modal('Aviso', 'Voc&ecirc; deve preenche seu nome corretamente'); return false; 
		}
		
		if (!jQuery("#ccEmail").valid()) { 
			modal('Aviso', 'Preencha um e-mail v&aacute;lido'); return false; 
		}
		
		jQuery.post("index.php?option=com_receitas&task=newsletter", {
			ccNome: jQuery("#ccNome").val(),
			ccEmail: jQuery("#ccEmail").val()
		}, function (data) {			
			modal('Aviso', data);
			jQuery("#ccNome").val("");
			jQuery("#ccEmail").val("");
		});
	});
		
});

