// JavaScript Document

var __LOADLIB__ = '/__loadfiles/';

// ******************************** AJAX REQUEST **************************
function buscaCidadeDoEstado(idEstado, idObjDest)
{
	ExecutaAjax(__LOADLIB__+'cidades/buscaCidadeEstado.php?idEstado='+idEstado, idObjDest, 'select');
}

function buscaTipoDoSetor(idSetor, idObjDest)
{
	ExecutaAjax(__LOADLIB__+'tipoProduto/buscaTipoDoSetor.php?idSetor='+idSetor, idObjDest, 'select');
}

// ******************************** REDIRECIONADORES **************************
function gotoPage(numeroPagina, qtdPg)
{
	document.location.href='?inicio='+numeroPagina+'&qtd='+qtdPg;
}


function mostraPreviewNewsletter()
{
	var altura = screen.availHeight;
	//var achou  = false;
	var strId  = '';
	var radios = document.getElementsByTagName('input');
	for(var i=0; i<radios.length; i++)
	{
		if(radios[i].type == 'checkbox')
		{
			if(radios[i].id.substr(0,12) == 'chkIdNoticia')
			{
				if(radios[i].checked)
					strId+= radios[i].value +',';
			}
		}
	}
	
	if(strId != '')
	{
		strId = strId.substr(0,strId.length-1);
		window.open('visualizarNewsletter.php?id='+strId,'preview','width=635,height='+altura+',left=0,top=0,resizable=yes,scrollbars=yes');
	}
	else
		alert('Selecione uma ao menos uma notícia');
}
// ******************************** VALIDAÇÕES *************************
function confirmaExclusao()
{
	return confirm('Você deseja realmente excluir este registro ?');
}

// Valida o formulário de cadastro de administradores
function validaFormAdministrador()
{
	if(document.getElementById('txtNome').value == '')
	{
		alert('Nome: preenchimento obrigatório');
		document.getElementById('txtNome').focus();
		return false;
	}

	if(document.getElementById('txtLogin').value == '')
	{
		alert('Login: preenchimento obrigatório');
		document.getElementById('txtLogin').focus();
		return false;
	}

	return true;
}

// Valida o cadastro do banner
function validaFormBanner()
{
	if(document.getElementById('txtTitulo').value == '')
	{
		alert('Título: preenchimento obrigatório');
		document.getElementById('txtTitulo').focus();
		return false;
	}
	
	if(document.getElementById('txtUrl').value == '')
	{
		alert('URL: preenchimento obrigatório');
		document.getElementById('txtUrl').focus();
		return false;
	}
	
	if(document.getElementById('txtImagem').value == '')
	{
		alert('Imagem: obrigatório selecionar uma');
		document.getElementById('txtImagem').focus();
		return false;
	}
	
	return true;
}

// Testa se o usuário selecionou ao menos um checkbox
function validaVisualizaEnvioNews()
{
	var radios = document.getElementsByTagName('input');
	for(var i=0; i<radios.length; i++)
	{
		if(radios[i].type == 'checkbox')
		{
			if(radios[i].id.substr(0,12) == 'chkIdNoticia')
			{
				if(radios[i].checked)
					return true;
			}
		}
	}
	
	alert('Notícia: obrigatório selecionar umao menos a opção');
	return false;
}

function validaFormContato()
{
	if(document.getElementById('lstSetor').value == '')
	{
		alert('Setor: obrigatório selecionar uma opção');
		document.getElementById('lstSetor').focus();
		return false;
	}

	if(document.getElementById('txtNome').value == '')
	{
		alert('Nome: preenchimento obrigatório');
		document.getElementById('txtNome').focus();
		return false;
	}

	if(document.getElementById('lstEstado').value == '')
	{
		alert('Estado: obrigatório selecionar uma opção');
		document.getElementById('lstEstado').focus();
		return false;
	}

	if(document.getElementById('lstCidade').value == '')
	{
		alert('Cidade: obrigatório selecionar uma opção');
		document.getElementById('lstCidade').focus();
		return false;
	}

	if(document.getElementById('txtTelefone').value == '')
	{
		alert('Telefone: preenchimento obrigatório');
		document.getElementById('txtTelefone').focus();
		return false;
	}

	if(document.getElementById('txtEmail').value == '')
	{
		alert('E-mail: preenchimento obrigatório');
		document.getElementById('txtEmail').focus();
		return false;
	}

	if( !isEmail(document.getElementById('txtEmail').value) )
	{
		alert('E-mail: inválido');
		document.getElementById('txtEmail').focus();
		return false;
	}

	if(document.getElementById('txtMensagem').value == '')
	{
		alert('Mensagem: preenchimento obrigatório');
		document.getElementById('txtMensagem').focus();
		return false;
	}

	return true;
}

