/*
	Any error in this script can be reported to: shahmeet.singh@morningstar.com
	Usage: 	onclick="set_cookie(fontSize = 'medium'); return false;"
	use 'small' 'medium' 'large' as id(s) in respective click event generator elements;
*/

var contentId = 'MainBody'; 		// Set Id of block in which you want font to re-size
var className = 'font_selection'; 	// Mention the class for highligting selected 'A'
var smallFont = '100%';			// Small font size value
var mediumFont = '120%';		// Medium font size value
var largeFont = '140%';			// Large font size value
var n, fontSize = "small";		// Default font size


function set_fontSize() {

	if(fontSize == 'medium') {
		document.getElementById(contentId).style.fontSize = mediumFont;
		document.getElementById('medium').className = className;
		document.getElementById('large').className = '';
		document.getElementById('small').className = '';
	} else if (fontSize == 'large') {
		document.getElementById(contentId).style.fontSize = largeFont;
		document.getElementById('large').className = className;
		document.getElementById('medium').className = '';
		document.getElementById('small').className = '';
	} else if (fontSize == 'small') {
		document.getElementById(contentId).style.fontSize = smallFont;
		document.getElementById('small').className = className;
		document.getElementById('medium').className = '';
		document.getElementById('large').className = '';
	}
}

if(document.cookie) {
	var ca = new Array();
	var na = new Array();
	var aa = document.cookie;
	ca = aa.split(';');
	for(n=0; n != ca.length; n++) {
		if(ca[n].match("ftsize")) {
			na = ca[n].split('=');
			fontSize = na[1];
			set_fontSize();
		}
	}
}

function set_cookie() {
	set_fontSize();
	var kill_time = new Date();
	kill_time.setTime(kill_time.getTime() + 1000*60*60*24*2);
	var cookie_dough = "ftsize=" + escape(fontSize) + "; expires=" + kill_time.toGMTString();
	document.cookie = cookie_dough;
	return false;
}


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") == "committee") {
         anchor.onkeypress = function(){window.open('/ir/btsm_new/images/executive2_large.jpg', 'committee', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,status=no,height=750,width=750'); return false;}
         anchor.onclick = function(){window.open('/ir/btsm_new/images/executive2_large.jpg', 'committee', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,status=no,height=750,width=750'); return false;}
         anchor.setAttribute("href","#");
    }
	
	if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "site-disclaimer") 
   {
      anchor.onkeydown = function(){window.open('/ir/btsm_new/html/disclaimer.htm', 'CtrlWindow', 'toolbar=no,menubar=no,height=525,width=638,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
      anchor.onclick = function(){window.open('/ir/btsm_new/html/disclaimer.htm', 'CtrlWindow', 'toolbar=no,menubar=no,height=525,width=638,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
      anchor.setAttribute("href","#");
      }
	  
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "notes1") 
   {
      anchor.onkeydown = function(){window.open('/ir/btsm_new/html/external_job_notes1.htm', 'CtrlWindow', 'toolbar=no,menubar=no,height=525,width=638,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
      anchor.onclick = function(){window.open('/ir/btsm_new/html/external_job_notes1.htm', 'CtrlWindow', 'toolbar=no,menubar=no,height=525,width=638,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
      anchor.setAttribute("href","#");
      }  
	  
	  		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "notes2") 
   {
      anchor.onkeydown = function(){window.open('/ir/btsm_new/html/external_job_notes2.htm', 'CtrlWindow', 'toolbar=no,menubar=no,height=525,width=638,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
      anchor.onclick = function(){window.open('/ir/btsm_new/html/external_job_notes2.htm', 'CtrlWindow', 'toolbar=no,menubar=no,height=525,width=638,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
      anchor.setAttribute("href","#");
      }
	  

	if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "policy-privacy") 
   {
      anchor.onkeydown = function(e){if(e.keyCode == 13) {window.open('/ir/btsm_new/html/privacy.htm', 'CtrlWindow', 'toolbar=no,menubar=no,height=525,width=638,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}}
      anchor.onclick = function(){window.open('/ir/btsm_new/html/privacy.htm', 'CtrlWindow', 'toolbar=no,menubar=no,height=525,width=638,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
      anchor.setAttribute("href","#");
      }
	  
    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "rsshelp") {
         anchor.onkeypress = function(){window.open('http://online.hemscottir.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://online.hemscottir.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") == "top") {
     anchor.target = "_top";
    }    

   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "shareholdershelppopup") {
     anchor.onkeypress = function(){window.open('http://online.hemscottir.com/helppages/majorshareholders.htm', 'CtrlWindow', 'toolbar=no,menubar=no,height=643,width=580,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
     anchor.onclick = function(){window.open('http://online.hemscottir.com/helppages/majorshareholders.htm', 'CtrlWindow', 'toolbar=no,menubar=no,height=643,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=650');return false;}
         anchors[i].onclick = function(){window.open(this.href, 'NewsItem', 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no,width=650,height=580');return false;}
    }

    if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "charthelp") {
         anchor.onkeypress = function(){window.open('http://online.hemscottir.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://online.hemscottir.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") == "disclaimer") 
   {
      var disclaimerURL = anchor.getAttribute('href');
      anchor.onkeydown = function(e){if(e.keyCode == 13) {window.open(disclaimerURL, 'CtrlWindow', 'toolbar=no,menubar=no,height=525,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=525,width=638,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100');return false;}
      anchor.setAttribute("href","#");
      }

}


}

window.onload=externalLinks;