/* ChangeBackground script by Derek S. Henderson, www.sp-webdesign.com */
var changeBackground = {
	init:function() {
		if (!document.getElementById || !document.createTextNode) {return;} // Check for DOM support
		if (!document.getElementsByTagName('body')) {return;} // Check that the target element actually exists
        var bgPic = new Array("skills","science","innov","f-educ","h-educ"); // Possible id values, corresponds to existing backgrounds
        var randNum = Math.floor(Math.random() * bgPic.length); // Create random value to use as array position
		var oBody = document.getElementsByTagName('body')[0]; // Find the body tag
		oBody.id = bgPic[randNum]; // Randomly assigns id to body
	},

    /* addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html */
	addEvent:function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn](window.event);}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};
changeBackground.addEvent(window, 'load', function(){changeBackground.init();});

