

function VerificaDados(){


	if(document.cadastro.Nome.value==''){
		msg="Preencha seu nome.";
		alert(msg);
		return false;
	}
	
   if (document.cadastro.email.value.search(/^[^@]+@[^@]+.[a-z]{2,}$/) == -1) 
   {
      alert('Email Inválido');
      return false;
    } 
	if(document.cadastro.CPF.value==''){
		msg="Preencha seu CPF.";
		alert(msg);
		return false;
	}					
	if(document.cadastro.ddd.value==''){
		msg="Preencha o DDD de seu telefone.";
		alert(msg);
		return false;
	}					
	
	if(document.cadastro.Residencial.value==''){
		msg="Preencha seu Telefone.";
		alert(msg);
		return false;
	}
	if(document.cadastro.Endereco.value==''){
		msg="Preencha seu Endereço.";
		alert(msg);
		return false;
	}
	if(document.cadastro.numero.value==''){
		msg="Preencha o número do endereço de entrega.";
		alert(msg);
		return false;
	}
	if(document.cadastro.Cep.value==''){
		msg="Preencha seu CEP.";
		alert(msg);
		return false;
	}
	if(document.cadastro.Bairro.value==''){
		msg="Preencha seu Bairro.";
		alert(msg);
		return false;
	}
	if(document.cadastro.UF.value==''){
		msg="Preencha seu Estado.";
		alert(msg);
		return false;
	}
	if(document.cadastro.Cidade.value==''){
		msg="Preencha sua Cidade.";
		alert(msg);
		return false;
	}
	
	if (window.confirm("Basta voce clicar em OK para finalizar sua compra, voce recebera em seu e-mail um boleto bancario no valor de R$32,80 (R$29,90 referente ao kit OmelhorParaWebmasters + R$2,90 referente a taxas bancarias). Os CDs serao postados em um prazo maximo de 48 horas uteis apos a efetivacao do seu pagamento."))

 {
	document.cadastro.Submit.disabled=true;
	document.cadastro.submit();

    }
    else
    {
		if (window.confirm("Voca tem certeza que vai perder esta chance?\r\nCompre agora mesmo o Kit OmelhorParaWebmasters, e tenha o melhor material para trabalhar no desenvolvimento de sites!"))



 {
	document.cadastro.Submit.disabled=true;
	document.cadastro.submit();
		}



		else
		{
			return false;
		}
	}
}






function verificaFormato(){
	if(event.keyCode < 48 || event.keyCode > 57){
		event.returnValue = false;
	}
}

function verificaPeso(){
	if(event.keyCode <= 44 || event.keyCode > 57){
		event.returnValue = false;
	}
}



function checaCPF(campo) {
	CPF = campo.value;
	erro = 0;
	
	if(CPF==''){
		return false;
	}
	if (CPF.length != 11 || CPF == "00000000000" || CPF == "11111111111" ||
		CPF == "22222222222" ||	CPF == "33333333333" || CPF == "44444444444" ||
		CPF == "55555555555" || CPF == "66666666666" || CPF == "77777777777" ||
		CPF == "88888888888" || CPF == "99999999999")
		erro = 1;
		soma = 0;
	for (i=0; i < 9; i ++)
		soma += parseInt(CPF.charAt(i)) * (10 - i);
		resto = 11 - (soma % 11);
	if (resto == 10 || resto == 11)
		resto = 0;
	if (resto != parseInt(CPF.charAt(9)))
		erro = 1;
		soma = 0;
		for (i = 0; i < 10; i ++)
			soma += parseInt(CPF.charAt(i)) * (11 - i);
		resto = 11 - (soma % 11);
		if (resto == 10 || resto == 11)
			resto = 0;
		if (resto != parseInt(CPF.charAt(10)))
			erro = 1;
		if(erro==1){
			alert('CPF invalido!!!');
			campo.focus();
		}

}


function CalcularPeso(){
var erro =0;
	if(document.calcpeso.altura.value==''){
		msg="Preencha sua altura \r\n Ex: 1.55";
		alert(msg);
		return false;
	}
	if(document.calcpeso.peso.value==''){
		msg="Preencha seu peso";
		alert(msg);
		return false;
	}		
   if (document.calcpeso.calcemail.value.search(/^[^@]+@[^@]+.[a-z]{2,}$/) == -1) 
   {
      alert('Email Inválido');
      return false;
    } 
	var end = 'calcula_peso.php?altura=' +document.calcpeso.altura.value + '&peso=' +document.calcpeso.peso.value+ '&email=' +document.calcpeso.calcemail.value 
	window.open(end,'calula_peso','width=333, height=200,toolbar=0,status=0,scrollbars=0,resizable=0,menubar=0');
}
	


