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

function addUnloadEvent(func) {
	var oldonunload = window.onunload;
	if (typeof window.onunload != 'function') {
		window.onunload = func;
	} else {
		window.onunload = function() {
			if (oldonunload) oldonunload();
			func();
		}
	}
}

include = function (file) {
	var script = document.createElement('script');
	var type = document.createAttribute('type');
	type.nodeValue = 'text/javascript';
	script.setAttributeNode(type);
	var src = document.createAttribute('src');
	src.nodeValue = file;
	script.setAttributeNode(src);
	var head = document.getElementsByTagName('head')[0];
	head.appendChild(script);
}

