function butEnviar_onClick()
{
	if(valida_form())
		$("frmOrcamento").submit();
}

function valida_form()
{
	var hoje = new Date;
	var data = new Date;
	//VALIDA NOME
	if($("txbNome").value.length < 1)
	{
		alert("Nome não foi preenchido");
		$("txbNome").focus();
		return false;
	}
	//VALIDA E-MAIL
	if($("txbEmail").value.length < 1)
	{
		alert("E-mail não foi preenchido");
		$("txbEmail").focus();
		return false;
	}
	if(!validaCampo($("txbEmail"),"mail"))
	{
		alert("E-mail inválido");
		$("txbEmail").focus();
		return false;
	}
	//VALIDA DDD
	if($("txbDDDTel").value.length < 1)
	{
		alert("DDD não foi preenchido");
		$("txbDDDTel").focus();
		return false;
	}
	if($("txbDDDTel").value.length < 2)
	{
		alert("DDD inválido");
		$("txbDDDTel").focus();
		return false;
	}
	if(!validaCampo($("txbDDDTel"),"num"))
	{
		alert("DDD inválido");
		$("txbDDDTel").focus();
		return false;
	}
	//VALIDA NÚMERO DO TELEFONE
	if($("txbNumTel").value.length < 1)
	{
		alert("Número de telefone não foi preenchido");
		$("txbNumTel").focus();
		return false;
	}
	if(!validaCampo($("txbNumTel"),"telCurto"))
	{
		alert("Número de telefone inválido");
		$("txbNumTel").focus();
		return false;
	}
	//VALIDA CIDADE
	if($("txbCidade").value.length < 1)
	{
		alert("Cidade não foi preenchido");
		$("txbCidade").focus();
		return false;
	}
	//VALIDA DATA INICIAL
	if($("txbDataInicio").value.length < 1)
	{
		alert("Data inicial não foi preenchida");
		$("txbDataInicio").focus();
		return false;
	}
	if(!validaCampo($("txbDataInicio"),"date"))
	{
		alert("Data inválida");
		$("txbDataInicio").focus();
		return false;
	}
	//VALIDA DATA FINAL
	if($("txbDataFim").value.length < 1)
	{
		alert("Data final não foi preenchida");
		$("txbDataFim").focus();
		return false;
	}
	if(!validaCampo($("txbDataFim"),"date"))
	{
		alert("Data inválida");
		$("txbDataFim").focus();
		return false;
	}
	//VALIDA NÚMERO DE PESSOAS
	if($("txbNumPessoasEvento").value.length < 1)
	{
		alert("Número de pessoas não foi preenchido");
		$("txbNumPessoasEvento").focus();
		return false;
	}
	if(!validaCampo($("txbNumPessoasEvento"),"num"))
	{
		alert("Número inválido");
		$("txbNumPessoasEvento").focus();
		return false;
	}
	return true;
}
/////////////////////////
//FUNÇÔES DE HOSPEDAGEM//
/////////////////////////
var intApto = 0;
function adiciona_apto()
{
	if(!valida_apto())
		return;
	intApto ++;
	novaLinha = $("tblAptos").insertRow(intApto+1);
	novaCelula = novaLinha.insertCell(0);
	novaCelula.innerHTML = '<input type="text" id="txbTipoApto' + intEquipamentos + '" class="combo" name="txbTipoApto[]" value="' + $("iselTipoApto").options[$("iselTipoApto").selectedIndex].text + '"/>';
	novaCelula.innerHTML += '<input type="hidden" id="hidTipoApto' + intEquipamentos + '" name="hidTipoApto[]" value="' + $("iselTipoApto").options[$("iselTipoApto").selectedIndex].value + '"/>';
	novaCelula = novaLinha.insertCell(1);
	novaCelula.innerHTML = '<input type="text" id="txbQuantidadeApto' + intApto + '" class="number" name="txbQuantidadeApto[]" value="' + $("itxbQuantidadeApto").value + '" maxlength="5" onkeypress="return filtraCampo(this,event,\'numero\')" />';
	novaCelula = novaLinha.insertCell(2);
	novaCelula.innerHTML = '<input type="text" id="txbDiariasApto' + intApto + '" class="number" name="txbDiariasApto[]"  value="' + $("itxbDiariasApto").value + '" maxlength="5" onkeypress="return filtraCampo(this,event,\'numero\')" />';
	novaCelula = novaLinha.insertCell(3);
	novaCelula.innerHTML = '<input type="button" class="botao_pequeno" value="-" onclick="remove_apto(this)" />';
	$("iselTipoApto").selectedIndex = 0;
	$("itxbQuantidadeApto").value = "";
	$("itxbDiariasApto").value = "";
}

