function redirecionar( caminho ){ $('#redirecionar').val(caminho); } var mensagem=""; function clickIE() { if (document.all) {(mensagem);return false;} } function clickNS(e) { if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) { (mensagem);return false; } } } function jumpInput(anterior, tamanho, proximo) { elementAnt = document.getElementById(anterior).value; elementProx = document.getElementById(proximo); if (elementAnt.length >= tamanho) { elementProx.focus(); } } function eventEnter(lightbox,event,caminho,parametro){ var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode; if(keyCode == 13){ switch (lightbox) { case 'logar': autenticarUsuario(caminho); break; case 'indicar': indicarAmigo(caminho,parametro);break; case 'recuperar': recuperarSenha(caminho);break; case 'nomear': editarNome(caminho,parametro);break; } } if(keyCode == 9){ switch (lightbox) { case 'indicar': indicarAmigo(caminho,parametro);break; } } } function tamanhoMax(teclapres, textarea, tamMax, contador) { var tam,texto; var tecla = teclapres.keyCode; texto = textarea.value; tam = texto.length ; contador.value = tam; //46 del 8 backspace if (tecla >= 37 & tecla <= 40 || tecla == 46 || tecla == 8){ //left, rigth, up, down } else{ if(tam>tamMax){ alert('Tamanho excedido!'); tam = tamMax; textarea.value = textarea.value.substring(0, tamMax); contador.value = tam; } } } function confirmacao(){ resp = window.confirm('Tem certeza que deseja excluir este Registro?'); return resp; } function confirmacaoCarrinho(){ resp = window.confirm('Tem certeza que deseja remover este item do carrinho?'); return resp; } function confereSenhas(senha1,senha2){ objSenha1 = document.getElementById(senha1); objSenha2 = document.getElementById(senha2); if (objSenha1.value != objSenha2.value) { alert('Email não confere!'); objSenha1.focus(); } } function actionClick(id){ document.getElementById(id).click(); } function marcarTodos(){ var inputs = document.getElementsByTagName('input'); for(var x = 0; x < inputs.length; x++) { var _inputs = inputs[x]; if(_inputs.type == 'checkbox' && _inputs.name != 'USU_TERMOS') { _inputs.checked = 'checked'; } } } function desmarcarTodos(){ var inputs = document.getElementsByTagName('input'); for(var x = 0; x < inputs.length; x++) { var _inputs = inputs[x]; if(_inputs.type == 'checkbox'){ _inputs.checked = ''; } } } function temLista(){ var inputs = document.getElementsByTagName('input'); var validou = false; for(var x = 0; x < inputs.length; x++) { var _inputs = inputs[x]; if(_inputs.type == 'checkbox'){ if(_inputs.checked){ validou = true; } } } if(!validou){ alert('Nenhum registro selecionado!'); } else{ validou = confirmacaoLista(); } return validou; } function mudarCor(obj){ if( obj.style.backgroundColor){ obj.style.backgroundColor=''; } else{ obj.style.backgroundColor='#FFFCCC'; } } //DIV // Utilizado para evitar de digitar: document.getElementById toda hora, tornando o processo mais prático function gE(ID) { return document.getElementById(ID); } // Utilizado para evitar de digitar: document.getElementsByTagName toda hora, tornando o processo mais prático function gEs(tag) { return document.getElementsByTagName(tag); } function getPageSize(){ var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = document.body.scrollWidth; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { // all except Explorer windowWidth = self.innerWidth; windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if(xScroll < windowWidth){ pageWidth = windowWidth; } else { pageWidth = xScroll; } arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) } // Utilizado para criar o fundo sobre a página (wiewport), body. function exibirBgBody() { // Seleciona a tag body. item(0) por que só existe uma tag body var tagBody = gEs('body').item(0); // Pega os tamanhos atuais da página, como largura, altura, ... var sizesPage = getPageSize(); // Vamos criar uma tag div var bgBody = document.createElement('div'); // Setar o atributo ID a div criada bgBody.setAttribute('id','bgBody'); // Essa div terá o tamanho exato da página bgBody.style.height = arrayPageSize[1] + 'px'; // Essa div terá a largura exata da página bgBody.style.width = arrayPageSize[0] + 'px'; // Evita criar a div novamente if (!gE('bgBody')) { tagBody.insertBefore(bgBody, tagBody.firstChild); } } // Cria a div denominada como boxCad, a qual conterá o formulário de cadastro function boxCad() { // Cria um 'container' que comportará o formulário de cadastro. var objBody = gEs('body').item(0); var sizesPage = getPageSize(); var boxCad = document.createElement('div'); boxCad.setAttribute('id','boxCad'); var wPage = arrayPageSize[2]; // Largura total da página var hPage = arrayPageSize[3]; // tamanho total da página /*boxCad.style.width = (wPage / 2) + 'px'; // metade da largura da página*/ //boxCad.style.height = (wPage / 2) + 'px'; // metada da altura da página //boxCad.style.height = hPage + 'px'; // metada da altura da página boxCad.style.marginTop = (hPage/8) + 'px'; // 1 quarto da largura //boxCad.style.marginLeft = -(wPage / 4) + 'px'; // 1 quarto da altura objBody.insertBefore(boxCad, objBody.lastChild); } // Esta função elimina da página o fundo criado sobre o body e o boxCad; function removerDivs() { var bgBody = gE('bgBody'); var boxCad = gE('boxCad'); bgBody.parentNode.removeChild(bgBody); if (boxCad) { // Por que ao clicar X (para deletar um registro) cria-se somente o encobridor e não o boxCad boxCad.parentNode.removeChild(boxCad); } } function mostrarImagemGr(caminho){ obj = document.getElementById('boxCad'); var img = new Image(); img.src = caminho; img.border = '5px'; img.style.borderColor = '#FFFFFF'; img.style.cursor = 'pointer'; img.alt = 'Clique para fechar.'; img.title = 'Clique para fechar.'; var divLegenda = document.createElement('div'); divLegenda.setAttribute('id','tituloBranco'); divLegenda.innerHTML = 'Av. Joaquim Nabuco, 2216, Centro - Cep: 69020-031'; img.onclick = function() { var bgBody = gE('bgBody'); var boxCad = gE('boxCad'); bgBody.parentNode.removeChild(bgBody); boxCad.parentNode.removeChild(boxCad); } obj.appendChild(img); obj.appendChild(divLegenda); } function url_decode(str) { var n, strCode, strDecode = ""; for (n = 0; n < str.length; n++) { if (str.charAt(n) == "%") { strCode = str.charAt(n + 1) + str.charAt(n + 2); strDecode += String.fromCharCode(parseInt(strCode, 16)); n += 2; } else { strDecode += str.charAt(n); } } return strDecode; } function trocarImagem(caminho){ ObjImgGR = document.getElementById('imgGR'); ObjImgGR.src = caminho; } function trocarAbas(idAbaEsconder,idAbaMostrar){ //alert(idAbaMostrar+idAbaEsconder); ObjMostrar = document.getElementById(idAbaMostrar); ObjEsconder = document.getElementById(idAbaEsconder); ObjMostrar.style.display = "block"; ObjEsconder.style.display = "none"; } function displayMenu(idMenu,idImg) { var menu = document.getElementById(idMenu); var imgMenu = document.getElementById(idImg); if (menu.style.display == "none") { menu.style.display = ''; imgMenu.src = '../img/estrutura/delete.png'; } else { menu.style.display = 'none'; imgMenu.src = '../img/estrutura/add.png'; } }