function validaFormContatoShowRoom()
{
	if(document.getElementById('lstCooperativa').value == '')
	{
		alert('Cooperativa: obrigatório selecionar uma opção');
		document.getElementById('lstCooperativa').focus();
		return false;
	}

	if(document.getElementById('txtNome').value == '')
	{
		alert('Nome: preenchimento obrigatório');
		document.getElementById('txtNome').focus();
		return false;
	}

	if(document.getElementById('txtEndereco').value == '')
	{
		alert('Endereço: preenchimento obrigatório');
		document.getElementById('txtEndereco').focus();
		return false;
	}

	if(document.getElementById('txtBairro').value == '')
	{
		alert('Bairro: preenchimento obrigatório');
		document.getElementById('txtBairro').focus();
		return false;
	}

	if(document.getElementById('lstEstado').value == '')
	{
		alert('Estado: obrigatório selecionar uma opção');
		document.getElementById('lstEstado').focus();
		return false;
	}

	if(document.getElementById('lstCidade').value == '')
	{
		alert('Cidade: obrigatório selecionar uma opção');
		document.getElementById('lstCidade').focus();
		return false;
	}

	if(document.getElementById('txtTelefone').value == '')
	{
		alert('Telefone: preenchimento obrigatório');
		document.getElementById('txtTelefone').focus();
		return false;
	}

	if(document.getElementById('txtEmail').value == '')
	{
		alert('E-mail: preenchimento obrigatório');
		document.getElementById('txtEmail').focus();
		return false;
	}

	if( !isEmail(document.getElementById('txtEmail').value) )
	{
		alert('E-mail: inválido');
		document.getElementById('txtEmail').focus();
		return false;
	}

	if(document.getElementById('txtMensagem').value == '')
	{
		alert('Mensagem: preenchimento obrigatório');
		document.getElementById('txtMensagem').focus();
		return false;
	}

	return true;
}

// Login do administrador
function validaFormLogin()
{
	if(document.getElementById('txtLogin').value == '')
	{
		alert('Login: preenchimento obrigatório');
		document.getElementById('txtLogin').focus();
		return false;
	}

	if(document.getElementById('txtSenha').value == '')
	{
		alert('Senha: preenchimento obrigatório');
		document.getElementById('txtSenha').focus();
		return false;
	}

	return true;
}

// Cadastro de diretores
function validaFormDiretoria()
{
	if(document.getElementById('lstSetor').value == '')
	{
		alert('Setor: obrigatório selecionar uma opção');
		document.getElementById('lstSetor').focus();
		return false;
	}

	if(document.getElementById('txtNome').value == '')
	{
		alert('Nome: preenchimento obrigatório');
		document.getElementById('txtNome').focus();
		return false;
	}

	if(document.getElementById('txtEmail').value == '')
	{
		alert('E-mail: preenchimento obrigatório');
		document.getElementById('txtEmail').focus();
		return false;
	}

	return true;
}

// Cadastro de produtos
function validaFormProduto()
{
	if(document.getElementById('lstTipo').value == '')
	{
		alert('Tipo de Produto: obrigatório selecionar uma opção');
		document.getElementById('lstTipo').focus();
		return false;
	}

	if(document.getElementById('lstCooperativa').value == '')
	{
		alert('Cooperativa: obrigatório selecionar uma opção');
		document.getElementById('lstCooperativa').focus();
		return false;
	}

	if(document.getElementById('txtNome').value == '')
	{
		alert('Nome: preenchimento obrigatório');
		document.getElementById('txtNome').focus();
		return false;
	}

	return true;
}

