var ie4 = document.all && !document.getElementById;
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;

function v4msg() {
        document.open();
        document.write("<p>Pois é... nem adianta carregar a página... Você está usando um navegador muito antigo. Faça download do <a href=\"http://channels.netscape.com/ns/browsers/download.jsp\">netscape</a> ou do <a href=\"http://www.microsoft.com/downloads/searchdl.asp?LangIDCODE=25%3Bpt-br&Submit1=GO\">Internet Explorer</a> mais recente.</p>");
        document.close();
}

// * Dependencies *
// this function requires the following snippets:
// JavaScript/readable_MM_functions/findObj
//
// Accepts a variable number of arguments, in triplets as follows:
// arg 1: simple name of a layer object, such as "Layer1"
// arg 2: X
// arg 3: Y
// repeat...
//
// Example: showHideLayers(Layer1,10,100,Layer2,20,100);
function moveLayers() {
    var i, x, y, obj, args = moveLayers.arguments;
    for (i=0; i<(args.length-2); i+=3) {
        if ((obj = findObj(args[i])) != null) {
            x = args[i+1];
            y = args[i+2];
            if (obj.style) {
                obj = obj.style;
            }
            if(ns6){
                obj.left = x + "px";
                obj.top = y + "px";
            } else {
                obj.left = x;
                obj.top = y;
            }
        }
    }
}

// * Dependencies *
// this function requires the following snippets:
// JavaScript/readable_MM_functions/findObj
//
// Accepts a variable number of arguments, in triplets as follows:
// arg 1: simple name of a layer object, such as "Layer1"
// arg 2: ignored (for backward compatibility)
// arg 3: 'hide' or 'show'
// repeat...
//
// Example: showHideLayers(Layer1,'','show',Layer2,'','hide');
function showHideLayers() { 
    var i, visStr, obj, args = showHideLayers.arguments;
    for (i=0; i<(args.length-2); i+=3) {
        if ((obj = findObj(args[i])) != null) {
            visStr = args[i+2];
            if (obj.style) {
                obj = obj.style;
                if(visStr == 'show') visStr = 'visible';
                else if(visStr == 'hide') visStr = 'hidden';
            }
            obj.visibility = visStr;
        }
    }
    
    return false; // do not follow link
}

// * Dependencies * 
// this function requires the following snippets:
// JavaScript/readable_MM_functions/findObj
// Example: if(isVisible("image1"))
function isVisible(theObj) {
    if ((obj = findObj(theObj)) != null) {
        if (obj.style) {
            obj = obj.style;
        }
        if(obj.visibility == 'visible' || obj.visibility == 'show') return true;
    }
    
    return false;
}

// Example: obj = findObj("image1");
function findObj(theObj, theDoc) {
    var p, i, foundObj;
  
    if(!theDoc) theDoc = document;
    if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) {
        theDoc = parent.frames[theObj.substring(p+1)].document;
        theObj = theObj.substring(0,p);
    }
    if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
    for (i=0; !foundObj && i < theDoc.forms.length; i++) 
        foundObj = theDoc.forms[i][theObj];
    for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
        foundObj = findObj(theObj,theDoc.layers[i].document);
    if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
    return foundObj;
}

function nw(vai, volta){
    // use this.href=
    w = window.open (vai,"nw","directories=no, height=600, width=800, location=no, menubar=no, resizeable=yes, scrollbars=yes, status=no, toolbar=no");
    w.focus();
    return volta;
}

function winFull(url) {
	if(screen.width > 800) {
		x = (screen.width - 800) / 2;
		y = (screen.height - 600) / 2.5;
		w = window.open(url, "Full", "left=" + x + ",screenX=" + x + ",top=" + y + ",screenY=" + y + ",fullscreen=0,directories=0, height=600,width=800,location=0,menubar=0,resizeable=1,scrollbars=0,status=0,toolbar=0");
	} else {
		
		w = window.open(url, "Full", "left=0,screenX=0,top=0,screenY=0,fullscreen=1,directories=0, height=600,width=800,location=0,menubar=0,resizeable=1,scrollbars=0,status=0,toolbar=0");
	}
	w.focus();
}

function layerWrite(obj, conteudo) {
        if ((obj = findObj(obj)) != null) {
                if(ns4) {
                        obj.document.open();
                        obj.document.write(conteudo);
                        obj.document.close();
                } else {
                        obj.innerHTML = conteudo;
                }

        }
}

function sComentario() {
    w = window.open("","nwcomentario","directories=no, height=300, width=600, location=no, menubar=no, resizeable=yes, scrollbars=yes, status=no, toolbar=no");
	w.focus();
    document.frmcomentario.submit();
    document.frmcomentario.reset();
    document.location.reload();
}
