function InboxInitScript() {
	var self = this;
	var param;
	var acceptId;

	this.loading = Number(0);
	this.asyncLoad = false;
	this.useQueue = false;
	this.scripts = new Array();
	this.scriptNames = new Array();

	this.scripts.push('interface/js/userprofile.php?reqFile='+tplf.getUrlParam('reqFile')+'&rand='+Math.random(0,900)+'&ext=userprofile.js');
	this.scriptNames.push('User Profiles');

	this.scripts.push('interface/js/languages.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Languages');

	this.scripts.push('interface/js/queue.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Inbox Queue');

	this.scripts.push('interface/js/themes.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Inbox Theme Manager');

	this.scripts.push('interface/js/pidmanager.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Pid Manager');

	this.scripts.push('interface/js/fsxml.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Filesystem To XML');

	this.scripts.push('interface/js/events.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Mouse & Keyboard Events');

	this.scripts.push('lib/soundmanager/script/soundmanager2.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Inbox Sound System');

	this.scripts.push('interface/js/getpopups.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Base Popup Templates');

	this.scripts.push('interface/js/inboxmenu.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Rightclick Menu');

	this.scripts.push('interface/js/draganddrop.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Drag And Drop library');

	this.scripts.push('interface/js/multipledrag.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Multiple Drag Objects');

	this.scripts.push('interface/js/fsmanipulate.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Filesystem Manipulation');

	this.scripts.push('interface/js/multiplefs.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Multiple Operations Of Filesystem');

	this.scripts.push('interface/js/windowmaker.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Window Maker');

	this.scripts.push('interface/js/popupwindows.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Popup Windows System');

	this.scripts.push('interface/js/systemwindows.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('System Windows');

	this.scripts.push('interface/js/applications.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Inbox Application Service');

	this.scripts.push('interface/js/visual.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Inbox Filesystem Visualization');

	this.scripts.push('interface/js/winVisibility.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Inbox Window Activation');

	this.scripts.push('interface/js/taskbar.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Inbox Taskbar');

	this.scripts.push('interface/js/applicationRegistry.js?rand='+Math.random(0,900)+'&ext=t.js');
	this.scriptNames.push('Inbox Application Registry');

	this.init = function() {
		tplf.getHtml('interface/templates/reqFile-inbox.html',true,'iScript.startLoading();');
	}
	this.startLoading = function() {
		if (tplf.getHtmlTemplate) {
			document.getElementsByTagName('body')[0].innerHTML = tplf.getHtmlTemplate;
		}
		self.loadService();
	}
	this.loadService = function() {
		if (!self.useQueue && typeof(inboxqueue) == 'object') {
			self.createQueues();
		}
		else {
			var l = true;
			while (self.loading <= self.scripts.length && l == true) {
				if (self.scripts[self.loading]) {
					this.asyncLoad = setTimeout("iScript.errorLoading("+self.loading+")",15000);
					tplf.createjscssfile(self.scripts[self.loading],'js');
					l = false;
				}
				else { l = true; }
				self.loading++;
			}
		}
	}
	this.loadNext = function() {
			if (self.loading == self.scripts.length) {
				soundManager.reboot();
			}
			if (self.useQueue) {
				inboxqueue.resume('loadInbox');
			}
			else {
				self.resumeLoading();
			}
	}
	this.resumeLoading = function(param) {
		if (self.loading < self.scripts.length) {
			if (typeof(self.asyncLoad) == 'number') {
				clearTimeout(self.asyncLoad);
				self.asyncLoad = false;
			}
			self.loadService();
		}
		else {
			if (typeof(inboxqueue)) { inboxqueue.resume('loadInbox'); }
		}
	}
	this.errorLoading = function() {
		if (self.loading < self.scripts.length) {
			self.loadNext();
		}
	}
	this.createQueues = function() {
		if (!self.useQueue && typeof(inboxqueue) == 'object') {
			self.useQueue = true;
			var queueName = 'loadInbox';
			for (i=self.loading;i<self.scripts.length;i++) {
				var func = function(queueparams) {
					iScript.resumeLoading();
				}
				var queueopts = new Array();
				queueopts['oname'] = self.scriptNames[i];
				inboxqueue.add(queueName,func,queueopts);
			}
			visualqueue.listen(queueName,iLang.getTranslation('iScript','Loading'),'oname','interface/img/taskbar/ico-progress.png');
			inboxqueue.resume(queueName);
		}
	}
	this.loadjs = function(param,acceptId) {
		var fileref=document.createElement('script');
		fileref.setAttribute("type","text/javascript");
		if (acceptId) { fileref.setAttribute("id", acceptId); }
		fileref.setAttribute("src", param);
		document.getElementsByTagName('head')[0].appendChild(fileref);
		return true;
	}
	this.unloadjs = function(param) {
		var allsuspects=document.getElementsByTagName("script")
		for (var i=allsuspects.length; i>=0; i--){
			if (allsuspects[i] && allsuspects[i].getAttribute("src")!=null && allsuspects[i].getAttribute("src").indexOf(param)!=-1) {
				allsuspects[i].parentNode.removeChild(allsuspects[i]);
				return true;
			}
		}
		return false;
	}
}
var iScript = new InboxInitScript();