/////////////////////////////////////////////////////// /////////////////////////////////////////////////////// /////////////////////////////////////////////////////// ///////////// C Ó D I G O B A S E ////////////////// /////////////////////////////////////////////////////// /////////////////////////////////////////////////////// /////////////////////////////////////////////////////// function trata_js(js) { js = js.replace(/\n/g,""); js = js.replace(/\r/g,""); js = js.replace(/\"/g,"\'"); js = js.replace(/\'/g,"\\'"); return js; } function getPageSizeWithScroll(){ if (window.innerHeight && window.scrollMaxY) { // Firefox yWithScroll = window.innerHeight + window.scrollMaxY; xWithScroll = window.innerWidth + window.scrollMaxX; } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac yWithScroll = document.body.scrollHeight; xWithScroll = document.body.scrollWidth; } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari yWithScroll = document.body.offsetHeight; xWithScroll = document.body.offsetWidth; } arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll); //alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll ); return arrayPageSizeWithScroll; } function make_alert(title,msg,extra_js,bot_val) { extra_js = trata_js(extra_js); h = getPageSizeWithScroll(); x = h[0]; y = h[1]; //verifica se existe barra de scroll vertical, porque o x (width da pagina) empurra a largura da barra, //criando scroll horizontal var winheight = parseInt(document.documentElement.scrollHeight) var boheight = parseInt(document.body.scrollHeight) if (winheight >= boheight) { x = x-15; } document.getElementById('alert_fundo').style.height = y; document.getElementById('alert_fundo').style.width = x; document.getElementById('alert_fundo').style.display = ''; document.getElementById('alertLayer').style.display=''; makeAlert(title,msg,extra_js,bot_val); } function make_confirm(title,msg,bot_sim,bot_nao,js_sim,js_nao) { js_sim = trata_js(js_sim); js_nao = trata_js(js_nao); h = getPageSizeWithScroll(); x = h[0]; y = h[1]; //verifica se existe barra de scroll vertical, porque o x (width da pagina) empurra a largura da barra, //criando scroll horizontal var winheight = parseInt(document.documentElement.scrollHeight) var boheight = parseInt(document.body.scrollHeight) if (winheight >= boheight) { x = x-15; } document.getElementById('alert_fundo').style.height = y; document.getElementById('alert_fundo').style.width = x; document.getElementById('alert_fundo').style.display = ''; document.getElementById('alertLayer').style.display=''; makeConfirm(title,msg,bot_sim,bot_nao,js_sim,js_nao); } function make_options(title,msg,opcoes) { h = getPageSizeWithScroll(); x = h[0]; y = h[1]; //verifica se existe barra de scroll vertical, porque o x (width da pagina) empurra a largura da barra, //criando scroll horizontal var winheight = parseInt(document.documentElement.scrollHeight) var boheight = parseInt(document.body.scrollHeight) if (winheight >= boheight) { x = x-15; } document.getElementById('alert_fundo').style.height = y; document.getElementById('alert_fundo').style.width = x; document.getElementById('alert_fundo').style.display = ''; document.getElementById('alertLayer').style.display=''; makeOptions(title,msg,opcoes); } function make_form(title,msg,form_elements,action,on_submit) { h = getPageSizeWithScroll(); x = h[0]; y = h[1]; //verifica se existe barra de scroll vertical, porque o x (width da pagina) empurra a largura da barra, //criando scroll horizontal var winheight = parseInt(document.documentElement.scrollHeight) var boheight = parseInt(document.body.scrollHeight) if (winheight >= boheight) { x = x-15; } document.getElementById('alert_fundo').style.height = y; document.getElementById('alert_fundo').style.width = x; document.getElementById('alert_fundo').style.display = ''; document.getElementById('alertLayer').style.display=''; makeForm(title,msg,form_elements,action,on_submit); } function BrowserCheck() { var b = navigator.appName; if (b == "Netscape") this.b = "NS"; else if (b == "Microsoft Internet Explorer") this.b = "IE"; else this.b = b; this.v = parseInt(navigator.appVersion); this.NS = (this.b == "NS" && this.v>=4); this.NS4 = (this.b == "NS" && this.v == 4); this.NS5 = (this.b == "NS" && this.v == 5); this.IE = (this.b == "IE" && this.v>=4); this.IE4 = (navigator.userAgent.indexOf('MSIE 4')>0); this.IE5 = (navigator.userAgent.indexOf('MSIE 5')>0); if (this.IE5 || this.NS5) this.VER5 = true; if (this.IE4 || this.NS4) this.VER4 = true; this.OLD = (! this.VER5 && ! this.VER4) ? true : false; this.min = (this.NS||this.IE); } is = new BrowserCheck(); alertBox = (is.VER5) ? document.getElementById("alertLayer").style : (is.NS) ? document.layers["alertLayer"] : document.all["alertLayer"].style; alertFundo = (is.VER5) ? document.getElementById("alert_fundo").style : (is.NS) ? document.layers["alert_fundo"] : document.all["alert_fundo"].style; function hideAlert(){ alertBox.visibility = "hidden"; } function button_function(extra_js) { alertBox.visibility = "hidden"; alertFundo.display = "none"; eval(extra_js); } function fecha_form() { alertBox.visibility = "hidden"; alertFundo.display = "none"; } function makeAlert(aTitle,aMessage,extra_js,bot_val){ document.getElementById('alertLayer').contentWindow.document.body.innerHTML = "
" + "" + "" + "" + "" + "" + "" + "
" + " " + aTitle + "
" + aMessage + "

