var utf8 = { encode: function (string) { string = string.replace(/\r\n/g, "\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if ((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }, decode: function (utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while (i < utftext.length) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if ((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i + 1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i + 1); c3 = utftext.charCodeAt(i + 2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; } } var browserDetect = { init: function () { this.browser = this.searchString(this.dataBrowser) || "Browser desconhecido"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "versão desconhecida"; this.OS = this.searchString(this.dataOS) || "browser desconhecido"; }, searchString: function (data) { for (var i = 0; i < data.length; i++) { var dataString = data[i].string; var dataProp = data[i].prop; this.versionSearchString = data[i].versionSearch || data[i].identity; if (dataString) { if (dataString.indexOf(data[i].subString) != -1) return data[i].identity; } else if (dataProp) return data[i].identity; } }, searchVersion: function (dataString) { var index = dataString.indexOf(this.versionSearchString); if (index == -1) return; return parseFloat(dataString.substring(index + this.versionSearchString.length + 1)); }, dataBrowser: [ { string: navigator.userAgent, subString: "OmniWeb", versionSearch: "OmniWeb/", identity: "OmniWeb" }, { string: navigator.vendor, subString: "Apple", identity: "Safari" }, { prop: window.opera, identity: "Opera" }, { string: navigator.vendor, subString: "iCab", identity: "iCab" }, { string: navigator.vendor, subString: "KDE", identity: "Konqueror" }, { string: navigator.userAgent, subString: "Firefox", identity: "Firefox" }, { string: navigator.vendor, subString: "Camino", identity: "Camino" }, {// for newer Netscapes (6+) string: navigator.userAgent, subString: "Netscape", identity: "Netscape" }, { string: navigator.userAgent, subString: "MSIE", identity: "Explorer", versionSearch: "MSIE" }, { string: navigator.userAgent, subString: "Gecko", identity: "Mozilla", versionSearch: "rv" }, {// for older Netscapes (4-) string: navigator.userAgent, subString: "Mozilla", identity: "Netscape", versionSearch: "Mozilla" } ], dataOS: [{ string: navigator.platform, subString: "Win", identity: "Windows" }, { string: navigator.platform, subString: "Mac", identity: "Mac" }, { string: navigator.platform, subString: "Linux", identity: "Linux" } ] }; browserDetect.init(); var msie = browserDetect.browser == "Explorer"; //var substituirDiv_htmlCarregando = "Carregando..."; var substituirDiv_htmlCarregando = " Carregando. Aguarde..."; var permitirSubstituirDiv = null; // CLASSE AJAX ***************************************************************** function Ajax() { if (window.XMLHttpRequest) { // IE7, Mozilla, Safari, etc: browsers decentes this.xmlhttprequest = new XMLHttpRequest() } else { if (window.ActiveXObject) { // ?outro jeito, usando o ActiveX para IE5.x e IE6 this.xmlhttprequest = new ActiveXObject("Microsoft.XMLHTTP"); } } // this.xmlhttprequest = new XMLHttpRequest(); this.executar = function (url, onreadystatechange) { // function antiCacheUrlAjax(aurl){ // var dt = new Date(); // if (aurl.indexOf("?") >= 0){ // return aurl + "&" + encodeURI(Math.random() + dt.getTime()) // } else { // return aurl + "?" + encodeURI(Math.random() + dt.getTime()); // } // } // // url = antiCacheUrlAjax(url); if (msie) url = utf8.encode(url); this.xmlhttprequest.open("POST", url, true); this.xmlhttprequest.onreadystatechange = onreadystatechange; this.xmlhttprequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=UTF-8"); this.xmlhttprequest.setRequestHeader("Content-length", url.length); this.xmlhttprequest.setRequestHeader("Connection", "close") this.xmlhttprequest.send(null); } this.extrairscript = function (texto) { //desenvolvido por Skywalker.to, Micox e Pita. //Não retire para não violar os direitos autorais. var ini, pos_src, fim, codigo; var objScript = null; ini = texto.indexOf('', ini) + 1; //Verifica se este e um bloco de script ou include para um arquivo de scripts if (pos_src < ini && pos_src >= 0) {//Se encontrou um "src" dentro da tag script, esta e um include de um arquivo script //Marca como sendo o inicio do nome do arquivo para depois do src ini = pos_src + 4; //Procura pelo ponto do nome da extencao do arquivo e marca para depois dele fim = texto.indexOf('.', ini) + 4; //Pega o nome do arquivo codigo = texto.substring(ini, fim); //Elimina do nome do arquivo os caracteres que possam ter sido pegos por engano codigo = codigo.replace("=", "").replace(" ", "").replace("\"", "").replace("\"", "").replace("\'", "").replace("\'", "").replace(">", ""); // Adiciona o arquivo de script ao objeto que sera adicionado ao documento objScript.src = codigo; } else {//Se nao encontrou um "src" dentro da tag script, esta e um bloco de codigo script // Procura o final do script fim = texto.indexOf('', ini); // Extrai apenas o script codigo = texto.substring(ini, fim); // Adiciona o bloco de script ao objeto que sera adicionado ao documento objScript.text = codigo; } //Adiciona o script ao documento document.body.appendChild(objScript); // Procura a proxima tag de