if (!this.JSON) {
    JSON = {};
}
(function () {

    function f(n) {
        // Format integers to have at least two digits.
        return n < 10 ? '0' + n : n;
    }

    if (typeof Date.prototype.toJSON !== 'function') {

        Date.prototype.toJSON = function (key) {

            return this.getUTCFullYear()   + '-' +
                 f(this.getUTCMonth() + 1) + '-' +
                 f(this.getUTCDate())      + 'T' +
                 f(this.getUTCHours())     + ':' +
                 f(this.getUTCMinutes())   + ':' +
                 f(this.getUTCSeconds())   + 'Z';
        };

        String.prototype.toJSON =
        Number.prototype.toJSON =
        Boolean.prototype.toJSON = function (key) {
            return this.valueOf();
        };
    }

    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        escapeable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
        gap,
        indent,
        meta = {    // table of character substitutions
            '\b': '\\b',
            '\t': '\\t',
            '\n': '\\n',
            '\f': '\\f',
            '\r': '\\r',
            '"' : '\\"',
            '\\': '\\\\'
        },
        rep;


    function quote(string) {

// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.

        escapeable.lastIndex = 0;
        return escapeable.test(string) ?
            '"' + string.replace(escapeable, function (a) {
                var c = meta[a];
                if (typeof c === 'string') {
                    return c;
                }
                return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
            }) + '"' :
            '"' + string + '"';
    }


    function str(key, holder) {

// Produce a string from holder[key].

        var i,          // The loop counter.
            k,          // The member key.
            v,          // The member value.
            length,
            mind = gap,
            partial,
            value = holder[key];

// If the value has a toJSON method, call it to obtain a replacement value.

        if (value && typeof value === 'object' &&
                typeof value.toJSON === 'function') {
            value = value.toJSON(key);
        }

// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.

        if (typeof rep === 'function') {
            value = rep.call(holder, key, value);
        }

// What happens next depends on the value's type.

        switch (typeof value) {
        case 'string':
            return quote(value);

        case 'number':

// JSON numbers must be finite. Encode non-finite numbers as null.

            return isFinite(value) ? String(value) : 'null';

        case 'boolean':
        case 'null':

// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.

            return String(value);

// If the type is 'object', we might be dealing with an object or an array or
// null.

        case 'object':

// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.

            if (!value) {
                return 'null';
            }

// Make an array to hold the partial results of stringifying this object value.

            gap += indent;
            partial = [];

// If the object has a dontEnum length property, we'll treat it as an array.

            if (typeof value.length === 'number' &&
                    !value.propertyIsEnumerable('length')) {

// The object is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.

                length = value.length;
                for (i = 0; i < length; i += 1) {
                    partial[i] = str(i, value) || 'null';
                }

// Join all of the elements together, separated with commas, and wrap them in
// brackets.

                v = partial.length === 0 ? '[]' :
                    gap ? '[\n' + gap +
                            partial.join(',\n' + gap) + '\n' +
                                mind + ']' :
                          '[' + partial.join(',') + ']';
                gap = mind;
                return v;
            }

// If the replacer is an array, use it to select the members to be stringified.

            if (rep && typeof rep === 'object') {
                length = rep.length;
                for (i = 0; i < length; i += 1) {
                    k = rep[i];
                    if (typeof k === 'string') {
                        v = str(k, value);
                        if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
                    }
                }
            } else {

// Otherwise, iterate through all of the keys in the object.

                for (k in value) {
                    if (Object.hasOwnProperty.call(value, k)) {
                        v = str(k, value);
                        if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
                    }
                }
            }

// Join all of the member texts together, separated with commas,
// and wrap them in braces.

            v = partial.length === 0 ? '{}' :
                gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
                        mind + '}' : '{' + partial.join(',') + '}';
            gap = mind;
            return v;
        }
    }

// If the JSON object does not yet have a stringify method, give it one.

    if (typeof JSON.stringify !== 'function') {
        JSON.stringify = function (value, replacer, space) {

// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.

            var i;
            gap = '';
            indent = '';

// If the space parameter is a number, make an indent string containing that
// many spaces.

            if (typeof space === 'number') {
                for (i = 0; i < space; i += 1) {
                    indent += ' ';
                }

// If the space parameter is a string, it will be used as the indent string.

            } else if (typeof space === 'string') {
                indent = space;
            }

// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.

            rep = replacer;
            if (replacer && typeof replacer !== 'function' &&
                    (typeof replacer !== 'object' ||
                     typeof replacer.length !== 'number')) {
                throw new Error('JSON.stringify');
            }

// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.

            return str('', {'': value});
        };
    }


// If the JSON object does not yet have a parse method, give it one.

    if (typeof JSON.parse !== 'function') {
        JSON.parse = function (text, reviver) {

// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.

            var j;

            function walk(holder, key) {

// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.

                var k, v, value = holder[key];
                if (value && typeof value === 'object') {
                    for (k in value) {
                        if (Object.hasOwnProperty.call(value, k)) {
                            v = walk(value, k);
                            if (v !== undefined) {
                                value[k] = v;
                            } else {
                                delete value[k];
                            }
                        }
                    }
                }
                return reviver.call(holder, key, value);
            }


// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.

            cx.lastIndex = 0;
            if (cx.test(text)) {
                text = text.replace(cx, function (a) {
                    return '\\u' +
                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
                });
            }

// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.

// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.

            if (/^[\],:{}\s]*$/.
test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {

// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.

                j = eval('(' + text + ')');

// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.

                return typeof reviver === 'function' ?
                    walk({'': j}, '') : j;
            }

// If the text is not JSON parseable, then a SyntaxError is thrown.

            throw new SyntaxError('JSON.parse');
        };
    }
})();



/* CLASS Element */

function Element()  {
    this.display_name =  function(x) { /* a helper function */
        var tokens = x.split('.');
        var fname = tokens.pop();
        fname = fname.replace(/_id/, '');
        return fname;
    };
    
    this.createEventListener = function ( target, eventName, handlerFunc, captureFlag /*bool*/) {
        var context = this;
        var funcWrapper =   function(e) {
                                    var retval = false;
                                    try {
                                        retval = handlerFunc.call(context, e, this);
                                    } catch (ex) {
                                        Ngx.Odb.Form.firstMessage("caught exception in event handler wrapper");
                                    }
                                    return retval;
                                };
        if(Ngx.Odb.Browserinfo.appname=="Microsoft Internet Explorer"){
            target.attachEvent(eventName, funcWrapper);
        }
        else {
            eventName = eventName.replace("on","");
            target.addEventListener(eventName, funcWrapper, captureFlag);
        }
        return funcWrapper; /* callers must return this on deleteEvent calls ! */
    };

    this.deleteEventListener = function ( target, eventName, funcWrapper, captureFlag /*bool*/) {
        if(Ngx.Odb.Browserinfo.appname=="Microsoft Internet Explorer"){
            target.detachEvent(eventName, funcWrapper);
        }
        else {
            eventName = eventName.replace("on","");
            target.removeEventListener(eventName, funcWrapper, captureFlag);
        }
    };
}


/* CLASS Form */

