function body_Load()
{
  var currentSize = parseInt(ReadCookie('fontsize'));
  if(currentSize)
    document.getElementById('content').style.fontSize = currentSize + '%';
    
  if(parent == self)
	SetControlsPosition();
  else
	document.getElementById('controls').style.display = 'none';
}

function SetControlsPosition()
{
  var scrollTop = document.all ? 
    ((document.compatMode && document.compatMode != 'BackCompat') ? 
      document.documentElement.scrollTop : document.body.scrollTop) : self.pageYOffset;
  
  var controls = document.getElementById('controls');
  
  var top = scrollTop + 20;
  if(top < 150) top = 150;
  controls.style.top = top + 'px';
  controls.style.left = (document.body.clientWidth - 140)  + 'px';
  
  window.setTimeout('SetControlsPosition()', 100);
}

function PrintPage()
{
  self.print();
}

function LargerFont()
{
  var content = document.getElementById('content');
  var currentSize = parseInt(content.style.fontSize);
  if(isNaN(currentSize))
  {
    if(!(currentSize = parseInt(ReadCookie('fontsize'))))
      currentSize = 100;
  }
  
  if(currentSize < 200)
  {
    currentSize += 10;
    content.style.fontSize = currentSize + '%';
    
    CreateCookie('fontsize', currentSize, 100);
  }
  else
    alert('Sorry, You have reached the maximum font size.');
}

function SmallerFont()
{
  var content = document.getElementById('content');
  var currentSize = parseInt(content.style.fontSize);
  if(isNaN(currentSize))
  {
    if(!(currentSize = parseInt(ReadCookie('fontsize'))))
      currentSize = 100;
  }
  
  if(currentSize > 70)
  {
    currentSize -= 10;
    content.style.fontSize = currentSize + '%';

    CreateCookie('fontsize', currentSize, 100);
  }
  else
    alert('Sorry, You have reached the minimum font size.');
}

function CreateCookie(name, value, days) 
{
	if(days) 
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function ReadCookie(name) 
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) 
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1, c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
	}
	return null;
}

function EraseCookie(name) 
{
	createCookie(name, "", -1);
}