" + "
"; thisText = aMessage.length; if (aTitle.length > aMessage.length){ thisText = aTitle.length; } aWidth = (thisText * 5) + 80; aHeight = 100; if (aWidth < 150){ aWidth = 200; } if (aWidth > 350) { aWidth = 350; } if (thisText > 60) { aHeight = 110; } if (thisText > 120){ aHeight = 130; } if (thisText > 180){ aHeight = 150; } if (thisText > 240){ aHeight = 170; } if (thisText > 300){ aHeight = 190; } if (thisText > 360){ aHeight = 210; } if (thisText > 420){ aHeight = 230; } if (thisText > 490){ aHeight = 250; } if (thisText > 550){ aHeight = 270; } if (thisText > 610){ aHeight = 290; } aHeight = 200; aWidth = 400; alertBox.width = aWidth; //alertBox.height = document.getElementById('alertLayer').contentWindow.document.body.scrollHeight+10; alertBox.height = aHeight; alertBox.left = ((document.body.clientWidth)/2)-(aWidth/2); alertBox.top = ((document.body.clientHeight)/2)-(aHeight/2); alertBox.visibility = "visible"; tmp = eval("document.getElementById('alertLayer').contentWindow.document"); tmp.getElementById('alert_var_button').focus(); } function makeConfirm(aTitle,aMessage,bot_sim,bot_nao,js_sim,js_nao){ document.getElementById('alertLayer').contentWindow.document.body.innerHTML = "
" + "" + "" + "" + "" + "" + "" + "
" + " " + aTitle + "
" + aMessage + "
  
" + "
"; thisText = aMessage.length; if (aTitle.length > aMessage.length){ thisText = aTitle.length; } aWidth = (thisText * 5); aHeight = 100; if (aWidth < 250){ aWidth = 250; } if (aWidth > 400) { aWidth = 400; } if (thisText > 60) { aHeight = 110; } if (thisText > 120){ aHeight = 130; } if (thisText > 180){ aHeight = 150; } if (thisText > 240){ aHeight = 170; } if (thisText > 300){ aHeight = 190; } if (thisText > 360){ aHeight = 210; } if (thisText > 420){ aHeight = 230; } if (thisText > 490){ aHeight = 250; } if (thisText > 550){ aHeight = 270; } if (thisText > 610){ aHeight = 290; } alertBox.width = aWidth; alertBox.height = document.getElementById('alertLayer').contentWindow.document.body.scrollHeight+10; //alertBox.height = aHeight+5; alertBox.left = ((document.body.clientWidth)/2)-(aWidth/2); alertBox.top = ((document.body.clientHeight)/2)-(aHeight/2); /*var winheight = parseInt(document.getElementById('alertLayer').documentElement.scrollHeight); var boheight = parseInt(document.body.scrollHeight);*/ /*if (document.getElementById('alertLayer')) { tmp = document.getElementById('alertLayer').offsetHeight; } else { tmp = 0; } alertBox.height = tmp+5;*/ //alert(document.getElementById('alertLayer').body.scrollHeight); //alert(document.body.scrollHeight); /*for(i=1;i="+document.body.clientHeight); if(document.body.scrollHeight>=document.body.clientHeight){ break; } }*/ //alert(document.getElementById('alertLayer').style.height); //alert(winheight+">="+boheight); /*while (winheight >= boheight) { alert(winheight+">="+boheight); alertBox.height = alertBox.height+1; winheight = parseInt(document.documentElement.scrollHeight); boheight = parseInt(document.body.scrollHeight); }*/ alertBox.visibility = "visible"; } function makeOptions(aTitle,aMessage,opcoes){ tmp = "
" + "" + "" + "" + "" + ""; soma_altura = 0; for ( var i=0, len=opcoes.length; i"; } tmp = tmp + "
" + " " + aTitle + "
" + aMessage + "

