// 22/09/2008 R Norton-Hall
// USED FOR LOADING SCRIPTS ON DOM OR PAGE LOADING

// ++ REQUIRES ++ var scriptsForLoading	= './scripts/basefunctions.js,./scripts/loginMaster.js,./scripts/mainStore.js'; // scripts to load


	var alreadyrunflag=0 //flag to indicate whether target function has already been run
	
// on loading dom or page, whichever is sooner	
// load scripts dynamically
	if(scriptsForLoading && scriptsForLoading.length)
	{
		
	// alert('Called Me Once');
		if (document.addEventListener)
		{
	//		alert('Called Me Twice');
	  		document.addEventListener("DOMContentLoaded", function(){alreadyrunflag=1; scriptsToLoad(scriptsForLoading);}, false);
		}else if (document.all && !window.opera)
		{
	  		document.write('<script type="text/javascript" id="contentloadtag" defer="defer" src="javascript:void(0)"><\/script>');
	  		var contentloadtag=document.getElementById("contentloadtag");
	  		contentloadtag.onreadystatechange=function()
	  		{
	    		if (this.readyState=="complete"){
	    	  		alreadyrunflag=1;
	      			scriptsToLoad(scriptsForLoading);
	    		}
	  		}
		}
	
		window.onload=function(){
	  		setTimeout("if (!alreadyrunflag){scriptsToLoad("+scriptsForLoading+")}", 0);
		}
	}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++	