function limpaCampo(fld, msg, ac) { if ($(fld).value == msg && ac == 1) $(fld).value = ""; if ($(fld).value == "" && ac == 0) $(fld).value = msg; } function addEvent(obj,type,fn){ if(obj.addEventListener)obj.addEventListener(type,fn,true) if(obj.attachEvent)obj.attachEvent("on"+type,fn) } /*** MAILING ***/ function cadastraMailing(email) { if (email == "Digite aqui seu e-mail") email = ""; layer = 'status_mailing'; $('bt_mailing').focus(); $(layer).innerHTML = "

Carregando...

"; Element.show(layer); var url = "/home/mailing/incluirAjax"; var params = "email_mailing=" + email; var ajax = new Ajax.Request(url, { method: 'post', parameters:params, asynchronous:true, onSuccess:function(t) { $(layer).innerHTML = "

" + t.responseText + "

fechar"; Element.show(layer); if (t.responseText.search(/sucesso/i) != -1) { $('email_mailing').value = ""; } }}); } /****** OVERLAY ******/ function addOverlay() { var objBody = document.getElementsByTagName("body").item(0); var objOverlay = document.createElement("div"); objOverlay.setAttribute('id','overlay'); objOverlay.style.display = 'none'; objBody.appendChild(objOverlay); } function startOverlay() { if ($('overlay')) { var arrayPageSize = getPageSize(); $('overlay').style.height = arrayPageSize[1] +"px"; Effect.BlindDown('overlay', { duration:0.3 }); } } function toggleObjOverlay(ac, obj) { if (ac == 1) { hideSelects(); startOverlay(); Effect.Appear(obj, { duration:0.3, delay:0.3 }); } else { Effect.Fade(obj, { duration:0.3 }) Effect.BlindUp('overlay', { duration:0.3, delay:0.3 }); setTimeout("showSelects()",600); } } function hideSelects(){ var oSelects=document.getElementsByTagName("select"); for(var i=0;i < oSelects.length;i++) oSelects[i].style.display = "none"; } function showSelects(){ var oSelects=document.getElementsByTagName("select"); for(var i=0;i < oSelects.length;i++) oSelects[i].style.display = ""; //oSelects[i].className=oSelects[i].className.replace(" hide",""); } /****** FIM OVERLAY ******/ function getPageScroll(){ var yScroll; var xScroll; if (self.pageYOffset) { yScroll = self.pageYOffset; xScroll = self.pageXOffset; } else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict yScroll = document.documentElement.scrollTop; xScroll = document.documentElement.scrollLeft; } else if (document.body) {// all other Explorers yScroll = document.body.scrollTop; xScroll = document.body.scrollLeft; } arrayPageScroll = new Array(xScroll,yScroll) return arrayPageScroll; } function getHeightElement(el) { if (el.innerHeight) { return el.innerHeight; } else if (el.offsetHeight){ // all but Explorer Mac return el.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari return el.offsetHeight; } } 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) return arrayPageSize; } function url_encode(str) { var hex_chars = "0123456789ABCDEF"; var noEncode = /^([a-zA-Z0-9\_\-\.])$/; var n, strCode, hex1, hex2, strEncode = ""; for(n = 0; n < str.length; n++) { if (noEncode.test(str.charAt(n))) { strEncode += str.charAt(n); } else { strCode = str.charCodeAt(n); hex1 = hex_chars.charAt(Math.floor(strCode / 16)); hex2 = hex_chars.charAt(strCode % 16); strEncode += "%" + (hex1 + hex2); } } return strEncode; } // url_decode version 1.0 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 decodeText(txt) { txt = txt.replace(/\+/g," "); return unescape(txt); } function createExternalLinks() { if(document.getElementsByTagName) { var anchors = document.getElementsByTagName('a'); for(var i=0; i < anchors.length; i++) { var anchor = anchors[i]; if(anchor.getAttribute("href") && anchor.getAttribute('rel')=='externo') { // <-- É necessário inserir rel="externo" no link anchor.target = '_blank'; //var title = anchor.title + ' (Este link abre uma nova janela)'; // <-- Insere este texto no final do Title do link //anchor.title = title; } } } } function addPopup() { var objBody = document.getElementsByTagName("body").item(0); var objPopup = document.createElement("div"); objPopup.setAttribute('id','popup_blind'); objPopup.style.display = 'none'; objPopup.innerHTML = 'Cataratas do Iguaçu, vote nesta maravilhaPantanal, vote nesta maravilhafechar'; objBody.appendChild(objPopup); } function startPopup() { addOverlay(); addPopup(); createExternalLinks(); toggleObjOverlay(1, 'popup_blind'); } function loadLastPost() { var url = "../blog-home.php"; var params = ""; var ajax = new Ajax.Request(url, { method:'post', parameters:params, asynchronous:true, onComplete:function(t) { $('post').innerHTML = t.responseText; }}); } window.onload = function() { createExternalLinks(); if ($('b_home') && $('post')) { loadLastPost(); } }