" + "
"; document.getElementById('alertLayer').contentWindow.document.body.innerHTML = tmp; thisText = aMessage.length; if (aTitle.length > aMessage.length){ thisText = aTitle.length; } aWidth = (thisText * 5) + 80; aHeight = 100; if (aWidth < 150){ aWidth = 200; } if (aWidth > 350) { aWidth = 350; } if (thisText > 60) { aHeight = 110; } if (thisText > 120){ aHeight = 130; } if (thisText > 180){ aHeight = 150; } if (thisText > 240){ aHeight = 170; } if (thisText > 300){ aHeight = 190; } if (thisText > 360){ aHeight = 210; } if (thisText > 420){ aHeight = 230; } if (thisText > 490){ aHeight = 250; } if (thisText > 550){ aHeight = 270; } if (thisText > 610){ aHeight = 290; } alertBox.width = aWidth; alertBox.height = document.getElementById('alertLayer').contentWindow.document.body.scrollHeight+10; //alertBox.height = aHeight+soma_altura+5; alertBox.left = ((document.body.clientWidth)/2)-(aWidth/2); alertBox.top = ((document.body.clientHeight)/2)-(aHeight/2); alertBox.visibility = "visible"; } function makeForm(aTitle,aMessage,form_elements,action,on_submit){ tmp = "
" + "
" + "" + "" + "" + "" + "" + "" + "
" + " " + aTitle + "Fechar Formulário
" + aMessage + "
"; soma_altura = 0; for ( var i=0, len=form_elements.length; i"; } else { if (form_elements[i]['tipo']=="submit") { tmp = tmp + ""; } else { tmp = tmp + ""; } } } tmp = tmp + "
" + form_elements[i]['designacao'] + "

