/******************************************************************/
/* ARD Blankplayer Version 2							*/
/******************************************************************/
/* � DMC 01 Consulting & Development GmbH - gerald.urbas@dmc01.at */
/******************************************************************/
/* ARD Player loader.js                                           */
/******************************************************************/
/* Javascript File loader class.                                          */
/* based on config vars loading of JS files of uncompressed, comppressed 6 merged js files  */
/* correct Order JS fileloading                    .                 */
/******************************************************************/

var DMCLoader = {
  Version: '3',
  Compression: COMPRESSEDJS,
  Merged: MERGEDJS,
  NoDebugjs: NODEBUGJS,
  jsbasepath: JSBASEPATH,
  jspath_uncompressed:'uncompressed',
  jspath:'uncompressed',
  compressedjspath:'compressed',
  mergedpath:'merged',
  nodebugext:'_nodebug',
  jquery_files:'jquery,jquery_compatibility,addons',
  start_files:'ac_quicktime,swfobject2_source,rpdetect,detection',
  //basicjquery_jsfiles:'jquery.cookie,jquery.media,jquery.form,player', // BlankPlayer
  basicjquery_jsfiles:'jquery.cookie,jquery.media,jquery.form,jmousewheel,jScrollPane,jcycle,player', //DAS ERSTE
  dmcplayerplugins_jsfiles:'quickmedia,realmedia,microsoftmedia,flashmedia,ardtabs',
  dmcplayer_jsfiles:'dmcplayer',
  
  jquery_files_merged:'jquery',
  start_files_merged:'detection',
  basicjquery_jsfiles_merged:'jquery_plugins',
  dmcplayerplugins_jsfiles_merged:'playerplugins',
  dmcplayer_jsfiles_merged:'dmcplayer',

  
  require: function(libraryName) {
    // inserting via DOM fails in Safari 2.0, so brute force approach
    document.write('<script type="text/javascript" src="'+this.jspath+"/"+libraryName+'.js"><\/script>');
  },
  init: function () {
	this.jspath = this.jsbasepath+'/'+this.jspath_uncompressed;
	if (this.NoDebugjs) {
		this.jspath = this.jsbasepath+'/'+this.jspath_uncompressed+this.nodebugext;
	}
	if (this.Compression==true) {
		this.jspath = this.jsbasepath+'/'+this.compressedjspath;
		if (this.NoDebugjs) {
			this.jspath = this.jsbasepath+'/'+this.compressedjspath+this.nodebugext;
		}
	}
	if (this.Merged==true) {
		this.jspath = this.jsbasepath+'/'+this.mergedpath;
		if (this.NoDebugjs) {
			this.jspath = this.jsbasepath+'/'+this.mergedpath+this.nodebugext;
		}
		this.jquery_files = this.jquery_files_merged;
		this.start_files = this.start_files_merged;
		this.basicjquery_jsfiles = this.basicjquery_jsfiles_merged;
		this.dmcplayerplugins_jsfiles = this.dmcplayerplugins_jsfiles_merged;
		this.dmcplayer_jsfiles = this.dmcplayer_jsfiles_merged;
	}
	//this.jspath = this.jsbasepath+'/'+this.jspath;
  },
  getScriptPath: function () {
	return this.jspath;
  },
  load: function(type) {
	var js = type.split(',');
	for (var file in js) {
		this.require(js[file]);
	}
  },
  loadjquery:function() {
	this.load(this.jquery_files);
  },
  loadplugindetection:function() {
	this.load(this.start_files);
  },
  start: function() {
	this.load(this.basicjquery_jsfiles);
	this.load(this.dmcplayerplugins_jsfiles);
	this.load(this.dmcplayer_jsfiles);
  }
}
DMCLoader.init();
DMCLoader.loadjquery();
DMCLoader.loadplugindetection();

