var d = document;
onload = function() {
    var viewport_height = (self.innerHeight) ? self.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : (document.body) ? document.body.clientHeight : 0;
    var page_height = d.getElementById('content').offsetHeight;
    var ttl = d.getElementById('to_top');
    if (page_height < viewport_height) ttl.style.display = 'none';
}
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);

}




// popup dialogs
function dialog(url, width, height, scrollbars)
{
 var win = window.open(url, '',
  [
   'directories=no',
   'location=no',
   'menubar=yes',
   'resizable=yes',
   'scrollbars=' + (scrollbars ? 'yes' : 'no'),
   'status=yes',
   'toolbar=no',
   'width=' + width + 'px',
   'height=' + height + 'px',
   'top=' + Math.floor((screen.availHeight - height) / 2 - 22) + 'px',
   'left=' + Math.floor((screen.availWidth - width - 10) / 2) + 'px'
  ].toString()
 );

 win.focus();
 return win;
}




