function externalLinks() { 
checkPageLength(false);
 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"; 
 } 
}

var windowHeight = 0;
var bodyHeight = 0;

function checkPageLength(active) {
	if( active )
		back_to_top.style.display = 'block';
	else
	{
		bodyHeight = document.body.scrollHeight;
		if( typeof( window.innerWidth ) == 'number' ) 
		{
			//Non-IE
			windowHeight = window.innerHeight;
		} 
		else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
		{
			//IE 6+ in 'standards compliant mode'
			windowHeight = document.documentElement.clientHeight;
		}
		
		var back_to_top = document.getElementById("footer_top");
		
		if( bodyHeight > windowHeight )
			back_to_top.style.display = 'block';
		else
			back_to_top.style.display = 'none';
	}
}