// difinir tipo de cadastro
/*$(function(){
	$('#txtMidia').change(function(){
		if ($(this).val() == "0"){
			$('.optMidia').toggle();
		}else{
			$('.optMidia').hide();
		}
	});
})*/
function setTipo(){
	if( $('input[name=txtTipo]:checked').val() == "PJ" ){
		$(".tipo").show();
	}else{
		$(".tipo").hide();
	}
}
function setMidia(){
	if ($('#txtMidia').val() == "0"){
		$('.optMidia').toggle();
	}else{
		$('.optMidia').hide();
	}
}
// valida formulario contato dialog passagem
function validaFormContato(){
	valRadio = false;
	$('#frmContato input:radio').each(function(){
		if( $(this).is(':checked') ){
			valRadio = true;
		}
	});
	if( valRadio == false){
		alert('selecione um tipo');
		$('#txtTipo1').focus();
		return false;
	}
	if( $('input[name=txtTipo]:checked').val() == "PJ" ){
		if( $('#txtNomeEmp').val() == "" ){
			$('#txtNomeEmp').focus();
			alert('preencha o nome da agência/empresa');
			return false;
		}
	}
	if( $('#txtNome').val() == "" ){
		alert('preencha o campo nome');
		$('#txtNome').focus();
		return false;
	}
	// valida email
	if( $('#txtEmail').val() == "" ){
		alert('Preencha o campo E-mail.');
		$('#txtEmail').focus();
		return false;
	}
	testaEmail = '';
	if($('#txtEmail').val() != ""){
		if(!$('#txtEmail').val().match(/^\w+([\.\-]\w+)*@\w+([\.\-]\w+)*\.[a-z]{2,4}$/i)) testaEmail += " ";	
			if(testaEmail != '') {
				alert('Preencha o campo E-mail corretamente.');
				$('#txtEmail').focus();
				return false;
		}
	}
	if( $('#txtDDD').val() == "" ){
		alert('preencha o campo DDD');
		$('#txtDDD').focus();
		return false;
	}
	if( $('#txtFone').val() == "" ){
		$('#txtFone').focus()
		alert('preencha o campo Telefone');
		return false;
	}
	if( $('#txtDpto').val() == "0" ){
		$('#txtDpto').focus()
		alert('informe qual departamento deseja falar.');
		return false;
	}
	if( $('#txtMsg').val() == "" ){
		$('#txtMsg').focus();
		alert('preencha o campo mensagem.');
		return false;
	}
	if( $('#txtMidia').val() == "00" ){
		$('#txtMidia').focus();
		alert('informe como conheceu a Kangaroo Tours.');
		return false;
	}
	if( $('#txtMidia').val() == "0" ){
		if( $('#txtMidia2').val() == "" ){
			$('#txtMidia2').focus();
			alert('Escreva como nos conheceu.');
			return false;
		}
	}
	return true;
}
// valida indicacao
function validaFormDlgIndica(){
	
	if( $('#txtNomeR').val() == "" ){
		alert('preencha o campo seu nome ');
		$('#txtNomeR').focus();
		return false;
	}
	// valida email
	if( $('#txtEmailR').val() == "" ){
		alert('Preencha o campo seu E-mail.');
		$('#txtEmailR').focus();
		return false;
	}
	testaEmail = '';
	if($('#txtEmailR').val() != ""){
		if(!$('#txtEmailR').val().match(/^\w+([\.\-]\w+)*@\w+([\.\-]\w+)*\.[a-z]{2,4}$/i)) testaEmail += " ";	
			if(testaEmail != '') {
				alert('Preencha o campo seu E-mail corretamente.');
				$('#txtEmailR').focus();
				return false;
		}
	}
	if( $('#txtNomeD').val() == "" ){
		alert('preencha o campo nome destinatirio ');
		$('#txtNomeD').focus();
		return false;
	}
	// valida email
	if( $('#txtEmailD').val() == "" ){
		alert('Preencha o campo E-mail destinatario.');
		$('#txtEmailD').focus();
		return false;
	}
	testaEmail = '';
	if($('#txtEmailD').val() != ""){
		if(!$('#txtEmailD').val().match(/^\w+([\.\-]\w+)*@\w+([\.\-]\w+)*\.[a-z]{2,4}$/i)) testaEmail += " ";	
			if(testaEmail != '') {
				alert('Preencha o campo E-mail destinatario corretamente.');
				$('#txtEmailD').focus();
				return false;
		}
	}
	return true;
}