// Global JavaScripts

/* Function to add routines to page load event */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

/* Just add class="preload" to any images so that they'll be loaded in the background for quicker transitions */
function preloadImages() {
	if (!document.getElementById) return;
	var aPreLoad = new Array();
	var aImages = document.getElementsByTagName('img');
	for (var i = 0; i < aImages.length; i++) {
		if (aImages[i].className == 'preload') {
			var src = aImages[i].getAttribute('src');
			aPreLoad[i] = new Image();
			aPreLoad[i].src = src;
		}
	}
}

addLoadEvent(preloadImages);