function PageBase() {

    this.Clipboard = null;
    this.LibraryHost = '';

    this._arr_div_window = new Array();
    this._arr_action_list = new Array();
    this._dic_action = new Object();
    this._interval_action_list = null;
    
    this.CallbackFunc = null;
    
    this.ant_obj1 = null;
    
    this.expand_ant_sel = new Object();
    
    this._arr_expression  = new Object();
    this._arr_expression_count = 0;
    
    this._int_sync1 = null;
    this._count_sync1 = 0;
    this._check_sync1 = new Object();
    
    //this._ActionRefRender = false;
    
    this.NewSync = new Array();
    
    this.SyncServerTime = false;
    
    this.Testing = null;
    this._AntTimeExp = null;
    
    this.DoRenderCompleto = true;
    
	this._arr_callback = new Array();
	this._arr_callback_start = 0;
	this._arr_callback_count = 0;

    this.CallbackFuncSync = function(aObjParam, aRetFunc, aUrl) {
		this._arr_callback[this._arr_callback_count] = new PageCallbackAction(aObjParam, aRetFunc, aUrl, this._arr_callback_count);
		this._arr_callback[this._arr_callback_count].DoAction(false);
		this._arr_callback_count++;
    }

    window.ValidatorGetValue = function(aId) {
        var lcontrol;
        lcontol = document.getElementById(aId);
        if(lcontrol && typeof(lcontrol.value) == 'string') {
            return lcontrol.value;
        } else if(window[aId+'_obj'] && window[aId+'_obj'].get_Text) {
            return window[aId+'_obj'].get_Text();
        }
        
        return window.ValidatorGetValueRecursive(lcontrol);
    }
    
    window.ValidatorOnChange = function(event) {
        if (!event) {
            event = window.event;
        }
        Page_InvalidControlToBeFocused = null;
        var targetedControl;
        if ((typeof(event.srcElement) != "undefined") && (event.srcElement != null)) {
            targetedControl = event.srcElement;
        }
        else {
            targetedControl = event.target;
        }
        var vals;
        if (typeof(targetedControl.Validators) != "undefined") {
            vals = targetedControl.Validators;
        }
        else {
            if (targetedControl.tagName.toLowerCase() == "label") {
                targetedControl = document.getElementById(targetedControl.htmlFor);
                vals = targetedControl.Validators;
            }
        }
        if(vals) {
            var i;
            for (i = 0; i < vals.length; i++) {
                ValidatorValidate(vals[i], null, event);
            }
            ValidatorUpdateIsValid();
        }
    }
    
    //document.write('<textarea>' + window.ValidatedTextBoxOnKeyPress + '</textarea>');
    /*for(att in window)
        if(att.indexOf('Key') != -1)
            alert(att + ' -> ' + window[att]);*/
        
    this.BeforeHandleCallback = function(aObjParam) {
    }
    
    this.HandleCallbackSync = function(aResp) {
        if(aResp !== false) {
            eval(aResp);
        }
        setTimeout('Page_obj.DoCallbackNewSync();',1700);
    }
    
    this.HandleCallbackCustomProc = function(aResp) {
        if(aResp !== false) {
            eval(aResp);
        }
    }

    this.HandleCallbackGetServerTime = function(aResp) {
        if(aResp !== false) {
            Page_obj.gblTime = (new Date()).getTime();
            eval(aResp);
        }
    }

    this.HandleCallback = function(aResp,aContext) {
        //alert(aResp);
        var lreg = new RegExp("<script id='proper'> (.*) </script>","m"); 
        var lscript = aResp.match(lreg);
        if(lscript && lscript[1])
            aResp = aResp.replace(lscript[0],'');
        if(lscript && lscript[1] != null) {
            var lnewdiv = document.createElement('div');
            var lscript_find = '';
            lnewdiv.innerHTML = aResp;
            var lnode = lnewdiv.firstChild;
            while(lnode != null)
            {
                var lnext = lnode.nextSibling;
                if(lnode.tagName != 'SCRIPT')
                {
                    var lid = lnode.id;
                    var lid_ref = document.getElementById(lid);
                    var lparent = lid_ref.parentNode;
                    var lhide = lid_ref.style.display;
                    lparent.replaceChild(lnode,lid_ref);
                    lid_ref = document.getElementById(lid);
                    if(lhide == 'none')
                        lid_ref.style.display = lhide;
                }
                else
            	    lscript_find += lnode.text;
        	    lnode = lnext;
            }
            //alert(lscript[1]);
            setTimeout((lscript&&lscript.length>0?lscript[1]:'') + lscript_find + 'Page_obj.ProcIntervalActionList();Page_obj.ProcessWindowAfterCallback();',3);
        } else if(Page_obj.ant_obj1 != null && aResp != '') {
            setTimeout('Page_obj.DoCallback(Page_obj.ant_obj1,Page_obj.ant_obj2,Page_obj.ant_obj3,Page_obj.ant_obj4);',50);
        }
    }
    
    this.ProcessWindowAfterCallback = function() {
        if(Page_obj._arr_div_window && Page_obj._arr_div_window.length > 0) {
        	var lid_win = Page_obj._arr_div_window[Page_obj._arr_div_window.length-1]; 
        	eval(lid_win+'_obj._ant_element=null;');
        	for(var i = 0; i < Page_obj._arr_div_window.length; i++) {
        	    lid_win = Page_obj._arr_div_window[i];
        	    var lref = document.getElementById(lid_win);
        	    if(lref && Browser_obj.is_Msie()) 
        	        Util_obj.HideSelect(lref);
        	}
        }
        if(typeof(ValidaHeight) != 'undefined')
            ValidaHeight();
    }
    
    this.HandleCallbackError = function(aParam) {
        //alert(aParam);
        /*var larr = aParam.split('0|');
        if(larr.length > 0)
            alert(larr[0]);*/
    }
    
    this.DoCallback = function(aControlRef,aParam,aCommand,aRender) {  
        //alert('Paso1 ' + this._arr_expression_count);
        if(this._arr_expression_count > 0) {
            this.ProcIntervalExpression(0);
        }
        //alert('Paso2');
        
        if(!(typeof(aControlRef) == 'object' && aControlRef.length > 0))
            aControlRef = [aControlRef];
        var lgroups = new Object();
        var lMyArr = new Array();
        
        var lobj = new Object();
        lobj.Command = aCommand;
        lobj.Render = aRender;
        lobj.ControlId = new Array();
        lCommandCtrl = aCommand.replace('NewCtrl__', '');
        for(var i = 0; i < aControlRef.length; i++) {
            aControlRef[i]._mytimeout = null;
            lobj.ControlId[lobj.ControlId.length] = aControlRef[i].UniqueId;
            if(aControlRef[i].PreRender && aRender)
                aControlRef[i].PreRender();
            if(aCommand.substr(0,9) != 'NewCtrl__') {
                var larr = aControlRef[i].RenderGroup.split(',');
                for(var j = 0; j < larr.length; j++)
                    lgroups[larr[j]] = 1;
            } else {
                lMyArr[lMyArr.length] = aControlRef[i];
                if(window[lCommandCtrl + '_obj'])
                    lMyArr = window[lCommandCtrl + '_obj'].get_ToArrayList(lMyArr);
                lgroups['NoGroup'] = lMyArr;
            }
        }
        //alert('Paso3');
        //alert(lgroups['NoGroup']);
        var lcount = 0;
        lobj.Cts = new Object();
        for(var att in lgroups) {
            var llist = att == 'NoGroup' ? lgroups[att] : this['Group' + att];
            if(llist && llist.length)
                for(var grp = 0; grp < llist.length + aControlRef.length; grp++) {
                    var lref = grp < llist.length ? llist[grp] : aControlRef[grp - llist.length];
                    if(lref.ClientId && document.getElementById(lref.ClientId) != null && !lobj.Cts[lref.UniqueId]) {
                        if(lref.ProcessBridge) {
                            if(!aParam)
                                aParam = new Object();
                            if(!aParam[lref.ClientId])
                                aParam[lref.ClientId] = new Object();
                            lref.ProcessBridge(aParam[lref.ClientId]);
                        }
                        var lCalcObj = new Object();
                        if(window[lref.ClientId+'_obj'].CdtID && window[lref.ClientId+'_obj'].CdtID != '') {
                            var lcdt = window[window[lref.ClientId+'_obj'].CdtID + '_obj'];
                            lcdt.set_RowData(window[lref.ClientId+'_obj'].CdtKey, window[lref.ClientId+'_obj'].CdtCol, window[lref.ClientId+'_obj'].get_Text());
                        }
                        /*if(lref.Cts && lref.Cts.length) {
                            for(var i = 0; i < lref.Cts.length; i++) {
                                lCalcObj[lref.Cts[i]] = lref['get_' + lref.Cts[i]](); // eval(lref.ClientId+'_obj.get_'+lref.Cts[i]+'();');
                            }
                        }*/
                        if(lref.get_Frm && Designer_obj) {
                            lCalcObj['Frm'] = lref.get_Frm();
                        }
                        var lIdent = lref.get_Ident();
                        if(lIdent && lIdent.length > 0 && Designer_obj) {
                            lCalcObj['Ident'] = lIdent;
                        }
                        if(lref.ClientToServer) {
                            lref.ClientToServer(lCalcObj);
                        }

                        for(var lAtt in lCalcObj) {
                            lobj.Cts[lref.UniqueId] = lCalcObj;
                            break;
                        }
                        lcount++;
                    }
                }
        }
        //alert(lcount);
        //alert(aParam);
        if(aParam && typeof(aParam) == "object") {
            for(lclientid in aParam) {
                var lref = window[lclientid+'_obj'];
                if(typeof(aParam[lclientid]) == "object" && ((lref && lref.UniqueId && document.getElementById(lref.ClientId) != null) || aParam[lclientid].ControlsToGetValue))
                    for(att in aParam[lclientid]) {
                        if(att == 'ControlsToGetValue') {
                            var lstr = aParam[lclientid][att];
                            if(lstr && lstr != '')
                            {
                                var larr = lstr.split(',');
                                for(var i = 0; i < larr.length; i++) {
                                    var lctrl = eval(larr[i]+'_obj;');
                                    if(lctrl) {
                                        lobj.Cts[lctrl.UniqueId] = new Object();
                                        for(var j = 0; j < lctrl.Cts.length; j++)
                                            lobj.Cts[lctrl.UniqueId][lctrl.Cts[j]] = eval(larr[i]+'_obj.get_'+lctrl.Cts[j]+'();');
                                    }
                                }
                            }
                        } else if(lobj.Cts[lref.UniqueId])
                            lobj.Cts[lref.UniqueId][att] = aParam[lclientid][att];
                    }
            }
        }
        //alert(this.Serialize(lobj));
        this.ant_obj1 = aControlRef;
        this.ant_obj2 = aParam;
        this.ant_obj3 = aCommand;
        this.ant_obj4 = aRender;
        this.CallbackFunc(lobj);
    }
    
    this.DoCallbackCustomProc = function(aDataSource, aField1, aField2, aField3, aField4, aField5, aField6, aField7, aField8, aExpVal1, aExpVal2, aExpVal3, aAction, aKeyValue, aSqlProc, aForm, aAfterKey, aAfterFieldSta, aAfterFieldDate, aAfterStaValue, aClientId) {
        var lData = aDataSource; //0
        lData += ':,:' + aField1; //1
        lData += ':,:' + aField2; //2
        lData += ':,:' + aField3; //3
        lData += ':,:' + aField4; //4
        lData += ':,:' + aField5; //5
        lData += ':,:' + aField6; //6
        lData += ':,:' + aField7; //7
        lData += ':,:' + aField8; //8
        lData += ':,:' + aExpVal1; //9
        lData += ':,:' + aExpVal2; //10
        lData += ':,:' + aExpVal3; //11
        lData += ':,:' + aAction; //12
        lData += ':,:' + aKeyValue; //13
        lData += ':,:' + aSqlProc; //14
        lData += ':,:' + aForm; //15
        lData += ':,:' + aAfterKey; //16
        lData += ':,:' + aAfterFieldSta; //17
        lData += ':,:' + aAfterFieldDate; //18
        lData += ':,:' + aAfterStaValue; //19
        lData += ':,:' + aClientId; //20
        
        this.CallbackFuncSync(lData, this.HandleCallbackCustomProc, '/ProcessCustomProc.aspx');
    }
    
    this.DoCallbackGetTime = function() 
    {
        this.CallbackFuncSync('Time', this.HandleCallbackGetServerTime, '/ProcessGetServerTime.aspx');
        Page_obj.gblFirstTime = new Date().getTime();
    }
    
    this.DoCallbackNewSync = function()
    {
        var lArr = this._int_sync1.get_DataKeys();
        var lKeys1 = '';
        for(var i = 0; i < lArr.length; i++)
        {
            if(this._check_sync1['Key' + lArr[i]] == 1) {
                lKeys1 += (lKeys1 == '' ? '' : ',') + lArr[i];
            }
        }
        this._count_sync1++;
        if(lKeys1.length > 0) {
            this.CallbackFuncSync(this._int_sync1.ClientId + ':,:' + this._int_sync1.get_SyncFields() + ':,:' + lKeys1, this.HandleCallbackSync, '/ProcessSync.aspx');
        } else
            setTimeout('Page_obj.DoCallbackNewSync();',1700);
    }

    this.Render = function(aControlRef,aParam,aCommand) {
        if(!aCommand)
            aCommand = '';
        this.DoCallback(aControlRef,aParam,aCommand,true);
    }
    
    this.AddActionHidden = function(aCtrl) {
        /*this._arr_action_list[this._arr_action_list.length] = aCtrl;
        this._dic_action[aCtrl.get_Ident()] = aCtrl;
        if(this._arr_action_list.length == 1) {
            this._interval_action_list = setInterval('Page_obj.ProcIntervalActionList()',600);
        }*/
    }
    
    this.ProcIntervalActionList = function() {
        /*if(this._arr_action_list)
            for(var i = 0; i < this._arr_action_list.length; i++) {
                if(this._arr_action_list[i].OnUpdateStatus != null) {
                    var lstatus = this._arr_action_list[i].OnUpdateStatus();
                    if(lstatus != null) {
                        this._arr_action_list[i].ChangeStatus(lstatus);
                    }
                }
            }*/
    }
    
    this.AddExpression = function(aId) {
        this._arr_expression[aId] = 1;
        this._arr_expression_count += 1;
        if(window[aId + '_obj'] && window[aId + '_obj'].get_Type() == '3' && !Page_obj.SyncServerTime) {
            var lDifTime = 1000 - (new Date()).getMilliseconds();
            setTimeout('Page_obj.DoCallbackGetTime()',lDifTime);
            Page_obj.SyncServerTime = true;
            /*if(Page_obj._int_sync1 != null)
                Page_obj._int_sync1.Render();*/
        }
        if(this._arr_expression_count == 1) {
            //setTimeout('Page_obj.ProcIntervalExpression(0)',100);
            var lDif = 1000 - (new Date()).getMilliseconds() + 1000;
            setTimeout('Page_obj.ProcIntervalExpression(1)',lDif);
        }
    }
    
    this.ProcIntervalExpression = function(aInterval) {
        //var lCount = 0;
        var lNow = (new Date()).getTime();
        this.DoRenderCompleto = true;
        for(att in this._arr_expression) {
            if(this._arr_expression[att] == 1) {
                var lRef = document.getElementById(att);
                if(lRef) {
                    window[lRef.id + '_obj'].Calculate(aInterval);
                } /*else {
                    this._arr_expression[att] = 0;
                }*/
            }
        }
        if(aInterval) {
            var lDifExec = (new Date()).getTime() - lNow;
            lDif = 998 - lDifExec;
            //Page_obj._AntTimeExp = (new Date()).getTime();
            setTimeout('Page_obj.ProcIntervalExpression(1)',lDif);
        }
    }
    
    this.AddSync1 = function(aList) {
        if(this._int_sync1 == null) {
            this._int_sync1 = aList;
            //this._int_sync1_obj = 
            setTimeout('Page_obj.DoCallbackNewSync();',1700);
            setTimeout('Page_obj.DoRenderCompletoFunc()', 240000);
        }
    }
    
    this.DoRenderCompletoFunc = function() {
        if(Page_obj.DoRenderCompleto) {
            if(Page_obj._int_sync1 != null)
                Page_obj._int_sync1.Render();
            setTimeout('Page_obj.DoRenderCompletoFunc()', 240000);
        } else
            setTimeout('Page_obj.DoRenderCompletoFunc()',15000);
    }
    
	this.FocusNext = function(aElem) {
        var lref_form = document.forms[0];
        var larr = lref_form.elements;
        var lfind = typeof(aElem) == 'undefined' || aElem == null ? 1 : 0;
        for(var lind = 0;lind < larr.length; lind++) 
        {
            var lproc_elem = larr[lind];
            if(larr[lind].getAttribute('enter_focus'))
            {
                var ltmp_elem = document.getElementById(larr[lind].getAttribute('enter_focus'));
                if(ltmp_elem)
                    lproc_elem = ltmp_elem;
            }
	        if(lfind && lproc_elem.tabIndex != '-2' && lproc_elem.tabIndex != '-1' && !lproc_elem.disabled && !lproc_elem.readOnly && ((lproc_elem.tagName == 'INPUT' && lproc_elem.type != 'hidden') || lproc_elem.tagName == 'SELECT' || lproc_elem.tagName == 'BUTTON' || lproc_elem.tagName == 'TEXTAREA'))
	        {
	            try{document.selection.empty();}catch(e){}
		        try{
			        lproc_elem.focus();
		        }catch(e){
			        aElem.focus();
			        if(aElem.select)
				        aElem.select();
				    return true;
		        }
		        if(lproc_elem.select)
			        lproc_elem.select();
			    return true;
	        }
	        if(lproc_elem == aElem) lfind = 1;
        }
        return false;
	}

	this.ProcessEnter = function(aEvt,aBtn) {
	    aEvt = (aEvt) ? aEvt : ((window.event) ? event : null);
	    if (aEvt) {
	        var elem = (aEvt.target) ? aEvt.target : ((aEvt.srcElement) ? aEvt.srcElement : null);
	        var charCode = (aEvt.charCode) ? aEvt.charCode : ((aEvt.which) ? aEvt.which : aEvt.keyCode);
	        if(elem && charCode && charCode == 13 && ((elem.tagName == 'INPUT' && elem.type != 'image' && elem.type != 'button') || elem.tagName == 'SELECT'))
		    {
		        var lres = false;
		        if(aBtn != "") {
		            var lref = document.getElementById(aBtn);
		            if(lref) {
		                lref.click();
		                lres = true;
		            }
		        } else
		    	    lres = Page_obj.FocusNext(elem);
		    	if(lres) {
		    	    Util_obj.StopEvent(aEvt);
			        return false;						
		    	}
		    }
	    }
		return true;
	}
	
	this.GoUrl = function(aUrl) {
	    location.href = aUrl;
	}

	this.Serialize = function(aData) {
		if (aData == null) {
			return 'N;';
		}
		var type = typeof(aData);
		var code = '';
		var iterator = 0;
		var length = null;
		var key = null;
		if (type == 'boolean') {
			code += 'b:' + (aData ? 1 : 0) + ';';
		} else if (type == 'number') {
			if (Math.round(aData) == aData) {
				code += 'i:' + aData + ';';
			} else {
				code += 'd:' + aData + ';';
			}
		} else if (type == 'string') {
		    aData = aData.replace(/(\r\n)|\n|\r|"/g, function(aText){ return aText == '\r\n' ? '\\r\\n' : (aText == '\n' ? '\\n' : (aText == '\r' ? '\\r' : '\\"'))});
			code += 's:"' + aData + '";';
	    } else if (type == 'object' && aData.getDate) {
	        code += 't:' + aData.getFullYear() + '-' + (aData.getMonth()+1) + '-' + aData.getDate() + 'T' + aData.getHours() + ':' + aData.getMinutes() + ':' + aData.getSeconds() + ';';
		} else if (type == 'object') {
			length = 0;
			if ((typeof(aData.length) == 'number') && (((aData.length > 0) && (typeof(aData[0]) != 'undefined')) || aData.length == 0)) {
				for (iterator = 0; iterator < aData.length; iterator ++) {
					if (typeof(aData[iterator]) != 'function') {
						code += this.Serialize(aData[iterator]);
					}
				}
    			code = 'a:{' + code + '}';
			} else {
				for (key in aData) {
					if (typeof(aData[key]) != 'function') {
						if (/^[0-9]+$/.test(key)) {
							code += this.Serialize(parseInt(key));
						} else {
							code += this.Serialize(key);
						}
						code += this.Serialize(aData[key]);
					}
				}
    			code = 'h:{' + code + '}';
			}
		} else {
			code = 'N;'
		}
		return code;
	}
	
	this.ExecAction = function(aRef, aAttr, aEffect) {
	   var lCtrlAct = aRef.getAttribute(aAttr);
	   var lRef = window[lCtrlAct + '_obj'];
	   if(lRef && lRef.Execute)
	        lRef.Execute(aRef, aEffect);
	}
	
	this.set_FontColor = function(aRef, aColor) {
        var lref = aRef;
        if(lref.style)
            lref.style.color = aColor;
        var lChild = lref.firstChild;
        while(lChild != null) {
            if(lChild.style)
                Page_obj.set_FontColor(lChild, aColor);
            lChild = lChild.nextSibling;
        }
	}
	
	this.get_XmlHttp = function() {
		var xmlHttp = null;
		try {
			xmlHttp = new XMLHttpRequest();
		} catch (e) {
			var progIds = ['MSXML2.XMLHTTP', 'Microsoft.XMLHTTP', 'MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0'];
			var success = false;
			for (var iterator = 0; (iterator < progIds.length) && ( ! success); iterator ++) {
				try {
					xmlHttp = new ActiveXObject(progIds[iterator]);
					success = true;
				} catch (e) {}
			}
			if ( ! success ) {
				return null;
			}
		}
		return xmlHttp;
	}
}

function PageCallbackAction(aObjParam, aCallbackFunc, aUrl, aIndex) {

	this.CallSuspender = function() {
		return {
			Suspend	: function() {
				this.Suspended = true;
			},
			Suspended	:	false
		}
	}

	this.CallResult = true;
	this.CallbackFunc = aCallbackFunc;
	this.Index = aIndex;
	this.XmlHttp = Page_obj.get_XmlHttp();
	this.Param_obj = aObjParam;
	this.Executed = false;

	this.RequestCompleted = function() {
		if (typeof(this.CallResult) == 'object') {
			if(this.CallResult.Suspended) {
				return false;
			}
		}
		if (this.XmlHttp.status != 200) {
			//throw {code:this.XmlHttp.status,message:this.XmlHttp.statusText};
			return false;
		} else {
			if (this.XmlHttp.responseText == null) {
				//throw {code:this.XmlHttp.status,message:'Empty response'};
				return false; 
			}
			return this.XmlHttp.responseText;
		}
		return false;
	}

	this.CallbackStateChange = function() {
		for(var i = Page_obj._arr_callback_start; i < Page_obj._arr_callback.length; i++) {
			var ref = Page_obj._arr_callback[i];
			if (ref != null && !ref.Executed && ref.XmlHttp.readyState == 4) {
				ref.Executed = true;
				ref.CallbackFunc(ref.RequestCompleted());
				Page_obj._arr_callback[i] = null;
				if(i == Page_obj._arr_callback_start)
					Page_obj._arr_callback_start++;
				else {
					while(Page_obj._arr_callback[Page_obj._arr_callback_start] == null && Page_obj._arr_callback_start < Page_obj._arr_callback.length) 
						Page_obj._arr_callback_start++;
				}
			}
		}
	}
	
	this.Url = aUrl ? aUrl : '/ProcessSync.aspx';
	
	this.DoAction = function(aSync) {
		if(!aSync) {
			this.XmlHttp.open('GET', this.Url + '?Key=' + Key_obj.get_Text() + '&Data=' + this.Param_obj + '&Now=' + (new Date()).getTime(), true);
		} else {
			this.XmlHttp.open('GET', this.Url + '?Key=' + Key_obj.get_Text() + '&Data=' + this.Param_obj + '&Now=' + (new Date()).getTime(), false);
		}
		var requestbody = ''; //Page_obj.Serialize(this.Param_obj);
		try {
			//this.XmlHttp.setRequestHeader('Content-Length', requestbody.length); 
			this.XmlHttp.setRequestHeader('Content-Type', 'text/plain; charset=UTF-8');
			this.XmlHttp.setRequestHeader('Accept-Charset', 'UTF-8');
		} catch(e) {}
		if(!aSync) {
			this.XmlHttp.onreadystatechange = this.CallbackStateChange;
		}
		this.XmlHttp.send(requestbody); 
		if(aSync) {
			this.CallbackFunc(this.RequestCompleted());
			Page_obj._arr_callback[this.Index] = null;
			if(this.Index == Page_obj._arr_callback_start)
				Page_obj._arr_callback_start++;
			else {
				while(Page_obj._arr_callback[Page_obj._arr_callback_start] == null && Page_obj._arr_callback_start < Page_obj._arr_callback.length) 
					Page_obj._arr_callback_start++;
			}
		} else {
			this.CallResult = new this.CallSuspender();
			return this.CallResult;
		}
	}
}

function Browser() {
	
	this._msie = null;
	this.is_Msie = function() {
		if(this._msie == null)
			this._msie = /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
		return this._msie;
	}
	
	this._msie5 = null;
	this.is_Msie5 = function() {
		if(this._msie5 == null)
			this._msie5 = this.is_Msie() && /msie 5\.0/i.test(navigator.userAgent);
		return this._msie5;
	}
	
	this._msie8 = null;
	this.is_Msie8 = function() {
		if(this._msie8 == null)
			this._msie8 = this.is_Msie() && /msie 8\.0/i.test(navigator.userAgent);
		return this._msie8;
	}

	this._opera = null;
	this.is_Opera = function() {
		if(this._opera == null)
			this._opera = /opera/i.test(navigator.userAgent);
		return this._opera;
	}
	
	this._safari = null;
	this.is_Safari = function() {
		if(this._safari == null)
			this._safari = /safari/i.test(navigator.userAgent);
		return this._safari;
	}

	this._firefox = null;
	this.is_Firefox = function() {
		if(this._firefox == null)
			this._firefox = /firefox/i.test(navigator.userAgent);
		return this._firefox;
	}

	this._khtml = null;
	this.is_Khtml = function() {
		if(this._khtml == null)
			this._khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
		return this._khtml;
	}
}
var Browser_obj = new Browser();

String.prototype.verify_name = function (aName) {
	return /[^A-Za-z0-9]/.test(aName);
}

String.prototype.ltrim = function () {
	return this.replace( /^\s*/, "" );
}

String.prototype.rtrim = function () {
	return this.replace( /\s*$/, "" );
}
	
String.prototype.trim =	function () {
	return this.rtrim().ltrim();
}

Date.stand_format = new Object();
Date.stand_format.s = '%Y-%m-%dT%H:%M:%S';

Date.parseDate = function(str, fmt) {
    if(this.stand_format[fmt])
        fmt = this.stand_format[fmt];
	var today = new Date();
	var y = 0;
	var m = -1;
	var d = 0;
	var a = str.split(/\W|T+/);
	var b = fmt.match(/%./g);
	var i = 0, j = 0;
	var hr = 0;
	var min = 0;
	var sec = 0;
	var hr_paso = false;
	var ampm_paso = false;
	var is_int = false;
	for (i = 0; i < b.length; ++i) {
		if (!a[i])
			continue;
		if(hr_paso && !ampm_paso) {
			if(/pm|p/i.test(a[i])) {
				if(!(hr >= 1 && hr <= 12))
					return null;
				if(hr < 12) hr += 12;
				a[i] = a[i].replace(/pm|p/i,'');
				ampm_paso = true;
			} else if(/am|a/i.test(a[i])) {
				if(!(hr >= 1 && hr <= 12))
					return null;
				if(hr >= 12) hr -= 12;
				a[i] = a[i].replace(/am|a/i,'');
				ampm_paso = true;
			}
		}
		is_int = /^\d+$/.test(a[i]);
		switch (b[i]) {
		    case "%d":
		    case "%e":
				d = is_int ? parseInt(a[i], 10) : Number.NaN;
			break;
		    case "%m":
				m = is_int ? parseInt(a[i], 10) - 1 : Number.NaN;
			break;
		    case "%Y":
		    case "%y":
				y = is_int ? parseInt(a[i], 10) : Number.NaN;
				!isNaN(y) && (y < 100) && (y += (y > 29) ? 1900 : 2000);
			break;
		    case "%H":
		    case "%I":
		    case "%k":
		    case "%l":
				hr = is_int ? parseInt(a[i], 10) : Number.NaN;
				hr_paso = true;
			break;
		    case "%P":
		    case "%p":
		    	if(!isNaN(hr) && hr_paso && !ampm_paso) {
					if(!(hr >= 1 && hr <= 12))
						return null;
					if (/pm/i.test(a[i]) && hr < 12)
						hr += 12;
					else if (/am/i.test(a[i]) && hr >= 12)
						hr -= 12;
					ampm_paso = true;
				}
			break;
		    case "%M":
				min = is_int ? parseInt(a[i], 10) : Number.NaN;
			break;
		    case "%S":
				sec = is_int ? parseInt(a[i], 10) : Number.NaN;
			break;
		}
	}
	if(isNaN(y) || isNaN(m) || isNaN(d) || isNaN(hr) || isNaN(min) || isNaN(sec))
		return null;
	if (y != 0 && m != -1 && d != 0) {
		var ret = new Date(y, m, d, hr, min, sec);
		return ret.getFullYear() == y && ret.getMonth() == m && ret.getDate() == d && ret.getHours() == hr && ret.getMinutes() == min && ret.getSeconds() == sec ? ret : null;
	}
	y = 0; m = -1; d = 0;
	hr_paso = false; ampm_paso = false;
	var min_paso = false;
	var sec_paso = false;
	var val_act = 0;
	for (i = 0; i < a.length; ++i) {
		if(hr_paso && !ampm_paso) {
			if(/pm|p/i.test(a[i])) {
				if(!(hr >= 1 && hr <= 12))
					return null;
				if(hr < 12) hr += 12;
				a[i] = a[i].replace(/pm|p/i,'');
				ampm_paso = true;
			} else if(/am|a/i.test(a[i])) {
				if(!(hr >= 1 && hr <= 12))
					return null;
				if(hr >= 12) hr -= 12;
				a[i] = a[i].replace(/am|a/i,'');
				ampm_paso = true;
			}
		}
		is_int = /^\d+$/.test(a[i]);
		val_act = parseInt(a[i], 10);
        if (is_int && val_act <= 12 && m == -1) {
			m = val_act-1;
		} else if (is_int && val_act > 31 && y == 0) {
			y = val_act;
			(y < 100) && (y += (y > 29) ? 1900 : 2000);
		} else if (is_int && d == 0) {
			d = val_act;
		} else if (is_int && d != 0 && m == 0) {
			m = val_act;
		} else if (is_int && m != 0 && y == 0) {
			y = val_act;
			(y < 100) && (y += (y > 29) ? 1900 : 2000);
		} else if (is_int && m != 0 && d != 0 && !hr_paso) {
			hr = val_act;
			hr_paso = true;
		} else if (is_int && m != 0 && d != 0 && !min_paso) {
			min = val_act;
			min_paso = true;
		} else if (is_int && m != 0 && d != 0 && !sec_paso) {
			sec = val_act;
			sec_paso = true;
		}
	}
	if (y == 0)
		y = today.getFullYear();
	if (m != -1 && d != 0) {
		var ret = new Date(y, m, d, hr, min, sec);
		return ret.getFullYear() == y && ret.getMonth() == m && ret.getDate() == d && ret.getHours() == hr && ret.getMinutes() == min && ret.getSeconds() == sec ? ret : null;
	}
	return null;
}

function Util() {

	this._select = new Object();

	this.get_ElementPosition = function(aElem, aParent) {
		var offsetTrail = aElem;
		var offsetLeft = 0;
		var offsetTop = 0;
		while (offsetTrail && offsetTrail != aParent) 
		{
			offsetLeft += offsetTrail.offsetLeft;
			offsetTop += offsetTrail.offsetTop;
			offsetTrail = offsetTrail.offsetParent;
		}
		if (navigator.userAgent.indexOf('Mac') != -1 && 
			typeof document.body.leftMargin != 'undefined') 
		{
			offsetLeft += document.body.leftMargin;
			offsetTop += document.body.topMargin;
		}
		return {left:offsetLeft, top:offsetTop};
	}
	
    this.get_MousePosition = function(aEvent) {
        aEvent = this.get_Event(aEvent);
        var coords = {left:0, top:0};
        if(aEvent)
        {
            if (aEvent.pageX) {
                coords.left = aEvent.pageX;
                coords.top = aEvent.pageY;
            } else if (aEvent.clientX) {
                coords.left = 
                    aEvent.clientX + document.body.scrollLeft - document.body.clientLeft;
                coords.top = 
                    aEvent.clientY + document.body.scrollTop - document.body.clientTop;
                if (document.body.parentElement && document.body.parentElement.clientLeft) {
                    var bodParent = document.body.parentElement;
                    coords.left += bodParent.scrollLeft - bodParent.clientLeft;
                    coords.top += bodParent.scrollTop - bodParent.clientTop;
                }
            }
        }
        return coords;
    }

	this.get_Event = function(aEvent) {
		return aEvent ? aEvent : (window.event ? event : null);
	}
	
	this.get_EventElement = function(aEvent) {
	    if(!aEvent)
	        aEvent = this.get_Event(aEvent);
        return(aEvent.target) ? aEvent.target : 
          ((aEvent.srcElement) ? aEvent.srcElement : null);
	}
	
	this.StopEvent = function(aEvent) {
		if(this.get_Event(aEvent)) {
			if (Browser_obj.is_Msie()) {
				aEvent.cancelBubble = true;
				aEvent.returnValue = false;
			} else {
				aEvent.preventDefault();
				aEvent.stopPropagation();
			}
		}
	}
	
	this.AddEvent = function(aRef, aEventName, aFunc) {
		if(aRef) {
			if (Browser_obj.is_Msie()) {
				aRef.attachEvent('on' + aEventName, aFunc);
			} else {
				aRef.addEventListener(aEventName, aFunc, true);
			}
		}
	}
    
	this.RemoveEvent = function(aRef, aEventName, aFunc) {
		if(aRef) {
			if (Browser_obj.is_Msie()) {
				aRef.detachEvent('on' + aEventName, aFunc);
			} else {
				aRef.removeEventListener(aEventName, aFunc, true);
			}
		}
	}
	
	this.get_DivParent = function(aElement,aId) {
	    while(aElement != null && ((!aId && aElement.getAttribute('mydiv_id') == null) || (aId && aElement.getAttribute('mydiv_id') != aId)))
	        aElement = aElement.offsetParent;
	    return aElement;
	}
	
	this.is_ElementVisible = function(aElement) {
		while(aElement != null && aElement.style.visibility != 'hidden' && aElement.style.display != 'none')
			aElement = aElement.offsetParent;
		return aElement == null;
	}
	
	this.HideSelect = function(aRefDiv) {
		if(!this._select[aRefDiv.id]) {
			var lArr = document.getElementsByTagName('SELECT');
			var lParent = null;
			lDivPos = this.get_ElementPosition(aRefDiv);
			this._select[aRefDiv.id] = new Array();
			for(var i = 0; i < lArr.length; i++)
			{
				lParent = this.get_DivParent(lArr[i],aRefDiv.id);
				if(lArr[i].style.visibility != 'hidden' && lParent == null && this.is_ElementVisible(lArr[i]))
				{
					lComPos = this.get_ElementPosition(lArr[i]);
					if(
						(lComPos.left >= lDivPos.left && lComPos.left <= lDivPos.left + aRefDiv.offsetWidth) &&
						(lComPos.top >= lDivPos.top && lComPos.top <= lDivPos.top + aRefDiv.offsetHeight)
					)
					{
						lArr[i].setAttribute("elem_hidden",lArr[i].style.visibility);
						lArr[i].style.visibility = 'hidden';
						this._select[aRefDiv.id][this._select[aRefDiv.id].length] = lArr[i];
					}
					else if(
						(lComPos.left + lArr[i].offsetWidth >= lDivPos.left && lComPos.left + lArr[i].offsetWidth  <= lDivPos.left + aRefDiv.offsetWidth) &&
						(lComPos.top + lArr[i].offsetHeight >= lDivPos.top && lComPos.top + lArr[i].offsetHeight <= lDivPos.top + aRefDiv.offsetHeight)
					)
					{
						lArr[i].setAttribute("elem_hidden",lArr[i].style.visibility);
						lArr[i].style.visibility = 'hidden';
						this._select[aRefDiv.id][this._select[aRefDiv.id].length] = lArr[i];
					}
					else if(
						(lComPos.left + lArr[i].offsetWidth >= lDivPos.left && lComPos.left + lArr[i].offsetWidth  <= lDivPos.left + aRefDiv.offsetWidth) &&
						(lComPos.top >= lDivPos.top && lComPos.top <= lDivPos.top + aRefDiv.offsetHeight)
					)
					{
						lArr[i].setAttribute("elem_hidden",lArr[i].style.visibility);
						lArr[i].style.visibility = 'hidden';
						this._select[aRefDiv.id][this._select[aRefDiv.id].length] = lArr[i];
					}
					else if(
						(lComPos.left >= lDivPos.left && lComPos.left <= lDivPos.left + aRefDiv.offsetWidth) &&
						(lComPos.top + lArr[i].offsetHeight >= lDivPos.top && lComPos.top + lArr[i].offsetHeight <= lDivPos.top + aRefDiv.offsetHeight)
					)
					{
						lArr[i].setAttribute("elem_hidden",lArr[i].style.visibility);
						lArr[i].style.visibility = 'hidden';
						this._select[aRefDiv.id][this._select[aRefDiv.id].length] = lArr[i];
					}
				}
			}
		} else {
		    var larr = this._select[aRefDiv.id];
		    var lold = null;
		    if(larr && larr.length)
		        for(var i = 0; i < larr.length; i++) {
		            lold = larr[i];
		            larr[i] = document.getElementById(larr[i].id);
			        larr[i].style.visibility = 'hidden';
			        larr[i].setAttribute("elem_hidden",lold.getAttribute("elem_hidden"));
				}
		}
	}
	
	this.RestoreSelect = function(aRefDiv) {
		var larr = this._select[aRefDiv.id];
		if(larr && larr.length)
			for(var i = 0; i < larr.length; i++)
				larr[i].style.visibility = larr[i].getAttribute("elem_hidden");
		this._select[aRefDiv.id] = null;
	}
	
	this.ParseTime = function(aStr) {
    	var a = aStr.split(/\W+/);
    	var lhour = 0;
    	var lmin = 0;
    	var lsec = 0;
    	var lhour_paso = false;
    	var lampm_paso = false;
    	var is_int = false;
    	var val_act = 0;
    	for(var i = 0; i < a.length; i++) {
    	    if(a[i] == 'm')
    	        continue;
    	    if(lhour_paso && !lampm_paso) {
			    if(/pm|p/i.test(a[i])) {
				    if(!(lhour >= 1 && lhour <= 12))
					    return null;
				    if(lhour < 12) lhour += 12;
				    a[i] = a[i].replace(/pm|p/i,'');
				    lampm_paso = true;
			    } else if(/am|a/i.test(a[i])) {
				    if(!(lhour >= 1 && lhour <= 12))
					    return null;
				    if(lhour >= 12) lhour -= 12;
				    a[i] = a[i].replace(/am|a/i,'');
				    lampm_paso = true;
			    }
			}
			a[i] = a[i].trim();
		    is_int = /^\d+$/.test(a[i]);
		    val_act = parseInt(a[i], 10);
		    if(is_int) {
                if(i == 0) {
                    lhour = val_act;
                    lhour_paso = true;
                } else if(i == 1)
                    lmin = val_act;
                else
                    lsec = val_act;
            } else if(a[i] != '')
                return null;
    	}
    	if(lhour >= 0 && lhour <=23 && lmin >= 0 && lmin <= 59 && lsec >= 0 && lsec <= 59)
    	    return new Date(null,null,null,lhour,lmin,lsec);
    	else
    	    return null;
	}
	
	this.ValidatorTimeCheck = function(aSource, aArg) {
	    var ldate = this.ParseTime(aArg.Value);
	    aArg.IsValid = ldate != null;
	}
	
	this.ValidatorEMail = function(aSource, aArg) {
	    var lfilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	    aArg.IsValid = aArg.Value == '-' || aArg.Value.substr(0,7) == 'nomail_' || lfilter.test(aArg.Value);
	}
	
	this.ValidatorPhone = function(aSource, aArg) {
	    var lfilter = /^(\+|)((\(\d{3}\)\s{0,1})|)(\d+(\s|-){0,1}){0,3}\d{3}(\s{1}(e|x|ex|ext)\s{0,1}\d+|)(\s*,\s*(\+|)((\(\d{3}\)\s{0,1})|)(\d+(\s|-){0,1}){0,3}\d{3}(\s{1}(e|x|ex|ext)\s{0,1}\d+|))*$/; //(\d{3}(-|\s))     (\+\d)*\s*((\(\d{3}\)\s*|(\d{3}-)))*\d{3}(-{0,1}|\s{0,1})\d{2}(-{0,1}|\s{0,1})\d{2}
	    aArg.IsValid = lfilter.test(aArg.Value);
	}
	
	this.ValidatorUrl = function(aSource, aArg) {
	    var lfilter = /https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?/;
	    aArg.IsValid = aArg.Value == 'http://' || lfilter.test(aArg.Value);
	}

    this.get_ClientWidth = function(){
        return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth : document.body.clientWidth;
    }
    
    this.get_ClientHeight = function(){
        return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight : document.body.clientHeight;
    }

    this.RepeatString = function (s, n){
        var a = [];
        while(a.length < n){
            a.push(s);
        }
        return a.join('');
    }

    this.get_Rgb = function(aBlue, aGreen, aRed) {
        var decColor = aRed + 256 * aGreen + 65536 * aBlue;
        return decColor.toString(16);
    }
    
    this.get_Color = function(aColor) {
        if(aColor.substr(0,3) == 'rgb') {
            var larr = aColor.split(' rgb');
            var lhex = eval(larr[0].replace('rgb', 'Util_obj.get_Rgb'));
            lhex = this.RepeatString('0', 6 - lhex.length) + lhex;
            return '#' + lhex;
        } else {
            var larr = aColor.split(' ');
            return larr[0];
        }
    }
    
    this.SplitData = function(aValue) {
        return aValue.split('|-|');
    }
    
    this.PrepareData = function(aValue) {
        return aValue.replace(/|-|/g, '');
    }
    
    this.CreateDate = function(aValue) {
        if(aValue) {
            var lArr = aValue.split(' ');
            var lArrDate = lArr[0].split('-');
            var lArrTime = lArr.length > 1 ? lArr[1].split(':') : new Array();
            return new Date(lArrDate[0],lArrDate[1]*1-1,lArrDate[2],lArrTime.length > 0 ? lArrTime[0] : 0,lArrTime.length > 1 ? lArrTime[1] : 0,lArrTime.length > 2 ? lArrTime[2] : 0);
        } else
            return new Date();
    }

    this.CreateCookie = function(name,value,days) {
	    if (days) {
		    var date = new Date();
		    date.setTime(date.getTime()+(days*24*60*60*1000));
		    var expires = "; expires="+date.toGMTString();
	    }
	    else var expires = "";
	    document.cookie = name+"="+value+expires+"; path=/";
    }

    this.ReadCookie = function(name) {
	    var nameEQ = name + "=";
	    var ca = document.cookie.split(';');
	    for(var i=0;i < ca.length;i++) {
		    var c = ca[i];
		    while (c.charAt(0)==' ') c = c.substring(1,c.length);
		    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	    }
	    return null;
    }

    this.DeleteCookie = function(name) {
	    this.CreateCookie(name,"",-1);
    }
}
var Util_obj = new Util();

var Designer_obj = null;

function derive(aClass1,aClass2) {
    var st = aClass2.toString();
    st = st.substring(st.indexOf(" ") + 1, st.indexOf("("));
    aClass1.prototype = new aClass2;
    aClass1.prototype.ClassBase = st;
    st = aClass1.toString();
    st = st.substring(st.indexOf(" ") + 1, st.indexOf("("));    
    aClass1.prototype.ClassName = st;
}
function override(aObj,aFunc) {
    aObj[aObj.ClassBase + '_' + aFunc] = aObj[aFunc]; 
}

        var ltmp_arr = new Object();

function ClassBase() {

    this.ClientId = '';
    this.ParentId = '';
    this.ContenIdPart = '';
    this.UniqueId = '';
    this.RenderGroup = '';
    this.CtrlType = 0;
    this.Frm = new Array();
    
    this.Property_Add = function(aPos, aCaption, aType, aGet, aSet, aParam1) {
       this.ArrProp[aPos] = {Caption: aCaption, Type: aType, Get: aGet, Set: aSet, Param1: aParam1};; 
    }
    
    this.Init = function() {
        var lPar = arguments[0].split('&');
        this.ParentId = lPar[0];
        this.ClientId = lPar[1].replace(/\$/g,'_');
        this.ContenIdPart = lPar[2];
        this.UniqueId = lPar[1];
        this.RenderGroup = arguments[2];
        /*var larr = this.UniqueId.split('$');
        if(larr.length > 0 && this.ClientId.substr(this.ClientId.length - larr[larr.length-1].length) != larr[larr.length-1]) {
            if(window[larr[larr.length-1] + '_obj'] != null && larr[larr.length-1].substr(0,3) != 'ctl') {
                alert('Duplicate ID ' + larr[larr.length-1] + '. This ID already exist.');
            }
            window[larr[larr.length-1] + '_obj'] = this;
        }*/
        if(this.ContenIdPart != '')
            window[this.ClientId + this.ContenIdPart + '_obj'] = this;
        if(this.RenderGroup != '' && this.RenderGroup != null && (this.ClientToServerPass() || Designer_obj != null)) {
            /*var lTmpSrvCli = new Array();
            if(typeof(ltmp_arr[this.ClassName]) == 'undefined' || ltmp_arr[this.ClassName] == null)
                alert(this.ClassName);
            ltmp_arr[this.ClassName] = 1;*/
            larr = this.RenderGroup.split(',');
            for(var i = 0; i < larr.length; i++) {
                if(typeof(Page_obj['Group' + larr[i]]) == 'undefined')
                    Page_obj['Group' + larr[i]] = new Array();
                var arr_ref = Page_obj['Group' + larr[i]];
                arr_ref[arr_ref.length] = this;
            }
        }
        if(Designer_obj) {
            this.ArrProp = new Array();
            this.Property_Add(10, 'Ancho', 'Text', 'Width', 'Width');
            this.Property_Add(11, 'Altura', 'Text', 'Height', 'Height');
            this.Property_Add(12, 'Tipo de letra', 'ComboTool', 'FontName', 'FontName');
            this.Property_Add(13, 'Tama&ntilde;o de letra', 'ComboTool', 'FontSize', 'FontSize');
            this.Property_Add(14, 'Letra negrita', 'Checkbox', 'FontBold', 'FontBold');
            this.Property_Add(15, 'Letra inclinada', 'Checkbox', 'FontItalic', 'FontItalic');
            this.Property_Add(16, 'Letra subrayada', 'Checkbox', 'FontUnderline', 'FontUnderline');
            this.Property_Add(17, 'Letra rayada', 'Checkbox', 'FontStrikeout', 'FontStrikeout');
            this.Property_Add(18, 'Color de letra', 'PickColor', 'FontColor', 'FontColor');
            this.Property_Add(19, 'Color de fondo', 'PickColor', 'BackColor', 'BackColor');
            this.Property_Add(20, 'Estilo de borde', 'ComboTool', 'BorderStyle', 'BorderStyle');
            this.Property_Add(21, 'Ancho de borde', 'ComboTool', 'BorderWidth', 'BorderWidth');
            this.Property_Add(22, 'Color de borde', 'PickColor', 'BorderColor', 'BorderColor');
            this.Property_Add(24, 'Img. de fondo', 'Image', 'BackImageUrl', 'BackImageUrl');
            this.Property_Add(25, 'Img. alin. horiz.', 'Combo', 'BackImagePosH', 'BackImagePosH', 'Left,Center,Right');
            this.Property_Add(26, 'Img. alin. vert.', 'Combo', 'BackImagePosV', 'BackImagePosV', 'Top,Center,Bottom');
            this.Property_Add(27, 'Modo repetir', 'Combo', 'BackImageRepeat', 'BackImageRepeat', 'No-Repeat,Repeat,Repeat-X,Repeat-Y');
            this.Property_Add(35, 'Identificaci&oacute;n', 'Text', 'Ident', 'Ident');
            this.Property_Add(36, 'Oculto', 'Checkbox', 'Hidden', 'Hidden');
            this.Property_Add(37, 'Texto de ayuda', 'PlainText', 'ToolTip', 'ToolTip');
            this.FrmCount = 18;
        }
    }
    
    this.ClientToServer = function(aArr) {
        var lRecPage = this.get_RecordPage();
        if(lRecPage != '') {
            aArr['RecordPage'] = lRecPage
        }
    }
    
    this.ClientToServerPass = function() {
        return this.get_RecordPage() != '';
    }

    this.get_Attr = function(aAttr) {
        var lref = document.getElementById(this.ClientId);
        return lref != null && lref.getAttribute(aAttr) != null ? lref.getAttribute(aAttr) : '';
    }
    this.set_Attr = function(aAttr, aValue) {
        var lref = document.getElementById(this.ClientId);
        if(lref)
            lref.setAttribute(aAttr, aValue);
    }
    this.get_ExistAttr = function(aAttr) {
        var lref = document.getElementById(this.ClientId);
        return lref ? lref.getAttribute(aAttr) != null : null;
    }
    
    this.set_RecordPageCount = function(aValue) {
        this.set_Attr('t16', aValue);
    }
    this.get_RecordPageCount = function(aValue) {
        return this.get_Attr('t16');
    }

    this.get_ReadOnly = function(aValue) {
        return this.get_Attr('t02') == '1';
    }

    this.set_RecordPage = function(aValue) {
        this.set_Attr('t15', aValue);
    }
    this.get_RecordPage = function(aValue) {
        return this.get_Attr('t15');
    }
    
    this.ChangeRecordPage = function(aValue) {
        if(this.get_RecordPage() != null && this.get_RecordPage() != aValue) {
            this.set_RecordPage(aValue);
            this.Render("Page");
        }
    }

    this.Render = function(aCommand, aParam) {
        var lparam = null;
        if(aParam != null) {
            lparam = new Object();
            lparam[this.ClientId] = aParam;
        }
        if(aCommand == null)
            aCommand = '';
        Page_obj.DoCallback(this, lparam, aCommand, true);
    }
    
    this.set_Visible = function(aValue) {
        document.getElementById(this.ClientId).style.display = aValue ? '' : 'none';
    }
    
    this.InitDesignMode = function() {

        //setTimeout(this.ClientId + '_obj.set_DesignMarkNor()', 50);
    }
    
    this.set_DesignMarkNor = function() {
        if(Designer_obj) {
            var lref = document.getElementById(this.ClientId);
            Designer_obj.set_DesignMarkNor(lref);
        }
    }
    
    this.set_DesignMarkSel = function() {
        if(Designer_obj) {
            var lref = document.getElementById(this.ClientId);
            Designer_obj.set_DesignMarkSel(lref);
        }
    }
    
    this.set_DesignSelected = function() {
        if(Designer_obj)
            Designer_obj.set_Selected(this.ClientId);
    }
    
    this.get_Frm = function() {
        return this.Frm;
    }
    
    this.set_Ident = function(aValue) {
        var lRef = document.getElementById(this.ClientId);
        lRef.setAttribute('t01', aValue.replace(/[^a-zA-Z0-9.]/, ''));
    }
    this.get_Ident = function() {
        var lRef = document.getElementById(this.ClientId);
        return lRef.getAttribute('t01') != null ? lRef.getAttribute('t01') : '';
    }

	this.set_Width = function(aValue) {
	    if(aValue != null) {
            var lref = document.getElementById(this.ClientId + this.ContenIdPart);
            lref.style.width = aValue;
            this.Frm[0] = lref.style.width;
        }
        return 0;
	}
	
	this.set_Height = function(aValue) {
	    if(aValue != null) {
            var lref = document.getElementById(this.ClientId + this.ContenIdPart);
            lref.style.height = aValue;
            this.Frm[1] = lref.style.height;
        }
        return 0;
	}
	
    this.get_WidthConten = function() {
        var lref = document.getElementById(this.ClientId + this.ContenIdPart);
        return lref.offsetWidth + 'px';
    }

    this.get_HeightConten = function() {
        var lref = document.getElementById(this.ClientId + this.ContenIdPart);
        return lref.offsetHeight + 'px';
    }

    this.get_Width = function() {
        var lref = document.getElementById(this.ClientId + this.ContenIdPart);
        return lref.style.width;
    }

    this.get_Height = function() {
        var lref = document.getElementById(this.ClientId + this.ContenIdPart);
        return lref.style.height;
    }
    
	this.set_Hidden = function(aValue) {
	    if(Designer_obj)
	        this.Frm[17] = aValue;
	    else {
	        this.set_HiddenClient(aValue);
	    }
	}
	this.get_Hidden = function() {
	    if(Designer_obj) {
    	    return this.Frm[17];
	    } else {
	        var lref = document.getElementById(this.ClientId);
	        return lref.style.display == 'none';
	    }
	}
	
	this.set_HiddenClient = function(aValue) {
        var lref = document.getElementById(this.ClientId);
        lref.style.display = aValue ? 'none' : '';
	}
    
    this.set_FontName = function(aValue) {
        var lref = document.getElementById(this.ClientId);
        lref.style.fontFamily = aValue;
        if(this.ContenIdPart != '') {
            lref = document.getElementById(this.ClientId + this.ContenIdPart);
            lref.style.fontFamily = aValue;
        }
        this.Frm[2] = lref.style.fontFamily;
    }
    this.get_FontName = function() {
        var lref = document.getElementById(this.ClientId);
        return lref.style.fontFamily;
    }

    this.set_FontSize = function(aValue) {
        var lref = document.getElementById(this.ClientId);
        lref.style.fontSize = aValue;
        if(this.ContenIdPart != '') {
            lref = document.getElementById(this.ClientId + this.ContenIdPart);
            lref.style.fontFamily = aValue;
        }
        this.Frm[3] = lref.style.fontSize;
    }
    this.get_FontSize = function() {
        var lref = document.getElementById(this.ClientId);
        return lref.style.fontSize;
    }
    
    this.set_FontBold = function(aValue) {
        var lref = document.getElementById(this.ClientId);
        lref.style.fontWeight = aValue ? 'bold' : 'normal';
        if(this.ContenIdPart != '') {
            lref = document.getElementById(this.ClientId + this.ContenIdPart);
            lref.style.fontWeight = aValue ? 'bold' : 'normal';
        }
        this.Frm[4] = aValue;
    }
    this.get_FontBold = function() {
        var lref = document.getElementById(this.ClientId);
        return lref.style.fontWeight == 'bold';
    }

    this.set_FontItalic = function(aValue) {
        var lref = document.getElementById(this.ClientId);
        lref.style.fontStyle = aValue ? 'italic' : 'normal';
        if(this.ContenIdPart != '') {
            lref = document.getElementById(this.ClientId + this.ContenIdPart);
            lref.style.fontStyle = aValue ? 'italic' : 'normal';
        }
        this.Frm[5] = aValue;
    }
    this.get_FontItalic = function() {
        var lref = document.getElementById(this.ClientId);
        return lref.style.fontStyle == 'italic';
    }
    
    this.set_FontUnderline = function(aValue) {
        var lref = document.getElementById(this.ClientId);
        if(!lref.style.textDecoration || lref.style.textDecoration == 'none')
            lref.style.textDecoration = '';
        var lpos = lref.style.textDecoration.indexOf('underline');
        if(aValue && lpos == -1)
            lref.style.textDecoration += ' underline';
        else if(!aValue && lpos >= 0)
            lref.style.textDecoration = lref.style.textDecoration.replace('underline', '');
        if(this.ContenIdPart != '') {
            var ltextdeco = lref.style.textDecoration;
            lref = document.getElementById(this.ClientId + this.ContenIdPart);
            lref.style.textDecoration = ltextdeco;
        }
        this.Frm[6] = aValue;
    }
    this.get_FontUnderline = function() {
        var lref = document.getElementById(this.ClientId);
        return lref.style.textDecoration.indexOf('underline') >= 0;
    }

    this.set_FontStrikeout = function(aValue) {
        var lref = document.getElementById(this.ClientId);
        if(!lref.style.textDecoration || lref.style.textDecoration == 'none')
            lref.style.textDecoration = '';
        var lpos = lref.style.textDecoration.indexOf('line-through');
        if(aValue && lpos == -1)
            lref.style.textDecoration += ' line-through';
        else if(!aValue && lpos >= 0)
            lref.style.textDecoration = lref.style.textDecoration.replace('line-through', '');
        if(this.ContenIdPart != '') {
            var ltextdeco = lref.style.textDecoration;
            lref = document.getElementById(this.ClientId + this.ContenIdPart);
            lref.style.textDecoration = ltextdeco;
        }
        this.Frm[7] = aValue;
    }
    this.get_FontStrikeout = function() {
        var lref = document.getElementById(this.ClientId);
        return lref.style.textDecoration.indexOf('line-through') >= 0;
    }

    this.set_FontColor = function(aValue) {
        var lref = document.getElementById(this.ClientId);
        lref.style.color = aValue;
        if(this.ContenIdPart != '') {
            lref = document.getElementById(this.ClientId + this.ContenIdPart);
            lref.style.color = aValue;
        }
        this.Frm[8] = aValue;
    }
    this.get_FontColor = function() {
        var lref = document.getElementById(this.ClientId);
        return Util_obj.get_Color(lref.style.color);
    }

    this.set_BackColor = function(aValue) {
        var lref = document.getElementById(this.ClientId);
        lref.style.backgroundColor = aValue;
        if(this.ContenIdPart != '') {
            lref = document.getElementById(this.ClientId + this.ContenIdPart);
            lref.style.backgroundColor = aValue;
        }
        this.Frm[9] = aValue;
    }
    this.get_BackColor = function() {
        var lref = document.getElementById(this.ClientId);
        return Util_obj.get_Color(lref.style.backgroundColor);
    }

    this.set_BorderStyle = function(aValue) {
        var lref = document.getElementById(this.ClientId + (this.ContenIdPart != '' ? this.ContenIdPart : ''));
        lref.style.borderStyle = aValue.toLowerCase();
        this.Frm[10] = this.get_BorderStyle();
    }
    this.get_BorderStyle = function() {
        var lref = document.getElementById(this.ClientId  + (this.ContenIdPart != '' ? this.ContenIdPart : ''));
        var larr = lref.style.borderStyle.split(' ');
        return larr[0].substr(0,1).toUpperCase() + larr[0].substr(1);
    }

    this.set_BorderWidth = function(aValue) {
        var lref = document.getElementById(this.ClientId + (this.ContenIdPart != '' ? this.ContenIdPart : ''));
        lref.style.borderWidth = aValue;
        this.Frm[11] = aValue;
    }
    this.get_BorderWidth = function() {
        var lref = document.getElementById(this.ClientId  + (this.ContenIdPart != '' ? this.ContenIdPart : ''));
        var larr = lref.style.borderWidth.split(' ');
        return larr[0];
    }

    this.set_BorderColor = function(aValue) {
        var lref = document.getElementById(this.ClientId + (this.ContenIdPart != '' ? this.ContenIdPart : ''));
        lref.style.borderColor = aValue;
        this.Frm[12] = aValue;
    }
    this.get_BorderColor = function() {
        var lref = document.getElementById(this.ClientId  + (this.ContenIdPart != '' ? this.ContenIdPart : ''));
        return Util_obj.get_Color(lref.style.borderColor);
    }
    
    this.set_BackImageUrl = function(aValue) {
        var lref = document.getElementById(this.ClientId + (this.ContenIdPart != '' ? this.ContenIdPart : ''));
        lref.style.backgroundImage = 'url(' + Page_obj.LibraryHost + aValue + ')';
        this.Frm[13] = aValue;
    }
    this.get_BackImageUrl = function() {
        return this.Frm[13];
    }

    this.set_BackImagePosH = function(aValue) {
        var lref = document.getElementById(this.ClientId + (this.ContenIdPart != '' ? this.ContenIdPart : ''));
        lref.style.backgroundPosition = aValue.toLowerCase() + ' ' + this.get_BackImagePosV().toLowerCase();
        this.Frm[14] = aValue;
    }
    this.get_BackImagePosH = function() {
        return this.Frm[14];
    }
    
    this.set_BackImagePosV = function(aValue) {
        var lref = document.getElementById(this.ClientId + (this.ContenIdPart != '' ? this.ContenIdPart : ''));
        lref.style.backgroundPosition = this.get_BackImagePosH().toLowerCase() + ' ' + aValue.toLowerCase();
        this.Frm[15] = aValue;
    }
    this.get_BackImagePosV = function() {
        return this.Frm[15];
    }

    this.set_BackImageRepeat = function(aValue) {
        var lref = document.getElementById(this.ClientId + (this.ContenIdPart != '' ? this.ContenIdPart : ''));
        lref.style.backgroundRepeat = aValue.toLowerCase();
        this.Frm[16] = aValue;
    }
    this.get_BackImageRepeat = function() {
        return this.Frm[16];
    }

    this.set_ToolTip = function(aValue) {
        this.Frm[18] = this.set_ValueLang(this.Frm[18], aValue); //aValue;
    }
    this.get_ToolTip = function() {
        return this.get_ValueLang(this.Frm[18]);
    }

    this.get_AllowDrag = function() {
        return true;
    }
    
    this.get_AllowDrop = function() {
        return false;
    }

    this.get_AllowDropBefore = function() {
        return true;
    }
    
    this.get_ToArrayList = function(aArr) {
        if(!aArr)
            aArr = new Array();
        aArr[aArr.length] = this;
        var lRef = document.getElementById(this.ClientId);
        lRef = lRef.firstChild;
        while(lRef != null) {
            if(lRef.id && lRef.id.length > 0 && window[lRef.id + '_obj'] && window[lRef.id + '_obj'] && window[lRef.id + '_obj'] != this && window[lRef.id + '_obj'].ClientId + window[lRef.id + '_obj'].ContenIdPart == lRef.id)
                window[lRef.id + '_obj'].get_ToArrayList(aArr);
            lRef = lRef.nextSibling;
        }
        return aArr;
    }
    
    this.get_ValueLang = function(aValue) {
        if(Designer_obj) {
            var lLang = Designer_obj.get_Lang();
            if(!aValue)
                aValue = '';
            var lArr = aValue.split('*_*');
            if(lLang == 'fr')    
                return lArr[0];
            else if(lLang == 'en' && lArr.length > 1)
                return lArr[1];
            else if(lLang == 'es' && lArr.length > 2)
                return lArr[2];
            else
                return lArr[0];
        }
    }
    
    this.set_ValueLang = function(aValue, aValueSet) {
        if(Designer_obj) {
            var lLang = Designer_obj.get_Lang();
            var lArr = aValue.split('*_*');
            if(lArr.length == 1 && lLang == Designer_obj.get_DefaultLang())
                return aValueSet;
            else {
                /*alert(aValue);
                alert(aValueSet);
                alert(lLang);*/
                if(lLang == 'fr')
                    lArr[0] = aValueSet;
                else if(lLang == 'en')
                    lArr[1] = aValueSet;
                else if(lLang == 'es')
                    lArr[2] = aValueSet;
                if(lArr[0] == null)
                    lArr[0] = ''
                if(lArr[1] == null)
                    lArr[1] = '';
                if(lArr[2] == null)
                    lArr[2] = '';
                return lArr.join('*_*');
            }
        }
        return '';
    }
}

derive(ClassInput, ClassBase)
function ClassInput() {

    this.TextChanges = null;
    
    this.OnChange = null;
    
    //this.Text = '';
    this.CdtID = '';
    this.CdtKey = '';
    this.CdtCol = -1;

    override(this, 'Init');
    this.Init = function() {
        this.ClassBase_Init(arguments[0],arguments[1],arguments[2]);
        //this.TextChanges = arguments[3];
        this.CtrlType = 1;
        if(Designer_obj) {
            this.Property_Add(6, 'Acci&oacute;n Cambio', 'ActionList', 'ActChange', 'ActChange');
            this.Property_Add(23, 'Orden del Tab', 'Text', 'TabIndex', 'TabIndex');
            this.Property_Add(28, 'Salvar valor', 'Combo', 'SaveValue', 'SaveValue', '1|Si,0|No');
            this.Property_Add(29, 'Valor defecto', 'PlainText', 'TextDefault', 'TextDefault');
            this.Property_Add(32, 'Multi idioma', 'Checkbox', 'MultiLang', 'MultiLang');
            this.FrmCount = 23;
        }
    }

    override(this, 'ClientToServer');   
    this.ClientToServer = function(aArr) {
        this.ClassBase_ClientToServer(aArr);
        aArr['Text'] = this.get_Text();
        if(Designer_obj != null && this.get_TextDefault() != '')
            aArr['TextDefault'] = this.get_TextDefault()
    }

    this.ClientToServerPass = function() {
        return true;
    }

    this.set_Text = function(aValue) {
        this.set_Attr('t05', aValue);
    }
    this.get_Text = function() {
        return this.get_Attr('t05');
    }
    
    this.get_TabIndex = function() {
        return this.Frm[19];
    }
    this.set_TabIndex = function(aValue) {
        var lRef = document.getElementById(this.ClientId);
        lRef.tabIndex = aValue;
        this.Frm[19] = aValue;
    }
    
    this.get_SaveValue = function() {
        return this.Frm[20];
    }
    this.set_SaveValue = function(aValue) {
        this.Frm[20] = aValue;
    }

    this.get_TextDefault = function() {
        return this.get_ValueLang(this.Frm[21]);
    }
    this.set_TextDefault = function(aValue) {
        this.Frm[21] = this.set_ValueLang(this.Frm[21], aValue);
    }

    this.ChangeText = function(aValue) {
        if(this.get_Text() != aValue) {
            this.set_Text(aValue);
            this.ProcessTextChange();
        }
    }
    
    this.Load = function(aCallback, aIsTextRender) {
        try
        {
            if(this.CdtID != '' && window[this.CdtID + '_obj'].get_Row(this.CdtKey) != null && window[this.CdtID + '_obj'].get_RowData(this.CdtKey, this.CdtCol) != null) {
                this.set_Text(window[this.CdtID + '_obj'].get_RowData(this.CdtKey, this.CdtCol));
            } else if(!aIsTextRender) {
                this.set_Text(this.get_Text());
            }
        } catch(aExcep) {
            this.set_Text(this.get_Text());
        }
    }
    
    this.set_Focus = function() {
        alert('Function set_Focus must be implemented.');
    }
    
    this.ControlsToGetValue = function(aIndex, aControls) {
        if(this.TextChanges[aIndex] && this.TextChanges[aIndex].Params)
            this.TextChanges[aIndex].Params.ControlsToGetValue = aControls;
    }
    
    this.ProcessTextChange = function(aEvent) {
        if((this.OnChange == null || this.OnChange(aEvent)) && this.TextChanges && this.TextChanges.length > 0) {
            var larr = new Array();
            var lparam = new Object();
            for(var i = 0; i < this.TextChanges.length; i++) {
                larr[larr.length] = eval(this.TextChanges[i].CtrlId + '_obj');
                lparam[this.TextChanges[i].CtrlId] = this.TextChanges[i].Params;
            }
            //alert(larr[0].ClientId);
            Page_obj.DoCallback(larr,lparam,'Change',true);
        }
        if(this.get_ActChange() != '') {
            this.ExecActChange(document.getElementById(this.ClientId));
        }
    }

    this.set_ActChange = function(aValue) {
        this.set_Attr('t06', aValue);
        this.Frm[22] = aValue;
    }
    this.get_ActChange = function() {
        if(Designer_obj)
            return this.Frm[22];
        return this.get_Attr('t06'); 
    }
    this.ExecActChange = function(aRef) {
        if(this.get_ActChange() != '') {
            var lObj = window[this.get_ActChange() + '_obj'];
            if(lObj) {
                lObj.Execute(aRef);
            }
        }
    }

    this.set_MultiLang = function(aValue) {
        this.Frm[23] = aValue;
    }
    this.get_MultiLang = function() {
        if(Designer_obj)
            return this.Frm[23];
    }
}

derive(ClassDataInput, ClassInput)
function ClassDataInput() {

    this.SelectedIndex = null;
    this.DataKeys = null;
    
    this.EmptySelection = false;
    this.SetFocusOnChangePage = true;
    
    override(this, 'Init');
    this.Init = function() {
        this.ClassInput_Init(arguments[0],arguments[1],arguments[2],arguments[3]);
        if(Designer_obj) {
            this.Property_Add(30, 'Fuente de datos', 'DataSourceFilter', 'DataSourceIDOne', 'DataSourceID');
            //this.Property_Add(31, 'Fuente Sql', 'PlainText', 'DataSourceSql', 'DataSourceSql');
            this.FrmCount = 30;
        }
    }

    override(this, 'ClientToServer');   
    this.ClientToServer = function(aArr) {
        this.ClassInput_ClientToServer(aArr);
        if(!this.get_ReadOnly()) {
            aArr['SelectedIndex'] = this.get_SelectedIndex();
            aArr['DataKeys'] = this.get_DataKeys();
        }
        if(this.get_DataSql() != '')
            aArr['DataSql'] = this.get_DataSql();
    }

    this.set_SelectedIndex = function(aValue) {
        this.RenderSelection(false);
        this.SelectedIndex = aValue;
        this.RenderSelection(true);
    }
    this.get_SelectedIndex = function() {
        if(this.SelectedIndex == null) {
            if(this.get_ExistAttr('t10'))
                this.SelectedIndex = this.get_Attr('t10').split('#');
            else
                this.SelectedIndex = parseInt(this.get_Attr('t11'));
        }
        return this.SelectedIndex;
    }
    this.set_SelectedIndexEmpty = function() {
        var lsel_index = this.get_SelectedIndex();
        this.set_SelectedIndex(typeof(lsel_index) == 'object' ? new Array() : -1);
    }
    
    this.get_DataKeys = function() {
        if(this.DataKeys == null) {
            if(this.get_Attr('t12') != '')
                this.DataKeys = this.get_Attr('t12').split('#');
            else {
                this.DataKeys = new Array();
            }
        }
        return this.DataKeys;
    }
    this.set_DataKeys = function(aValue) {
        this.DataKeys = aValue;
    }
    
    this.get_DataSql = function() {
        return this.get_Attr('t13');
    }
    this.set_DataSql = function(aValue) {
        this.set_Attr('t13', aValue);
    }

    this.get_ItemsCount = function() {
        this.DataKeys = null;
    	return this.get_DataKeys() != null ? this.DataKeys.length : 0;
    }
    
    this.set_Text = function(aValue) {
        var lsel_index = this.get_SelectedIndex();
        if(typeof(lsel_index) == 'object') {
            var larr = aValue.split('|');
            var lres = new Array();
            for(var i = 0; i < larr.length; i++) {
                var lindex = this.IndexOfDataKey(larr[i]);
                if(lindex != -1)
                    lres[lres.length] = lindex;
            }
            this.set_SelectedIndex(lres);
        } else {
            this.set_SelectedIndex(this.IndexOfDataKey(aValue));
        }
    }
    this.get_Text = function() {
        if(this.get_ReadOnly()) {
            if(this.get_ItemsCount() == 0)
                return '';
            else
                return this.get_DataKeys()[0];
        }
        var lsel_index = this.get_SelectedIndex();
        if(typeof(lsel_index) == 'object') {
            var lres = '';
            for(var i = 0; i < lsel_index.length; i++)
                if(this.get_DataKeys()[lsel_index[i]])
                    lres += (lres == '' ? '' : '|') + this.get_DataKeys()[lsel_index[i]];
            return lres;
        } else {
            if(lsel_index >= 0 && lsel_index < this.get_DataKeys().length)
                return this.get_DataKeys()[lsel_index];
            else
        	    return '';
        }
    }
    
    this.get_TextMultiple = function(aIndex) {
        var lsel_index = this.get_SelectedIndex();
        if(typeof(lsel_index) == 'object') {
        	return typeof(lsel_index[aIndex]) != 'undefined' && typeof(this.get_DataKeys()[lsel_index[aIndex]]) != 'undefined' ? this.get_DataKeys()[lsel_index[aIndex]] : '';
        } else {
            if(lsel_index >= 0 && lsel_index < this.get_DataKeys().length)
                return this.get_DataKeys()[lsel_index];
            else
        	    return '';
        }
    }

    this.IndexOfDataKey = function(aValue) {
        var lindex = -1;
        for(var i = 0; i < this.get_DataKeys().length; i++)
            if(this.get_DataKeys()[i] == aValue) {
                lindex = i;
                break;
            }
        return lindex;
    }
    
    this.ChangeSelectedIndex = function(aValue) {
        var lsel_index = this.get_SelectedIndex();
        if(lsel_index != aValue) {
            this.set_SelectedIndex(aValue);
            this.ProcessTextChange();
        } else if(this.EmptySelection) {
            this.set_SelectedIndexEmpty();
            this.ProcessTextChange();
        }
    }
    
    this.ChangeRecordPage = function(aValue) {
        if(this.get_RecordPage() != null && this.get_RecordPage() != aValue) {
            this.set_SelectedIndexEmpty();
            this.set_RecordPage(aValue);
            this.Render("Page",{SetFocus: this.SetFocusOnChangePage});
        }
    }
    
    this.ProcessSelection = function(aIndex,aEvent) {
        var lsel_index = this.get_SelectedIndex();
        var lant_sel_index = lsel_index;
        if(typeof(lsel_index) == 'object') {
            var lfind = false;
            var larr;
            for(var i = 0; i < lsel_index.length; i++) {
                if(aIndex < lsel_index[i]) {
                    lfind = true;
                    larr = lsel_index.slice(0,i).concat(aIndex,lsel_index.slice(i));
                    break;
                } else if(lsel_index[i] != '' && aIndex == lsel_index[i]) {
                    lfind = true;
                    if(this.EmptySelection)
                        larr = lsel_index.slice(0,i).concat(lsel_index.slice(i+1));
                    else {
                    	larr = new Array();
                    	larr.concat(lsel_index);
                    }
                    break;
                }
            }
            if(!lfind)
                larr = lsel_index.concat(aIndex);
            larr = this.VerifySelection(larr,aIndex,aEvent,lant_sel_index);
            this.ChangeSelectedIndex(larr);        
        } else
        	this.ChangeSelectedIndex(aIndex);
    }
    
    this.Load = function() {
        this.DataKeys = null;
        this.SelectedIndex = null;
        if(this.CdtID && this.CdtID != '' && window[this.CdtID + '_obj'].get_Row(this.CdtKey) != null && window[this.CdtID + '_obj'].get_RowData(this.CdtKey, this.CdtCol) != null) {
            this.set_Text(window[this.CdtID + '_obj'].get_RowData(this.CdtKey, this.CdtCol));
        } else
            this.set_SelectedIndex(this.get_SelectedIndex());
    }
    
    this.VerifySelection = function(aSelectedIndex,aIndex,aEvent) {
        return aSelectedIndex;
    }
    
    this.RenderSelection = function(aMark) {
    }

    this.set_DataSourceID = function(aValue) {
        this.Frm[24] = aValue;
    }
    this.get_DataSourceID = function() {
        return this.Frm[24];
    }
    this.get_DataSourceIDOne = function() {
        return this.Frm[24].split(',')[0];
    }

    this.set_DataSourceFilter = function(aValue) {
        this.Frm[25] = aValue;
    }
    this.get_DataSourceFilter = function() {
        return this.Frm[25];
    }

    this.set_DataSourceOrder = function(aValue) {
        this.Frm[26] = aValue;
    }
    this.get_DataSourceOrder = function() {
        return this.Frm[26];
    }
    
    this.set_DataSourceTop = function(aValue) {
        this.Frm[27] = aValue;
    }
    this.get_DataSourceTop = function() {
        return this.Frm[27];
    }

    this.set_DataSourceType = function(aValue) {
        this.Frm[28] = aValue;
    }
    this.get_DataSourceType = function() {
        return this.Frm[28];
    }

    this.set_DataSourceSql = function(aValue) {
        this.Frm[29] = aValue;
    }
    this.get_DataSourceSql = function() {
        return this.Frm[29];
    }

    this.set_DataSourceKey = function(aValue) {
        this.Frm[30] = aValue;
    }
    this.get_DataSourceKey = function() {
        return this.Frm[30];
    }

}

if(typeof(Page_IsValid) == 'undefined')
    Page_IsValid = true;

