System.generateID = function(){    var date = new Date();    var timeEpoch = date.getTime();    var ID = timeEpoch + System.Data.rand(1,1000000);    return ID;}System.Data.objSize = function(obj) {    var size = 0, key;    for (key in obj) {        if (obj.hasOwnProperty(key)) size++;    }    return size;};System.objSize = function(obj){    return System.Data.objSize(obj);}System.Data.trim = function(str, chars){    return System.Data.ltrim(System.Data.rtrim(str, chars), chars);}System.Data.ltrim = function(str, chars){	chars = chars || "\\s";	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");}System.Data.rtrim = function(str, chars){    chars = chars || "\\s";	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");}System.trim = function(str, chars){    return System.Data.trim(str, chars);}System.rtrim = function(str, chars){    return System.Data.rtrim(str, chars);}System.ltrim = function(str, chars){    return System.Data.ltrim(str, chars);}System.strim = function(string){     return string.split(' ').join('');}System.Data.rand = function(min, max){    // Returns a random number    //    // version: 1004.2314    // discuss at: http://phpjs.org/functions/rand    // +   original by: Leslie Hoare    // +   bugfixed by: Onno Marsman    // %          note 1: See the commented out code below for a version which will work with our experimental (though probably unnecessary) srand() function)    // *     example 1: rand(1, 1);    // *     returns 1: 1    var argc = arguments.length;    if (argc === 0) {        min = 0;        max = 2147483647;} else if (argc === 1) {        throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');    }    return Math.floor(Math.random() * (max - min + 1)) + min;}System.rand = function(min, max){    return System.Data.rand(min, max);}System.Data.isEmpty = function(map) {   for(var key in map) {      if (map.hasOwnProperty(key)) {         return false;      }     return true;    }}System.isEmpty = function(map){    return System.isEmpty(map);}System.inArray = function (array,value)// Returns true if the passed value is found in the// array. Returns false if it is not.{    var i;    for (i=0; i < array.length; i++) {        // Matches identical (===), not just similar (==).        if (array[i] === value) {            return true;        }    }    return false;};System.getVariableByName = function(objName){        var objNameArray = objName.split(".");        var objNameArrayLength = objNameArray.length;        if(objNameArrayLength > 1){            var object = window[objNameArray[0]];            for(var i = 1; i < objNameArrayLength; i++){                object = object[objNameArray[i]];            }        }else{            var object = window[objName];        }            return object;}// ARRAY INDEX OF EXTENSIONif (!Array.prototype.indexOf){  Array.prototype.indexOf = function(elt /*, from*/)  {    var len = this.length;    var from = Number(arguments[1]) || 0;    from = (from < 0)         ? Math.ceil(from)         : Math.floor(from);    if (from < 0)      from += len;    for (; from < len; from++)    {      if (from in this &&          this[from] === elt)        return from;    }    return -1;  };}System.sprintf = (function() {	function get_type(variable) {		return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();	}	function str_repeat(input, multiplier) {		for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}		return output.join('');	}	var str_format = function() {		if (!str_format.cache.hasOwnProperty(arguments[0])) {			str_format.cache[arguments[0]] = str_format.parse(arguments[0]);		}		return str_format.format.call(null, str_format.cache[arguments[0]], arguments);	};	str_format.format = function(parse_tree, argv) {		var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;		for (i = 0; i < tree_length; i++) {			node_type = get_type(parse_tree[i]);			if (node_type === 'string') {				output.push(parse_tree[i]);			}			else if (node_type === 'array') {				match = parse_tree[i]; // convenience purposes only				if (match[2]) { // keyword argument					arg = argv[cursor];					for (k = 0; k < match[2].length; k++) {						if (!arg.hasOwnProperty(match[2][k])) {							throw(sprintf('[sprintf] property "%s" does not exist', match[2][k]));						}						arg = arg[match[2][k]];					}				}				else if (match[1]) { // positional argument (explicit)					arg = argv[match[1]];				}				else { // positional argument (implicit)					arg = argv[cursor++];				}				if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {					throw(sprintf('[sprintf] expecting number but found %s', get_type(arg)));				}				switch (match[8]) {					case 'b': arg = arg.toString(2); break;					case 'c': arg = String.fromCharCode(arg); break;					case 'd': arg = parseInt(arg, 10); break;					case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;					case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;					case 'o': arg = arg.toString(8); break;					case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;					case 'u': arg = Math.abs(arg); break;					case 'x': arg = arg.toString(16); break;					case 'X': arg = arg.toString(16).toUpperCase(); break;				}				arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);				pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';				pad_length = match[6] - String(arg).length;				pad = match[6] ? str_repeat(pad_character, pad_length) : '';				output.push(match[5] ? arg + pad : pad + arg);			}		}		return output.join('');	};	str_format.cache = {};	str_format.parse = function(fmt) {		var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;		while (_fmt) {			if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {				parse_tree.push(match[0]);			}			else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {				parse_tree.push('%');			}			else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {				if (match[2]) {					arg_names |= 1;					var field_list = [], replacement_field = match[2], field_match = [];					if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {						field_list.push(field_match[1]);						while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {							if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {								field_list.push(field_match[1]);							}							else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {								field_list.push(field_match[1]);							}							else {								throw('[sprintf] huh?');							}						}					}					else {						throw('[sprintf] huh?');					}					match[2] = field_list;				}				else {					arg_names |= 2;				}				if (arg_names === 3) {					throw('[sprintf] mixing positional and named placeholders is not (yet) supported');				}				parse_tree.push(match);			}			else {				throw('[sprintf] huh?');			}			_fmt = _fmt.substring(match[0].length);		}		return parse_tree;	};	return str_format;})();System.vsprintf = function(fmt, argv) {	argv.unshift(fmt);	return sprintf.apply(null, argv);};System.UI.Iframe = function(controllerPathQuery,css){    var self = this;	if(typeof(css) == 'undefined'){css = {"width":'0px',"height":"0px","border":"0px"};}    this.ID = "UI_iframe" + System.generateID();    this.append = function(){        $("body").append('<iframe class="UI_iframe" style="width:0px; height:0px; border: 0px" id='+'"'+self.ID+'"'+' src='+'"'+controllerPathQuery+'"'+'></iframe>');        $("#"+self.ID).css(css);    }    this.remove = function(){        $("#"+self.ID).remove();    }		this.append();}System.UI.sfHover = function(ID) {                        var sfEls = document.getElementById(ID).getElementsByTagName("LI");                        for (var i=0; i<sfEls.length; i++) {                            sfEls[i].onmouseover=function() {                                this.className+=" sfhover";                            }                            sfEls[i].onmouseout=function() {                                this.className=this.className.replace(new RegExp(" sfhover\\b"), "");                            }                        }}System.UI.Window = function(data,argsObj){     var Translations = new System.Translations({id:"UI"});     this.ID = System.generateID();     var selfID = "Self"+this.ID;          if(typeof(data) == 'undefined'){data = '';}          this.args = {        autoOpen: true,        useSourceData: false,        modal: false,        title: System.Env.siteUrl,        position: 'center',        width: 400,        minWidth: 400,        showClose: true,        langCode: System.Env.langCode,        isResizable: false,        outputType: 'html',        onClose: function(){},        onOpen: function(){}     }          for(i in argsObj){this.args[i] = argsObj[i];}          /*if(typeof(args) === "undefined"){args = {};}     if(typeof(args.autoOpen) === "undefined"){args.autoOpen = true;}     if( typeof(args.useSourceData) == 'undefined' ){args.useSourceData = false;}     if( typeof(args.modal) == 'undefined' ){args.modal = false;}     if( typeof(args.title) == 'undefined' ){args.title = System.Env.siteUrl;}     if( typeof(args.position) == 'undefined' ){args.position = "center";}     if( typeof(args.width) == 'undefined' ){args.width = 400;}     if( typeof(args.minWidth) == 'undefined' ){args.minWidth = args.width;}     if( typeof(args.showClose) == 'undefined' ){args.showClose = true;}     if( typeof(args.langCode) == 'undefined' ){args.langCode = System.Env.defLangCode;}     if( typeof(args.isResizable) == 'undefined' ){args.isResizable = false;}     if( typeof(args.outputType) == 'undefined' ){args.outputType = 'html';}          if( typeof(args.onClose) == 'undefined' ){args.onClose = function(){};}     if( typeof(args.onOpen) == 'undefined' ){args.onOpen = function(){};}          this.args = args;*/               //System.Globals[selfID] = this;     var self = this;          if(Translations){        var btnCloseTitle = Translations.btnClose;     }else{        var btnCloseTitle = "Close";     }        this.setConfig = function(config){        var self = this;        for(prop in config){            self.args[prop] = config[prop];        }    }         this.onClose = function(){        var self = this;        self.args.onClose.call(this);           }          this.onOpen = function(){        var self = this;        self.args.onOpen.call(this);                 }              var buttons = {};          if(typeof(this.args.buttons) != 'undefined'){         for(var prop in this.args.buttons){              buttons[prop] = this.args.buttons[prop];         }     }               buttons[btnCloseTitle] = function(){self.close();/*jQuery(this).dialog("destroy");jQuery(System.Globals[selfID].windowHolderSelector).remove();System.Globals[selfID].onClose();*/}          this.windowHolderId = "";     if(typeof(this.args.windowId) == 'undefined'){         this.windowHolderId = "UI_window_" + this.ID;     }else{         this.windowHolderId = this.args.windowId;     }     if(!this.args.useSourceData){        this.windowHolderSelector = "#" + this.windowHolderId;        jQuery("body").append("<div style='display:none;' id='"+this.windowHolderId+"'></div>");        if(this.args.outputType == 'html'){            jQuery(this.windowHolderSelector).html(data);        }else if(this.args.outputType == 'text'){            jQuery(this.windowHolderSelector).text(data);        }     }else{        //jQuery(this.windowHolderSelector).html();        this.windowHolderSelector = data;     }     this.open = function(){         var self = this;         var args = self.args;         this.onOpen();         if(args.showClose === true){              jQuery(self.windowHolderSelector).dialog({closeOnEscape:false,resizable:args.isResizable,modal:args.modal,buttons: buttons,title:args.title,position:args.position,minWidth: args.minWidth,width:args.width,close:function(){self.close();},beforeClose:function(){self.onClose();}});         }else if(args.showClose === false){              jQuery(self.windowHolderSelector).dialog({closeOnEscape:false,resizable:args.isResizable,modal:args.modal,title:args.title,position:args.position,minWidth: args.minWidth,width:args.width,beforeClose:function(){self.onClose();}/*,close:function(){self.onClose();jQuery(self.windowHolderSelector).dialog("destroy");jQuery(self.windowHolderSelector).remove();}*/});         }     }     this.close = function(){        var self = this;        this.onClose();        jQuery(self.windowHolderSelector).dialog("destroy");        jQuery(self.windowHolderSelector).remove();     }          this.destroy = function(){        var self = this;        jQuery(self.windowHolderSelector).dialog("destroy");        jQuery(self.windowHolderSelector).remove();             }     if(this.args.autoOpen){         this.open();     }}System.UI.Windows.Msg = function(data,setModal,setWidth,isResizable,showClose){    //var instance = new System.UI.Window('',{autoOpen:false});    if(typeof(data) == 'undefined'){data = '';}    if( typeof(setModal) == 'undefined' ){setModal = false;}	if( typeof(setWidth) == 'undefined' ){setWidth = 400;}	if( typeof(showClose) == 'undefined' ){showClose = true;}	if( typeof(isResizable) == 'undefined' ){isResizable = false;}        var instance = new System.UI.Window(data,{modal:setModal,width:setWidth,showClose:showClose,isResizable:isResizable,title:"System message:"});    this.close = function(){        instance.close();    }}System.UI.Windows.Progress = function(args){    if(typeof(args) == 'undefined'){args = {};}    if(typeof(args.modal) == 'undefined'){args.modal = true;}    var UITranslations = new System.Translations({id:"UI"});    var MsgTranslations = new System.Translations({id:"System",container:"Msg"});    var ID = System.generateID();    args.showClose = false;    args.title = UITranslations.textPleaseWait;    args.onClose = function(){        System.UI.Windows.Msg("<p class='sys-msg-err'>"+MsgTranslations["warning_close_window_progress_stop"]+"</p>",true);    }        var instance = new System.UI.Window("<div style='text-align:center;padding-top:30px;' id='"+ID+"'>"+System.UI.Elements.Loaders["32Red"]+"</div>",args);    this.close = function(destroy){        instance.close();    }        this.destroy = function(){        instance.destroy();    }   }System.UI.Windows.FileTree = function(TreeArgsObj,WindowArgsObj){        var self = this;        var WindowArgs = {        title: "File Browser",        modal: false    }        for(var i in WindowArgsObj){WindowArgs[i] = WindowArgsObj[i];}        var ID = System.generateID();    var fileTreeContainerId = "FileTree"+ID;    var fileTreeContainerSelector = "#"+fileTreeContainerId    var html = '<div style="padding:10px;" id="'+fileTreeContainerId+'">/div>';            this.WindowInstance = new System.UI.Window(html,WindowArgs);    this.FileTreeInstance = new System.UI.FileTree(fileTreeContainerSelector,TreeArgsObj);         }System.UI.FileTree = function(selector,ArgsObj){        var self = this;        var Args = {        root: System.Env['sitePath'] + "userfiles/",        script: System.Env['siteUrl']+'js/jqueryFileTree/jqueryFileTree.php',        folderEvent: 'click',        expandSpeed: 500,        collapseSpeed: 500,        expandEasing: null,        collapseEasing: null,        multiFolder: true,        loadMessage: 'Loading...',            onSelect: function(){},        onOpen: function(){},        autoInit: true    }        for(var i in ArgsObj){Args[i] = ArgsObj[i];}        var TreeArgs = {        root: Args.root,        script: Args.script,        folderEvent: Args.folderEvent,        expandSpeed: Args.expandSpeed,        collapseSpeed: Args.collapseSpeed,        expandEasing: Args.expandEasing,        collapseEasing: Args.collapseEasing,        multiFolder: Args.multiFolder,        loadMessage: Args.loadMessage    }        this.onSelect = function(file){        Args.onSelect.call(this,file);    }        this.onOpen = function(){        Args.onOpen.call(this);    }        this.init = function(){        //alert(jQuery(selector).text());        jQuery(selector).fileTree(TreeArgs,function(file){Args.onSelect(file);});    }        if(Args.autoInit){        self.init();    }}    System.Data.Validator = function(argsObj){        if(typeof(argsObj) == "undefined"){argsObj = {};}	var self = this;        this.args = {        data: '',        autoInit: true,        pattern: "",        mandatory: false,    }	    this.setConfig = function(config){        var self = this;        if(typeof(argsObj.ID) != 'undefined' || argsObj.ID != ''){			for(var i in System.Config.Validators[argsObj.ID]){				self.args[i] = System.Config.Validators[argsObj.ID][i];			}		}		for(var prop in config){            self.args[prop] = config[prop];        }    }	this.setConfig(argsObj);    this.validate = function(data){                if(typeof(data) == "undefined"){data = this.args.data}                if(data == ''){            if(this.args.mandatory){                return false;            }            return true;        }                        if(this.args.minLength != "" || typeof(this.args.minLength) != 'undefined'){            //alert(data.length + " " + this.args.minLength + " " + data);            if(data.length < this.args.minLength){                return false;            }        }        if(this.args.maxLength != "" || typeof(this.args.maxLength) != 'undefined'){            if(data.length > this.args.maxLength){                return false;            }                }        if(this.args.pattern != ""){            if(!data.test(this.args.pattern)){                return false;            }        }        return true;    }            if(this.args.autoInit){        return this.validate();    }}System.UI.Form = function(){    var self = this;        this.Elements = {};        this.getValues = function(){        var Values = {};        for(var i in self.Elements){            Values[i] = self.Elements[i].val();        }        return Values;        }        this.reset = function(){        for(var i in self.Elements){            self.Elements[i].reset();        }    }} System.UI.Form.validationIndicatorUpdate = function(FuncArgs){        var Args = {            iconSuccess: System.UI.Elements.Icons["16Accept"],            iconError: System.UI.Elements.Icons["16Reject"]        }                for(var i in FuncArgs){            if(!((i == 'iconSuccess' && typeof(FuncArgs[i]) == 'undefined') || (i == 'iconError' && typeof(FuncArgs[i]) == 'undefined' ))){                Args[i] = FuncArgs[i];            }        }        if(typeof(Args.type) != 'undefined'){            if(Args.type){                jQuery(Args.selector).html(System.UI.Elements.Icons["16Accept"]);                            }else{                jQuery(Args.selector).html(System.UI.Elements.Icons["16Reject"]);                             }        }else{            if(Args.validate || Args.mandatory){                if(Args.Validator.validate(Args.Instance.val())){                    jQuery(Args.selector).html(System.UI.Elements.Icons["16Accept"]);                                }else{                    jQuery(Args.selector).html(System.UI.Elements.Icons["16Reject"]);                               }            }                }}System.UI.Form.TextField = function(selector,ArgsObj){		if(typeof(ArgsObj) == 'undefined'){ArgsObj = {};}		var self = this;	this.Instance = jQuery(selector);	this.Validator = {};		var Args = {		validate: false,		validator: 'name',		validationSelector: '',		counter: true,		errorSelector: '',		errorString: '',		value: '',		onInput: function(data){},        mandatory: false	}		this.setConfig = function(FuncArgs){		for(i in FuncArgs){Args[i] = FuncArgs[i];}	}			this.init = function(FuncArgs){		if(typeof(FuncArgs) == 'undefined'){FuncArgs = ArgsObj;}		self.setConfig(FuncArgs);		self.val(Args.value);			self.Instance.keyup(function(){self.onInput();});		if(Args.validate || Args.mandatory){            self.Validator = new System.Data.Validator({ID: Args.validator, autoInit: false, mandatory: Args.mandatory});            self.validationIndicatorUpdate();        }	}		this.reset = function(FuncArgs){		this.init(FuncArgs);	}				this.val = function(data){		if(typeof(data) != 'undefined'){			self.Instance.val(data);		}else{			var val = self.Instance.val();			if(Args.validate == true){				if(!self.Validator.validate(val)){					return false;				}else{					return val;				}			}else{				return val;			}		}	}	    this.validationIndicatorUpdate = function(type){        System.UI.Form.validationIndicatorUpdate({selector:Args.validationSelector,                                                  type:type,                                                  mandatory:Args.mandatory,                                                  validate:Args.validate,                                                  Validator:self.Validator,                                                  Instance:self.Instance,                                                  iconSuccess:Args.validationIconSuccess,                                                  iconError:Args.validationIconError});    }    	this.onInput = function(data){		data = self.val();        self.validationIndicatorUpdate();		Args.onInput.call(this,data);	}			this.init(ArgsObj);}System.UI.Form.CheckBoxFields = function(selector,ArgsObj){    if(typeof(ArgsObj) == 'undefined'){ArgsObj = {};}		var self = this;	this.Validator = {};    	var Args = {		validationSelector: '',		errorSelector: '',		errorString: '',		value: '',		onInput: function(data){},        mandatory: false	}        	this.setConfig = function(FuncArgs){		for(i in FuncArgs){Args[i] = FuncArgs[i];}	}			this.init = function(FuncArgs){		if(typeof(FuncArgs) == 'undefined'){FuncArgs = ArgsObj;}		self.setConfig(FuncArgs);			jQuery(selector + " input:checkbox").each(function(){            jQuery(this).click(function(){                self.onInput();            });        });		if(Args.mandatory){                  if(!System.UI.checkedItemsExists(selector)){                self.validationIndicatorUpdate(false);            }else{                self.validationIndicatorUpdate(true);            }        }	}         this.validationIndicatorUpdate = function(type){        System.UI.Form.validationIndicatorUpdate({selector:Args.validationSelector,                                                  type:type,                                                  mandatory:Args.mandatory,                                                  iconSuccess:Args.validationIconSuccess,                                                  iconError:Args.validationIconError});    }    	this.val = function(data){		if(typeof(data) != 'undefined'){			self.Instance.val(data);		}else{			var val = self.Instance.val();			if(Args.validate == true){				if(!self.Validator.validate(val)){					return false;				}else{					return val;				}			}else{				return val;			}		}	}        	this.onInput = function(data){		//data = self.val();        if(Args.mandatory){            if(!System.UI.checkedItemsExists(selector)){                self.validationIndicatorUpdate(false);            }else{                self.validationIndicatorUpdate(true);            }        }		Args.onInput.call(this,data);	}	            this.init(ArgsObj);}System.UI.Element = function(selector){                var self = this;                this.top = 0;        this.left = 0;        this.bottom = 0;        this.right = 0;        this.width = 0;        this.height = 0;        this.hidden = false;        this.selector = selector;        this.Instance = jQuery(selector);        this.opacity = this.Instance.css("opacity");                this.update = function(){            var offset = jQuery(this.selector).offset();            self.offset = offset;            self.top = offset.top;            self.left = offset.left;            self.width = self.Instance.width();            self.height = self.Instance.height();            self.bottom = self.top + self.height;            self.right = self.left + self.width;                  }                this.getPos = function(){            self.update();        }                this.fadeTo = function(duration,value){             jQuery(self.selector).fadeTo(duration,value);              self.opacity = value;        }                   this.update();}System.Translations = function(argsObj){        this.Translations = [];        this.args = {        langCode: System.Env.langCode,        id: "",        container: "Translations"     }        //for(i in argsObj){args[i] = argsObj[i];}            this.get = function(id,langCode){        if(typeof(langCode) == "undefined"){            langCode = this.args.langCode;        }        if(typeof(System.Config[this.args.container][id]) != "undefined"){            return System.Config[this.args.container][id][langCode];        }else return false;            }        this.setConfig = function(configObj){        if(typeof(configObj) == 'undefined'){configObj == {};}        for(i in configObj){this.args[i] = configObj[i];}    }            this.setConfig(argsObj);       return this.get(this.args.id);}System.Msg = function(argsObj){        this.Msgs = {};    this.MsgsContainer = {};    this.empty = true;      this.count = 0;        this.args = {        lang: System.Env.langCode,        id: 'System'    }        this.setConfig = function(configObj){        if(typeof(configObj) == 'undefined'){configObj == {};}        for(i in configObj){this.args[i] = configObj[i];}        /*if(this.args.lang == ""){            this.args.lang = System.Env.defLangCode;        }        if(this.args.id != ''){            this.MsgsContainer = System.Config.Msg[this.args.id][this.args.lang];        }*/        this.MsgsContainer = System.Config.Msg[this.args.id][this.args.lang];    }            this.set = function(argsObjSet){        this.empty = false;        var argsSet = {            custom: false,            content: "",            lang: ""        }                for(i in argsObjSet){argsSet[i] = argsObjSet[i];}                if(argsSet.content != ""){            if(typeof(this.MsgsContainer[argsSet.id]) == "undefined"){                   this.MsgsContainer[argsSet.id] = argsSet.content;            }        }                if(typeof(this.Msgs[argsSet.id]) == "undefined"){            this.Msgs[argsSet.id] = {};            //this.Msgs[argsSet.id].count = 0;            this.Msgs[argsSet.id].content = this.MsgsContainer[argsSet.id];            this.count += 1;        }        //alert(this.empty);                /*if(typeof(this.Msgs[argsSet.id].count) == "undefined"){            this.Msgs[argsSet.id].count = 0;        }*/        //this.Msgs[argsSet.id].count += 1;            }        this.isEmpty = function(){        return this.empty;    }            this.get = function(argsObjGet){        var argsGet = {            id: "",            type: "content",            mode: ""        }                for(i in argsObjGet){argsGet[i] = argsObjGet[i];}                if(argsGet.id == ""){            if(argsGet.type == "content"){                var contents = {};                if(argsGet.mode == "config"){                    for(i in this.MsgsContainer){                        contents[i] = this.MsgsContainer[i];                    }                                    }else{                    var contents = [];                    for(i in this.Msgs){                        contents.push(this.Msgs[i].content);                    }                                }                return contents;            }else if(argsGet.type == "count"){                return this.count;            }else if(argsGet.type == "id"){                var IDs = [];                if(argsGet.mode == "config"){                    for(i in this.MsgsContainer){                        IDs.push(i);                    }                               }else{                    for(i in this.Msgs){                        IDs.push(i);                    }                                }                return IDs;            }         }else{            if(argsGet.type == "content"){                 if(argsGet.mode == "config"){                    if(typeof(this.MsgsContainer[argsGet.id]) != "undefined"){                        return this.MsgsContainer[argsGet.id];                                       }else{                        return "";                    }                 }else{                    if(typeof(Msgs[argsGet.id]) != "undefined"){                        return this.Msgs[argsGet.id].content;                    }else{                        return "";                    }                }            }        }    }            /*this.checkState = function(){        if(System.Data.isEmpty(this.Errors)){            return false;        }else{            var ctr = 0;            for(i in this.Msgs){                ctr += this.Msgs[i].count;            }            if(ctr == 0){                return false;            }else{                return true;            }        }    }*/        this.remove = function(id){        if(typeof(this.Msgs[id]) != "undefined"){            delete this.Msgs[id];            if(this.count != 0){                this.count -= 1;            }            if(this.count == 0){                this.reset();            }        }        //alert(this.empty);    }        this.reset = function(){        this.Msgs = {};        this.empty = true;        this.count = 0;        //alert("reset");    }        this.setConfig(argsObj);}System.UI.Toolbar = function(containerID,args){        var UITranslations = new System.Translations({id:"UI"});            if(typeof(args) == 'undefined'){this.args = {};}else{this.args = args;}    if(typeof(this.args.buttons) == 'undefined'){this.args.buttons = {};}    if(typeof(this.args.toolbarClass) == 'undefined'){this.args.toolbarClass = 'UI_toolbar';}    if(typeof(this.args.buttonsClass) == 'undefined'){this.args.buttonsClass = 'UI_button';}    if(typeof(this.args.addButtonsClass) == 'undefined'){this.args.addButtonsClass = 'UI_button_small';}    if(typeof(this.args.addButtons) == 'undefined'){this.args.addButtons == {}}    if(typeof(this.args.closeButtonValue) == 'undefined'){this.args.closeButtonValue = UITranslations['btnHide'];}    this.containerID = containerID;    this.html = '';    this.script = '<script type="text/javascript">\n';    this.ID = 'UI_toolbar_'+ (System.Data.rand(1,10000) + System.Data.rand(1,100000));    this.addButtonsContainerID = this.ID + "_" + "addButtonsHolder";    this.buttons = {};    this.init = function(){        var self = this;        self.html += "<div class='"+self.args.toolbarClass+"' id='"+self.ID+"' style='display:inline'>\n";        for(var name in self.args.buttons){            self.buttons[name] = self.args.buttons[name];            if(typeof(self.buttons[name].buttonClass) == 'undefined'){self.buttons[name].buttonClass = self.args.buttonsClass;}            if(typeof(self.buttons[name].ID) == 'undefined'){self.buttons[name].ID = self.ID + "_button_" + System.strim(name)};            self.buttons[name].html = '<button id="'+self.buttons[name].ID+'" class="'+self.buttons[name].buttonClass+'">'+name+'</button>\n';            self.html += self.buttons[name].html;            self.script += 'jQuery("#'+self.buttons[name].ID+'").click('+self.buttons[name].buttonFunction+')\n';        }        self.script +=  "</script>\n";        self.html += "<span id='"+self.addButtonsContainerID+"' style='display:none'></span>";        self.html += self.script;        self.html += "</div>\n";                jQuery(containerID).html(self.html);        self.addButtonsAll(self.args.addButtons);    }    this.generateButtonID = function(){        var self = this;        var buttonID = self.ID + "_" + "button_" + System.generateID();        return buttonID;    }    this.addButtonsShow = function(btnName,addButtonsCustom){        var self = this;        if(typeof(addButtonsCustom) == 'undefined'){addButtonsCustom = false;}        if(!addButtonsCustom){            jQuery("#"+self.addButtonsContainerID).html(self.buttons[btnName].addButtons.html).fadeIn(200);        }else{            self.buttons[btnName].buttonFunction();        }    }    this.addButtons = function(btnName,addButtons){        var self = this;        this.show = true;        if(typeof(self.buttons[btnName].addButtons) == 'undefined'){self.buttons[btnName].addButtons = {}}        if(!System.Data.isEmpty(addButtons) && typeof(addButtons) == 'object'){            var html = '';            var script = '';            script += '<script>\n';            for(var name in addButtons){                if(typeof(addButtons[name].type) == 'undefined'){addButtons[name].type = '';}                if(typeof(addButtons[name].buttonClass) == 'undefined'){addButtons[name].buttonClass = self.args.addButtonsClass;}                if(typeof(addButtons[name].ID) == 'undefined'){addButtons[name].ID = self.ID + "_addButton_" + btnName + "_" + System.strim(name)};                if(typeof(addButtons[name].closeButtonValue) == 'undefined'){addButtons[name].closeButtonValue = self.args.closeButtonValue};                if(typeof(addButtons[name].buttonFunction) == 'undefined'){addButtons[name].buttonFunction = function(){}};                /*if(args.addButtons[name].type == 'html'){                    //if(typeof(args.buttons[name].ID) == 'undefined'){args.buttons[name].ID = '';}                    //html += addButtons[name].html;                }*/                if(addButtons[name].type == 'html'){                    html += addButtons[name].html;                }else{                    if(name == 'addButtonsCustom'){                        self.buttons[btnName].buttonFunction = function(){addButtons[name].init();}                        this.show = false;                    }else{                        html += '<button id="'+addButtons[name].ID+'" class="'+addButtons[name].buttonClass+'">'+name+'</button>\n';                        script += 'jQuery("#'+addButtons[name].ID+'").click('+addButtons[name].buttonFunction+')\n';                    }                }                /*jQuery("#"+self.buttons[btnName].ID).unbind('click');                if(this.show){                    jQuery("#"+self.buttons[btnName].ID).click(self.buttons[btnName].buttonFunction;self.addButtonsShow());                }else{                    jQuery("#"+self.buttons[btnName].ID).click(self.buttons[btnName].buttonFunction);                }*/            }            html += "<button id='"+self.generateButtonID()+"' class='UI_button_small' onClick='javascript: System.UI.elementHide("+'"#'+self.addButtonsContainerID+'"'+")'>"+addButtons[name].closeButtonValue+"</button>";            script += '</script>\n';            addButtons.html = html + script;            self.buttons[btnName].addButtons = addButtons;            jQuery("#"+self.buttons[btnName].ID).unbind('click');            jQuery("#"+self.buttons[btnName].ID).click(self.buttons[btnName].buttonFunction);            if(this.show){                self.buttons[btnName].buttonFunction = self.addButtonsShow(btnName);            }            jQuery("#"+self.addButtonsContainerID).css({"display":"none"});        }    }    this.addButtonsAll = function(addButtons){            var self = this;            for(var btnName in addButtons){                self.addButtons(btnName,addButtons[btnName]);            }    }        this.init();}System.UI.Table = function(args){        var self = this;    this.ID = System.generateID();    this.intervalID = '';    this.tableID = "UI_table_" + this.ID;        this.UITranslations = new System.Translations({id:"UI"});        if(typeof(args) == 'undefined'){this.args = {};}else{this.args = args;}    if(typeof(this.args.startPage) == 'undefined'){this.args.startPage = 1;}    if(typeof(this.args.itemsPerPage) == 'undefined'){this.args.itemsPerPage = 25;}    if(typeof(this.args.defaultItemsPerPage) == 'undefined'){this.args.defaultItemsPerPage = 25;}    if(typeof(this.args.paginate) == 'undefined'){this.args.paginate = true;}        if(typeof(this.args.showLoader) == 'undefined'){this.args.showLoader = true;}     /*if(typeof(this.args.fancyBoxConfig) == 'undefined'){this.args.fancyBoxConfig = {'speedIn': 300,'speedOut': 300,'cyclic': true}}    if(typeof(this.args.fancyBoxSelector) == 'undefined'){this.args.fancyBoxSelector = "a[rel^='fancyBox']";}*/    if(typeof(this.args.loaderHtml) == 'undefined'){this.args.loaderHtml = self.UITranslations['textUpdating']+" ...";}    if(typeof(this.args.debug) == 'undefined'){this.args.debug = false;}    if(typeof(this.args.customErrors) == 'undefined'){this.args.customErrors = true;}    if(typeof(this.args.lang) == 'undefined'){this.args.lang = System.Env.langCode;}    if(typeof(this.args.DataContainer) == 'undefined'){this.args.DataContainer = {}}       if(typeof(this.args.autoInit) == 'undefined'){this.args.autoInit = true}    if(typeof(this.args.onAfterInit) == 'undefined'){this.args.onAfterInit = function(){}}    if(typeof(this.args.onError) == 'undefined'){this.args.onError = function(){return true;}}          if(typeof(this.args.onDataEmpty) == 'undefined'){this.args.onDataEmpty = function(){return true;}}           if(typeof(this.args.styleSuffix) == 'undefined'){this.args.styleSuffix = ''}     if(typeof(this.args.showControls) == 'undefined'){this.args.showControls = false}         if(typeof(this.args.ControlsArgs) == 'undefined'){this.args.ControlsArgs = {}}    if(typeof(this.args.refreshIntervalEnable) == 'undefined'){this.args.refreshIntervalEnable = false;}        if(typeof(this.args.refreshInterval) == 'undefined'){this.args.refreshInterval = 180;}        this.args.refreshInterval = this.args.refreshInterval * 1000;            this.args.itemsCheckSelector = "#"+this.tableID+" "+this.args.itemsCheckSelector;    this.args.ControlsArgs.TableInstance = this;        //this.Msg = new System.Msg({mode:'config'});        var self = this;    this.actionLock = false;    this.resetLock = false;    this.MsgTranslations = new System.Translations({id:"System",container:"Msg"});    this.DataContainer = this.args.DataContainer;        this.Controls = {};        this.html = '';     this.page = this.args.startPage;    this.ipp = this.args.itemsPerPage;    this.def_ipp = this.args.defaultItemsPerPage;    this.paginatorSuffix = "page="+this.page+"&ipp="+this.ipp+"&def_ipp="+this.def_ipp;    this.itemsCheckSelector = this.args.itemsCheckSelector;        this.sortSuffix = '';    this.filterSuffix = '';        this.init = function(){        var thisObj = this;        jQuery("#"+thisObj.args.tableHolderID).css({"display":"none"});        jQuery("#"+thisObj.args.loaderHolderID).css({"display":"none"});        jQuery("#"+thisObj.args.paginationHolderID).css({"display":"none"});        jQuery("#"+thisObj.args.loaderHolderID).html(thisObj.args.loaderHtml);        this.html += "<table class='UI_table"+self.args.styleSuffix+"' id='"+self.tableID+"' cellpadding='0' cellspacing='0' >";                   this.displayAll();        this.args.onAfterInit();        if(self.args.refreshIntervalEnable){            self.refreshIntervalSet();        }           }        this.getSelf = function(){        return self;    }        this.onError = function(jqXHR, textStatus, errorThrown){        self.args.onError.call(this,jqXHR, textStatus, errorThrown);               }        this.displayAll = function(showLoader){        var thisObj = this;        if(thisObj.args.paginate){            thisObj.displayPagination();                  }else{            thisObj.displayTable(showLoader);        }        //thisObj.displayTablePagination(thisObj.args.paginatorSuffix,thisObj.args.selectorPg,thisObj.args.urlActionPg,thisObj.args.controllerScript);    }        this.displayPagination = function(){        var thisObj = this;        jQuery.ajax({            type: "GET",            url: thisObj.args.controllerScriptPath,            data: thisObj.args.controllerActionPagination+"&"+thisObj.paginatorSuffix,            success: function(data){                //alert(data);                if(System.trim(data) == 'error_access_denied'){                    data = "";                }                if(thisObj.args.debug){                    System.UI.Window(data,{outputType:'text',width:900,title:"Debug::Pagination"});                }                jQuery("#"+thisObj.args.paginationHolderID).html(data);                thisObj.displayTable();            },            error: function(jqXHR, textStatus, errorThrown){                //alert(errorThrown);            }        });    }    this.displayTable = function(showLoader){        var thisObj = this;        //alert(self.args.controllerScriptPath);        if(typeof(showLoader) == 'undefined'){showLoader = true;}        if(thisObj.args.showLoader){            if(showLoader){                jQuery("#"+thisObj.args.loaderHolderID).fadeIn(150);            }        };        jQuery.ajax({            type: "POST",            url: thisObj.args.controllerScriptPath,            beforeSend: function(){                //alert(thisObj.args.controllerScriptPath);            },            cache: false,            data: thisObj.args.controllerActionTable+"&"+thisObj.paginatorSuffix+thisObj.sortSuffix+thisObj.filterSuffix,            success: function(data){                        self.resetLock = false;                        if(thisObj.args.debug){                            System.UI.Window(data,{outputType:'text',width:900,title:"Debug::Content"});                        }                        if(data == 'error_access_denied'){                            jQuery("#"+thisObj.args.loaderHolderID).fadeOut(150);                                                                    var error = self.args.onError();                            if(!(error == false)){                                System.UI.Windows.Msg("<p class='sys-msg-err'>"+self.MsgTranslations[data]+"</p><p>"+self.MsgTranslations['text_log_in']+"</p>",true);                            }                                }else if(data == "empty"){                            jQuery("#"+thisObj.args.loaderHolderID).fadeOut(150,function(){                                var dataEmpty = self.args.onDataEmpty();								if(!(dataEmpty == false)){									jQuery("#"+thisObj.args.paginationHolderID).fadeIn(150);									jQuery("#"+thisObj.args.tableHolderID).fadeIn(150);									jQuery("#"+thisObj.args.loaderHolderID).html("<div class='no-items'>"+thisObj.MsgTranslations['error_no_items_db']+"</div>");									jQuery("#"+thisObj.args.loaderHolderID).fadeIn(150);								}else{									jQuery("#"+thisObj.args.loaderHolderID).html("");								}                            });                        }else if(data == "no_matches"){                            jQuery("#"+thisObj.args.loaderHolderID).fadeOut(150,function(){                                //setTimeout('listReset()', 500);                                System.UI.Windows.Msg("<p class='sys-msg-err'>"+thisObj.MsgTranslations["error_no_matches"]+"</p>",true);                            });                        }else{                            thisObj.html += data;                            thisObj.html += "</table>";                            jQuery("#"+thisObj.args.tableHolderID).html(thisObj.html);                            //alert(/*jQuery("#"+self.args.tableHolderID).css('width')*/self.args.controllerScriptPath);                            jQuery("#"+thisObj.args.loaderHolderID).fadeOut(150,function(){                                jQuery("#"+thisObj.args.loaderHolderID).css({"display":"none"});                                jQuery("#"+thisObj.args.paginationHolderID).fadeIn(150);                                jQuery("#"+thisObj.args.tableHolderID).fadeIn(150);                            });                            //jQuery("a[rel^='fancyBox']").fancybox(thisObj.args.fancyBoxConfig);                        }                    },               error: function(jqXHR, textStatus, errorThrown){                    self.resetLock = false;                    jQuery("#"+self.args.loaderHolderID).fadeOut(300);                    var error = self.args.onError(jqXHR, textStatus, errorThrown);                    if(!(error == false)){                        if(typeof(errorThrown) != "undefined"){                            System.UI.Windows.Msg("<p class='sys-msg-err'>"+errorThrown+"</p>",true);                        }else{                             System.UI.Windows.Msg("<p class='sys-msg-err'>"+textStatus+"</p>",true);                                               }                    }               }		    });    }        this.refreshIntervalAction = function(){        //alert(self.checkedItemsExists());        if(self.checkedItemsExists()){            return false;        }else{            self.reset();        }    }        this.refreshIntervalSet = function(){        //if(self.intervalID == ''){        self.intervalID = setInterval(self.refreshIntervalAction,self.args.refreshInterval);                    //}    }        this.checkedItemsValues = function(msg){        if(typeof(msg) == 'undefined'){msg = true;}        var IDs = self.checkedItemsExists();        var values = [];         if(IDs){            for(var i = 0; i < IDs.length; i++){                values[i] = jQuery(self.args.itemsCheckSelector).val();            }            return IDs;        }else{            if(!msg){                return IDs;            }            System.UI.Windows.Msg("<p class='sys-msg'>"+self.MsgTranslations["warning_select_items"]+"</p>",true);        }            }        this.checkedItemsExists = function(){        var self = this;        return System.UI.checkedItemsExists(self.args.itemsCheckSelector);    }    this.checkedItemsDelete = function(){        var self = this;        return System.UI.checkedItemsDelete(self.args.itemsCheckSelector,self.args.controllerActionItemsDelete,self.args.controllerScriptPath,self.args.customErrors);    }    this.deleteChecked = function(args){        var self = this;        if(typeof(args) == 'undefined'){args = {};}        if(typeof(args.modal) == 'undefined'){args.modal = true;}        if(typeof(args.width) == 'undefined'){args.width = 400;}        if(this.checkedItemsExists()){            //var UITranslations = new System.Translations({id:"UI"});            //var MsgTranslations = new System.Translations({id:"System",container:"Msg"});            var btnDeleteTitle = self.UITranslations.btnDel;            var delMsg = "<p class='sys-msg'>"+self.MsgTranslations["warning"]+"</p><p>"+self.MsgTranslations["warning_delete_checked"]+"</p>";            args.buttons = {};            args.buttons[btnDeleteTitle] = function (){jQuery(this).dialog("destroy");self.checkedItemsDelete();}            System.UI.Window(delMsg,args);        }else{            System.UI.Windows.Msg("<p class='sys-msg'>"+self.MsgTranslations["warning_select_items"]+"</p>",true);        }    }    this.reset = function(funcArgs){		if(typeof(funcArgs) == 'undefined'){funcArgs = {};}		for(var i in funcArgs){self.args[i] = funcArgs[i];}		        var self = this;        if(self.resetLock){            return false;        }        self.resetLock = true;        this.resetFade('out');        this.resetFade('in');           this.loaderInit();        this.html = "<table class='UI_table"+self.args.styleSuffix+"' id='"+self.tableID+"' cellpadding='0' cellspacing='0' >";                   this.displayAll(self.args.showLoader);        //alert(this.paginatorSuffix);    }        this.loaderInit = function(){        jQuery("#"+self.args.loaderHolderID).css({"display":"none"});        jQuery("#"+self.args.loaderHolderID).html(self.args.loaderHtml);       }        this.resetFade = function(dir){        var self = this;        if(dir == 'out'){            jQuery("#"+self.args.tableHolderID).animate({opacity:0.5});        }else if(dir == 'in'){            jQuery("#"+self.args.tableHolderID).animate({opacity:1});        }    }        /*this.highlightRowGroup = function(selector){            }*/            this.cellValueEdit = function(argsObj){        return new System.UI.Table.cellValueEdit(argsObj);    }        if(this.args.autoInit){        this.init();    }        if(this.args.showControls){        this.Controls = new System.UI.Table.Controls(this.args.ControlsArgs);        this.Controls.init();    }}System.UI.Table.Controls = function(ArgsObj){        var self = this;         this.Args = {        sort: true,        sortSelector: '',        SortDataSource: {},        filter: true,        filterSelector: '',        autoInit: true    }        for(var i in ArgsObj){this.Args[i] = ArgsObj[i];}    if(typeof(this.Args.TableInstance) != 'undefined'){        if(typeof(this.Args.controllerScript) == 'undefined'){this.Args.controllerScript = this.Args.TableInstance.args.controllerScriptPath;}    }    this.UITranslations = new System.Translations({id:"UI"});           this.ID = System.generateID();        this.sortTableID = "SystemTableSort"+self.ID;    this.sortTableSelector = "#"+this.sortTableID;    this.sortColDropID = "SystemTableSortColDrop"+self.ID;    this.sortColDropSelector = "#"+this.sortColDropID;    this.sortDirDropID = "SystemTableSortDir"+self.ID;    this.sortDirDropSelector = "#"+this.sortDirDropID;    this.sortBtnSortID = "SystemTableSortBtnSort"+self.ID;    this.sortBtnSortSelector = "#"+self.sortBtnSortID;    this.sortBtnResetID = "SystemTableSortBtnReset"+self.ID;    this.sortBtnResetSelector = "#"+self.sortBtnResetID;         this.filterTableID = "SystemTableFilter"+self.ID;    this.filterTableSelector = "#"+this.filterTableID;    this.filterInputID = "SystemTableInput"+self.ID;    this.filterInputSelector = "#"+this.filterInputID;    this.filterBtnFilterID = "SystemTableBtnFilter"+self.ID;    this.filterBtnFilterSelector = "#"+this.filterBtnFilterID;    this.filterBtnResetID = "SystemTableFilterBtnReset"+self.ID;    this.filterBtnResetSelector = "#"+this.filterBtnResetID;    this.TableInstance = this.Args.TableInstance;        this.sortHtml = function(){        var html = '<table id="'+self.sortTableID+'">';        html += '<tr>';        html += '<td>';        html += '<select id="'+self.sortColDropID+'">';        for(title in self.Args.SortDataSource){            html += '<option value="'+title+'">'+self.Args.SortDataSource[title]+'</option>';                    }        html += '</select>';        html += '</td>';        html += '<td>';        html += '<select id="'+self.sortDirDropID+'">';        html += '<option value="DESC">'+self.UITranslations.textDesc+'</option>';        html += '<option value="ASC">'+self.UITranslations.textAsc+'</option>';        html += '</select>';        html += '</td>';        html += '<td>';        html += '<button id="'+self.sortBtnSortID+'">'+self.UITranslations.btnSort+'</button>';        html += '</td>';        html += '<td>';        html += '<button id="'+self.sortBtnResetID+'">'+self.UITranslations.btnReset+'</button>';        html += '</td>';        html += '</tr>';        html += '</table>';                jQuery(self.Args.sortSelector).html(html);    }        this.sortActions = function(){                        jQuery(self.sortBtnSortSelector).click(function(){            var column = jQuery(self.sortColDropSelector).val();            var dir = jQuery(self.sortDirDropSelector).val();            self.TableInstance.sortSuffix = "&sortColumn=" + column + "&sortDir=" + dir;            self.TableInstance.filterSuffix = '';                       self.TableInstance.reset();        });        jQuery(self.sortBtnResetSelector).click(function(){                   self.TableInstance.sortSuffix = '';            self.TableInstance.filterSuffix = '';                         self.TableInstance.reset();        });    }        this.sortInit = function(){        self.sortHtml();        self.sortActions();    }        this.filterHtml = function(){        var html = '<table>';        html += '<tr>';        html += '<td>';        html += '<input type="text" id="'+self.filterInputID+'" />';        html += '</td>';        html += '<td>';        html += '<button id="'+self.filterBtnFilterID+'">'+self.UITranslations.btnFilter+'</button>';        html += '</td>'        html += '<td>';        html += '<button id="'+self.filterBtnResetID+'">'+self.UITranslations.btnReset+'</button>';        html += '</td>'                html += '</tr>';        html += '</table>';                jQuery(self.Args.filterSelector).html(html);            }        this.filterActions = function(){            jQuery(self.filterBtnFilterSelector).click(function(){            var filterString = jQuery(self.filterInputSelector).val();            self.TableInstance.filterSuffix = "&filterString="+filterString;            self.TableInstance.sortSuffix = '';                        self.TableInstance.reset();        });                jQuery(self.filterBtnResetSelector).click(function(){            self.TableInstance.filterSuffix = '';            self.TableInstance.sortSuffix = '';                           self.TableInstance.reset();        });                        jQuery(self.filterInputSelector).keyup(function(e){            //alert(e.keyCode);            if(e.keyCode == 13) {                var filterString = jQuery(self.filterInputSelector).val();                self.TableInstance.filterSuffix = "&filterString="+filterString;                self.TableInstance.sortSuffix = '';                            self.TableInstance.reset();            }             });           }        this.filterInit = function(){        self.filterHtml();        self.filterActions();    }        this.init = function(){        if(self.Args.sort){            self.sortInit();        }        if(self.Args.filter){            self.filterInit();        }    }        if(this.Args.autoInit){        this.init;    }}System.UI.Table.actionLock = false;System.UI.Table.highlightRowSingle = function(selector,args){        //alert(jQuery(selector).attr('checked'));    this.args = args;    if(typeof(this.args) == 'undefined'){this.args = {};}    if(typeof(this.args.colorChecked) == 'undefined'){this.args.colorChecked = '#d9fff6';}    if(typeof(this.args.colorUnchecked) == 'undefined'){this.args.colorUnchecked = '#fafafa';}    //alert("color checked: "+this.args.colorChecked+" colorUnchecked: "+this.args.colorUnchecked);    if(jQuery(selector).attr('checked') == true){        //jQuery(selector).attr("checked",true);		jQuery(selector).closest("tr").css({"background":this.args.colorChecked});	}else{        //jQuery(selector).attr("checked",false);        //alert(this.args.colorUnchecked);		jQuery(selector).closest("tr").css({"background":this.args.colorUnchecked});	}}System.UI.Table.highlightRowGroup = function(checked,t,args){    this.args = args;    if(typeof(this.args) == 'undefined'){this.args = {};}    if(typeof(this.args.colorChecked) == 'undefined'){this.args.colorChecked = '#d9fff6';}    if(typeof(this.args.colorUnchecked) == 'undefined'){jQuery(selector).css('background-color');}    if(checked == true){		jQuery(t).closest("tr").css({"background":this.args.colorChecked});	}else{		jQuery(t).closest("tr").css({"background":this.args.colorUnchecked});	}}/*System.UI.Table.statusTextChange = function(statusSelector,statusSelectorText,statusList){        var index = statusList.indexOf(statusSelectorText);        if(index != -1){            if(index == (statusList.length - 1)){                index = 0;            }else{                index++;                if(index > (statusList.length - 1)){                    index = statusList.length;                }            }        }else return false;                alert(index);        statusSelectorText = statusList[index];        jQuery(statusSelector).children().html("<span class='UI_table_status_"+statusSelectorText+"'>"+statusSelectorText+"</span>");}*/System.UI.Table.statusChange = function(argsObj){                        var UITranslations = new System.Translations({id:"UI"});                        this.args = {                selector: "",                id: "",                status: "",                controllerPath: "",                controllerAction: "",                statusList: ['active','inactive']            }                        for(i in argsObj){this.args[i] = argsObj[i];}        			var statusSelector = "";            var selector = this.args.selector;            var statusList = this.args.statusList;            statusSelector = selector;			var statusSelectorText = jQuery(statusSelector).children().text();			var oldHtml = jQuery(statusSelector).children().html();			jQuery(statusSelector).children().html(System.UI.Elements.Loaders["LoaderFBSmallGrey"]);			jQuery.ajax({				type: "GET",				url: this.args.controllerPath,                data: this.args.controllerAction+"&Id="+this.args.id+"&currentStatus="+statusSelectorText,				success: function(data){					if(System.inArray(statusList,System.trim(data))){                        jQuery(statusSelector).children().html("<div class='UI_table_status_"+data+"'>"+UITranslations[data]+"</div>");					}else{                        //alert(data);					    System.UI.Windows.Msg("<p class='sys-msg-err'>Error!</p>",true);						jQuery(statusSelector).children().html(oldHtml);					}				},                error: function(jqXHR, textStatus, errorThrown){                    System.UI.Windows.Msg(errorThrown,true);                    jQuery(selectorTd).html(tdHtml);                                        }		    });    }System.UI.Table.statusChangeGroup = function(argsObj){                        var UITranslations = new System.Translations({id:"UI"});		            var MsgTranslations = new System.Translations({id:"System",container:"Msg"});            var self = this;                        this.args = {                status: "",                checkSelector: "",                statusSelector: "",                controllerPath: "",                controllerAction: ""            }                        for(i in argsObj){this.args[i] = argsObj[i];}                 var self = this;                var ctr = 0;				var checkedIDs = [];				var selectorCheck = this.args.checkSelector + " :checked";				jQuery(selectorCheck).each(function(){					checkedIDs[ctr] = jQuery(this).val();					ctr++;				});				if(!System.UI.checkedItemsExists(this.args.checkSelector)){					System.UI.Windows.Msg("<p style='font-weight:bold;'>"+MsgTranslations['warning_select_items']+"</p>",true);				}else{					/*var statusClass = "";                    if(newStatus === "active"){						statusClass = "StatusAct";					}else if(newStatus === "inactive"){						statusClass = "StatusInact";					}else if(newStatus === "archive"){						statusClass = "StatusArch";					}*/					var oldHtmlArray = [];					for(var ctr1=0; ctr1<checkedIDs.length; ctr1++){							    var Id = checkedIDs[ctr1];								var statusSelector = this.args.statusSelector+Id;								oldHtmlArray[ctr1] = jQuery(statusSelector).html();								jQuery(statusSelector).children().html(System.UI.Elements.Loaders["LoaderFBSmallGrey"]);					}					jQuery.ajax({						type: "GET",						url: self.args.controllerPath,		                data: self.args.controllerAction+"&checkedIDs="+checkedIDs+"&status="+self.args.status,						success: function(data){                            var statusSelector = "";                            if(System.trim(data) == "success"){								for(var i=0; i<checkedIDs.length; i++){                                    var Id = checkedIDs[i];                                    statusSelector = self.args.statusSelector+Id;									jQuery(statusSelector).children().html("<div class='UI_table_status_"+self.args.status+"'>"+UITranslations[self.args.status]+"</div>");								}							}else{								var ctr2 = 0;								for(i in CheckedIDs){										    /*ArtId = CheckedIDs[i];											statusSelector = "#ArtTblStatus"+ArtId;*/											jQuery(statusSelector).html(oldHtmlArray[ctr2]);											ctr2++;								}								System.UI.Windows.Msg(data,true);                                								//System.UI.Windows.Msg("<p class='sys-msg-err'>Error!</p>",true);							}						},                        error:function(jqXHR, textStatus, errorThrown){                            System.UI.Windows.Msg(errorThrown,true);						    var ctr2 = 0;								for(i in CheckedIDs){										    /*ArtId = CheckedIDs[i];											statusSelector = "#ArtTblStatus"+ArtId;*/											jQuery(statusSelector).html(oldHtmlArray[ctr2]);											ctr2++;								}                                                } 				     });				 }    }System.UI.Table.prototype.dateTimeEdit = function(argsObj){    TableInstance = this.getSelf();    argsObj.TableInstance = TableInstance;    System.UI.Table.dateTimeEdit(argsObj);}System.UI.Table.dateTimeEdit = function(argsObj){        /*if(System.UI.Table.actionLock){        return false;    }else{        System.UI.Table.actionLock = true;     }*/        var sysDate = new System.Date();         var ID = System.generateID();    var inputID = "CellInput"+ID;    var inputSelector = "#" + inputID;    var saveID = "CellButtonSave"+ID;    var MsgTranslations = new System.Translations({id:"System",container:"Msg"});        var saveSelector = "#" + saveID;    var cancelID = "CellButtonCancel" + ID;    var cancelSelector = "#" + cancelID;            this.args = {        inputHtml:  "<input id='"+inputID+"' type='text' style='font-size:12px;margin-left:5px;margin-right:5px;padding:2px;padding-left:5px;' size='23' />",        saveHtml: "<button id='"+saveID+"' class='DateEditBtnSave' >Save</button>",        cancelHtml: "<button id='"+cancelID+"' class='DateEditBtnCancel' >Cancel</button>",        controllerPath: System.Env.SiteUrl + "controller.php",        controllerAction: "",        tdAction: "",        selectorBtnSave: saveSelector,        selectorBtnCancel: cancelSelector,        type: "datetime",        onSuccess: function(){},        datetimepicker: { 			changeMonth: true,			changeYear: true,			currentText: 'Now',			showButtonPanel: true,			showAnim: 'fadeIn',			duration: 200,			dateFormat: "dd.mm.yy",            separator: " // ",            timeFormat: "hh:mm:ss",            showSecond: false,            stepHour: 1,            stepMinute: 30,            stepSecond: 59        }    }        for(i in argsObj){this.args[i] = argsObj[i];}        this.TableInstance = {};        if(typeof(this.args.TableInstance) != 'undefined'){        this.TableInstance = this.args.TableInstance();    }        this.onSuccess = function(data,value){        self.args.onSuccess.call(this,data,value);             }        this.TableInstance.resetLock = true;        var Id = this.args.id;    var selector = this.args.selector;    var self = this;    var selectorTd = selector;	var selectorDiv = selector+" div";	var selectorInput = selectorTd+" input";    	var selectorBtnSave = selector+" "+this.args.selectorBtnSave;	var selectorBtnCancel = selector+" "+this.args.selectorBtnCancel;	var inputText = jQuery(selectorDiv).text();	var inputHtml = this.args.inputHtml;	var saveHtml = this.args.saveHtml;	var cancelHtml = this.args.cancelHtml;    var tdHtml = "";    var tdHtmlOrig = jQuery(selectorTd).html();	jQuery(selectorTd).html(inputHtml+"<br/>");	jQuery(selectorInput).val(inputText);	jQuery(selectorTd).append(saveHtml);	jQuery(selectorTd).append(cancelHtml);	jQuery(selectorInput).addClass('datepicker'+ID);        /*var displayDate = jQuery(selectorInput).val();      var displayDateObj = Date.split({string:displayDate});*/    	jQuery(selectorBtnSave).click(function(){            self.saveAction();	});        this.cellHtml = function(html){        jQuery(selector).html(html);                }            this.cellDivText = function(text){        jQuery(selector + " div").text(text);            }        this.saveAction = function(){			jQuery(selectorBtnSave).html("<div style='padding:3px;'>"+System.UI.Elements.Loaders["LoaderFBSmallGrey"]+"</div>");			            var dateTimeValue = jQuery(selectorInput).val();                        var parsedDateTime = sysDate.parse({value:dateTimeValue,type:self.args.type});                                        if(parsedDateTime.minutes == 59){                sysDate.set({hours:parsedDateTime.hours,minutes:60,seconds:parsedDateTime.seconds});                var newDate = sysDate.get();                dateTimeValue = newDate.time;            }             				jQuery.ajax({					type: "POST",					url: self.args.controllerPath,	                data: self.args.controllerAction+"&value="+dateTimeValue+"&Id="+Id,					success: function(data){                        //alert(data);                        self.TableInstance.resetLock = false;                         self.onSuccess(data,dateTimeValue);                        if(System.trim(data) == "error_access_denied"){                            self.cellHtml(tdHtmlOrig);                             System.UI.Windows.Msg("<p class='sys-msg-err'>"+MsgTranslations[data]+"</p><p>"+MsgTranslations['text_log_in']+"</p>",true);                        }else if(System.trim(data) == "success"){							 var tdSpanText = dateTimeValue;                                                         self.cellHtml(tdHtmlOrig);                             self.cellDivText(dateTimeValue);						}else{							System.UI.Windows.Msg(data,true);                            //var tdHtml = "<span class='UI_table_edit' " + self.args.tdAction + " >"+tdSpanText+"</span>";                             self.cellHtml(tdHtmlOrig);                             						}					},                    error: function(jqXHR, textStatus, errorThrown){                        System.UI.Windows.Msg("<p class='sys-msg-err'>"+errorThrown+"</p>",true);                        self.cellHtml(tdHtmlOrig);                         self.TableInstance.resetLock = false;                                            }				});        }    	jQuery(selectorBtnCancel).click(function(){        self.cellHtml(tdHtmlOrig);        self.TableInstance.resetLock = false;           	});        if(self.args.type == "datetime"){        jQuery(".datepicker"+ID).datetimepicker(this.args.datetimepicker);     }else if(self.args.type == "date"){        jQuery(".datepicker"+ID).datepicker(this.args.datetimepicker);             }else if(self.args.type == "time"){        jQuery(".datepicker"+ID).timepicker(this.args.datetimepicker);        }}System.UI.Table.cellValueEdit = function(argsObj){    /*if(System.UI.Table.actionLock){        return false;    }else{        System.UI.Table.actionLock = true;     }*/          var self = this;                var MsgTranslations = new System.Translations({id:"System",container:"Msg"});        var ID = System.generateID();        var inputID = "CellInput"+ID;        var inputSelector = "#" + inputID;        var saveID = "CellButtonSave"+ID;        var saveSelector = "#" + saveID;        var cancelID = "CellButtonCancel" + ID;        var cancelSelector = "#" + cancelID;               this.args = {            inputHtml:  "<input id='"+inputID+"' type='text' style='font-size:12px;margin-left:5px;margin-right:5px;padding:2px;padding-left:5px;width:80%' />",            saveHtml: "<button id='"+saveID+"' class='CellEditBtnSave' >Save</button>",            cancelHtml: "<button id='"+cancelID+"' class='CellEditBtnCancel' >Cancel</button>",            controllerPath: System.Env.SiteUrl + "controller.php",            controllerAction: "",            autocomplete: false,            tdAction: "",            selectorBtnSave: saveSelector,            selectorBtnCancel: cancelSelector,            selectorInput: inputSelector        }                for(i in argsObj){this.args[i] = argsObj[i];}                this.TableInstance = {};                if(typeof(this.args.TableInstance) != 'undefined'){            this.TableInstance = this.args.TableInstance();        }                this.TableInstance.resetLock = true;                                  var Id = this.args.id;        var column = this.args.column;        var selector = this.args.selector;        var selectorInput = selector + " "+this.args.selectorInput;            var selectorBtnSave = selector+" "+this.args.selectorBtnSave;        var selectorBtnCancel = selector+" "+this.args.selectorBtnCancel;        var inputText = jQuery(selector).text();        var inputHtml = this.args.inputHtml;        var saveHtml = this.args.saveHtml;        var cancelHtml = this.args.cancelHtml;        var tdHtml = "";        var tdHtmlOrig = jQuery(selector).html();        jQuery(selector).html(inputHtml+"<br/>");        jQuery(selectorInput).val(inputText);        jQuery(selector).append(saveHtml);        jQuery(selector).append(cancelHtml);         if(this.args.autocomplete){            jQuery(selectorInput).autocomplete({source:self.args.autocompleteSource});        }        jQuery(selectorInput).keyup(function(e){            //alert(e.keyCode);            if(e.keyCode == 13) {                    self.saveAction();            }             });                   jQuery(selectorBtnSave).click(function(){                self.saveAction();        });                jQuery(selectorBtnCancel).click(function(){                jQuery(selector).html(tdHtmlOrig);	                self.TableInstance.resetLock = false;        });                  this.cellHtml = function(html){            jQuery(selector).html(html);                 }                this.cellDivText = function(text){            jQuery(selector + " div").text(text);                }                this.saveAction = function(){                jQuery(selectorBtnSave).html("<div style='padding:3px;'>"+System.UI.Elements.Loaders["LoaderFBSmallGrey"]+"</div>");                var cellValue = jQuery(selectorInput).val();                    jQuery.ajax({                        type: "POST",                        url: self.args.controllerPath,                        data: self.args.controllerAction+"&value="+cellValue+"&Id="+Id+"&column="+column,                        success: function(data){                            self.resetLock = false;                            if(System.trim(data) == 'error_access_denied'){                                jQuery(selector).html(tdHtmlOrig);                                                                       System.UI.Windows.Msg("<p class='sys-msg-err'>"+MsgTranslations[data]+"</p><p>"+MsgTranslations['text_log_in']+"</p>",true);                                                        }else if(System.trim(data) == "success"){                                 var tdSpanText = cellValue;                                 //var tdHtml = "<div class='UI_table_edit_cell' " + args.tdAction + " >"+tdSpanText+"</div>";                                 self.cellHtml(tdHtmlOrig);                                 self.cellDivText(tdSpanText);                            }else if(System.trim(data) == "error"){                                System.UI.Windows.Msg("<p class='sys-msg-err'>Error!</p>",true);                                //var tdHtml = "<span class='UI_table_edit' " + args.tdAction + " >"+tdSpanText+"</span>";                                jQuery(selector).html(tdHtmlOrig);                            }else{                                System.UI.Windows.Msg("<p class='sys-msg-err'>"+data+"</p>",true);                                //var tdHtml = "<span class='UI_table_edit' " + args.tdAction + " >"+tdSpanText+"</span>";                                jQuery(selector).html(tdHtmlOrig);                                                       }                        },                        error: function(jqXHR, textStatus, errorThrown){                            System.UI.Windows.Msg("<p class='sys-msg-err'>"+errorThrown+"</p>",true);                            self.cellHtml(tdHtmlOrig);                              self.resetLock = false;                        }                    });            } }System.UI.Table.Paginator = {};System.UI.Table.Paginator.pageNumberClick = function(pagenum,tableObj){        var page;        var ipp;        var paginatorSuffix;        var def_ipp;        var table = System.getVariableByName(tableObj);        if (pagenum === "All"){			page = pagenum;			ipp = pagenum;		}else if(pagenum === "Next"){			page = page + 1;		}else if (pagenum === "Previous"){			page = page - 1;		}else{			page = pagenum;		}        ipp = table.ipp;        def_ipp = table.def_ipp;        table.page = page;		table.paginatorSuffix = "page="+page+"&ipp="+ipp+"&def_ipp="+def_ipp;        table.reset();}System.UI.checkedItemsDelete = function(Selector,UrlAction,ControllerScript,customErrors){				var MsgTranslations = new System.Translations({id:"System",container:"Msg"});				if(typeof(customErrors) === "undefined"){customErrors = false;}				var ctr = 0;				var CheckedIDs = [];				var SelectorFull = Selector+" :checked";				jQuery(SelectorFull).each(function() {					CheckedIDs[ctr] = jQuery(this).val();					ctr++;				});				var progress = new System.UI.Windows.Progress();				jQuery.ajax({					type: "POST",					url: ControllerScript,	                data: UrlAction+"&CheckedIDs="+CheckedIDs,					success: function(data){						progress.destroy();                        if(System.trim(data) == 'error_access_denied'){                               System.UI.Windows.Msg("<p class='sys-msg-err'>"+MsgTranslations[data]+"</p><p>"+MsgTranslations['text_log_in']+"</p>",true);                                                    }else if(data == "ok"){							jQuery(SelectorFull).parents("tr").remove();							//System.UI.Windows.Msg("<p class='sys-msg'>Items deleted!</p>",true);						}else{							if(!customErrors){                                System.UI.Windows.Msg("<p class='sys-msg-err'>Errors while deleting from database!</p><p class='sys-msg'>Please refresh page and try again!</p>",true);							}else{								System.UI.Windows.Msg("<p class='sys-msg-err'>"+data+"</p>",true);							}						}					}			    });}System.UI.checkedItemsExists = function(Selector){                var ctr = 0;				var CheckedIDs = [];                var SelectorFull = Selector+" :checked";                //alert(SelectorFull);                				jQuery(SelectorFull).each(function() {					CheckedIDs[ctr] = jQuery(this).val();                    //alert(SelectorFull);                    //alert(jQuery(this).val());					ctr++;				});				if (CheckedIDs.length < 1){					return false;				}else return CheckedIDs;}System.UI.elementHide = function(buttonsHolderSelector,fadeOutValue){    if(typeof(fadeOutValue) == "undefined"){fadeOutValue = 200;}    jQuery(buttonsHolderSelector).fadeOut(fadeOutValue);}/*System.UI.DataTable = function(selector, argsObj){          var self = this;     this.args = {     }          for(i in argsObj){this.args[i] = argsObj[i];}     this.init = function(){          }                    this.init();}*/System.Date = function(argsObj){        var self = this;    var dateObj = {};    var datetimeObj = {};        this.args = {        separator: " // ",        timeSeparator: ":",        dateSeparator: ".",        leadingZero: true,        autoInit: true    }        for(i in argsObj){this.args[i] = argsObj[i];}            this.leadingZero = function(num){			if (num < 10) num = "0" + num;			return num;    }         this.get = function(){        return datetimeObj;    }            this.setArgs = function(argsObj){        for(i in argsObj){this.args[i] = argsObj[i];}           }        this.set = function(funcArgs){        if(typeof(funcArgs) == "undefined"){            dateObj = new Date();        }else if((typeof(funcArgs) == "string") || typeof(funcArgs) == "number"){            dateObj = new Date(funcArgs);        }else if(typeof(funcArgs == "object")){            dateObj = new Date();                        if(typeof(funcArgs.year) != "undefined"){                dateObj.setFullYear(funcArgs.miliseconds);            }            if(typeof(funcArgs.month) != "undefined"){                dateObj.setMonth(funcArgs.month);            }                     if(typeof(funcArgs.day) != "undefined"){                dateObj.setDate(funcArgs.day);            }                        if(typeof(funcArgs.hours) != "undefined"){                dateObj.setHours(funcArgs.hours);            }               if(typeof(funcArgs.minutes) != "undefined"){                dateObj.setMinutes(funcArgs.minutes);            }                 if(typeof(funcArgs.seconds) != "undefined"){                dateObj.setSeconds(funcArgs.seconds);            }                        if(typeof(funcArgs.miliseconds) != "undefined"){                dateObj.setMiliseconds(funcArgs.miliseconds);            }                             }                datetimeObj.Date = dateObj;        datetimeObj.day = dateObj.getDate();        datetimeObj.month = dateObj.getMonth()+1;        datetimeObj.year = dateObj.getFullYear();        datetimeObj.hours = dateObj.getHours();        datetimeObj.minutes = dateObj.getMinutes();        datetimeObj.seconds = dateObj.getSeconds();                 if(self.args.leadingZero){            datetimeObj.day = self.leadingZero(datetimeObj.day);            datetimeObj.month = self.leadingZero(datetimeObj.month);              datetimeObj.hours = self.leadingZero(datetimeObj.hours);             datetimeObj.minutes = self.leadingZero(datetimeObj.minutes);             datetimeObj.seconds = self.leadingZero(datetimeObj.seconds);                   }                    datetimeObj.hour = datetimeObj.hours;        datetimeObj.minute = datetimeObj.minutes;        datetimeObj.second = datetimeObj.seconds;                datetimeObj.time = datetimeObj.hours + self.args.timeSeparator + datetimeObj.minutes + self.args.timeSeparator + datetimeObj.seconds;        datetimeObj.date = datetimeObj.day + self.args.dateSeparator + datetimeObj.month + self.args.dateSeparator + datetimeObj.year;         datetimeObj.datetime = datetimeObj.date + self.args.separator + datetimeObj.time;                                    }                this.parse = function(funcArgsObj){        var funcArgs = {            value: "",            type: "datetime",            separator : ""        };        for(var i in funcArgsObj){funcArgs[i] = funcArgsObj[i];}        for(var n in self.args){funcArgs[n] = self.args[n];}        var separator = "";        if(funcArgs.separator == ""){separator = self.args.separator;}        var datetimeArray = "";        var returnObj = {};        if(funcArgs.type == "date"){            datetimeArray = funcArgs.value.split(funcArgs.dateSeparator);            returnObj.day = datetimeArray[0];            returnObj.month = datetimeArray[1];            returnObj.year = datetimeArray[2];        }else if(funcArgs.type == "time"){            datetimeArray = funcArgs.value.split(funcArgs.timeSeparator);            returnObj.hours = datetimeArray[0];            returnObj.minutes = datetimeArray[1];            returnObj.seconds = datetimeArray[2];              returnObj.hour = datetimeArray[0];            returnObj.minute = datetimeArray[1];            returnObj.second = datetimeArray[2];                      }else if(funcArgs.type == "datetime"){            datetimeArray = funcArgs.value.split(funcArgs.separator);            alert(funcArgs.string);            dateArray = datetimeArray[0].split(funcArgs.dateSeparator);            timeArray = datetimeArray[1].split(funcArgs.timeSeparator);            returnObj.day = dateArray[0];            returnObj.month = dateArray[1];            returnObj.year = dateArray[2];                             returnObj.hours = timeArray[0];            returnObj.minutes = timeArray[1];            returnObj.seconds = timeArray[2];            returnObj.hour = timeArray[0];            returnObj.minute = timeArray[1];            returnObj.second = timeArray[2];                     }                return returnObj;    }        //this.get = function(){        self.set(this.args.initData);        //}        //this.get();    }System.UI.textOverflow = function(selector,continueChars,autoUpdate){    if(typeof(autoUpdate) == 'undefined'){autoUpdate = true;}    if(typeof(continueChars) == 'undefined'){continueChars = " ...";}        jQuery(selector).text("33");    //jQuery(selector).textOverflow(continueChars,autoUpdate);}System.UI.textClip = function(selector,charNumber,continueChars){    if(typeof(continueChars) == 'undefined'){continueChars = " ...";}     var text = jQuery(selector).text();    var textNew = text.substr(0,charNumber);        if(textNew.length < text.length){        textNew = textNew+continueChars;    }else{        textNew = text;    }    jQuery(selector).text(textNew);}System.Test = function(){    var self = this;    var id = 1;    this.ID = 2;    this.getSelf = function(){        return self;    }}System.Test.prototype.get = function(){    var self = this.getSelf();    alert("self: "+self+" id: "+self.id+" ID: "+self.ID);}System.AjaxUpload = function(selector,ArgsObj){                var self = this;                var Args = {            controllerPath: "controller.php",            onSubmit: function(){},            onComplete: function(){},            onSuccess: function(){},            showProgressWindow: true,            singleUpload: true,            customResponseHandler: false,            name: 'userfile'        }                for(var i in ArgsObj){Args[i] = ArgsObj[i];}        this.onSubmit = function(file, ext){            Args.onSubmit.call(this,file,ext);        }                this.onComplete = function(file,response){            Args.onSubmit.call(this,file,response);        }                this.onSuccess = function(file){            Args.onSuccess.call(this,file);                    }        var ProgressWindows = {};                var button = jQuery(selector), interval;                new AjaxUpload(button,{            action: Args.controllerPath,            name: Args.name,            onSubmit: function(file, ext){                Args.onSubmit(file,ext);                if(Args.showProgressWindow){                    ProgressWindows[file] = new /*System.UI.Window(System.UI.Elements.Loaders["32Red"]);*/System.UI.Windows.Progress();                }                    // If you want to allow uploading only 1 file at time,                    // you can disable upload button                if(Args.singleUpload){                    this.disable();                }             },            onComplete: function(file, response){              Args.onComplete(file,response);              if(Args.showProgressWindow){                ProgressWindows[file].destroy();              }                            if(Args.customResponseHandler == false){                  if (response == ""){                    System.UI.Windows.Msg("<span class='sys-msg'><p>General upload error:</p></span></br><p class='sys-msg-err'>Probably internal MaxFileSize limit! </p>",true);                  }else if (response != "success"){                    if(Args.showProgressWindow){                        ProgressWindows[file].destroy();                    }                    var errorsCheck = response.split(":");                    if(errorsCheck[0] == 'errors'){                        var errorsArray = errorsCheck[1].split(";");                        var errors = '';                                                for(var i = 0; i < errorsArray.length; i++){                            errors += errorsArray[i] + '<br/>';                        }                        System.UI.Windows.Msg("<span class='sys-msg'><p>Upload errors:</p></span><p class='sys-msg-err'>"+errors+"</p>",true);                    }else{                        System.UI.Windows.Msg("<p class='sys-msg'>"+response+"</p>",true);                                        }                  }else if(response == "success"){                        Args.onSuccess(file);                  }              }              this.enable();            }        });}
