// COMP has been loaded as well as rws.html so set postLoad to true so that the 
// remainder of the libraries is loaded correctly.
COMP.postLoad = true;


function loadFiles(){
	COMP.LoadLibrary('ext_overrides', function(){
		updateStatus('language strings');	//NEWLS
		COMP.LoadLibrary('rws_strings', function(){
			updateStatus('interface controls');	//NEWLS
			COMP.LoadLibraries(['rws_controls', 'controls'], function(){
				updateStatus('configuration');	//NEWLS
				COMP.LoadLibrary('rws_config', function(){
					updateStatus('patron');	//NEWLS
					COMP.LoadLibrary('rws_patron', function(){
						updateStatus('explore');	//NEWLS
						COMP.LoadLibraries(['rws_search','rws_explore', 'rws_center', 'rws_saved_lists'], function(){
							updateStatus('search filters');	//NEWLS
							COMP.LoadLibrary('rws_prefilters', function(){
								updateStatus('bulletins');	//NEWLS
								COMP.LoadLibraries(['rws_bulletins', 'rws_print', 'rws_login', 'rws_circ'], function(){
									updateStatus('details');	//NEWLS
									COMP.LoadLibrary('rws_details', function(){
						   				updateStatus('bread crumbs');	//NEWLS
										COMP.LoadLibraries(['rws_bread', 'rws_results', 'rws_postfilters'], function(){
											updateStatus('layout');	//NEWLS
											COMP.LoadLibrary('rws_layout', loadAppFile);
										});   
									});
								});
							});
						});
					});
				});
			});
		});  
	});
}

function updateStatus(status){
	document.getElementById('loadStatus').innerHTML = 'Loading ' + status + '...';  // NEWLS -- rework for translatable grammar
}

Ext.onReady(loadFiles, window, {single:true});

function loadAppFile()
{
	COMP.LoadLibrary('rws', function(){RWS_Init()});
}
if (window.COMP) COMP.Broadcast('scriptLoaded_rws_load');