function Form()  { 
    this.message = "",
    this.firstMessage = function(x) {
        if (!this.message) {
            this.message = x;
        }
    };

    this.validationObjects = [];

    this.addValidationObject =  function(x, index) {
        this.validationObjects.push({field : x, index : index });
    };

    this.lastError = {
        obj : null,
        style : {}
    };

    this.runValidations = function() {
        var result = true;
        this.message = '';
        if (this.lastError.obj) {
            for (var p in this.lastError.style) {
                this.lastError.obj.style[p] = this.lastError.style[p];
            }
        }
        this.validationObjects.sort(function(a,b) { return a.index - b.index }); //sort ascending by index
        for (var i=0; i<this.validationObjects.length; i++) {
              var vobj = this.validationObjects[i].field;
              result = result && vobj.validationFunction(); /* no validation function should fail! */
              if (!result) {
                  this.lastError.obj = vobj;
                  this.lastError.style.borderWidth = vobj.style.borderWidth;
                  this.lastError.style.borderColor = vobj.style.borderColor;
                  vobj.style.borderWidth = 'medium';
                  vobj.style.borderColor = 'red';
                  vobj.scrollIntoView();
                  window.scrollBy(0,-50);
                  vobj.focus();
                  break;
              }
        }
        return result;
    };

    this.create = function() {
        return new Form(x, y, m, d);
    };

};

Form.prototype = new Element();
Form.prototype.constructor = Form;

/* CLASS Control */

function Control() {

    this.validations = {

        notNull: function(x,s) {
                      if (!x.value) {
                          Ngx.Odb.Form.firstMessage( (s || Ngx.Odb.Form.display_name(x.name)) + " cannot be null");
                          return false;
                      }
                      else {
                          return true;
                      }
                   },
        isNull: function(x,s) {
                      if (!x.value) {
                          return true;
                      }
                      else {
                          Ngx.Odb.Form.firstMessage( (s || Ngx.Odb.Form.display_name(x.name)) + " must be null");
                          return false;
                      }
                  },
         isNumber: function(x,s) {
             if (isNaN(x.value)){
                     Ngx.Odb.Form.firstMessage( (s || Ngx.Odb.Form.display_name(x.name)) + " must be a number");
                     return false;
                 }
                 else { 
                     return true;
                 }
             },
         isNotNumber: function(x,s) {
             if (!x.value || isNaN(x.value)){
                     return true;
                 }
                 else { 
                     Ngx.Odb.Form.firstMessage((s || Ngx.Odb.Form.display_name(x.name)) + " must not be a number");
                     return false;
                 }
             },
    
         inRange: function(x,s, min, max) {
             if (!isNaN(x.value) && !isNaN(min) && !isNaN(max) && x.value >= min && x.value <= max) {
                 return true;
             }
             else {
                 Ngx.Odb.Form.firstMessage((s || Ngx.Odb.Form.display_name(x.name)) + " must be a number between " + min + " and " + max);
                 return false;
             }
         },
         isPositive: function(x,s) {
             if (isNaN(x.value) || x.value == '' ) {
                 return true;
             }
             if (x.value <= 0) {
                 Ngx.Odb.Form.firstMessage((s || Ngx.Odb.Form.display_name(x.name)) + " value not valid");
                 return false;
             }
             else {
                 return true;
             }
         },
         isEmail: function(x, s) {
             objRegExp = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
             if(x.value && objRegExp.test(x.value) == false) {
                 Ngx.Odb.Form.firstMessage((s || Ngx.Odb.Form.display_name(x.name)) + " must be a valid email id");
                 return false
             }
             else {
                 return true;
             }
         }

    };

    this.create = function() {
        return new Control();
    };


}

Control.prototype = Element;
Control.prototype.constructor = Control;


/* CLASS Date control */

function DateDropdown(x, y, m, d, nullable, range_begin, range_end) {
    this.x = x;
    this.y = y;
    this.m = m;
    this.d = d;
    this.nullable=nullable;
    this.range_begin = range_begin;
    this.range_end = range_end;

    var _this = this;
    this.init_date = function() {
        var day = document.main[_this.d];
        var month = document.main[_this.m];
        var year = document.main[_this.y];
        var dateobj = new Date();
/*        _this.end_year = _this.compareYear(_this.range_begin) ? _this.compareYear(_this.range_begin) : dateobj.getFullYear()+30;
        _this.start_year = _this.compareYear(_this.range_end) ? _this.compareYear(_this.range_end) : 1940;

*/
	 _this.start_year = _this.compareYear(_this.range_begin);
        _this.end_year = _this.compareYear(_this.range_end);

	_this.end_year = _this.end_year ? _this.end_year : dateobj.getFullYear()+30;
	_this.start_year = _this.start_year ? _this.start_year : 1940;
        var init_date = document.main.elements[_this.x].value;
        var init_date_tokens = init_date.split("-");
        var init_year = parseInt(init_date_tokens[0]);
        var init_month = parseInt(init_date_tokens[1]);
        var init_day  = parseInt(init_date_tokens[2]);

        //alert('init date : ' + _this.x + '=' +  init_day + '=' + init_month + '=' + init_year);

        if (this.nullable == 1) {
          day.options[0] =  new Option('', '', false, false);
          month.options[0] =  new Option('', '', false, false);
          year.options[0] =  new Option('', '', false, false);
        }
        for (var i=1; i<= 31 ; i++) {
            var opt;
            if (init_day == i) {
                opt = new Option(i, i, false, false);
            }
            else {
                opt = new Option(i, i, false, false);
            }
            day.options[i] = opt;
        }
        for (var i=1; i<= 12 ; i++) {
            var opt;
            if (init_month == i) {
                opt = new Option(i, i, false, false);
            }
            else {
                opt = new Option(i, i, false, false);
            }
            month.options[i] = opt;
        }
        for (var i=_this.start_year; i<= _this.end_year; i++) {
            var opt;
            if (init_year == i) {
                opt = new Option(i, i, false, false);
            }
            else {
                opt = new Option(i, i, false, false);
            }
            year.options[i-_this.start_year+1] = opt;
        }
    };

	this.compareYear = function(xx)
        {
                var FY = xx.split("-");
                for(var t in FY){
                        if(FY[t]>1000){
                                return FY[t];
                        }
                }
        };





    this.check_date = function(y,m,d) {
         var date = new Date (y,m,d);
         var yy = date.getFullYear();
         var mm = date.getMonth();
         var dd = date.getDate();
         return ((yy == y) && (mm == m) && (dd == d));
    };

    this.recalc_day = function(){
        var day = document.main[_this.d];
        var month = document.main[_this.m];
        var year = document.main[_this.y];
        var sel_day = day.value;
        var sel_month = month.value;
        var sel_year = year.value;
        day.options.length = 0;

        // 0 = jan, 1 = feb, 2 = mar etc
        if (! isNaN(sel_month)) {
             sel_month = sel_month - 1;
        }

        //alert('recalculating days : ' +  sel_day + '=' + sel_month + '=' + sel_year);

        if (_this.nullable == 1) {
          day.options[0] =  new Option('', '', false, false);
        }

        for (var i=1; i<= 31 ; i++) {
            var date_flag=0;
            if (isNaN(sel_year) || sel_year == '' || isNaN(sel_month) || sel_month == '') {
                date_flag=1;
            } else if (this.check_date(sel_year,sel_month,i)) {
                date_flag=1;
            }
            if (date_flag == 1) {
                var opt;
                if (i == sel_day) {
                    opt = new Option(i, i, false, true);
                }
                else {
                    opt = new Option(i, i, false, false);
                }
                day.options[i] = opt;
            }
        }
    };

    this.update_field = function() {
         var field = document.main[_this.x];
         var day_val = parseInt(document.main[_this.d].value);
         var month_val = parseInt(document.main[_this.m].value);
         var year_val = parseInt(document.main[_this.y].value);
         if (!isNaN(day_val) && !isNaN(month_val) && !isNaN(year_val)) {
            field.value = year_val + '-' + month_val + '-' + day_val;
         }
    };

    this.create = function(x, y, m, d, nullable, range_begin, range_end) {
        return new DateDropdown(x, y, m, d, nullable, range_begin, range_end);
    };

}

