// JavaScript Document

ClasseFazenda = "includes/ClasseFazenda.php";

function winInteresse(animal) {
	$("#contFrmInteresse").html("<div align='center'><img src='imagens/preload.gif' alt='aguarde..' title='aguarde...' border='0'><br />Um momento...</div>");
	$("#formDetInteresse").show();
	$.post(ClasseFazenda, { funcao: "FormNegociacao", animal: animal },
		   function(msg) {
			   $("#contFrmInteresse").html(msg);
		   });
}

function IniciarNegociacao(animal) {
	hash = $("input,select", $("#contato")).serialize();
	$("#sendData").show();
	$.ajax({
	  type: "POST",
	  url: ClasseFazenda,
	  data: "funcao=GravaContato&animal="+animal+"&"+hash,
	  success: function(msg){
		if(msg == "sucesso") {
			$("#contFrmInteresse").html("Os seus dados foram enviados com sucesso, agradecemos o seu interesse, entraremos em contato.");	
		}else{
			alert(msg);	
		}
	  }
	});
}

function ccalend(acao,mes,ano) {
	$("#calendario").html("<p align='center'>Aguarde...</p>");
	$.post("includes/agenda_ajax.php", { load: true, ano: ano, mes: mes }, 
		   function(data) {
			   $("#calendario").html(data);
		   });
}

play=false;
function svideo() {
	if(!play) {
		$("#videoplay").show();
		play=true;
	} else {
		$("#videoplay").hide();
		play=false;
	}
}

function Janela(theURL,winName,features) {
	var teste = window.open(theURL,winName,features);
	if(teste != null) teste.focus();
}