//-------------------------------
// * Xythe Studios *
// * Coded by Rob Kleffner (Cyborg) *
// * Started: 3/19/2010 *
// * Last updated: 4/29/2010 *
//-------------------------------
// This file contains core functions
// that are necessary for base working
// scripts to function correctly.
//-------------------------------

//-------------------------------
// * JPrime *
//-------------------------------
// This class contains functions
// that are basic core things that
// javascript needs to do. Makes
// running a basic script a bit easier.
//-------------------------------
var JPrime = new Object();

//-------------------------------
// * Start(delegate, parameters) *
//-------------------------------
// When the page loads, this function
// is run. Multiple functions can be
// set to this; however, it is best to
// define one function that instantiates
// everything.
//-------------------------------
JPrime.Start = function(className, parameters)
{
	//problem here:
	//load is called after ALL content (including images) is loaded
	//FireFox and Opera provide functionality for when the html is loaded
	//so this hack makes the function run as soon as possible in whatever browser it's in
	var callOnce = function()
	{
		if (arguments.callee.done) return;
		arguments.callee.done = true;
		className.Initialize(parameters);
	};
	
	EventMan.AddEventListener(document, "DOMContentLoaded", callOnce);
	EventMan.AddEventListener(window, "load", callOnce);
}
