/* Submenu e Enviar por e-mail */

/*function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('submenu'+i)) {document.getElementById('submenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}*/

/* Popup e alerta */

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

/* Target blank */

// Esta função "chama" todas as funções usadas em um documento.
function init() {
	createExternalLinks();
}

// FORÇA LINKS A ABRIREM EM UMA NOVA JANELA

function createExternalLinks() {
    if(document.getElementsByTagName) {
        var anchors = document.getElementsByTagName('a');
        for(var i=0; i<anchors.length; i++) {
            var anchor = anchors[i];
            if(anchor.getAttribute("href") && anchor.getAttribute('rel')=='externo') { // <-- É necessário inserir rel="externo" no link
                anchor.target = '_blank';
                var title = anchor.title + ' (Este link abre uma nova janela)'; // <-- Insere este texto no final do Title do link
                anchor.title = title;
            }
        }
    }
}

// Esta função "chama" todas as funções usadas em um documento.

function addEvent(obj, evType, fn){
    if(obj.addEventListener){
        obj.addEventListener(evType, fn, false);

        return true;

    } else if (obj.attachEvent){
        var r = obj.attachEvent('on'+evType, fn);

        return r;

    } else {
        return false;

    }
}

addEvent(window, "load", init);


// toggle

function toggle_block(id) {
    var identity = document.getElementById(id);
    if(identity.style.display == "block" || identity.style.display == "")
    {
        identity.style.display="none";
    } else {
        identity.style.display="block";
    }
}

function toggle_inline(id) {
    var identity = document.getElementById(id);
    if(identity.style.display == "inline" || identity.style.display == "")
    {
        identity.style.display="none";
    } else {
        identity.style.display="none";
    }
}

/* Popups */
var newwindow;
function poptastic(url)
{
	newwindow=window.open(url,'name','height=350,width=350,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');
	if (window.focus) {newwindow.focus()}
}

var newwindow;
function poptastic2(url)
{
	newwindow=window.open(url,'name','height=450,width=520,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');
	if (window.focus) {newwindow.focus()}
}

var newwindow;
function poptastic3(url)
{
	newwindow=window.open(url,'name','height=575,width=520,left=100,top=100,resizable=no,scrollbars=yes,toolbar=no,status=no');
	if (window.focus) {newwindow.focus()}
}
