// //
var container = 'content';
////

function getElementsByClassName(classname, node) {
	  if (!node) {
		var nodes = document.getElementsByTagName("body");
		var node = nodes[0];
	  }
      var a = [];
      var re = new RegExp('\\b' + classname + '\\b');
      var els = node.getElementsByTagName("*");
      for(var i=0,j=els.length; i<j; i++)
      if(re.test(els[i].className))a.push(els[i]);
      return a;
}
function scroll_loader()
{
	var viewportwidth;
	var viewportheight;
	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	if (typeof window.innerWidth != 'undefined')
	 {
	      viewportwidth = window.innerWidth,
	      viewportheight = window.innerHeight
	 }
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
	{
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
	}
	// older versions of IE
	else
	{
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
	}
    var ttl = document.getElementById('to_top');
	
	
	var page_height = document.getElementById(container).offsetHeight;
	//var page_height = getElementsByClassName('middle_column')[0].offsetHeight;
	
        if (page_height+100 < viewportheight) ttl.style.display='none';
	
	ttl.onclick = a;
}	
function a(){
for(i=document.getElementsByTagName('body')[0].offsetHeight;i>document.getElementsByTagName('body')[0].offsetHeight/5;i--)
	{i--;i--;i--;i--;i--;i--;i--;i--;i--;i--;i--;i--;
	 window.scroll(0,i);
	}
for(i=document.getElementsByTagName('body')[0].offsetHeight/5;i>document.getElementsByTagName('body')[0].offsetHeight/20;i--)
	{i--;i--;i--;i--;i--;i--;i--;i--;
	 window.scroll(0,i);
	}
	for(i=document.getElementsByTagName('body')[0].offsetHeight/20;i>0;i--)
	{i--;i--;i--;
	 window.scroll(0,i);
	}void(0);
}
if(typeof jQuery == 'function')
{
	$(document).ready(function(){scroll_loader();});
} else {
	window.onload = scroll_loader;
}


