﻿function resetFontSize(el, increment,def) {
 var s = '';
 if (el.style.fontSize) {
    s = parseInt(el.style.fontSize.replace("px", ""));
 }
 if (isNaN(s)|| s == '') {
    s = def;
 } 
 s += increment;
 
 el.style.fontSize = s + "px"
}
function setTagFontSize(tag, increment,def) {
 var p = document.getElementsByTagName(tag);
 for (i = 0; i < p.length; i++) {
    resetFontSize(p[i], increment,def);
 }
}
function changeFontSize(increment) {
 setTagFontSize("p",  increment,11);
 setTagFontSize("h1", increment,30);
 setTagFontSize("h2", increment,20);
 setTagFontSize("h3", increment,16);
 setTagFontSize("h4", increment,13);
 setTagFontSize("h5", increment,12);
 setTagFontSize("div", increment,11);
}
function goHome() {
 if (parent.callHome)
  	parent.callHome();
 else
    document.location="http://lusopresse.com/index.htm"; 
}
function enviarComentario() {
    var url = "http://lusopresse.com/inc/SendMail.aspx?artigo=" + location.href;
    if (window.showModalDialog) {
        window.showModalDialog(url,"COMENTARIO","dialogWidth:575px;dialogHeight:470px");
    } 
    else {
        window.open(url, 'COMENTARIO', 'height=470,width=575,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');
    }
}
function isNotRoot() {
   return  /\d{4}\/\d{3}/.test(url);
}
var url = location.href;
var rgxRoot = new RegExp("[0-9]{4}~\d{3}");
document.write('<div class="pageTools" style="border-width: thin; border-color: #C0C0C0; FONT-SIZE: small; float: right;"><img style="CURSOR: hand" title="Diminuir tamanho da letra" onclick="changeFontSize(-2);" alt="Diminuir Texto" src="http://lusopresse.com/images/dimunuirTexto.gif" /> <img style="CURSOR: hand" title="Aumentar tamanho da letra" onclick="changeFontSize(+2);" alt="Aumentar Texto" src="http://lusopresse.com/images/aumentarTexto.gif" /><a style="TEXT-DECORATION: none" href="mailto:?subject=Artigo a não perder!&amp;body=Artigo interessante no LusoPresse:'+url+'"><img style="CURSOR: hand" title="Enviar artigo" border="0" alt="Enviar artigo" src="http://lusopresse.com/images/enviarArtigo.gif" /></a> <img style="CURSOR: hand" title="Imprimir Artigo" onclick="window.print();" alt="Imprimir Artigo" src="http://lusopresse.com/images/imprimirArtigo.gif" /> <img style="WIDTH: 13px; HEIGHT: 15px; CURSOR: hand" title="Comentar artigo" onclick="enviarComentario()" alt="Comentar Artigo" src="http://lusopresse.com/images/comentarArtigo.gif" /> </div>');
function dhtmlLoadScript(url) {
    var e = document.createElement("script");
    e.src = url;
    e.type = "text/javascript";
    document.getElementsByTagName("head")[0].appendChild(e);
}

var scriptPath = isNotRoot()? "../../js/": "/";
//if (parent.popUpImage) {
//    scriptPath += "parentPopImage.js";
//}
//else {
//   scriptPath += "PopupImage.js"; 
//}
//dhtmlLoadScript(scriptPath);
/*
function showMousePos(e) {
    e = e || window.event;
    var pos = getMouseXY(e);
    document.getElementById("pos").innerHTML = "left = " + pos.x + ", top = " + pos.y;
}
*/

var IE = document.all ? true : false
function getMouseXY(e) {
    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX + document.body.scrollLeft
        //        tempY = event.clientY + document.body.scrollTop
        //        tempX = document.body.scrollLeft + document.body.clientWidth / 2
        tempY = document.body.scrollTop;
    } else {  // grab the x-y pos.s if browser is NS
        tempX = e.pageX
        //        tempY = e.pageY
        //        tempX = pageXOffset + window.innerWidth / 2 - topmsg.document.width / 2;
        tempY = pageYOffset; 
    }
    var pos = { x: 0, y: 0 };
    // catch possible negative values in NS4
    if (tempX < 0) { tempX = 0 }
    if (tempY < 0) { tempY = 0 }
    // show the position values in the form named Show
    // in the text fields named MouseX and MouseY
    pos.x = tempX
    pos.y = tempY
    return pos;
}
