function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}

function openWindow(path, name, width, height) {
     style = eval("'status=no,width="+width+",height="+height+",resizable=yes,menubar=no,scrollbars=yes,toolbar=no'");
     window.open(path, name, style) ;
}

window.onload = function() {
        externalLinks();
        altToTitle();
        initSrb("srb");
}

function altToTitle() {
         d = document;
         for (var i=0;i<d.images.length;++i) {
             if (d.images[i].title.length<3)  {
                d.images[i].title=d.images[i].alt;
             }
         }
}

function initSrb(menuid) {

        navRoot = document.getElementById(menuid);

        if (navRoot==null) { return 0; }
        if (document.all && document.getElementById) {

               for (i=0; i<navRoot.childNodes.length; i++) {
                        node = navRoot.childNodes[i];
                        if (node.nodeName == "LI") {

                                node.onclick = function() {
                                        this.className += " active";
                                        div = document.getElementById(this.id+"d");
                                        div.className = "";

                                        hideSrb(menuid,this.id);
                                }

                        }
               }
         }
}

function hideSrb(menuid,active) {

        navRoot = document.getElementById(menuid);
        if (navRoot==null) { return 0; }
        if (document.all && document.getElementById) {

               for (i=0; i<navRoot.childNodes.length; i++) {
                        node = navRoot.childNodes[i];
                        if (node.nodeName == "LI" && node.id!=active) {
                                node.className = "";
                                div = document.getElementById(node.id+"d");
                                div.className = " hidden";
                        }
               }
         }

}
