function testa(){

	var a = 0;

	with(document.cadastrar){	

	tipo.disabled=false;

	tipo.style.color='#fff';

	document.getElementById("tipo").style.border='none';

	if(cnpj.value == "")

					{

					alert("Informe o campo CNPJ !");

					cnpj.focus();

					return false;

					a = 1;

					}

	if(ie.value == "")

					{

					alert("Informe o campo Inscricao Estadual !");

					ie.focus();

					return false;

					a = 1;

					}

	if(razao.value == "")

					{

					alert("Informe o campo Razao!");

					razao.focus();

					return false;

					a = 1;

					}

	if(fantasia.value == "")

					{

					alert("Informe o campo Fantasia !");

					fantasia.focus();

					return false;

					a = 1;

					}

	if(end.value == "")

					{

					alert("Informe o campo Endereço !");

					end.focus();

					return false;

					a = 1;

					}

	if(cid.value == "")

					{

					alert("Informe o campo Cidade !");

					cid.focus();

					return false;

					a = 1;

					}

	if(bairro.value == "")

					{

					alert("Informe o campo Bairro !");

					bairro.focus();

					return false;

					a = 1;

					}

	if(tel.value == "")

					{

					alert("Informe o campo Telefone !");

					tel.focus();

					return false;

					a = 1;

					}

	if(cep.value == "")

					{

					alert("Informe o campo CEP !");

					cep.focus();

					return false;

					a = 1;

					}

	if(ddd.value=="")

			{

					alert("Informe o campo DDD !");

					ddd.focus();

					return false;

					a = 1;

					}

	if(contato.value == "")

					{

					alert("Informe o campo Contato !");

					contato.focus();

					return false;

					a = 1;

					}

	}

}





function testaromfg(){

	var woot=document.getElementById("clientes").value;

	var woot2=document.getElementById("qtd").value;

	if(woot == 0)

					{

					alert("É necessário selecionar um cliente para fazer um pedido de venda!");

					document.getElementById("clientes").focus();

					return false;

					}	

	if(woot2==0)

					{

					alert("É necessário que a quantidade seja maior que zero.");

					document.getElementById("qtd").focus();

					return false;

					}

	if(woot2=="")

						{

					alert("A quantidade não pode ser vazia!");

					document.getElementById("qtd").focus();

					return false;

					}

}



function testa_pedido(){
	var contador=0,lala=0;
	alert("1");
		for(lala;lala<100;lala++){
		document.getElementById("quantidade"+lala).disabled=false;
		document.getElementById("alterar"+lala).disabled=true;
		document.getElementById("excluir"+lala).disabled=false;	
	}
	alert("2");
		document.getElementById("total").disabled=false;
		document.getElementById("enviar").disabled=true;
		document.getElementById("tabela_preco").disabled=false;
		document.getElementById("data_s").disabled=false;
for(var i=0;i<100;i++){
	if(document.getElementById("cod"+i).value != '')
	contador++;
}
alert("3");
/*if(document.formpedidos.condicoes_pagamento.value=="nada2"){ 
	alert("Você não pode fazer um pedido sem escolher uma Condição de Pagamento");
			return false;
			document.getElementById("total").disabled=true;
														  }
if(document.formpedidos.modalidades.value=="nada2"){ 
	alert("Você nao pode fazer um pedido sem escolher uma Modalidade");
			return false;
			document.getElementById("total").disabled=true;
														  }*/
if(contador == 0){

	alert("Voce nao pode emitir um pedido sem nenhum item!");

	return false;

				}else if (document.getElementById("total").value == ''){

							alert("e nao pode emitir um pedido com total zero!");

							return false;

							document.getElementById("total").disabled=true;

						}

if (contador ==1){

			if (confirm("Esse pedido contem "+contador+" item. Deseja confirmar-lo?" ))

			{ 

			if(document.getElementById("observacao").value==''){

					if (confirm("Confirma o pedido sem informacoes adicionais?"))

					{

						   return true;

					} else return false;

					document.getElementById("total").disabled=true;

											}

			} else { return false; document.getElementById("total").disabled=true;}

				 }

if (contador > 1){

		if (confirm("Esse pedido contem "+contador+" itens. Deseja confirmar-lo?" ))

			{

				 var objResp=document.getElementById("observacao");	
var varString = new String(objResp.value);
var stringAcentos = new String('àâêôûãõáéíóúçüÀÂÊÔÛÃÕÁÉÍÓÚÇÜ');
var stringSemAcento = new String('aaeouaoaeioucuAAEOUAOAEIOUCU');

var i = new Number();
var j = new Number();
var cString = new String();
var varRes = '';



for (i = 0; i < varString.length; i++) {

cString = varString.substring(i, i + 1);

for (j = 0; j < stringAcentos.length; j++) {

if (stringAcentos.substring(j, j + 1) == cString){

cString = stringSemAcento.substring(j, j + 1);

													}

											}

varRes += cString;

										}

document.getElementById("obs2").value = varRes;

			}else return false;

}

		

}