DateDropdown.prototype = Control;
DateDropdown.prototype.constructor = DateDropdown;

/* CLASS Date control */

function Hobjectpicker( fieldname, fieldname_selected_text, main_div_name, full_base_url , random ) {
    this.fieldname = fieldname;
    this.fieldname_selected_text = fieldname_selected_text;
    this.main_div_name = main_div_name;
    this.full_base_url = full_base_url;
    var _this = this;
    var event_wrapper
    
    this.leaf_nodes = function() {
        var main = document.getElementById(_this.main_div_name);
        var main_lis = main.getElementsByTagName("li");
        if(main_lis.length){
            for(var t=0; t<main_lis.length;t++){
                var inner_ul = main_lis[t].getElementsByTagName("ul");
                var count = main_lis[t].id.split("/");
                if(!inner_ul.length && count.length>2){
                    main_lis[t].className="leaf_node";
                }
            }
        }
    }

    this.show_picker = function() {
       var div_arr = document.getElementsByTagName("div");
       var prefix = _this.main_div_name.slice(0,_this.main_div_name.lastIndexOf("_")+1);
       for(var q=0;q<div_arr.length;q++){
           var div_prefix = div_arr[q].id.search(prefix);
           var div_id = div_arr[q].id;
           if(div_prefix ==0 && div_id != _this.main_div_name){
               div_arr[q].style.visibility="hidden";
           }
           else if(div_prefix ==0 && div_id == _this.main_div_name){
               if(div_arr[q].style.visibility=="hidden") {
                   div_arr[q].style.visibility="visible";
                   _this.selected_item();
                   event_wrapper = Ngx.Odb.Form.createEventListener( document, 'onclick', _this.closepicker, true /*bool*/);
               }
               else {
                   _this.hide();
               }
           }
       }
    };

    this.select_kid = function(xpath,xid) {
        /* copying path to textbox */
        var fld = document.main.elements[_this.fieldname];
        fld.value = xid;
        var elem = document.getElementById(_this.fieldname_selected_text);
        elem.rel = xpath;
        elem.innerHTML = xpath.substring(xpath.indexOf('/')+1);
        if (this.onchange) { 
            this.onchange.call(fld);
        }
        _this.hide();
    };

    this.show_kids = function(xpath,xid) {
        var xelement = document.getElementById(xpath);
        var uls = xelement.getElementsByTagName("ul");
        /* hide all kids */
        _this.hide_kids(xelement.id);
        /* hide/show currently selected item  */
        if(uls.length){
            if(uls[0].style.display=="block") {
                uls[0].style.display="none";
                xelement.style.backgroundImage="url('" + _this.full_base_url + 'themes/Default/images/arrow.gif' +"')";
            }
            else {
                uls[0].style.display="block";
                inner_lis = uls[0].getElementsByTagName("li");
                xelement.style.backgroundImage="url('" + _this.full_base_url + 'themes/Default/images/arrow-open.gif' +"')";
            }
        }
    };


    this.hide_kids = function(xnode_id) {
        var sup = document.getElementById(_this.main_div_name);
        var lis = sup.getElementsByTagName("li");
        for(var j=0; j<lis.length;j++){
            var li_obj = lis[j];
            var place = xnode_id.lastIndexOf("/");
            var last_place = li_obj.id.lastIndexOf("/");
            if((xnode_id != li_obj.id) && (place == last_place)){
                var uls = li_obj.getElementsByTagName("ul");
                if(uls.length){
                    uls[0].style.display="none";
                    li_obj.style.backgroundImage="url('" + _this.full_base_url + 'themes/Default/images/arrow.gif' +"')";
                }
            }
        }
    };



    this.create = function(fieldname, fieldname_selected_text, main_div_name, full_base_url) {
        return new Hobjectpicker(fieldname,fieldname_selected_text, main_div_name, full_base_url);
    };
    
    this.get_element = function(element,member,type){
        /* select only LI */    
        do{
            if (member == "parent"){
                element = element.parentNode;
            }
            else if(member == "child") {
                element = element.firstChild;
            }
            else if(member == "prev_sibling") {
                element = element.previousSibling;
            }
            else if(member == "next_sibling") {
                element = element.nextSibling;
            }
        }while(element && (element.nodeName!=type || element.nodeType!=1) && element.id != "menu");
        return element;
    }
    
    this.get_key = function(ev,xpath,xid){
        var doc_obj = document.getElementById(xpath);
        var key_obj = window.event? event : ev;
        var key_target = key_obj.target || key_obj.srcElement;
        var key_targetid = key_target.id;
        var key = key_obj.keyCode ? key_obj.keyCode : key_obj.charCode;
        if (key == 27){
            _this.hide();
            var elem = document.getElementById(_this.fieldname_selected_text);
            elem.focus();
        }
        if(key==13) {
            if(key_targetid.indexOf("_")>0) {
                var main_div = document.getElementById(_this.main_div_name);
                if(main_div.style.visibility=="hidden") {
                    _this.show_picker();
                    if(doc_obj.rel=="") {
                        var main_div_arr = main_div.getElementsByTagName("a");
                        main_div_arr[0].focus();
                    }
                }
            }
            else {
                _this.select_kid(xpath,xid);
                enter_wrapper = Ngx.Odb.Form.createEventListener( document, 'onkeydown', _this.link_focus, true /*bool*/);
            }
        }
        else if(key == 40){ //down arrow
            doc_obj.blur();
            var sib = _this.get_element(doc_obj,'next_sibling','LI');
            var obj_ul = doc_obj.getElementsByTagName("ul");
            if(obj_ul.length!=0 && obj_ul[0].style.display=="block"){
                var obj_li = obj_ul[0].getElementsByTagName("li");
                var sub_an = obj_li[0].getElementsByTagName("a");
                sub_an[0].focus();
            }
            else if(sib) {
                    var sub_an = sib.getElementsByTagName("a");
                    sub_an[0].focus();
            }
            else
            {
                 _this.next_item(doc_obj);
            }
        }
        else if(key == 38) { //up arrow
            var sib = _this.get_element(doc_obj,'prev_sibling','LI');
            if(sib) {
                _this.prev_item(sib);
            }
            else
            {
                var sib = _this.get_element(doc_obj,'parent','LI');
                if(sib){
                    var sub_an = sib.getElementsByTagName("a");
                    sub_an[0].focus();
                }
            }
        }
        else if(key == 37) { //left arrow
            var sib = _this.get_element(doc_obj,'parent','LI');
            if(sib && sib.id!="menu") {
                var sub_an = sib.getElementsByTagName("a");
                sub_an[0].focus();
                _this.show_kids(sib.id,sib.value);
            }
        }
        else if(key == 39) { //right arrow
            _this.show_kids(xpath,xid);
            var sub_li = doc_obj.getElementsByTagName("li");
            if(sub_li.length) {
                var sub_an = sub_li[0].getElementsByTagName("a");
                sub_an[0].focus();
            }
        }
        
    }
    
    this.prev_item = function(sib){
        var sup_ul = sib.getElementsByTagName("ul");
                if(sup_ul.length==0 || sup_ul[0].style.display=="none"){
                    var sub_an = sib.getElementsByTagName("a");
                    sub_an[0].focus();
                }
                else{
                    var children = sib.getElementsByTagName("li");
                    var child = children[0];
                    var last_child;
                    do{
                        last_child = child;
                        child = _this.get_element(child,'next_sibling','LI');
                    }while(child)
                    var ul = last_child.getElementsByTagName("ul");
                    if(ul.length==0 || ul[0].style.display=="none"){
                        var sub_an = last_child.getElementsByTagName("a");
                        sub_an[0].focus();
                    }
                    else{
                        _this.prev_item(last_child);
                    }
                }
    }
    
    this.next_item = function(doc_obj){
        var par = _this.get_element(doc_obj,'parent','LI');
        if(par){
            var par_sib = _this.get_element(par,'next_sibling','LI');
            if(par_sib){
                var sub_an = par_sib.getElementsByTagName("a");
                sub_an[0].focus();
            }
            else{
                _this.next_item(par);
            }
        }
    }
    
    this.hide = function(){
        var main_div = document.getElementById(_this.main_div_name);
        main_div.style.visibility="hidden";
        var uls = main_div.getElementsByTagName("ul");
        for(var t = 1; t<=uls.length-1; t++){
            if(uls[t].style.display!="none")
            {
                uls[t].style.display="none";
                parent = _this.get_element(uls[t],'parent','LI');
                parent.style.backgroundImage="url('" + _this.full_base_url + 'themes/Default/images/arrow.gif' +"')";
            }
        }
        Ngx.Odb.Form.deleteEventListener( document, 'onclick', event_wrapper, true /*bool*/);
     }
    
    this.click = function(xpath,xid) {
        /* to select a leaf node */
        var obj = document.getElementById(xpath);
        if(obj.className=="leaf_node") {
            _this.select_kid(xpath,xid);
         //   _this.hide();
        }
        else {
            _this.show_kids(xpath,xid);
        }
    }
    
    this.closepicker = function(e) {
        e = e || event;
	var target = e.target || e.srcElement;
	var target_id = target.id || "xyz";
	if(target_id!=_this.fieldname_selected_text && target_id.indexOf('/')=='-1'){
	    _this.hide();
	}
    }
    
    this.selected_item = function() {
        var selected_text = document.getElementById(_this.fieldname_selected_text).rel;
        if(selected_text.indexOf("/")!="-1"){
            var selected_text_arr = selected_text.split("/");
            var elem = document.getElementById(selected_text);
            var an = elem.getElementsByTagName("a");
            for(var y=selected_text_arr.length ; y>2 ;y--){
                elem = _this.get_element(elem,'parent','UL');
                elem.style.display="block";
                elem = _this.get_element(elem,'parent','LI');
                elem.style.backgroundImage="url('" + _this.full_base_url + 'themes/Default/images/arrow-open.gif' +"')";
            }
            an[0].focus();   
        }
        else{
            var picker = document.getElementById(_this.main_div_name);
            lis = picker.getElementsByTagName("LI");
            lis[0].focus();
        }
    }
    
    this.link_focus = function() {
        document.getElementById(_this.fieldname_selected_text).focus();
        Ngx.Odb.Form.deleteEventListener( document, 'onkeydown', enter_wrapper, true /*bool*/);
    }

}

