//
//	common.js -- common javascipt functions used throughout the website
//	Written by Jon Burney (e4education)
//	Copyright 2007 Bluestone New Media Ltd (e4education)
//


//  function:  addLoadEvent
//  arguments:  func - the name of the function to attach
//  return: none
// desc: Attaches a function to the onload event while preserving existing onload functions
//  Credit to Simon Willison (see http://simonwillison.net/2004/May/26/addLoadEvent/ for more details)
function addLoadEvent(func) {

	var oldonload = window.onload;
	
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
		
			if (oldonload) {
				oldonload();
			}
		
			func();
		}
	}
}