function contato_teste(){

	with(document.formok){

		if(empresa.value == "")

					{

					alert("Informe o campo Empresa !");

					empresa.focus();

					return false;

					}

	if(end.value == "")

					{

					alert("Informe o campo Endereço !");

					end.focus();

					return false;

					}	

	if(bairro.value == "")

					{

					alert("Informe o campo Bairro !");

					bairro.focus();

					return false;

					}	

	if(numero.value == "")

					{

					alert("Informe o campo Numero !");

					numero.focus();

					return false;

					}	

	if(cidade.value == "")

					{

					alert("Informe o campo Cidade !");

					cidade.focus();

					return false;

					}	

	if(estado.value == "")

					{

					alert("Informe o campo Estado !");

					estado.focus();

					return false;

					}	

	if(cep.value == "")

					{

					alert("Informe o campo CEP !");

					cep.focus();

					return false;

					}	

	if(telefone.value == "")

					{

					alert("Informe o campo Telefone !");

					telefone.focus();

					return false;

					}	

	if(website.value == "")

					{

					alert("Informe o campo Website !");

					website.focus();

					return false;

					}	

	if(email.value == "")

					{

					alert("Informe o campo E-mail !");

					email.focus();

					return false;

					}	

	if(ramo.value == "")

					{

					alert("Informe o campo Ramo !");

					ramo.focus();

					return false;

					}

	if(contato.value == "")

					{

					alert("Informe o campo Contato !");

					contato.focus();

					return false;

					}	

	if(msg.value == "")

					{

					alert("Preencha alguma mensagem de contato !");

					msg.focus();

					return false;

					}				

					

		}

	

	

	}

	

	

	function testa_busca(){

		var tamanho = document.getElementById("valor").value;

		

		if(tamanho.leght <=2){

			alert("Por favor, preencha o campo da procura com mais de 2 caracteres!");

			return false;			

			}

		

		}

	function verificasenha(){

		var pv = document.getElementById("passv");

		var p1 = document.getElementById("pass1");

		var p2 = document.getElementById("pass2");

		var u = document.getElementById("usuario");

	if(u.value =='')

		{

			alert("Por favor, preencha o usuario!");

			u.focus();

			return false;	

		}

	if(pv.value =='')

		{

			alert("Por favor, senha antiga necessaria por motivos de seguanca!");

			pv.focus();

			return false;	

		}

		



	if(p1.value =='')

		{

			alert("Por favor, preencha a senha!");

			p1.focus();

			return false;	

		}	

		if(p2.value =='')

		{

			alert("Por favor, preencha a confirmacao de senha!");

			p2.focus();

			return false;	

		}	

			if(p1.value != p2.value)

		{

			alert("As senhas nao coincidem, verifique-as!");

			p1.value='';

			p2.value='';

			return false;	

		}	

		return true;

		}
	

