/**
 *	LOADLIBRARY
 *	###############################################################################################
 *	This function dynamically loads external JavaScript libraries to a pre-exiting/pre-loaded page.
 */
function LoadLibrary( sLibURL )
{
	// Create a new "script" element.
	var NewScriptLib = document.createElement('script');
	// Modify the elemtn to have the correct type for JS code.
	NewScriptLib.type = 'text/javascript';
	// Configure the element to call the code in the URL passed in.
	NewScriptLib.src = sLibURL;
	// Add the "script" element to the page and run the library.
	document.getElementsByTagName('head')[0].appendChild(NewScriptLib);
}


/**
 *	MAIN
 *	###############################################################################################
 *	This function actually kick-starts the setup and processing for this page.
 */
function main()
{	
	// Load the base app global library.
	LoadLibrary( "SHWcalculator/SHW_global.js" );
	// Load the base app economics library.
	LoadLibrary( "SHWcalculator/SHW_economics.js" );
	// Load the base app calculator library.
	LoadLibrary( "SHWcalculator/SHW_calculator.js" );
	// Load the base app validation library.
	LoadLibrary( "SHWcalculator/SHW_validation.js" );

	// Load the supporting tool tip library.
	LoadLibrary( "SHWcalculator/visual_tooltips.js" );
	// Load the supporting gui library.
	LoadLibrary( "SHWcalculator/visual_gui.js" );
}


/**
 *	RUN TIME 
 *	###############################################################################################
 *	The actions below setup default actions (bootstraps) functionality implmented by this file.
 */
	MochiKit.DOM.addLoadEvent(main());
