// Given an array of flash element references, 
// these functions will ensure they are ready,
// then launch them more or less simultaneously
var flashLoader = flashLoader ? flashLoader : {
	flash: new Array(),
	checkInterval: 1000,
	
	// Get references to flash elements
	init: function(elms) {
		for (var i = 0; i < elms.length; i++) {
			if (document.getElementById(elms[i])) {
				flashLoader.flash[i] = document.getElementById(elms[i]);
			}
		}
		flashLoader.checkReady();
	},
	
	// Make sure they are both ready
	checkReady: function() { 	
		// Bail if an element is not ready
		for (var i = 0; i < flashLoader.flash.length; i++) {
			if (!flashLoader.flash[i]) return false
			if (!flashLoader.flash[i].ready || !flashLoader.flash[i].ready()) {
				setTimeout(flashLoader.checkReady,flashLoader.checkInterval);
				return false
			}
		}
		// If we got this far, launch the elements!
		flashLoader.startThem();
	}, 
	
	// Start the flash elements
	startThem: function() {
		for (var i = 0; i < flashLoader.flash.length; i++) {
			flashLoader.flash[i].commence();
		}
	}
}

// Load the init without screwing anything up
loadLoader = function () {
	flashLoader.init( ['horseBadgeFlash', 'horseCloseupsFlash'] );
}
var oldonload = window.onload;
if (typeof window.onload != 'function') {
	window.onload = loadLoader;
} else {
	window.onload = function() {
		oldonload();
		loadLoader();
	}
}