function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function moveBorder() {
	var d = document;
	if(!d.getElementById && !offsetWidth) {
		return;
	}
	var mW = d.getElementById("main").offsetWidth;
	var sW = mW + 203;
	d.getElementById("rightBorder").style.backgroundPosition = sW + "px 0";
}

function addClass(element, value) {
	if(!element.className) {
		element.className = value;
	} else {
		newClassName = element.className;
		newClassName += " ";
		newClassName += value;
		element.className = newClassName;
	}
}

function addPrintLink(){
	if(!document.getElementById){ return; }
	
	if(document.getElementById("sidebar")){
		var sidebar = document.getElementById("sidebar");
	}else{
		return;
	}
	
	
	//create the link and its attributes
	var print = document.createElement("a");
	print.setAttribute("id", "print");
	print.setAttribute("href", "#");
	print.setAttribute("title", "Print Page");
	print.onclick = function() {
		window.print();
		return false;
	}
	
	//create the link text
	var printText = document.createTextNode("Print Page");
	
	//embed the link text into the link text
	print.appendChild(printText);
	
	//embed the link in the page in the appropriate spot
    sidebar.insertBefore(print, sidebar.childNodes[0]);
	
	sidebar.style.paddingTop = "10px";
}

addLoadEvent(addPrintLink);