// janela adaptativa para imagens - versão 1.1 b1
// ( C)2002-2004 Geoff Martin www.geoffmartin.com

// Alteracao por Rafael Costa <rafaelc@vegait.com.br>
// (Compatibilidade com Firefox)

// Alteracao por Fabricio <fabriciok@vegait.com.br>
// comentado var isIE = *
//por causa que causava erro de Event nao definido

PositionX = 100;
PositionY = 100;

defaultWidth  = 500;
defaultHeight = 500;

var AutoClose = true;

//var isIE = true;
//var isIE = (Event.keyCode ? true : false);

var optJanela='status=yes,scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle)
{
    imgWin = window.open ('about:blank', '', optJanela);

    with (imgWin.document) {
        writeln('<html><head><title>Carregando...</title><style>body{margin:0px;}</style>');
        writeln('<script type="text/javascript">');
        writeln('var isIE = true;');
        writeln('var isIE = (Event.keyCode ? true : false);');

        writeln('function reSizeToImage()');
        writeln('{');
        writeln('\tif (!isIE) {');
        writeln('\t\twindow.innerWidth = document.getElementById ("Imagem").width;');
        writeln('\t\twindow.innerHeight = document.getElementById ("Imagem").height;');
        writeln('\t} else {');
        writeln('\t\twindow.resizeTo (100, 100);');
        writeln('\t\tnumWidth = 100 - (document.body.clientWidth - document.getElementById ("Imagem").width);');
        writeln('\t\tnumHeight = 100 - (document.body.clientHeight - document.getElementById ("Imagem").height);');
        writeln('\t\twindow.resizeTo (numWidth, numHeight);');
        writeln('\t}');
        writeln('}');
        writeln('function doTitle () { document.title="' + imageTitle + '"; }');
        writeln('</script>');

        writeln('<meta http-equiv="imagetoolbar" content="no">')
        if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onBlur="self.close()" onload="reSizeToImage();doTitle();self.focus()">')
        else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
        writeln('<img id="Imagem" src=' + imageURL + ' style="display:block" onevent="javascript:noRightClick();"></body></html>');
        close();
    }
}
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
self.focus();
function openativ(URL,w,h) {
  window.open(URL,'ativ','scrollbars=yes, width='+w+',height='+h+',top='+((screen.height-h)/2)+',left='+((screen.width-w)/2));
}