// Cadastro de link
function validaFormLink()
{
	if(document.getElementById('lstTipo').value == '')
	{
		alert('Tipo: obrigatório selecionar uma opção');
		document.getElementById('lstTipo').focus();
		return false;
	}

	if(document.getElementById('txtTitulo').value == '')
	{
		alert('Título: preenchimento obrigatório');
		document.getElementById('txtTitulo').focus();
		return false;
	}

	if(document.getElementById('txtUrl').value == '')
	{
		alert('URL: preenchimento obrigatório');
		document.getElementById('txtUrl').focus();
		return false;
	}

	return true;
}

// Cadastro de link
function validaFormJingle()
{
	if(document.getElementById('txtTitulo').value == '')
	{
		alert('Título: preenchimento obrigatório');
		document.getElementById('txtTitulo').focus();
		return false;
	}

	if(document.getElementById('txtArquivo').value == '')
	{
		alert('Arquivo: obrigatório selecionar um');
		document.getElementById('txtArquivo').focus();
		return false;
	}

	return true;
}

// Cadastro de cooperativa
function validaFormCooperativa()
{
	if(document.getElementById('lstTipo').value == '')
	{
		alert('Tipo: obrigatório selecionar uma opção');
		document.getElementById('lstTipo').focus();
		return false;
	}

	if(document.getElementById('lstCidade').value == '')
	{
		alert('Cidade: obrigatório selecionar uma opção');
		document.getElementById('lstCidade').focus();
		return false;
	}

	if(document.getElementById('txtNome').value == '')
	{
		alert('Título: preenchimento obrigatório');
		document.getElementById('txtNome').focus();
		return false;
	}

	if(document.getElementById('txtTelefone').value == '')
	{
		alert('Telefone: preenchimento obrigatório');
		document.getElementById('txtTelefone').focus();
		return false;
	}

	return true;
}

// Cadastro de matriz/filial
function validaFormFilial()
{
	if(document.getElementById('rbtFilialS').checked == false && document.getElementById('rbtFilialN').checked == false)
	{
		alert('É Matriz? obrigatório selecionar uma opção');
		document.getElementById('lstTipo').focus();
		return false;
	}

	if(document.getElementById('lstCidade').value == '')
	{
		alert('Cidade: obrigatório selecionar uma opção');
		document.getElementById('lstCidade').focus();
		return false;
	}

	if(document.getElementById('txtNome').value == '')
	{
		alert('Título: preenchimento obrigatório');
		document.getElementById('txtNome').focus();
		return false;
	}

	if(document.getElementById('txtTelefone').value == '')
	{
		alert('Telefone: preenchimento obrigatório');
		document.getElementById('txtTelefone').focus();
		return false;
	}

	return true;
}

// Cadastro de e-mail newsletter
function validaFormMailingList()
{
	if(document.getElementById('txtEmail').value == '')
	{
		alert('E-mail: preenchimento obrigatório');
		document.getElementById('txtEmail').focus();
		return false;
	}

	if(isEmail(document.getElementById('txtEmail').value) == 'false')
	{
		alert('E-mail: inválido');
		document.getElementById('txtEmail').focus();
		return false;
	}

	return true;
}

// Valida o formulário de atualização de agro-preços
function validaFormAgroPreco()
{
	if(document.getElementById('txtData').value == '')
	{
		alert('Data: preenchimento obrigatório');
		document.getElementById('txtData').focus();
		return false;
	}

	if(document.getElementById('txtInformacao').value == '')
	{
		alert('Informação: preenchimento obrigatório');
		document.getElementById('txtInformacao').focus();
		return false;
	}
}

// Valida o formulário de rádios da rede
function validaFormRadioRede()
{
	if(document.getElementById('lstCidade').value == '')
	{
		alert('Cidade: obrigatório selecionar uma opção');
		document.getElementById('lstCidade').focus();
		return false;
	}

	if(document.getElementById('txtNome').value == '')
	{
		alert('Nome: preenchimento obrigatório');
		document.getElementById('txtNome').focus();
		return false;
	}

	if(document.getElementById('txtFrequencia').value == '')
	{
		alert('Frequencia: preenchimento obrigatório');
		document.getElementById('txtFrequencia').focus();
		return false;
	}
}

// Cadastro de notícias
function validaFormvalidaFormNoticia()
{
	if(document.getElementById('txtData').value == '')
	{
		alert('Data: preenchimento obrigatório');
		document.getElementById('txtData').focus();
		return false;
	}

	if(document.getElementById('txtTitulo').value == '')
	{
		alert('Título: preenchimento obrigatório');
		document.getElementById('txtTitulo').focus();
		return false;
	}

	if(document.getElementById('txtDescricao').value == '')
	{
		alert('Descrição: preenchimento obrigatório');
		document.getElementById('txtDescricao').focus();
		return false;
	}

	return true;
}

