loadedScripts = new Array;
loadedScriptsWarnings = true;

function include(scriptID) {

	// scriptID is the location of the script, it's possible that the script exists in multiple locations, and each will be loaded, this function is currently used only to
	// prevent multiple loading of the same exact script (e.g. multiple versions of a script can be used, and although discouraged, it might be necessary to do so)
	loaded = false; // flag standing for whether or not a script had already been loaded
	for (i = 0; i < loadedScripts.length; i++){
		if (loadedScripts[i].indexOf(scriptID) != -1) {
			//set flag to true, meaning a script was already loaded
			loaded = true;
			// Optional, if  loadedScriptsWarnings is set to true this will throw an alert when a page tries to load the same script multiple times
			if (loadedScriptsWarnings) {
				alert('This page attempted to load: <' + scriptID + '> multiple times. Please contact the webmaster to correct this.');
			}
		}
	}
		
	if (!loaded) { // if the script has not been loaded yet
		// add to array, the array.length returns size, so a size of 0 would put the ID in the first cell, 1 would be the next cell, which is also now the current array.length
		loadedScripts[loadedScripts.length] = scriptID;
		
		// load script, safe to use document.write because this should run ONLY when page is first loaded, not encouraged for use in AJAX calls
		document.write('<script type="text/javascript" src="' + scriptID + '"></script>');
	}

}