Hobjectpicker.prototype = Control;
Hobjectpicker.prototype.constructor = Hobjectpicker;


/* CLASS Objectpicker
 *
 * This is the replacement for dojo based dependent dropdowns implementation, 
 * We hope it is lighter weight and easier to understand and maintain
 */

function Objectpicker(fname, args) {

    var _this = this;

    this.do_onchange = function(/* event */evt) {
        this.cvalue = this.selectedValue();
        this.onchange(this.selectedName(), this.selectedValue());
    };

    this.onchange = function(name, value) {
        //functions for others to hook 
    };

    /* rows are an array of name, value pairs */
    /* the value can be a string or an object, user should know what they are retrieving */

        
    /* return the name field of selected row */
    this.selectedName = function() {
        return this.form_field.options[this.form_field.selectedIndex].text;
    };
    this.selectedValue = function() {
        return this.form_field.options[this.form_field.selectedIndex].value;
    };

    /* returns the (unflattened) selected row from cached_cdata */
    this.selectedRow = function(s) {
        for (var i=0; i<cdata.length; i++) {
            if (cdata[i][0] == s) {
                return cdata[i][1];
            }
        }
        return null;
    };

    this.check_constraints = function (row) {
       if (!this.constraint_fields) {
           return true;
       }
       for (var i=0; i<this.constraint_fields.length; i++) {
            var cname = this.constraint_fields[i];
            //var cfield = dojo.widget.manager.getWidgetById(cname).form_field;
            var cfield = document.getElementById(cname);
            var cvalue = cfield.options[cfield.selectedIndex].value
            //alert("checking constraint " + cname + " row val " + row[cname] + " con val " + cvalue);
            if (row[cname] &&  cvalue >0 &&
                row[cname] != cvalue )
            {
                //alert("check constraint failed");
                return false;
            }
       }
       return true;
    };

    /* a constrained objectpicker is deemed unconstrained if all of its constraining fields are set to null */

    this.is_unconstrained = function() {
       var result = true;


       if (!this.constraint_fields) {
           return false;
       }
       for (var i=0; i<this.constraint_fields.length; i++) {
            var cname = this.constraint_fields[i];
            var cfield = document.getElementById(cname);
            var cvalue = parseInt(cfield.options[cfield.selectedIndex].value);
            if (cvalue > 0 ) {
                result = false;
                break;
            }
        }
        return result;
    };
        

    /* recalc re-creates the options list of the select box */
    /* based on data, constraints, and values of constraining fields */
    /* while any constraining field set to null acts to relax the constraint by allowing all relevant values */
    /* the end condition of all constraining fields set to null causes this field to become disabled */
    /* this is not a mathematical consequence, but a usability issue */
    /* in that a fully unconstrained user input list which is otherwise constrained, is usually senseless */

    this.recalc = function() {

        if (_this.is_unconstrained()) {
            _this.form_field.options.length = 0;
            _this.form_field.innerHTML = '';
                if (_this.cis_filter>0) {
                    opt = new Option('Select here','', false, false);
                    _this.form_field.options[0] = opt;
                }
                else {
                    opt = new Option(_this.cnull_option_display_name,'', false, false);
                    _this.form_field.options[0] = opt;
                }
                    

            _this.form_field.setAttribute('disabled', true);
            _this.do_onchange();
            return;
        }
        else {
            _this.form_field.removeAttribute('disabled');
        }
          
        if (!_this.cdata) { 
            _this.do_onchange();
            return; 
        }

        _this.form_field.options.length = 0;
        _this.form_field.innerHTML = '';
        var counter = 0;
   
        var optstring = '';
        if (_this.cis_filter>0) {
            opt = new Option('Select here','', false, false);
            _this.form_field.options[counter++] = opt;
        }
        else {
            if (_this.cforce_selection > 0) {
                opt = new Option('Select here','-1', false, false);
            }
            else {
                opt = new Option('Select here','', false, false);
            }
            _this.form_field.options[counter++] = opt;
        }


        //optstring += '<option value=""></option>'

        var selIndex = null;
        var validOptions = 0;
        for (var i=0; i<_this.cdata.length; i++) {
            if (_this.check_constraints(_this.cdata[i][1])) {
                if (_this.cvalue == _this.cdata[i][1].id) {
                    opt = new Option(_this.cdata[i][0],_this.cdata[i][1].id,true, true);
                    selIndex = counter;
                }
                else {
                    opt = new Option(_this.cdata[i][0],_this.cdata[i][1].id,false, false);
                }
                validOptions++;
                _this.form_field.options[counter++] = opt;
            }
        }

        if (selIndex) {
            _this.form_field.selectedIndex = selIndex;
        }

        if (_this.cnull_option > 0 && _this.cis_filter <= 0) {
            opt = new Option(_this.cnull_option_display_name,'', false, false);
            _this.form_field.options[counter++] = opt;
        }
       
        if (_this.cnull_option > 0 && _this.cis_filter>0) {
            opt = new Option(_this.cnull_option_display_name,'null', false, false);
            _this.form_field.options[counter++] = opt;
        }   
            
        if (validOptions == 0) {
            _this.form_field.setAttribute("disabled", true);
        }

        _this.do_onchange();

    };

    this.valuename = function(v) { 
        for (var i=0; i<this.cdata.length; i++) {
            if (this.cdata[i][1].id == v) {
                return cdata[i][0];
            }
        }
        return '';
    };

    /* the qm api, a standardized set of wrappers around organically grown widgets */

    this.q_initialize = function(/* numeric id */ v) {
        for (var i=0; i<this.form_field.options.length; i++) {
            if (this.form_field.options[i].value == v) {
                this.form_field.options[i].selected = true;
            }
            else {
                this.form_field.options[i].selected = false;
            }
        }
    };

    if (fname) {
        this.form_field = document.getElementById(fname);
        this.cforce_selection = parseInt(args.force_selection);
        this.cnull_option = parseInt(args.null_option);
        this.cnull_option_display_name = args.null_option_display_name;
        this.cis_filter = parseInt(args.is_filter);
    
        /* set the style of select input field from args if specified */
        /* don't use setAttribute because IE does not like that for style property */
    
        if (args.style_string) {
            this.form_field.style.cssText = args.style_string;
        }
    
        /* allow data to be sent inline via data argument */
        /* TODO support remote data fetching if required */
    
        if (args.data) {
            this.cdata = JSON.parse(args.data);
        }
    
        this.cvalue = parseInt(args.value);
    
        /* set up constraints on the dataset */
        /* these are typically mapped from foreign key relationships in datamodel */
    
        if (args.constraints) { /* */
    
            this.constraint_fields = JSON.parse(args.constraints);
            for(var i=0; i<this.constraint_fields.length; i++) {
                var c = this.constraint_fields[i];
                //dojo.event.connect(dojo.widget.manager.getWidgetById(c).form_field, "onchange", this, "recalc");
                document.getElementById(c).onchange = this.recalc;
            }
    
        }
    
        /* surface the onchange event of form_field for others to hook */
    
        // dojo.event.connect(this.form_field, "onchange", this, "do_onchange");
    
        /* do the first recalc to create visible/available options list from data given constraints */
    
        this.recalc();
    
        /* initialize with value if present */
    
        if (this.value) {
            this.q_initialize(this.value);
        }
        
        /* disable if required */
    
        document.addOnLoadFunction( function() { if (_this.is_unconstrained()) {
                                                     _this.form_field.setAttribute('disabled', true);
                                                 } 
                                               });
    }
    

    this.create = function(fname, args) {
        return new Objectpicker(fname, args);
    };
}

