
$(document).ready(function(){
	$("#mostrar_error").hide();
	$("input#con_enviar").click(function(){
		$("#mostrar_error").hide().html("");
		
		if($("input#con_name").val() == "Nome...")
		{
			$("input#con_name").val("").focus();
			$("#mostrar_error").show().removeClass('sucess').addClass('.grid_1 error').html("Por favor, preencha todos os campos!");
		}
		
		else if(
			$("input#con_mail").val() == "E-mail...")
		{
			$("input#con_mail").val("").focus();
			$("#mostrar_error").show().removeClass('sucess').addClass('.grid_1 error').html("Por favor, preencha todos os campos!");
		}
		
		else if($("input#con_assunto").val() == "Assunto...")
		{
			$("input#con_assunto").val("").focus();
			$("#mostrar_error").show().removeClass('sucess').addClass('.grid_1 error').html("Por favor, preencha todos os campos!");
		}
		
			
		else if($("textarea#con_mensagem").val() == "Mensagem...")
		{
			$("textarea#con_mensagem").val("").focus();
			$("#mostrar_error").show().removeClass('sucess').addClass('.grid_1 error').html("Por favor, preencha todos os campos!");
		}
		else
		{
			enviar_contato();
		}
	});
	
	$("#mostrar_error").click(function()
	{
		$(this).hide();
	});
});

function enviar_contato(){$.post("http://agapeeventos.com.br/enviar.php",{name : $("input#con_name").val(),tipofesta : $("#con_tipofesta").val(),quantidade : $("input#con_quantidade").val(),mail : $("input#con_mail").val(),phone : $("input#con_fone").val(),dataevento : $("#dataevento").val(),subject : $("input#con_assunto").val(),mensagem : $("#con_mensagem").val()},function(responde_post){if(responde_post == 500){$("#mostrar_error").removeClass('.grid_1 error').addClass('sucess').show().html("Obrigado pelo contato, em breve retornaremos.");	}else{$("#mostrar_error").show().html(responde_post); }});	}


this.imagePreview = function(){	xOffset = 40;yOffset = -05;$("a.legenda").hover(function(e){this.t = this.title;this.title = "";	var c = (this.t != "") ? "<br/>" + this.t : "";$("body").append("<div id='preview'><div id='conteudo_legendas'>"+ this.t +"</div></div>");$("#preview").animate({ opacity: 0.80 });$("#preview").css("top",(e.pageY - xOffset) + "px").css("left",(e.pageX + yOffset) + "px").fadeIn("fast"); },function(){this.title = this.t;	$("#preview").remove();});	$("a").mousemove(function(e){$("#preview").css("top",(e.pageY - xOffset) + "px").css("left",(e.pageX + yOffset) + "px");});		$("li img").hover(function(){this.t2 = this.title;this.title = "";},function(){this.title = this.t2;});};

$(document).ready(function(){imagePreview();});

function mycarousel_initCallback(carousel) {jQuery('#paginar_dir').bind('click', function() {carousel.next();return false;});jQuery('#paginar_esq').bind('click', function() {carousel.prev();return false;});};jQuery(document).ready(function() {jQuery("#galeria").jcarousel({scroll :1,auto: 3,wrap: 'circular',initCallback: mycarousel_initCallback,buttonNextHTML: null,buttonPrevHTML: null});$("a[rel='galery']").colorbox();});
