/* Target blank nao valida como XHML */

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')=='co-worker') { // <-- É necessário inserir rel="co-worker neighbor" 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);
/* Submenu */

var mn_activo = "";
function montre(id) {
if (id==mn_activo){
	mn_activo="";
	return ;
}
var d = document.getElementById(id);
if (d){ mn_activo=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';}

}

function montreOut(){
	window.setTimeout("montre()","1000");
}


var obj = null;

function checkHover() {
	if (obj) {
		obj.find('div').hide();	
	} //if
} //checkHover


$(document).ready(function() {
	$('.submenu').hover(function() {
	
		if (obj) {
		
			obj.find('div').hide();
			obj = null;
		} //if
		
		$(this).find('div').show();
	}, function() {
		obj = $(this);
		setTimeout(
			"checkHover()",
			400);
	});
});