Objectpicker.prototype = new Control();
Objectpicker.prototype.constructor = Objectpicker;

function  Language()
{
	var _this = this;
        this.pphText=null;
        this.y = 2;

	this.indicChangePos =function()
	{
        	document.getElementById("indicimelayer").style.top=(document.all?document.documentElement.scrollTop:window.pageYOffset)+_this.y+"px";
	}

	this.indicChange = function(id, script)
	{
		this.pphText.setGlobalScript(script);
		document.getElementById('language').value = script.toLowerCase();
	}

 	this.init = function()
	{
		this.lang= "english";
                this.pphText  = new fontHandler();
                this.pphText.convertPageToIndicIME(this.lang, this.indicChange);
                if (document.getElementById("language") != null )
                        {
                                document.getElementById('language').value = this.lang.toLowerCase();
                        }
        }

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('V 1Y(){M t=V(b){J(14 b==\'15\'){b=\'1Z\'}N{b=b.1b()}M c=b;M d={};M e={};M f=0;M g=Q;T.2P=V(){X g};T.20=V(a){X d[a]};T.1h=V(a){X e[a]};M h=V(){K d["69"];K d["79"];K e["69"];K e["79"];K d["1z"];e["2Q"]="\\4l";e["2i"]="\\4m";d["89"]="\\4n";d["21"]="\\4o";d["2j"]=d["22"];d["2k"]=d["22"];K e["1v"];K e["1i"];K e["1j"]};M j=V(){g=W;K e["1M"];K d["1G"];K d["1v"];d["69"]="\\4p";d["1r"]="\\4q";d["79"]="\\4r";d["1s"]="\\4s";d["2R"]=d["23"];d["2S"]=d["23"];d["2T"]=d["23"];K d["2U"];K d["24"];d["2V"]=d["84"];d["68"]=d["84"];d["2W"]=d["84"];d["78"]="\\4t";d["2X"]=d["25"];d["2Y"]=d["25"];d["2Z"]=d["25"];d["4u"]="\\4v";d["30"]="\\4w";d["31"]="\\4x\\4y";d["33"]=d["26"];d["22"]=d["26"];d["34"]=d["26"];d["1T"]="\\4z";d["39"]="\\4A";d["3a"]="\\2l";d["83"]="\\2l";K d["2m"];K d["4B"];K e["1G"];K e["1v"];K e["1i"];K e["1j"];K d["1i"];K d["1j"];e["69"]="\\4C";e["1r"]="\\4D";e["79"]="\\4E";e["1s"]="\\4F";K e["42"];K d["38"];K d["1z"];d["4G"]="\\4H";d["4I"]="\\4J";d["4K"]="\\4L";d["48"]="\\4M";d["2m"]="\\4N\\4O\\2l"};M k=V(){g=W;d["1T"]="\\4P";K e["42"];K d["1z"];K d["38"];e["21"]="\\4Q";e["2Q"]="\\4R";K e["1i"];K e["1j"];d["69"]="\\4S";d["1r"]="\\4T";d["79"]="\\4U";d["1s"]="\\4V";e["69"]="\\4W";e["1r"]="\\4X";e["79"]="\\4Y";e["1s"]="\\4Z"};M l=V(){K e["1M"];K d["38"];K e["58"];K e["72"];K d["1G"];K d["1v"];K d["1i"];K d["1j"];K e["1G"];K e["1v"];K e["1i"];K e["1j"];K d["69"];K d["79"];K d["76"];K d["3b"];K e["1G"];K e["1v"];K e["69"];K e["79"];K d["3c"];d["1z"]="\\59";d["1T"]="\\5a";e["1M"]="\\5b";e["5c"]="\\5d";d["5e"]="\\5f";d["5g"]="\\5h"};M m=V(){g=W;K e["1M"];d["69"]="\\5i";d["1r"]="\\5j";d["79"]="\\5k";d["1s"]="\\5l";d["1T"]="\\5m";d["5n"]="\\5o";K e["42"];K d["38"];K e["1v"];e["69"]="\\5p";e["1r"]="\\5q";e["79"]="\\5r";e["1s"]="\\5s";e["2i"]="\\5t";K e["1i"];K e["1j"];K d["1z"]};M n=V(){g=W;K e["1M"];d["69"]="\\5u";d["1r"]="\\5v";d["79"]="\\5w";d["1s"]="\\5x";d["5y"]="\\5z";K e["42"];K d["38"];e["69"]="\\5A";e["1r"]="\\5B";e["79"]="\\5C";e["1s"]="\\5D";d["70"]="\\3d";d["39"]="\\3d";K e["1i"];K e["1j"];K d["1z"]};M o=V(){K d["69"];K d["79"];d["1T"]="\\5E";d["2j"]="\\3e";d["2k"]="\\3e";d["5F"]="\\5G";K e["69"];K e["79"];e["2i"]="\\5H";K d["1z"];d["21"]="\\5I";d["76"]=d["3f"]};M p=V(){K d["1j"];K d["1i"];K e["1j"];K e["1i"]};M q=V(){d["3g"]="\\5J";d["3h"]="\\5K";e["3g"]="\\5L";e["3h"]="\\5M";e["36"]="\\5N";e["5O"]="\\5P";e["35"]="\\5Q";e["5R"]="\\5S";d["64"]="\\5T"};M r=V(){g=Q;M a=1,1c,1A="";1m(1c 1N d){K d[1c]}1m(1c 1N e){K e[1c]}e["1M"]="\\5U";e["77"]="\\5V";e["58"]="\\3i";e["72"]="\\3i";d["27"]="\\5W";d["65"]="\\3j";d["3k"]="\\3j";d["3l"]="\\5X";d["73"]="\\3m";d["3n"]="\\3m";d["3o"]="\\5Y";d["85"]="\\3p";d["3q"]="\\3p";d["1G"]="\\5Z";d["1i"]="\\60";d["69"]="\\61";d["1r"]="\\62";d["3r"]="\\63";d["79"]="\\66";d["1s"]="\\67";d["3s"]="\\3t";d["3u"]="\\3t";d["23"]="\\3v";d["2R"]="\\6a";d["2S"]="\\6b";d["2T"]="\\6c";d["6d"]="\\6e";d["6f"]="\\6g";d["2U"]="\\6h";d["6i"]="\\3w";d["24"]="\\6j";d["6k"]="\\3x";d["84"]="\\6l";d["2V"]="\\6m";d["68"]="\\6n";d["2W"]="\\6o";d["78"]="\\6p";d["25"]="\\6q";d["2X"]="\\6r";d["2Y"]="\\6s";d["2Z"]="\\6t";d["30"]="\\6u";d["26"]="\\6v";d["31"]="\\3y";d["33"]="\\3y";d["22"]="\\6w";d["34"]="\\6x";d["6y"]="\\6z";d["6A"]="\\6B";d["6C"]="\\3z";d["82"]="\\3z";d["3f"]="\\6D";d["76"]="\\6E";d["2j"]="\\3A";d["2k"]="\\3A";d["3a"]="\\3B";d["83"]="\\3B";d["3b"]="\\3C";d["6F"]="\\6G";d["6H"]="\\6I";d["2m"]="\\3v\\2n\\3C";d["3c"]="\\3w\\2n\\3x";e["42"]="\\6J";d["38"]="\\6K";e["3k"]="\\3D";e["65"]="\\3D";e["3l"]="\\6L";e["73"]="\\3E";e["3n"]="\\3E";e["3o"]="\\6M";e["85"]="\\3F";e["3q"]="\\3F";e["1G"]="\\6N";e["1v"]="\\6O";e["69"]="\\6P";e["1r"]="\\6Q";e["3r"]="\\6R";e["79"]="\\6S";e["1s"]="\\6T";e["3s"]="\\3G";e["3u"]="\\3G";e[a]="\\2n";d["1z"]="\\6U";d["1v"]="\\6V";d["1j"]="\\6W";e["1i"]="\\6X";e["1j"]="\\6Y";d["48"]="\\6Z";d["49"]="\\71";d["50"]="\\74";d["51"]="\\75";d["52"]="\\7a";d["53"]="\\7b";d["54"]="\\7c";d["55"]="\\7d";d["56"]="\\7e";d["57"]="\\7f";M i=0;1m(1c 1N d){1A="";1m(i=0;i<d[1c].1g;i++){1A=1A+1U.1V((d[1c]).2o(i)+f)}d[1c]=1A}1m(1c 1N e){1A="";1m(i=0;i<e[1c].1g;i++){1A=1A+1U.1V((e[1c]).2o(i)+f)}e[1c]=1U.1V((e[1c]).2o(0)+f)}e["27"]="";d["3H"]="\\7g";d["7h"]="\\7i";d["7j"]="\\7k";d["3I"]="\\7l"};T.1O=V(a){c=a.1b();2p(a.1b()){S"2q":f=7m;Y;S"2r":f=7n;Y;S"1Z":f=0;Y;S"2s":f=7o;Y;S"2t":f=7p;Y;S"2u":f=7q;Y;S"2v":f=7r;Y;S"2w":f=7s;Y;S"2x":f=7t;Y}r();2p(a.1b()){S"2r":p();Y;S"1Z":q();Y;S"2s":m();Y;S"2t":l();Y;S"2u":k();Y;S"2v":n();Y;S"2q":o();Y;S"2w":j();Y;S"2x":h();Y}};T.1O(c)};M u=V(){T.Z=32;T.11=Q;T.1B=Q;T.28="";T.1d=Q;T.1e=Q;T.3J=Q;T.1P="1H";T.1n=Q;T.19={};T.1k=0;T.P=""};M v=[];M w=1;M x=7u,2y=x.7v;M y=(/7w/3K).2z(2y)&&(/7x/3K).2z(x.7y);M z=/7z/.2z(2y);M A=7A;M B={};M C=[];M D=Q;M E="7B";T.7C=V(a){A=a};T.7D=V(a){M b=v[a];X(14 b==\'15\')||b.1B?"1H":b.1P};T.1O=V(a,b){M c=v[a];J(14 c==\'15\'){X}J(b){b=b.1b()}J(b&&(b==\'2q\'||b==\'2r\'||b==\'1Z\'||b==\'2s\'||b==\'2t\'||b==\'2u\'||b==\'2v\'||b==\'2w\'||b==\'2x\')){c.1P=b;J(14 B[b]==\'15\'){B[b]=3L t(b)}c.16=B[b];c.1B=Q}N{c.1B=W}};T.7E=V(a){J(!a){a=\'1H\'}J(D){T.1O(E,a)}N{M i;1m(i 1N v){T.1O(i,a)}}};T.2A=V(a,b){J(!b||(14 b!=\'V\')){2B"1Y.2A(): 7F V 3M 3N 3O";}M c=v[a];c.28=b};T.29=V(a){M b=a;b.Z=32;b.11=Q;b.1d=Q;b.1e=Q;b.3J=Q};T.3P=V(a,b){M c=a;M d=0,P=\'\',17=\'\',1w=\'\',1I=\'\',1o=\'\',1x=\'\',1y=Q,1C=\'\';M e=Q,1J=Q,1K=Q,1Q=Q,1f=Q,10=Q,1L=Q,18=Q;c.P=\'\';c.1k=0;17=1U.1V(b);1C=1U.1V(c.Z);1w=c.16.20(c.Z.1a()+b.1a());1I=c.16.1h(c.Z.1a()+b.1a());1o=c.16.20(b.1a());1x=c.16.1h(b.1a());e=(14(1o)!=\'15\');1J=(14(1x)!=\'15\');1K=(14(1w)!=\'15\');1Q=(14(1I)!=\'15\');1f=c.16.2P();10=c.1d;1L=c.1e;18=c.11;2p(17){S"a":S"e":S"i":S"o":S"u":S"A":S"I":S"U":S"O":S"E":S"R":J(10&&!18){J(1f&&17!=\'R\'){d--}P=(!1J)?\'\':1x;J(1C==\'L\'){J(17==\'u\'){b=13}N J(17==\'U\'){b=12}N c.1e=10}N{c.1e=10}c.11=(P==\'\')}N J(1Q&&1L){J(1C!=\'a\'&&(!18||1f)){d--}P=1I;b=32;c.1e=10;c.11=Q}N J(1K){J(1f&&1C==\'R\'&&(17==\'u\'||17==\'U\')){d--}d--;P=1w;b=32;c.1e=10;c.11=Q}N J(e){J(17==\'R\'){J(1f){P=1o+c.16.1h(w)}N{P=(10&&!18?c.16.1h(w):\'\')+1o}}N{P=1o}c.1e=10;c.11=Q}N{c.1e=10;c.11=W}c.1d=Q;Y;S\'^\':J(!10&&1C!="^"){17=\'\'}N J(1K){d--;P=1w}N{P=(1f?\'\':c.16.1h(w))+1o}c.1e=10;c.1d=Q;c.11=(P==\'\');Y;S\' \':1y=W;J(!1f){17=\'\'}c.1e=10;c.1d=Q;c.11=Q;Y;S\'~\':J(c.Z==21||c.Z==35||c.Z==36||c.Z==38||c.Z==42||c.Z==64||c.Z==58||c.Z==3H){J(14 c.16.1h(c.Z.1a())!=\'15\'||14 c.16.20(c.Z.1a())!=\'15\'){d--;P=1C}N{P=17.1a()}b=32}N J(c.Z==3I){J(!18){d--;J(!1f){d--}}P=1C;b=32}N J((1L||c.Z==77||c.Z==78)&&1Q){J(c.Z==78&&1L){d--}N J(c.Z==13||c.Z==12){d-=2}d--;P=1I;b=32}N J(1K){J(c.Z==13||c.Z==12){d--}J(!18){d--}P=1w;b=32}N J(e){P=1o}N J(1J){J(10&&1f){d--}P=1x}N{P=17.1a()}c.1e=10;c.1d=Q;c.11=Q;Y;S\':\':S\'^\':S\'H\':S\'|\':S\'@\':S\'0\':S\'1\':S\'2\':S\'3\':S\'4\':S\'5\':S\'6\':S\'7\':S\'8\':S\'9\':S\'&\':J(1L&&1Q){d--;P=1I;b=32}N J(1K){J(!18){d--}P=1w;b=32}N{P=e?1o:1J?1x:(b>=65&&b<=3Q||b>=27&&b<=24)?\'\':17.1a()}c.1e=10;c.1d=Q;c.11=Q;Y;S\'*\':J(1J&&10&&!18){J(1f){d--;P=1x+c.16.1h(w)}N{P=1x}}N{P=17.1a()}c.11=Q;Y;7G:c.1e=10;J(1K){J(1f){d=18?0:d-2;P=1w+c.16.1h(w)}N{d=(!18)?d-1:0;P=(18&&10&&1L?c.16.1h(w):\'\')+1w}c.1d=W;c.11=Q}N J(e){J(1f){P=1o+c.16.1h(w)}N{P=(10&&!18?c.16.1h(w):\'\')+1o}c.1d=W;c.11=18?Q:18}N J(1Q){d--;P=1I;c.11=Q;c.1d=Q;b=32}N J(1J){J(10){d=18&&!1f?d-1:0}P=1x;c.11=Q;c.1d=Q}N J((b>=27&&b<=24)||(b>=65&&b<=3Q)){c.1d=W;c.11=W}N{P=17.1a();c.1d=Q;c.11=Q}}c.Z=b;c.1k=d;c.P=P;X 1y};T.3R=V(a,b){M c=D?v[E]:v[a],1t=y?b.1t:b.3S,1p;J(14 c==\'15\'){X W}J(D){M d=b.1D?b.1D:b.2a;J((d.1W.1b()=="3T"&&d.3U.1b()=="P")||d.1W.1b()=="3V"){1p=d;c.1n=Q}N J(d.1E.2b&&d.1E.2b.1b()=="3W"){c.1n=W;1p=d.1E}N{X W}J(c.19!=1p){c.19=1p;T.29(c)}J(C[1p.1l]||C[1p.2C]){X W}}J((1t==46)&&z&&c.1n){J(c.19.1u){1p=c.19.1u}N J(c.19.2c){1p=c.19.2c}M s=1p.2D(),r=s.2E(0);J(1p.1q.3X.2d.1g==1&&r.2F.2e&&r.2G==0){b.2H();b.2I();X Q}}N J(1t==A){J(c.1P!=\'1H\'){c.1B=!c.1B}J(c.28){c.28(a,c.1B?"1H":c.1P)}}N J((1t>=37&&1t<=40)||1t==46||1t==8||1t==13){T.29(c)}X W};T.3Y=V(a,b){M c=D?v[E]:v[a],1y=Q;J(14 c==\'15\'||c.1B){X W}M d=c.19;M e=0,s,r,P=\'\',1k=0;J(b.7H||b.7I){X W}e=y?b.1t:b.3S;J((e<32)||(e>=7J)){X W}J(D){M f=b.1D?b.1D:b.2a;J((f.1W.1b()=="3T"&&f.3U.1b()=="P")||f.1W.1b()=="3V"){d=f;c.1n=Q}N J(f.1E.2b&&f.1E.2b.1b()=="3W"){c.1n=W;d=f.1E}N{X W}J(c.19!=d){c.19=d;T.29(c)}J(C[d.1l]||C[d.2C]){X W}}J(c.1n){d=(D&&d.1l?v[d.1l].19:d);J(d.1u){d=d.1u}N J(d.2c){d=d.2c}}J(z&&(e==8||e==45)&&c.1n){s=d.2D();r=s.2E(0);J(r.2F==d.1q.3X.7K&&r.2G==0){b.2H();b.2I();X Q}}1y=T.3P(c,e);P=c.P;1k=c.1k;J(y){M g=d.1q?d.1q:d;r=g.7L.2J();r.7M(\'7N\',1k);r.P=(r.P.7O(r.P.1g-1)==\' \'?P+\' \':P);r.7P(W);r.7Q();b.1y=1y;b.7R=W}N{J(c.1n){M h,1F,2K="",2L="";s=d.2D();J(d.1q){d=d.1q}J(14(s)!=\'15\'){r=s.2E(0)}N{r=d.2J()}h=r.2F;1F=r.2G;J(h.7S==3){2K=h.2e.2f(0,1F+1k);2L=h.2e.2f(1F)}N{M i=d.7T(P);J(h.2d.1g>0&&h.2d[1F].1W=="7U"){h.7V(i,h.2d[1F])}N{h.7W(i)}h=i;1F=0}h.2e=(2K+P.1a()+2L.1a());r=d.2J();M j=1F+1k+P.1g;J(j<0){j=0}r.7X(h,j);r.7Y(h,j);s.7Z();s.80(r)}N{M k=d.3Z,41=d.43,44=d.47;J(14(P)!=\'15\'&&(P.1g!=0||1k!=0)){d.1X=d.1X.2f(0,d.3Z+1k)+P+d.1X.2f(d.81,d.1X.1g);k=k+P.1g+1k;J(k<0){k=0}d.86(k,k);d.43=41;d.47=44}}J(!1y){b.2H();b.2I()}}X 1y};T.2M=V(a,b){M c=v[a];J(y&&c.19.1u){X c.19.1u.2N}N{X(4a.2N)?4a.2N:b}};M F=V(a){X v[a].19};M G=V(b,c,d){J(!c.1R){c.1R=V(e){M a=(e.1D?e.1D:e.2a);a=(a.1l?a.1l:a.1E.1l);e=c.2M(a,e);X c.3Y(a,e)}}J(!c.1S){c.1S=V(e){M a=(e.1D?e.1D:e.2a);a=(a.1l?a.1l:a.1E.1l);e=c.2M(a,e);X c.3R(a,e)}}M f=F(b);J(f.1u){f=f.1u.1q}N J(f.4b){f=f.4b}J(!z){J(d){f.4c("4d",c.1R);f.4c("4e",c.1S)}N{f.4f("4d",c.1R);f.4f("4e",c.1S)}}N{J(d){f.4g("4h",c.1R,W);f.4g("4i",c.1S,W)}N{f.4j("4h",c.1R,W);f.4j("4i",c.1S,W)}}};T.2g=V(a,b,c,d){J(14 d==\'15\'||d==2O){d=W}J(!c){c=\'1H\'}J(!b){J(a){b=1q.87(a);J(y){M e=1q.88[a];J(e){J(e.1g){1m(M i=0;i<e.1g;i++){J(e[i].2C==a){b=e[i];Y}}}N{b=e}}N{b=2O}}J(!b){2B"1Y.2g(): 4k 3M 3N 3O";}}N{2B"1Y.2g(): 8a 1X 8b 1m 8c 4k 8d 8e";}}J(!a){a=\'8f\'+(v.1g)}v[a]=3L u();M f=v[a];f.1P=c.1b();f.19=b;f.1n=b.1u?W:Q;J(f.1n){b.1u.1q.1l=a}N{b.1l=a}T.1O(a,c);J(d){G(a,T,Q)}};T.8g=V(a,b,c,d){J(!a){a=\'1H\'}J(!c){c=""}J(14 d==\'15\'||d==2O){d=W}D=W;M e=c.8h(","),i=0,2h="";1m(;i<e.1g;i++){2h=e[i];J(2h!=""){C[2h]=W}}T.2g(E,1q,a,d);J(b){T.2A(E,b)}};T.8i=V(a){J(!a){X}G(a,T,W);K v[a]};T.8j=V(){J(!D){X}D=Q;G(E,T,W);K v[E];1m(M a 1N C){K C[a]}}};',62,516,'|||||||||||||||||||||||||||||||||||||||||||||if|delete||var|else||text|false||case|this||function|true|return|break|prevkey|pc|hidden|||typeof|undefined|il|keychar|hdn|elementObject|toString|toLowerCase|key|previousConsonant|previouspreviousConsonant|hls|length|getMod|13126|12126|displace|_indicId|for|isIFrame|base|element|document|101|111|keyCode|contentWindow|8285|bComb|mod|returnValue|7977|result|isEng|prevkeychar|target|ownerDocument|offset|82117|english|mComb|tmod|tbcomb|ppc|77126|in|setScript|language|tmcomb|kblistener|kbposition|114114|String|fromCharCode|nodeName|value|fontHandler|devanagari|getBase|126|98|107|122|116|112|97|callbackName|reset|srcElement|designMode|defaultView|childNodes|nodeValue|substring|convertToIndicIME|str|9785|118|119|u0bb7|120|u094d|charCodeAt|switch|bengali|gujarati|malayalam|gurmukhi|telugu|kannada|tamil|oriya|ua|test|onScriptChange|throw|id|getSelection|getRangeAt|startContainer|startOffset|preventDefault|stopPropagation|createRange|s1|s2|getEventObject|event|null|halfLetterScript|9773|107104|103|103104|67104|84104|68104|116104|100|100104|110|102||112104|98104|||||7676|115104|83104|71121|u0cde|u09f1|108|69126|79126|u0903|u0906|9797|105|u0908|101101|117|u090a|111111|97105|97117|u0914|111117|u0915|u091c|u091e|u092b|u0930|u0935|u0936|u0937|u093e|u0940|u0942|u094c|124|94|specialMode|gi|new|is|not|valid|getNext|90|keydownHandler|which|input|type|textarea|on|body|keypressHandler|selectionStart||st||scrollTop|sl|||scrollLeft|||window|contentDocument|detachEvent|onkeypress|onkeydown|attachEvent|removeEventListener|keypress|keydown|addEventListener|ElementName|u0b56|u0b57|u0b5f|u0b70|u0b8f|u0b8e|u0b93|u0b92|u0ba3|7878|u0ba8|u0ba9|u0b83|u0baa|u0bb1|u0bb4|74104|u0bc7|u0bc6|u0bcb|u0bca|4964|u0bf0|4938|u0bf1|49126|u0bf2|u0030|u0b95|u0bcd|u0c31|u0c55|u0c56|u0c0f|u0c0e|u0c13|u0c12|u0c47|u0c46|u0c4b|u0c4a||||||||||u0a74|u0a5c|u0a70|78126|u0a71|7382|u0a72|8582|u0a73|u0d0f|u0d0e|u0d13|u0d12|u0d31|122104|u0d34|u0d47|u0d46|u0d4b|u0d4a|u0d57|u0c8f|u0c8e|u0c93|u0c92|82114|u0cb1|u0cc7|u0cc6|u0ccb|u0cca|u09f0|116126|u09ce|u09d7|u09fa|u090e|u0912|u0946|u094a|u0951|3636|u0952|u0953|3535|u0954|u0970|u0901|u0902|u0905|u0907|u0909|u090b|u090c|u090d|u090f|u0910|||u0911|u0913|||u0916|u0917|u0918|7871|u0919|99104|u091a|u091b|106|u091d|7889|u091f|u0920|u0921|u0922|u0923|u0924|u0925|u0926|u0927|u0928|u092a|u092c|u092d|109|u092e|121|u092f|114|u0932|u0933|115|u0938|104|u0939|u093c|u093d|u093f|u0941|u0943|u0944|u0945|u0947|u0948|u0949|u094b|u0950|u0960|u0961|u0962|u0963|u0966||u0967|||u0968|u0969|||||u096a|u096b|u096c|u096d|u096e|u096f|u0964|124124|u0965|9494|u200c|u200d|128|384|1024|256|768|896|640|512|navigator|userAgent|MSIE|Explorer|appName|Gecko|123|_globalIndicIME|setToggleKey|getScript|setGlobalScript|Callback|default|altKey|ctrlKey|127|firstChild|selection|moveStart|character|charAt|collapse|select|cancelBubble|nodeType|createTextNode|BR|insertBefore|appendChild|setStart|setEnd|removeAllRanges|addRange|selectionEnd|||||setSelectionRange|getElementById|all||No|found|argument|or|ElementObject|indicime_|convertPageToIndicIME|split|convertToDefault|convertPageToDefault'.split('|'),0,{}));

        this.create = function() {
           return new Language();
        };

}
Language.prototype = new Control();
Language.prototype.constructor = Language;

