
if (document.location.host == "www.bigdrummer.com.br") {
	document.location = "http://www.maximizesistemas.com.br/bigdrummer";
}

var idPainelExibido = "banner";
var idPainelASerExibido = "";
var deveEsconderProdutos = false;

function exibir(idPainel, esconderProdutos) {

	if (esconderProdutos == null) {
		esconderProdutos = false;
	}
	
	deveEsconderProdutos = esconderProdutos;
	
	if (deveEsconderProdutos) {
		$("#produtos").fadeOut(200);
	}
	
	idPainelASerExibido = idPainel;
	$("#" + idPainelExibido).fadeOut(200, exibirCallback);
	
}

function exibirCallback() {

	$("#" + idPainelASerExibido).fadeIn(200);
	
	if (!deveEsconderProdutos) {
		$("#produtos").fadeIn(200);
	}

	idPainelExibido = idPainelASerExibido;
}

var idDivCaseExibido = null;

function exibirCase(idDiv) {

	if (idDivCaseExibido != null) {
		$("#" + idDivCaseExibido).fadeOut(200, exibirCallback);
	}
	
	var elemento = document.getElementById(idDiv);

	if (elemento.style.display == "" || elemento.style.display == "none") {
		$("#" + idDiv).slideDown(400);
		
	} else {
		$("#" + idDiv).fadeOut(200);
	}
	
	idDivCaseExibido = idDiv;
}

var idSolucaoExibida = null;
var idSolucaoASerExibida = "";

function exibirConteudoMaior(param1, param2) {

	if (param2 == null) {
		var idConteudoMaior = param1;
		idSolucaoASerExibida = idConteudoMaior;
		
	} else {
		var secao = param1;

		exibir(secao, true);

		var item = param2;

		idSolucaoASerExibida = secao + "_" + item;
	}
	
	if (idSolucaoExibida != null) {
		$("#" + idSolucaoExibida).fadeOut(200, exibirConteudoMaiorCallback);
	} else {
		exibirConteudoMaiorCallback();
	}
}

function exibirConteudoMaiorCallback() {
	$("#" + idSolucaoASerExibida).fadeIn(200);
	idSolucaoExibida = idSolucaoASerExibida;
}

var estaEnviando = false;

function enviarContato() {

	if (estaEnviando) {
		alert("Sua mensagem está sendo enviada. Aguarde.");
		return;
	}

	if (getValor("nome").trim() == "") {
		alert("Por favor, informe o seu nome.");
		document.getElementById("nome").focus();
		return;
	}

	if (getValor("email").trim() == "") {
		alert("Por favor, informe o seu e-mail para retorno do contato.");
		document.getElementById("email").focus();
		return;
	}

	if (getValor("mensagem").trim() == "") {
		alert("Por favor, escreva sua mensagem.");
		document.getElementById("mensagem").focus();
		return;
	}
	
	var agora = new Date();
	var url = "contato.jsp?" + agora.getTime();

	url += "&nome=" + getValor("nome");
	url += "&email=" + getValor("email");
	url += "&nomeempresa=" + getValor("nomeempresa");
	url += "&cidade=" + getValor("cidade");
	url += "&uf=" + getValor("uf");
	url += "&telefone=" + getValor("telefone");
	url += "&interesse=" + getValor("interesse");
	url += "&mensagem=" + getValor("mensagem");

	AjaxUtil.call(url, exibirMensagem);
	
	estaEnviando = true;
}

function getValor(idInput) {
	return document.getElementById(idInput).value;
}

function exibirMensagem(resposta) {

	if (resposta.trim() == "OK") {
		alert("Sua mensagem foi enviada com sucesso.\nEntraremos em contato em breve.\nObrigado.");
	} else {
		alert("Ocorreu um erro ao enviar sua mensagem.\nPor favor tente novamente, ou envie sua mensagem para contato@maximizesistemas.com.br.\nDesculpe o incômodo.");
	}
	
	estaEnviando = false;
}

function selecionarInteresse(indice) {
	document.getElementById("interesse").selectedIndex = indice;
}



