/******************************************************************************

	DP Module - Version 1.1

******************************************************************************/

var DP = {
	
	coreLibraries : [
	
		/* PROTOTYPE.JS	*/
		'prototype',
		
		/* CUSTOM SCRIPTS	*/
		'core',
		'extensions',
		'utilities',
		'cookie',
		'environment',
		'media',
		'window',
		'canada'
	],

	load: function() {
		var s	= document.getElementsByTagName("script");
		for (var x = 0; x < s.length; x++) {
			if (s[x].src && s[x].src.match(/dp\.js(\?.*)?$/)) {	
				
				// Set up DP.jsPath			
				this.jsPath = s[x].src.replace(/dp\.js(\?.*)?$/,'lib/');
				
				// Load Core Libraries
				for (var y = 0; y < this.coreLibraries.length; y++) {
					this.require(this.jsPath + this.coreLibraries[y] + '.js');
				}
								
				// Load additional requested Libraries
				var includes	= s[x].src.match(/\?.*load=([a-z_,0-9]*)/);
				if (includes) {
					var i = includes[1].split(',');
					for (var y = 0; y < i.length; y++) {
						this.require(this.jsPath + i[y] + '.js');
					}
				}
			}
		}
	},		
	require: function(file) {
		document.write('<script type="text/javascript" charset="utf-8" src="' + file + '"></script>');
	}	
};

DP.load();