/* GLOBAL Ngx */

var Ngx = { 

    Odb: {
        Form: new Form(),
        Control: new Control(),
        DateDropdown: new DateDropdown(),
        Objectpicker: new Objectpicker(),
        Hobjectpicker: new Hobjectpicker(),
        CommonUtil: new CommonUtil(),
	Language: new  Language()
    }

}

var pphObject = Ngx.Odb.Language.create();
pphObject.init();
function CommonUtil() {

             
    this.initNavigator = function() {
        this.navigator.appCodeName = navigator.appCodeName;
        this.navigator.appMinorVersion = navigator.appMinorVersion;
        this.navigator.appName = navigator.appName;
        this.navigator.appVersion = navigator.appVersion;
        this.navigator.cookieEnabled = navigator.cookieEnabled;
        this.navigator.cpuClass = navigator.cpuClass;
        this.navigator.onLine = navigator.onLine;
        this.navigator.platform = navigator.platform;
        this.navigator.userAgent = navigator.userAgent;
        this.navigator.browserLanguage = navigator.browserLanguage;
        this.navigator.systemLanguage = navigator.systemLanguage;
        this.navigator.userLanguage = navigator.userLanguage;
    };

    this.initialize = function() { 
        this.initNavigator();
    };    
    // CONSTRUCTOR CommonUtil

    this.navigator = {};

    this.create = function() {
        return this;
    };
}

CommonUtil.prototype = new Element();
CommonUtil.prototype.constructor = CommonUtil;

