/*
 * Loads the uncompiled version of the GeoMOOSE Libraries
 */
var IncludeLibraries = [
"contrib/excanvas.js",
'lib/libs/B2Tree.js',
'lib/libs/coordinate_systems.js',
'lib/menubar/menubar.js',
'lib/main.js',
'lib/libs/Debug.js',
'lib/libs/util.js',
'lib/libs/Polygon.js',
'lib/libs/WindowSize.js',
'lib/libs/opacity.js',
'lib/libs/Draggable2.js',
'lib/libs/http.js',
'lib/libs/CGI.js',
'lib/libs/Views.js',
'lib/libs/MapbookUtils.js',
'lib/objects/GEvents.js',
'lib/objects/Map.js',
'lib/objects/ReferenceMap.js',
'lib/objects/Popups.js',
'lib/objects/TreeView.js',
'lib/objects/VisibleLayers.js',
'lib/objects/Tools.js',
'lib/objects/Scalebar.js',
'lib/objects/Message.js',
'lib/services/render.js',
'lib/services/ServiceForm.js',
'lib/objects/ServiceManager.js',
'lib/objects/Viewbox.js',
'lib/interface/ScaleBox.js',
'lib/interface/LoadingBar.js',
'lib/interface/TabManager.js',
'lib/interface/MapNavigator.js',
'lib/interface/NavigatorHistory.js',
'lib/libs/newdoc.js',
'lib/libs/xml.js',
'lib/libs/url.js'
];

function loadLibrary(filename) {
	var head = document.getElementsByTagName('head')[0];
	var script = document.createElement('script');
	script.setAttribute('type', 'text/javascript');
	script.setAttribute('src', filename);
	head.appendChild(script);
}

function loadAllLibraries(libraryList) {
	if(new String(navigator.userAgent).match(/IE/)) {
		for(var i = 0; i < libraryList.length; i++) {
			document.write('<script type="text/javascript" src="'+libraryList[i]+'"></script>');
		}
	} else {
		for(var i = 0; i < libraryList.length; i++) {
			loadLibrary(libraryList[i]);
		}
	}
}

loadAllLibraries(IncludeLibraries);
