// Used for pages with strict doctypes (i.e. no target="_blank")
// Automagically adds them back in to links with rel="external"

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";
    }

   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "shareholdershelppopup") {
     anchor.onkeypress = function(){window.open('http://miranda.hemscott.com/helppages/majorshareholders.htm', 'CtrlWindow', 'toolbar=no,menubar=no,height=420,width=580,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
     anchor.onclick = function(){window.open('http://miranda.hemscott.com/helppages/majorshareholders.htm', 'CtrlWindow', 'toolbar=no,menubar=no,height=420,width=580,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
     anchor.setAttribute("href","#");
     }

    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "news-item") {
         anchors[i].onkeypress = function(){window.open(this.href, 'NewsItem', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no,height=580,width=600');return false;}
         anchors[i].onclick = function(){window.open(this.href, 'NewsItem', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no,height=580,width=600');return false;}
    }
    
    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "image-gallery") {
         anchors[i].onkeypress = function(){window.open(this.href, 'popup', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no,height=580,width=600');return false;}
         anchors[i].onclick = function(){window.open(this.href, 'popup', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no,height=580,width=600');return false;}
    }


    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "legaldisclaimer") {
         anchors[i].onkeypress = function(){window.open(this.href, 'Legal Disclaimer', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no,height=500px,width=638px');return false;}
         anchors[i].onclick = function(){window.open(this.href, 'dis', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no,height=500px,width=638px');return false;}
    }

    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "charthelp") {
         anchor.onkeypress = function(){window.open('http://miranda.hemscott.com/helppages/gifgraphs.htm', 'ChartHelp', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no,height=580,width=600');return false;}
         anchor.onclick = function(){window.open('http://miranda.hemscott.com/helppages/gifgraphs.htm', 'ChartHelp', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no,height=580,width=600');return false;}
         anchor.setAttribute("href","#");
    }
    
    
    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "rsshelp") {
         anchor.onkeypress = function(){window.open('http://miranda.hemscott.com/helppages/rss/guide_to_rss.htm', 'rsshelp', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no,height=580,width=600');return false;}
         anchor.onclick = function(){window.open('http://miranda.hemscott.com/helppages/rss/guide_to_rss.htm', 'rsshelp', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no,height=580,width=600');return false;}
         anchor.setAttribute("href","#");
    }

   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "disclaimer") {
      var disclaimerURL = anchor.getAttribute('href');
      anchor.onkeypress = function(){window.open(disclaimerURL, 'CtrlWindow', 'toolbar=no,menubar=no,height=505,width=638,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
      anchor.setAttribute("href","#");
      anchor.onclick = function(){window.open(disclaimerURL, 'CtrlWindow', 'toolbar=no,menubar=no,height=505,width=638,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
      anchor.setAttribute("href","#");
      }

}
}
window.onload = externalLinks;