// **************************** FUNÇÕES *****************************

/**
 * Testa se o CEP informado pelo usurio  valido
 */
function isCEP(objCEP,campoUF) 
{
	if (objCEP.value.length != 9) 
	{
		alert('Por favor digite o CEP no formato xxxxx-xxx.');
		objCEP.focus();
		return false 
	}	
	
	// if (isNaN(argCEP)) { alert('CEP invlido.\nApenas valores numricos.'); return false }
	var valor = parseInt(objCEP.value.substring(0,5))/*valor inicial*/; 
	var est = campoUF.toUpperCase();
	var erro = true;
	
	if (valor >= 0 && valor <= 19999) 
	{
		if (est == "SP")
			erro = false;
	}
	else if (valor >= 20000 && valor <= 29999) 
	{	
		if (est == "RJ" || est == "ES")
			erro = false;
	}
	else if (valor >= 30000 && valor <= 39999) 
	{
		if (est == "MG")
			erro = false;
	}	
	else if (valor >= 40000 && valor <= 49999) 
	{
		if (est == "BA" || est == "SE")
			erro = false;
	}
	else if (valor >= 50000 && valor <= 59999) 
	{
		if (est == "PE" || est == "AL" || est == "PB" || est == "RN")
			erro = false;
	}
	else if (valor >= 60000 && valor <= 69999) 
	{
		if (est == "CE" || est == "PI" || est == "MA" || est == "PA" || est == "AP" || est == "AM" || est == "RR" || est == "AC")
			erro = false;
	}	
	else if (valor >= 70000 && valor <= 79999) 
	{	
		if (est == "DF" || est == "GO" || est == "TO" || est == "MT" || est == "RO" || est == "MS")
			erro = false;
	}
	else if (valor >= 80000 && valor <= 89999) 
	{
		if (est == "PR" || est == "SC")
			erro = false;
	}	
	else if (valor >= 90000 && valor <= 99999) 
	{
		if (est == "RS")
			erro = false;
	}

	if (erro)
	{
		alert ("O CEP no corresponde ao estado selecionado.");
		objCEP.value = '';
		objCEP.focus();
		return false; 
	}
	return true;
}

// Verifica se é um e-mail
function isEmail(mail)
{
	var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
	
	if(typeof(mail) == "string")
		return (er.test(mail))
	else if(typeof(mail) == "object")
		return (er.test(mail.value))
	else
		return false;
}

/**
 * Testa o evento KeyCode de acordo com o tipo de browser e evento do campo
 */ 
function testaKeyCode(evnt)
{
	if (window.event)
		return window.event.keyCode;
	else if (evnt)
		return evnt.which;
}

/**
 * Máscara para formatação de datas
 *
 * obj => HTML Object do campo a ser testado (this)
 */