function remove_apto(pObject)
{
	linha = pObject.parentNode.parentNode.rowIndex;
	$("tblAptos").deleteRow(linha);
	intApto --;
}

function valida_apto()
{
	//VALIDA QUANTIDADE
	if($("itxbQuantidadeApto").value.length < 1)
	{
		alert("Quantidade de apartamentos não foi preenchido");
		$("itxbQuantidadeApto").focus();
		return false;
	}
	if(!validaCampo($("itxbQuantidadeApto"),"num"))
	{
		alert("Número inválido");
		$("itxbQuantidadeApto").focus();
		return false;
	}
	//VALIDA DIÁRIAS
	if($("itxbDiariasApto").value.length < 1)
	{
		alert("Número de diárias não foi preenchido");
		$("itxbDiariasApto").focus();
		return false;
	}
	if(!validaCampo($("itxbDiariasApto"),"num"))
	{
		alert("Número inválido");
		$("itxbDiariasApto").focus();
		return false;
	}
	return true;
}
////////////////////
//FUNÇÔES DE SALAS//
////////////////////
var intSalas = 0;
function adiciona_sala()
{
	if(!valida_sala())
		return;
	intSalas ++;
	novaLinha = $("tblSalas").insertRow(intSalas+1);
	novaCelula = novaLinha.insertCell(0);
	novaCelula.innerHTML = '<input type="text" id="txbTipoSala' + intEquipamentos + '" class="combo" name="txbTipoSala[]" value="' + $("iselTipoSala").options[$("iselTipoSala").selectedIndex].text + '"/>';
	novaCelula.innerHTML += '<input type="hidden" id="hidTipoSala' + intEquipamentos + '" name="hidTipoSala[]" value="' + $("iselTipoSala").options[$("iselTipoSala").selectedIndex].value + '"/>';
	novaCelula = novaLinha.insertCell(1);
	novaCelula.innerHTML = '<input type="text" id="txbPessoasSala' + intSalas + '" class="number" name="txbPessoasSala[]" value="' + $("itxbPessoasSala").value + '" maxlength="5" onkeypress="return filtraCampo(this,event,\'numero\')" />';
	novaCelula = novaLinha.insertCell(2);
	novaCelula.innerHTML = '<input type="text" id="txbDiariasSala' + intSalas + '" class="number" name="txbDiariasSala[]"  value="' + $("itxbDiariasSala").value + '" maxlength="5" onkeypress="return filtraCampo(this,event,\'numero\')" />';
	novaCelula = novaLinha.insertCell(3);
	novaCelula.innerHTML = '<input type="button" class="botao_pequeno" value="-" onclick="remove_sala(this)" />';
	$("iselTipoSala").selectedIndex = 0;
	$("itxbPessoasSala").value = "";
	$("itxbDiariasSala").value = "";
}

function remove_sala(pObject)
{
	linha = pObject.parentNode.parentNode.rowIndex;
	$("tblSalas").deleteRow(linha);
	intSalas --;
}

function valida_sala()
{
	//VALIDA NÚMERO DE PESSOAS
	if($("itxbPessoasSala").value.length < 1)
	{
		alert("Quantidade de pessoas não foi preenchido");
		$("itxbPessoasSala").focus();
		return false;
	}
	if(!validaCampo($("itxbPessoasSala"),"num"))
	{
		alert("Número inválido");
		$("itxbPessoasSala").focus();
		return false;
	}
	//VALIDA DIÁRIAS DA SALA
	if($("itxbDiariasSala").value.length < 1)
	{
		alert("Número de diárias para a sala não foi preenchido");
		$("itxbDiariasSala").focus();
		return false;
	}
	if(!validaCampo($("itxbDiariasSala"),"num"))
	{
		alert("Número inválido");
		$("itxbDiariasSala").focus();
		return false;
	}
	return true;
}
///////////////////////////
//FUNÇÔES DE EQUIPAMENTOS//
///////////////////////////
var intEquipamentos = 0;
function adiciona_equipamento()
{
	if(!valida_equipamento())
		return;
	intEquipamentos ++;
	novaLinha = $("tblEquipamentos").insertRow(intEquipamentos + 1);
	novaCelula = novaLinha.insertCell(0);
	novaCelula.innerHTML = '<input type="text" id="txbTipoEquipamento' + intEquipamentos + '" class="combo" name="txbTipoEquipamento[]" value="' + $("iselTipoEquipamento").options[$("iselTipoEquipamento").selectedIndex].text + '"/>';
	novaCelula.innerHTML += '<input type="hidden" id="hidTipoEquipamento' + intEquipamentos + '" name="hidTipoEquipamento[]" value="' + $("iselTipoEquipamento").options[$("iselTipoEquipamento").selectedIndex].value + '"/>';
	novaCelula = novaLinha.insertCell(1);
	novaCelula.innerHTML = '<input type="text" id="txbNumEquipamentos' + intEquipamentos + '" class="number" name="txbNumEquipamentos[]" value="' + $("itxbNumEquipamentos").value + '" maxlength="3" onkeypress="return filtraCampo(this,event,\'numero\')" />';
	novaCelula = novaLinha.insertCell(2);
	novaCelula.innerHTML = '<input type="text" id="txbDiariasEquipamento' + intEquipamentos + '" class="number" name="txbDiariasEquipamento[]" value="' + $("itxbDiariasEquipamento").value + '" maxlength="3" onkeypress="return filtraCampo(this,event,\'numero\')"/>';
	novaCelula = novaLinha.insertCell(3);
	novaCelula.innerHTML = '<input type="button" class="botao_pequeno" value=" - " onclick="remove_equipamento(this)" />';
	$("iselTipoEquipamento").selectedIndex = 0;
	$("itxbNumEquipamentos").value = "";
	$("itxbDiariasEquipamento").value = "";
}

