function index(theForm)
{
    if (theForm.usuario.value == '' || theForm.senha.value == '')
    {
        alert('Acesso restrito!');
        theForm.usuario.value = '';
        theForm.senha.value = '';
        theForm.usuario.focus();
        return false;
    }
    if (theForm.usuario.value.indexOf(' ') != -1 || theForm.senha.value.indexOf(' ') != -1 || theForm.usuario.value.indexOf('\"') != -1 || theForm.senha.value.indexOf('\"') != -1 || theForm.usuario.value.indexOf('\'') != -1 || theForm.senha.value.indexOf('\'') != -1)
    {
        alert('Acesso restrito!');
        theForm.usuario.value = '';
        theForm.senha.value = '';
        theForm.usuario.focus();
        return false;
    }
    return true;
}
function minusculas(theElement)
{
	theElement.value = theElement.value.toLowerCase();
}
function mascaranumero(keypress)
{
	if (keypress > 47 && keypress < 58)
		return true;
	return false;
}
function mascaravalor(fld, milSep, decSep, e)
{
	var sep = 0;
	var key = '';
	var i = j = 0;
	var len = len2 = 0;
	var strCheck = '0123456789';
	var aux = aux2 = '';
	var whichCode = (window.Event) ? e.which : e.keyCode;
	if (whichCode == 13) return true;
	key = String.fromCharCode(whichCode);
	if (strCheck.indexOf(key) == -1) return false;
	len = fld.value.length;
	if (len < 14)
	{
		for(i = 0; i < len; i++)
		if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break;
		aux = '';
		for(; i < len; i++)
		if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
		aux += key;
		len = aux.length;
		if (len == 0) fld.value = '';
		if (len == 1) fld.value = '0'+ decSep + '0' + aux;
		if (len == 2) fld.value = '0'+ decSep + aux;
		if (len > 2)
		{
			aux2 = '';
			for (j = 0, i = len - 3; i >= 0; i--)
			{
				if (j == 3)
				{
					aux2 += milSep;
					j = 0;
				}
				aux2 += aux.charAt(i);
				j++;
			}
			fld.value = '';
			len2 = aux2.length;
			for (i = len2 - 1; i >= 0; i--)
				fld.value += aux2.charAt(i);
			fld.value += decSep + aux.substr(len - 2, len);
		}
		return false;
	}
	return false;
}
function mascaracep(keypress,theElement)
{
	campo = eval(theElement);
	separador1 = '.';
	separador2 = '-';
	conjunto1 = 2;
	conjunto2 = 6;
	if (keypress > 47 && keypress < 58)
	{
		if (campo.value.length == conjunto1)
			campo.value = campo.value + separador1;
		if (campo.value.length == conjunto2)
			campo.value = campo.value + separador2;
		return true;
	}
	else
		return false;
}
function cepajax(elemCEP,elemLogradouro,elemBairro,elemCidade,elemEstado)
{
	var xmlHttp;
	try
	{
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				return false;
			}
		}
	}
	var cep = elemCEP.value;
	cep = cep.replace('.','');
	cep = cep.replace('-','');
	xmlHttp.open("GET","ajaxcep.asp?cep="+cep,true);
	xmlHttp.onreadystatechange = function()
	{
		if (xmlHttp.readyState == 4)
		{
			var r = xmlHttp.responseText;
			var logradouro = r.substring(0,(i = r.indexOf('¦')));
			r = r.substring(++i);
			var bairro = r.substring(0,(i = r.indexOf('¦')));
			r = r.substring(++i);
			var cidade = r.substring(0,(i = r.indexOf('¦')));
			r = r.substring(++i);
			var estado = r.substring(0,(i = r.indexOf('¦')));
			elemLogradouro.value = logradouro;
			elemBairro.value = bairro;
			elemCidade.value = cidade;
			var i = elemEstado.options.length;
			while (i--)
			{
				if (elemEstado.options[i].getAttribute("value") == estado)
				{
					break;
				}
			}
			elemEstado.selectedIndex = i;
		}
	}
	xmlHttp.send(null);
}
function produtoajax(elem_entrada_id,elem_descricao,elem_precovenda)
{
	var xmlHttp;
	try
	{
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				return false;
			}
		}
	}
	var entrada_id = elem_entrada_id.value;
	xmlHttp.open("GET","ajaxproduto.asp?id="+entrada_id,true);
	xmlHttp.onreadystatechange = function()
	{
		if (xmlHttp.readyState == 4)
		{
			var r = xmlHttp.responseText;
			if (r == '¦¦¦emitir aviso¦¦¦')
				alert('Código inválido!');
			else
			{
				var descricao = r.substring(0,(i = r.indexOf('¦')));
				r = r.substring(++i);
				var precovenda = r.substring(0,(i = r.indexOf('¦')));
				elem_descricao.value = descricao;
				elem_precovenda.value = precovenda;
			}
		}
	}
	xmlHttp.send(null);
}
function produtoajax1(elem_descricao,elem_opcoes)
{
	var xmlHttp;
	try
	{
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				return false;
			}
		}
	}
	var descricao = elem_descricao.value;
	descricao.replace(' ','%20');
	xmlHttp.open("GET","ajaxproduto1.asp?termo="+descricao,true);
	xmlHttp.onreadystatechange = function()
	{
		if (xmlHttp.readyState == 4)
		{
			var r = xmlHttp.responseText;
			if (r == '¦¦¦emitir aviso¦¦¦')
				alert('Produto não encontrado!');
			else
			{
				var itens = r.split('¦');
				var conta = itens.length - 1;
				elem_opcoes.options.length = 0;
				for (var i = 0; i < conta; i++)
				{
					var opcoes = itens[i].split("·");
					elem_opcoes.options[i] = new Option(opcoes[1],opcoes[0]);
				}
				elem_opcoes.selectedIndex = -1;
			}
		}
	}
	xmlHttp.send(null);
}
function produtoajax2(elem_opcoes,elem_entrada_id,elem_descricao,elem_precovenda)
{
	var xmlHttp;
	try
	{
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				return false;
			}
		}
	}
	var entrada_id = elem_opcoes.value;
	xmlHttp.open("GET","ajaxproduto2.asp?id="+entrada_id,true);
	xmlHttp.onreadystatechange = function()
	{
		if (xmlHttp.readyState == 4)
		{
			var r = xmlHttp.responseText;
			var descricao = r.substring(0,(i = r.indexOf('¦')));
			r = r.substring(++i);
			var precovenda = r.substring(0,(i = r.indexOf('¦')));
			elem_entrada_id.value = entrada_id;
			elem_descricao.value = descricao;
			elem_precovenda.value = precovenda;
		}
	}
	xmlHttp.send(null);
}
function mascaratelefone(keypress,theElement)
{
	campo = eval(theElement);
	separador1 = '(';
	separador2 = ')';
	separador3 = '-';
	conjunto1 = 0;
	conjunto2 = 3;
	conjunto3 = 8;
	if (keypress > 47 && keypress < 58)
	{
		if (campo.value.charAt(0) != '(')
			campo.value = '(' + campo.value
		if (campo.value.length == conjunto1)
			campo.value = campo.value + separador1;
		if (campo.value.length == conjunto2)
			campo.value = campo.value + separador2;
		if (campo.value.length == conjunto3)
			campo.value = campo.value + separador3;
		return true;
	}
	else
		return false;
}
function mascaradata(keypress,theElement)
{
	campo = eval(theElement);
	separador = '/';
	conjunto1 = 2;
	conjunto2 = 5;
	if (keypress > 47 && keypress < 58)
	{
		if (campo.value.length == conjunto1)
			campo.value = campo.value + separador;
		if (campo.value.length == conjunto2)
			campo.value = campo.value + separador;
		return true;
	}
	else
		return false;
}
function marcadesmarcatodos(theElement)
{
	var theForm = theElement.form;
	for (i = 0; i < theForm.length; i++)
	{
		if (theForm[i].type == 'checkbox' && !theForm[i].disabled & theForm[i].name != 'todos')
			theForm[i].checked = theElement.checked;
	}
}
function confirmaexclusao(theTextConfirm,theTextError,theForm)
{
    var encontrou = false;
	for (i = 0; i < theForm.length; i++)
	{
		if (theForm[i].type == 'checkbox' && !theForm[i].disabled & theForm[i].name != 'todos' && theForm[i].checked)
			encontrou = true;
	}
	if (encontrou)
	{
		if (confirm(theTextConfirm))
		    theForm.submit();
	}
	else
		alert(theTextError);
}
function confirmaexclusao1(theTextConfirm,theTextError,theForm,theFormTarget,theFormAction)
{
    var encontrou = false;
	for (i = 0; i < theForm.length; i++)
	{
		if (theForm[i].type == 'checkbox' && !theForm[i].disabled & theForm[i].name != 'todos' && theForm[i].checked)
			encontrou = true;
	}
	if (encontrou)
	{
		if (confirm(theTextConfirm))
		{
			theForm.target = theFormTarget;
			theForm.action = theFormAction;
		    theForm.submit();
		}
	}
	else
		alert(theTextError);
}
function verificaemail(theElement)
{
	if (theElement.value == '')
	{
		alert('Digite o e-mail!');
		theElement.focus();
		return false;
	}
	else
	{
		prim = theElement.value.indexOf('@');
		if (prim < 2)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf('@',prim + 1) != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf('.') < 1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf(' ') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf(';') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf('.@') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf('@.') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf('.com.br.') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf('/') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf('[') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf(']') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf('(') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf(')') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf('"') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf('\'') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
		if (theElement.value.indexOf('..') != -1)
		{
			alert('O e-mail informado não parece estar correto!');
			theElement.focus();
			return false;
		}
	}
	return true;
}
function verificadata(theElement)
{
	var dia = parseInt(theElement.value.substring(0,2),10);
	var mes = parseInt(theElement.value.substring(3,5),10);
	var ano = parseInt(theElement.value.substring(6,10),10);
	data = new Date();
	if (dia <= 31 && mes <= 12 && ano >= 1900)
	{
		if (theElement.value.substring(0,1) == '0' && theElement.value.substring(1,2) != '0' || theElement.value.substring(0,1) != '0')
		{
			if (theElement.value.substring(2,3) == '/')
			{
				if (theElement.value.substring(3,4) == '0' && theElement.value.substring(4,5) != '0' || theElement.value.substring(3,4) != '0')
				{
					if (theElement.value.substring(5,6) == '/')
					{
						if (theElement.value.substring(6,7) == '0' || theElement.value.substring(6,7) == '' && theElement.value.substring(7,8) != '0')
						{
							alert('Verifique a data!');
							theElement.focus();
							return false;
						}
						if (mes == 2)
						{
							if ((dia > 0) && (dia <= 29))
							{
								if (dia == 29)
								{
									if ((ano % 4) != 0)
									{
										alert('Verifique a data!');
										theElement.focus();
										return false;
									}
								}
							}
							else
							{
								alert('Verifique a data!');
								theElement.focus();
								return false; 
							}
						}
						if ((mes == 4) || (mes == 6) || (mes == 9) || (mes == 11))
						{
							if (!((dia > 0 ) && (dia <= 30)))
							{
								alert('Verifique a data!');
								theElement.focus();
								return false;
							}
						}
						if ((mes == 1) || (mes == 3) || (mes == 5) || (mes ==7) || (mes == 8) || (mes == 10) || (mes == 12))
						{
							if (!((dia > 0) && (dia <= 31)))
							{
								alert('Verifique a data!');
								theElement.focus();
								return false;
							}
						}
					}
					else
					{
						alert('Verifique a data!');
						theElement.focus();
						return false;
					}
				}
				else
				{
					alert('Verifique a data!');
					theElement.focus();
					return false;
				}
			}
			else
			{
				alert('Verifique a data!');
				theElement.focus();
				return false;
			}
		}
		else
		{
			alert('Verifique a data!');
			theElement.focus();
			return false;
		}
	}
	else
	{
		alert('Verifique a data!');
		theElement.focus();
		return false;
	}
	return true;
}
function verificadata1(theElement)
{
	var dia = parseInt(theElement.value.substring(0,2),10);
	var mes = parseInt(theElement.value.substring(3,5),10);
	var ano = parseInt(theElement.value.substring(6,10),10);
	data = new Date();
	if (dia <= 28 && mes <= 12 && ano >= 1900)
	{
		if (theElement.value.substring(0,1) == '0' && theElement.value.substring(1,2) != '0' || theElement.value.substring(0,1) != '0')
		{
			if (theElement.value.substring(2,3) == '/')
			{
				if (theElement.value.substring(3,4) == '0' && theElement.value.substring(4,5) != '0' || theElement.value.substring(3,4) != '0')
				{
					if (theElement.value.substring(5,6) == '/')
					{
						if (theElement.value.substring(6,7) == '0' || theElement.value.substring(6,7) == '' && theElement.value.substring(7,8) != '0')
						{
							alert('Verifique a data!');
							theElement.focus();
							return false;
						}
						if (mes == 2)
						{
							if ((dia > 0) && (dia <= 29))
							{
								if (dia == 29)
								{
									if ((ano % 4) != 0)
									{
										alert('Verifique a data!');
										theElement.focus();
										return false;
									}
								}
							}
							else
							{
								alert('Verifique a data!');
								theElement.focus();
								return false; 
							}
						}
						if ((mes == 4) || (mes == 6) || (mes == 9) || (mes == 11))
						{
							if (!((dia > 0 ) && (dia <= 30)))
							{
								alert('Verifique a data!');
								theElement.focus();
								return false;
							}
						}
						if ((mes == 1) || (mes == 3) || (mes == 5) || (mes ==7) || (mes == 8) || (mes == 10) || (mes == 12))
						{
							if (!((dia > 0) && (dia <= 31)))
							{
								alert('Verifique a data!');
								theElement.focus();
								return false;
							}
						}
					}
					else
					{
						alert('Verifique a data!');
						theElement.focus();
						return false;
					}
				}
				else
				{
					alert('Verifique a data!');
					theElement.focus();
					return false;
				}
			}
			else
			{
				alert('Verifique a data!');
				theElement.focus();
				return false;
			}
		}
		else
		{
			alert('Verifique a data!');
			theElement.focus();
			return false;
		}
	}
	else
	{
		alert('Verifique a data!');
		theElement.focus();
		return false;
	}
	return true;
}
function filtradatas(theForm)
{
	if (theForm.datade.value != '')
		if (!verificadata(theForm.datade))
			return false;
	if (theForm.dataate.value != '')
		if (!verificadata(theForm.dataate))
			return false;
	return true;
}
function grupos(theForm)
{
	if (theForm.grupo.value == '')
	{
		alert('Digite o nome do grupo!');
		theForm.grupo.focus();
		return false;
	}
    return true;
}
function produtos(theForm)
{
	if (theForm.grupo_id.selectedIndex == -1)
	{
		alert("Selecione o grupo!");
		theForm.grupo_id.focus();
		return false;
	}
	if (theForm.descricao.value == '')
	{
		alert('Digite a descrição do produto!');
		theForm.descricao.focus();
		return false;
	}
    return true;
}
function produtosent(theForm)
{
	if (theForm.fornecedor_id.selectedIndex == -1)
	{
		alert("Selecione o fornecedor!");
		theForm.fornecedor_id.focus();
		return false;
	}
	if (!estoque(theForm))
		return false
	return true;
}
function estoque(theForm)
{
	if (theForm.precocusto.value == '')
	{
		alert('Digite o preço de custo!');
		theForm.precocusto.focus();
		return false;
	}
	if (theForm.precovenda.value == '')
	{
		alert('Digite o preço de venda!');
		theForm.precovenda.focus();
		return false;
	}
	if (theForm.qtdeentrada.value == '' || theForm.qtdeentrada.value == '0' || theForm.qtdeentrada.value == '00' || theForm.qtdeentrada.value == '000' || theForm.qtdeentrada.value == '0000')
	{
		alert('Digite a quantidade de entrada!');
		theForm.qtdeentrada.focus();
		return false;
	}
	if (theForm.data.value == '')
	{
		alert('Digite a data de entrada!');
		theForm.data.focus();
		return false;
	}
	if (!verificadata(theForm.data))
		return false;
	return true;
}
function vendas(theForm)
{
	if (theForm.desconto.value == '')
	{
		alert('Digite o desconto!');
		theForm.desconto.focus();
		return false;
	}
	if (theForm.qtdesaida.value == '' || theForm.qtdesaida.value == '0' || theForm.qtdesaida.value == '00' || theForm.qtdesaida.value == '000' || theForm.qtdesaida.value == '0000')
	{
		alert('Digite a quantidade de saída!');
		theForm.qtdesaida.focus();
		return false;
	}
	if (theForm.data.value == '')
	{
		alert('Digite a data de saída!');
		theForm.data.focus();
		return false;
	}
	if (!verificadata(theForm.data))
		return false;
	return true;
}
function caixa(theForm)
{
	if (theForm.data.value == '')
	{
		alert('Digite a data de saída!');
		theForm.data.focus();
		return false;
	}
	if (!verificadata(theForm.data))
		return false;
	if (theForm.entrada_id.value == '')
	{
		alert('Digite o código do produto!');
		theForm.entrada_id.focus();
		return false;
	}
	if (theForm.descricao.value == '')
	{
		alert('Verifique o código do produto!');
		theForm.entrada_id.focus();
		return false;
	}
	if (theForm.qtdesaida.value == '' || theForm.qtdesaida.value == '0' || theForm.qtdesaida.value == '00' || theForm.qtdesaida.value == '000' || theForm.qtdesaida.value == '0000')
	{
		alert('Digite a quantidade de saída!');
		theForm.qtdesaida.focus();
		return false;
	}
	if (theForm.desconto.value == '')
	{
		alert('Digite o desconto!');
		theForm.desconto.focus();
		return false;
	}
	return true;
}
function fornecedores(theForm)
{
	if (theForm.grupo_id.selectedIndex == -1)
	{
		alert("Selecione o grupo!");
		theForm.grupo_id.focus();
		return false;
	}
	if (theForm.nomerazao.value == '')
	{
		alert('Digite o nome/razão social!');
		theForm.nomerazao.focus();
		return false;
	}
	if (theForm.fantasia.value == '')
	{
		alert('Digite o nome fantasia!');
		theForm.fantasia.focus();
		return false;
	}
	if (theForm.cpfcnpj.value == '')
	{
		alert('Digite o CPF/CNPJ!');
		theForm.cpfcnpj.focus();
		return false;
	}
	if (theForm.cpfcnpj.value.length != 11 && theForm.cpfcnpj.value.length != 14)
	{
		alert('Verifique o CPF/CNPJ!');
		theForm.cpfcnpj.focus();
		return false;
	}
	if (theForm.cep.value == '')
	{
		alert('Digite o CEP!');
		theForm.cep.focus();
		return false;
	}
	if (theForm.cep.value.length != 10)
	{
		alert('Verifique o CEP!');
		theForm.cep.focus();
		return false;
	}
	if (theForm.logradouro.value == '')
	{
		alert('Digite o logradouro!');
		theForm.logradouro.focus();
		return false;
	}
	if (theForm.numero.value == '')
	{
		alert('Digite o número!');
		theForm.numero.focus();
		return false;
	}
	if (theForm.bairro.value == '')
	{
		alert('Digite o bairro!');
		theForm.bairro.focus();
		return false;
	}
	if (theForm.cidade.value == '')
	{
		alert('Digite o cidade!');
		theForm.cidade.focus();
		return false;
	}
	if (theForm.estado.selectedIndex == -1)
	{
		alert("Selecione o estado!");
		theForm.estado.focus();
		return false;
	}
	if (theForm.telefone.value == '')
	{
		alert('Digite o telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.telefone.value.length != 13)
	{
		alert('Verifique o telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.celular.value != '')
	{
		if (theForm.celular.value.length != 13)
		{
			alert('Verifique o telefone!');
			theForm.celular.focus();
			return false;
		}
	}
	if (theForm.fax.value != '')
	{
		if (theForm.fax.value.length != 13)
		{
			alert('Verifique o fax!');
			theForm.fax.focus();
			return false;
		}
	}
	if (theForm.email1.value != '')
		if (!verificaemail(theForm.email1))
		    return false;
	if (theForm.email2.value != '')
		if (!verificaemail(theForm.email2))
			return false;
    return true;
}
function dados(theForm)
{
	if (theForm.telefone.value == '')
	{
		alert('Digite o telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (theForm.telefone.value.length != 13)
	{
		alert('Verifique o telefone!');
		theForm.telefone.focus();
		return false;
	}
	if (!verificaemail(theForm.email))
	    return false;
	if (theForm.usuario.value == '')
	{
		alert('Digite o login!');
		theForm.usuario.focus();
		return false;
	}
	if (theForm.usuario.value.length < 5)
	{
		alert('Escolha um login com pelo menos 5 caracteres!');
		theForm.usuario.value = '';
		theForm.usuario.focus();
		return false;
	}
	if (theForm.usuario.value.indexOf(' ') != -1)
	{
		alert('O login não permite a inclusão de espaços!');
		theForm.usuario.value = '';
		theForm.usuario.focus();
		return false;
	}
	if (theForm.usuario.value.indexOf('\"') != -1)
	{
		alert('O login não permite a inclusão de aspas!');
		theForm.usuario.value = '';
		theForm.usuario.focus();
		return false;
	}
	if (theForm.usuario.value.indexOf('\'') != -1)
	{
		alert('O login não permite a inclusão de aspas!');
		theForm.usuario.value = '';
		theForm.usuario.focus();
		return false;
	}
	if (theForm.senha1.value == '')
	{
		alert('Digite a senha!');
		theForm.senha1.focus();
		return false;
	}
	if (theForm.senha1.value.length < 5)
	{
		alert('Escolha uma senha com pelo menos 5 caracteres!');
		theForm.senha1.value = '';
		theForm.senha1.focus();
		return false;
	}
	if (theForm.senha1.value.indexOf(' ') != -1)
	{
		alert('A senha não permite a inclusão de espaços!');
		theForm.senha1.value = '';
		theForm.senha1.focus();
		return false;
	}
	if (theForm.senha1.value.indexOf('\"') != -1)
	{
		alert('A senha não permite a inclusão de aspas!');
		theForm.senha1.value = '';
		theForm.senha1.focus();
		return false;
	}
	if (theForm.senha1.value.indexOf('\'') != -1)
	{
		alert('A senha não permite a inclusão de aspas!');
		theForm.senha1.value = '';
		theForm.senha1.focus();
		return false;
	}
	if (theForm.senha2.value == '')
	{
		alert('Confirme a senha!');
		theForm.senha2.focus();
		return false;
	}
	if (theForm.senha1.value != theForm.senha2.value)
	{
		alert('Verifique a senha!');
		theForm.senha1.value = '';
		theForm.senha2.value = '';
		theForm.senha1.focus();
		return false;
	}
	return true;
}
function usuarios(theForm)
{
    if (theForm.nome.value == '')
	{
		alert('Digite o nome!');
		theForm.nome.focus();
		return false;
	}
	if (!dados(theForm))
		return false;
    return true;
}
function usuariosper(theForm)
{
	if (theForm.perfil_id.selectedIndex == -1)
	{
		alert("Selecione o perfil!");
		theForm.perfil_id.focus();
		return false;
	}
	return true;
}
