// Used for pages with strict doctypes (i.e. no target="_blank")
// Automagically adds them back in to links with rel="external"

function externalLinksFirestone() {
 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=0');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=0');return false;}
     }
   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,left=100,top=0');return false;}
     anchors[i].onclick = function(){window.open(this.href, 'NewsItem', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=noheight=580,width=600,left=100,top=0');return false;}
   }

   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "gallery") {
      var galleryURL = anchor.getAttribute('href');
      anchors[i].onkeypress = function(){window.open(this.href, 'GalleryWindow', 'toolbar=no,menubar=no,location=no,height=720,width=852,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=0');return false;}

      anchors[i].onclick = function(){window.open(this.href, 'GalleryWindow', 'toolbar=no,menubar=no,location=no,height=720,width=852,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=0');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,left=100,top=0');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,left=100,top=0');return false;}
    }

   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=0');return false;}
      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=0');return false;}
      }
  }
}
window.onload = externalLinksFirestone;

var ie = document.all; // IE Test
// Gets around the problem of having multiple onload handlers ----------------------------------
// http://www.onlinetools.org/articles/unobtrusivejavascript/chapter4.html
// http://www.quirksmode.org/js/events_advanced.html

function addEvent(obj, evType, fn) {

    // W3C type of event registration model
    if (obj.addEventListener) {
        obj.addEventListener(evType, fn, false);
        return true;
    // MS event registration model
    } else if (obj.attachEvent) {
        var r = obj.attachEvent("on"+evType, fn);
        return r;
    // Bad browsers that cant do either
    } else {
        return false;
    }
}
// Makes the print button visible on puts in the functionality
function makePrintButton() {

    // Fail safe for bad browsers
    if(!document.getElementById) return false;

    // Checks if object exists
    if(!document.getElementById('printCntrl')) return false;

    // Assigns a var and turns on visibility
    var pnt = document.getElementById('printCntrl');
    pnt.style.visibility = "visible"

    // Makes the print function for onclick, onkeypress and href.
    pnt.onclick = Function("window.print()");
    pnt.onkeypress = Function("window.print()");
    pnt.href = "javascript:window.print()";

}
addEvent(window, 'load', makePrintButton);


  function clearDefaultTextField(thisField,defaultText){
    if(thisField.value==defaultText){
      thisField.value='';
    }
  }