function remove_equipamento(pObject)
{
	$("tblEquipamentos").deleteRow(pObject.parentNode.parentNode.rowIndex);
	intEquipamentos --;
}

function valida_equipamento()
{
	//VALIDA TIPO DE EQUIPAMENTO
	if(!validaCombo("iselTipoEquipamento","-1"))
	{
		alert("Escolha o tipo de equipamento");
		$("iselTipoEquipamento").focus();
		return false;
	}
	//VALIDA NÚMERO DE EQUIPAMENTOS
	if($("itxbNumEquipamentos").value.length < 1)
	{
		alert("Quantidade de equipamentos não foi preenchido");
		$("itxbNumEquipamentos").focus();
		return false;
	}
	if(!validaCampo($("itxbNumEquipamentos"),"num"))
	{
		alert("Número inválido");
		$("itxbNumEquipamentos").focus();
		return false;
	}
	//VALIDA DIÀRIAS DOS EQUIPAMENTOS
	if($("itxbDiariasEquipamento").value.length < 1)
	{
		alert("Números de diárias para os equipamentos não foi preenchido");
		$("itxbDiariasEquipamento").focus();
		return false;
	}
	if(!validaCampo($("itxbDiariasEquipamento"),"num"))
	{
		alert("Número inválido");
		$("itxbDiariasEquipamento").focus();
		return false;
	}
	return true;
}
/////////////////////////
//FUNÇÔES DE TRANSPORTE//
/////////////////////////
var intTransportes = 0;
function adiciona_transporte()
{
	if(!valida_transporte())
		return;
	intTransportes ++;
	novaLinha = $("tblTransportes").insertRow(intTransportes + 1);
	novaCelula = novaLinha.insertCell(0);
	novaCelula.innerHTML = '<input type="text" id="txbTipoTransporte' + intTransportes + '" name="txbTipoTransporte[]" class="combo" value="' + $("iselTipoTransporte").options[$("iselTipoTransporte").selectedIndex].text + '"/>';
	novaCelula.innerHTML += '<input type="hidden" id="hidTipoTransporte' + intTransportes + '" name="hidTipoTransporte[]" value="' + $("iselTipoTransporte").options[$("iselTipoTransporte").selectedIndex].value + '"/>';
	novaCelula = novaLinha.insertCell(1);
	novaCelula.innerHTML = '<input type="text" id="txbNumPessoasTransporte' + intTransportes + '" class="number" name="txbNumPessoasTransporte[]" value="' + $("itxbNumPessoasTransporte").value + '" maxlength="3" onkeypress="return filtraCampo(this,event,\'numero\')" />';
	novaCelula = novaLinha.insertCell(2);
	novaCelula.innerHTML = '<input type="button" class="botao_pequeno" value=" - " onclick="remove_transporte(this)" />';
	$("iselTipoTransporte").selectedIndex = 0;
	$("itxbNumPessoasTransporte").value = "";
}

function remove_transporte(pObject)
{
	$("tblTransportes").deleteRow(pObject.parentNode.parentNode.rowIndex);
	intTransportes --;
}

function valida_transporte()
{
	//VALIDA TIPO DE VEICULO
	if(!validaCombo("iselTipoTransporte","-1"))
	{
		alert("Escolha o tipo de transporte");
		$("iselTipoTransporte").focus();
		return false;
	}
	//VALIDA NÚMERO DE PESSOAS
	if($("itxbNumPessoasTransporte").value.length < 1)
	{
		alert("Número de pessoas não foi preenchido");
		$("itxbNumPessoasTransporte").focus();
		return false;
	}
	if(!validaCampo($("itxbNumPessoasTransporte"),"num"))
	{
		alert("Número inválido");
		$("itxbNumPessoasTransporte").focus();
		return false;
	}
	return true;
}
