function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(resetCurrentsize);

function articlePageOnload() 
{
   if (document.getElementById && document.getElementById("CurrentSize") != null) {
	if(document.getElementById("CurrentSize").value == "")
		resetCurrentsize();
	else
		setCurrentsize(document.getElementById("CurrentSize").value);
 
    document.getElementById("textSizer").style.cssText = "display: block; float: right;";
  }
}

function getCurrentsize() {
  return currentSize;
}

function setCurrentsize(newsize) {
  currentSize = newsize;
 
  if (document.getElementById) {
  	document.getElementById("resizeableText").style.cssText = "font-size:"+currentSize+"px";
  	document.getElementById("textSizer").style.cssText = "display: block;";
  }  
}

function resetCurrentsize() {
  currentSize = 12;
  
  
  if (typeof(preDefaultSize) != "undefined") {
  	currentSize = preDefaultSize;
  }
  document.getElementById("CurrentSize").value = currentSize;
  if (document.getElementById) {
  	document.getElementById("resizeableText").style.cssText = "font-size:"+currentSize+"px";  	
  }
}

function sizeUp() {
  if (document.getElementById) {
    currentSize++;
    document.getElementById("CurrentSize").value = currentSize;
    document.getElementById("resizeableText").style.cssText = "font-size:"+currentSize+"px";
  }
}


function sizeDown() {
  if (document.getElementById) {
    currentSize--;
    document.getElementById("CurrentSize").value = currentSize;
    document.getElementById("resizeableText").style.cssText = "font-size:"+currentSize+"px";
  }
}

