$("#siteBody").ready(function(){ if(screen.width == '1024'){ $("#siteBody").attr('style','position: absolute; top: 0; left: 0px; z-index: 1;'); } else { $("#siteBody").attr('style','position: absolute; top: 0; left: 10px; z-index: 1;'); } }); function popup(page){ window.open(page,'page','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=1024,height=800'); } avaliar = { curso: function(id){ var resposta = confirm("Este curso já foi realizado e pedimos que você o avalie:\nDeseja Avaliá-lo Agora?"); if (confirm){ popup('http://www.programajoguelimpo.com.br/index.php/inicio/avaliacao/'+id); } } }; block = { ctrl: function(event){ var tecla = String.fromCharCode(event.keyCode).toLowerCase(); if (event.ctrlKey && (tecla == "c" || tecla == "v")) { window.event ? event.returnValue = false : event.preventDefault(); return false } } }; desinscrever = { evento: function(eid){ var res = confirm('Deseja sair desse evento?'); if (res){ $.post( 'http://www.programajoguelimpo.com.br/index.php/inicio/desinscrever_evento', { id: eid }, function (response){ if (response.status == 'ok'){ alert('Voce saiu do evento'); location.href='http://www.programajoguelimpo.com.br/index.php/meus_eventos'; } }, 'json' ); } }, curso: function(eid){ var res = confirm('Deseja sair desse curso?'); if (res){ $.post( 'http://www.programajoguelimpo.com.br/index.php/inicio/desinscrever_curso', { id: eid }, function (response){ if (response.status == 'ok'){ alert('Voce saiu do curso'); location.href='http://www.programajoguelimpo.com.br/index.php/meus_cursos'; } }, 'json' ); } } }; valida= { email: function(email) { if (email.length == 0 || email.indexOf('@') < 2) { return false; } else { var mail = email.split('@'); if (mail[1].length == 0 || mail[1].indexOf('.') < 2) { return false; } else { ail = mail[1].split('.'); var c = ail.length; for (i=1;i 1; i--) soma += numeros.charAt(10 - i) * i; resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; if (resultado != digitos.charAt(0)) return false; numeros = cpf.substring(0,10); soma = 0; for (i = 11; i > 1; i--) soma += numeros.charAt(11 - i) * i; resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; if (resultado != digitos.charAt(1)) return false; return true; } else return false; }, cnpj: function(cnpj) { var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais; digitos_iguais = 1; if (cnpj.length != 14) return false; for (i = 0; i < cnpj.length - 1; i++) if (cnpj.charAt(i) != cnpj.charAt(i + 1)) { digitos_iguais = 0; break; } if (!digitos_iguais) { tamanho = cnpj.length - 2; numeros = cnpj.substring(0,tamanho); digitos = cnpj.substring(tamanho); soma = 0; pos = tamanho - 7; for (i = tamanho; i >= 1; i--) { soma += numeros.charAt(tamanho - i) * pos--; if (pos < 2) pos = 9; } resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; if (resultado != digitos.charAt(0)) return false; tamanho = tamanho + 1; numeros = cnpj.substring(0,tamanho); soma = 0; pos = tamanho - 7; for (i = tamanho; i >= 1; i--) { soma += numeros.charAt(tamanho - i) * pos--; if (pos < 2) pos = 9; } resultado = soma % 11 < 2 ? 0 : 11 - soma % 11; if (resultado != digitos.charAt(1)) return false; return true; } else return false; } };