function fmtData(obj, e)
{
	// Testa se a entrada é apenas número
	if(apenasNumeros(e))
	{
		var keyCode = testaKeyCode(e);
		if(!specialKeys(keyCode))
		{
			var myVal = obj.value;
			if (myVal.length > 2 && !myVal.match(/\//))
				myVal = '';
			else
			{
				// Obtém o key code
				keyCode = testaKeyCode(e);
		
				if ((keyCode < 48 || keyCode > 57) && (keyCode < 96 || keyCode > 105))
					myVal = myVal.substr(0, (myVal.length - 1));
		
				if (myVal.length == 2 || myVal.length == 5)
					myVal += '/';
				
			}
			obj.value = myVal;
		}
		return true;
	}
	else
		return false;
}

/**
 * Máscara para formatação de cep
 *
 * obj => HTML Object do campo a ser testado (this)
 */
function fmtCep(obj, e)
{
	// Testa se a entrada é um número
	if(apenasNumeros(e))
	{
		var myVal = obj.value;
		if (myVal.length > 5 && !myVal.match(/\-/))
			myVal = '';

		var keyCode = testaKeyCode(e);
		if(!specialKeys(keyCode))
		{
			if ((keyCode < 48 || keyCode > 57) && (keyCode < 96 || keyCode > 105))
				myVal = myVal.substr(0, (myVal.length - 1));
	
			if (myVal.length == 5)
				myVal += '-';
			
			obj.value = myVal;
		}
		return true;
	}
	else
		return false;
}

/**
 * Máscara para formatação de CPF
 *
 * obj => HTML Object do campo a ser testado (this)
 * e => Evento do teclado
 */
function fmtCpf(obj, e)
{
	// Testa se a entrada é um número
	if(apenasNumeros(e))
	{
		keyCode = testaKeyCode(e);
		
		if(!specialKeys(keyCode))
		{
			var myVal = obj.value;
			if ( ((myVal.length > 3 || myVal.length > 7 || myVal.length > 10) && !myVal.match(/\./)) ||  (myVal.length > 14 && !myVal.match(/\-/)) )
				myVal = '';
	
			if (myVal.length == 3 || myVal.length == 7)
				myVal += '.';
				
			if(myVal.length == 11)
				myVal += '-';
			
			obj.value = myVal;
		}
		return true;
	}
	else
		return false;
}

/**
 * Máscara para formatação de CNPJ
 *
 * obj => HTML Object do campo a ser testado (this)
 * e => Evento do teclado
 */
function fmtCnpj(obj, e)
{
	// Testa se a entrada é um número
	if(apenasNumeros(e))
	{
		keyCode = testaKeyCode(e);
		
		if(!specialKeys(keyCode))
		{
			var myVal = obj.value;
			if ( ((myVal.length > 2 || myVal.length > 6) && !myVal.match(/\./)) ||  (myVal.length > 10 && !myVal.match(/\//)) ||  (myVal.length > 15 && !myVal.match(/\-/)) )
				myVal = '';
	
			if (myVal.length == 2 || myVal.length == 6)
				myVal += '.';
				
			if(myVal.length == 10)
				myVal += '/';
			
			if(myVal.length == 15)
				myVal += '-';
			
			obj.value = myVal;
		}
		return true;
	}
	else
		return false;
}

/**
 * Máscara para formatação de telefones e celulares
 *
 * obj => HTML Object do campo a ser testado (this)
 */
function fmtTelefone(obj, e)
{
	// Testa se a entrada é um número
	if(apenasNumeros(e))
	{
		var keyCode = testaKeyCode(e);
		
		if(!specialKeys(keyCode))
		{
			var myVal = obj.value;
			if (myVal.length > 9 && !myVal.match(/\-/))
				myVal = '';
	
			if (myVal.length == 2)
			{
				areaCode = myVal;
				myVal = '(' + areaCode +') ';
			}
			
			if (myVal.length == 9)
			{
				phoneNumber = myVal;
				myVal = phoneNumber +'-';
			}
			obj.value = myVal;
		}
		return true;
	}
	else
		return false;
}

/** Exibe o KeyCode da tecla pressionada
 *
 * obj => Id do textfield onde será digitado o caracter
 * e => evento da tecla
 * idCharDisplay => Id da Div/Td/Th onde aparecerá o CARACTER pressionado
  * idKeyCodeDisplay => Id da Div/Td/Th onde aparecerá o KEY CODE pressionado
 */
function showKeyCode(obj, e, idCharDisplay, idKeyCodeDisplay)
{
	str = '';
	// Obtém o key code
	keyCode = testaKeyCode(e);

	document.getElementById(idCharDisplay).innerHTML = obj.value;
	document.getElementById(idKeyCodeDisplay).innerHTML = keyCode;

	obj.value = '';
}

/**
 * Função para restringir a digitação de caracteres númericos no campo do código
 */
function apenasNumeros(evnt)
{
	keyCode = testaKeyCode(evnt);

	// Testa se é uma tecla de controle
	if(specialKeys(keyCode))
		return true;
	
	// Testa se é um número
	if( keyCode < 48 || keyCode > 57 )
		return false;
	else
		return true;	
}

/**
 * Testa se a tecla pressionada é uma tecla especial
 */
function specialKeys(keyCode)
{
	var keyCode = parseInt(keyCode);

	// 8->Backspace | 9->Tab | 13->Enter | 13->Shift | 15-19 -> Setas do teclado | 27->Esc | 127->Delete
	if(keyCode == 0 || keyCode == 8 || keyCode == 9 || keyCode == 13 || keyCode == 15 || keyCode == 16 || keyCode == 17 || keyCode == 18 || keyCode == 19 || keyCode == 127)
		return true;
	else
		return false;
}

/**
 * Função para validar uma data
 */
function validaData(obj)
{
	var dia = parseInt(obj.value.substr(0,2));
	var mes = parseInt(obj.value.substr(3,2));
	var ano = parseInt(obj.value.substr(6,4));
	var data = new Date();
	var anoAtual = data.getFullYear();
		
	if(dia < 1 || dia > 31)
	{
		alert('Data inválida');
		obj.value='';
		obj.focus();
		return false;
	}	

	if(mes < 1 || mes > 12)
	{
		alert('Data inválida');
		obj.value='';
		obj.focus();
		return false;
	}
	
	if(anoAtual - ano > 90)// Idade máxima de noventa anos
	{
		alert('Data inválida');
		obj.value='';
		obj.focus();
		return false;
	}
	
	if(mes == 2)
	{
		if(ano%4 == 0 && dia > 29)
		{
			alert('Data inválida');
			obj.value='';
			obj.focus();
			return false;
		}
		else if (ano%4 != 0 && dia > 28)
		{
			alert('Data inválida');
			obj.value='';
			obj.focus();
			return false;
		}
	}
	else if(mes == 4 || mes == 6 || mes == 9 || mes == 11)
	{
		if(dia > 30)
		{
			alert('Data inválida');
			obj.value='';
			obj.focus();
			return false;
		}
	}
	
	return true;
}

// *************************************** CADASTROS ***********************
function adicionaTipoLink()
{
	var nome = document.getElementById('txtNomeTipoLink').value;
	if(nome != '')
		ExecutaAjax(__LOADLIB__+'tipoLink/adiciona.php?txtNomeTipoLink='+nome, 'callBackTipoLink', 'conteudo');
	else
	{
		alert('NOME DO TIPO: preenchimento obrigatório');
		document.getElementById('txtNomeTipoLink').focus();
	}
	
	return false;
}

// Cooperativas
function adicionaTipoCooperativa()
{
	var nome = document.getElementById('txtNomeTipoCooperativa').value;
	if(nome != '')
		ExecutaAjax(__LOADLIB__+'tipoCooperativa/adiciona.php?txtNomeTipoCooperativa='+nome, 'callBackTipoCooperativa', 'conteudo');
	else
	{
		alert('NOME DO TIPO: preenchimento obrigatório');
		document.getElementById('txtNomeTipoCooperativa').focus();
	}
	
	return false;
}

// Cooperativas
function adicionaSetorDiretoria()
{
	var nome = document.getElementById('txtNomeSetorDiretoria').value;
	if(nome != '')
		ExecutaAjax(__LOADLIB__+'setorDiretoria/adiciona.php?txtNomeSetorDiretoria='+nome, 'callBackSetorDiretoria', 'conteudo');
	else
	{
		alert('NOME DO SETOR: preenchimento obrigatório');
		document.getElementById('txtNomeSetorDiretoria').focus();
	}
	
	return false;
}

// Setores dos produtos
function adicionaSetorProduto()
{
	var nome = document.getElementById('txtNomeSetorProduto').value;
	if(nome != '')
		ExecutaAjax(__LOADLIB__+'setorProduto/adiciona.php?txtNomeSetorProduto='+nome, 'callBackSetorProduto', 'conteudo');
	else
	{
		alert('NOME DO SETOR: preenchimento obrigatório');
		document.getElementById('txtNomeSetorProduto').focus();
	}
	
	return false;
}

// Tipos de tipo de produto
function adicionaTipoProduto()
{
	var nome = document.getElementById('txtNomeTipoProduto').value;
	var setor= document.getElementById('lstSetorProduto').value;
	
	if(nome != '')
		if(setor != '')
			ExecutaAjax(__LOADLIB__+'tipoProduto/adiciona.php?idSetor='+setor+'&txtNomeTipoProduto='+nome, 'callBackTipoProduto', 'conteudo');
		else
		{
			alert('SETOR: obrigatório selecionar uma opção');
			document.getElementById('lstSetorProduto').focus();
		}
	else
	{
		alert('NOME DO TIPO: preenchimento obrigatório');
		document.getElementById('txtNomeTipoProduto').focus();
	}
	
	return false;
}