" + form_elements[i]['designacao'] + "
" + "
"; document.getElementById('alertLayer').contentWindow.document.body.innerHTML = tmp; thisText = aMessage.length; if (aTitle.length > aMessage.length){ thisText = aTitle.length; } aWidth = (thisText * 5) + 80; aHeight = 100; if (aWidth < 150){ aWidth = 200; } if (aWidth > 350) { aWidth = 350; } if (thisText > 60) { aHeight = 110; } if (thisText > 120){ aHeight = 130; } if (thisText > 180){ aHeight = 150; } if (thisText > 240){ aHeight = 170; } if (thisText > 300){ aHeight = 190; } if (thisText > 360){ aHeight = 210; } if (thisText > 420){ aHeight = 230; } if (thisText > 490){ aHeight = 250; } if (thisText > 550){ aHeight = 270; } if (thisText > 610){ aHeight = 290; } alertBox.width = document.body.clientWidth/2; alertBox.height = document.getElementById('alertLayer').contentWindow.document.body.scrollHeight+10; //alertBox.height = aHeight+soma_altura+5; alertBox.left = (document.body.clientWidth/2)/2; alertBox.top = ((document.body.clientHeight)/2)-(aHeight/2); //teste = document.getElementById('alertLayer').offsetHeight; //alert(teste+" + "+alertBox.width); //tmp = eval(document.getElementById('alertLayer')); //alert(tmp.scrollHeight); //alert(tmp.contentWindow.document.body.scrollHeight); //alertBox.height = tmp.scrollHeight; alertBox.visibility = "visible"; } /////////////////////////////////////////////////////// /////////////////////////////////////////////////////// /////////////////////////////////////////////////////// /////////// C Ó D I G O E X T R A ////////////////// /////////////////////////////////////////////////////// /////////////////////////////////////////////////////// /////////////////////////////////////////////////////// //skyscraper function browser () { var b = navigator.appName; var v = this.version = navigator.appVersion; var ua = navigator.userAgent.toLowerCase(); this.v = parseInt(v); this.safari = ua.indexOf("safari")>-1; // always check for safari & opera this.opera = ua.indexOf("opera")>-1; // before ns or ie this.ns = !this.opera && !this.safari && (b=="Netscape"); this.ie = !this.opera && (b=="Microsoft Internet Explorer"); this.gecko = ua.indexOf('gecko')>-1; // check for gecko engine if (this.ns) { this.ns4 = (this.v==4); this.ns6 = (this.v>=5); this.b = "Netscape"; }else if (this.ie) { this.ie4 = this.ie5 = this.ie55 = this.ie6 = false; if (v.indexOf('MSIE 4')>0) { this.ie4 = true; this.v = 4; } else if (v.indexOf('MSIE 5')>0) { this.ie5 = true; this.v = 5; } else if (v.indexOf('MSIE 5.5')>0) { this.ie55 = true; this.v = 5.5; } else if (v.indexOf('MSIE 6')>0) { this.ie6 = true; this.v = 6; } this.b = "MSIE"; }else if (this.opera) { this.v=parseInt(ua.substr(ua.indexOf("opera")+6,1)); // set opera version this.opera6=(this.v>=6); this.opera7=(this.v>=7); this.b = "Opera"; }else if (this.safari) { this.ns6 = (this.v>=5); // ns6 compatible correct? this.b = "Safari"; } this.dom = (document.createElement && document.appendChild && document.getElementsByTagName)? true : false; this.def = (this.ie||this.dom); this.win32 = ua.indexOf("win")>-1; this.mac = ua.indexOf("mac")>-1; this.other = (!this.win32 && !this.mac); this.supported = (this.def||this.ns4||this.ns6||this.opera)? true:false; } function MM_reloadPage(init) { //reloads the window if Nav4 resized if (init==true) with (navigator) { if ((appName=="Netscape")&&(parseInt(appVersion)==4)) { document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; } } else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) { location.reload(); } } MM_reloadPage (true); //window.onresize = init_ad; //Caso a janela seja carregada a função init vai ser chamada para mudar a pósição horizontal do banner function init_ad(){ naveg = new browser(); if(naveg.ie || naveg.opera){ //block = document.all["alertLayer"].style; block = document.getElementById("alertLayer").style; //block.left = (window.screen.availWidth-parseInt(block.width)/2) //block.left = (document.body.clientWidth-parseInt(block.width))-document.body.scrollLeft - 10; } else if (naveg.ns4){ block = document.layers["alertLayer"]; //block.left = (window.screen.availWidth/2) //block.left = (window.innerWidth-100)-window.pageXOffset - 70; } else if (naveg.ns6){ block = document.getElementById("alertLayer").style; //block.left = (window.screen.availWidth-parseInt(block.width)/2) //block.left = (document.body.clientWidth-parseInt(block.width))-window.pageXOffset - 12; } a = 0; } function ad(){ if(naveg.ie || naveg.opera){ pósY = document.body.scrollTop; } else if (naveg.ns){ pósY = window.pageYOffset; } else if (naveg.ns6){ pósY = window.pageYOffset; } //alert(window.screen.availHeight); //tmp = (window.screen.availHeight/2)-125; //tmp = (window.innerHeight/2)/2; tmp = (document.body.clientHeight/2)/2; if((pósY % 2) !== 0) pósY-=1; tmp = Math.floor(tmp); if ((tmp % 2) !== 0) { tmp = tmp+1; } if(pósY+tmp != parseInt(block.top)){ for(i=0; i<5; i++){ if (pósY+tmp > parseInt(block.top)) a+= 2; else a-=2; block.top = a; } } setTimeout("ad()",10); } init_ad(); ad();