/* Class Document (ver 1.0.1 - July 16 2008)  */
if (typeof Base == 'undefined') var Base = {};

var ReqNormalColor = '#fff';
var ReqValueColor = '#F3D528';
var NumericValues = "0123456789.";
var TextValues = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_.,#'";
var TextNumericValues = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_.,#'0123456789";
var returnElements = [];

// http://pietschsoft.com/post/2007/07/Creating-Namespaces-in-JavaScript-is-actually-rather-simple.aspx
// http://www.javascriptkit.com/jsref/navigator.shtml
// http://www.dustindiaz.com/top-ten-javascript/

if (!Base.Browser) Base.Browser = {};
/*
Base.Browser = {
Name : 'Browser',
Msgbox : function(msg){alert(msg);},
Confirm : function(msg){return confirm(msg);},
Confirm2 : function(msg){return confirm(msg);},
Return : {
Test1 : 'Allo',
Test2 : function(){
alert(Test1);		
}
}
}
*/
/* BROWSER CLASS  */
function Browser() {
    this.IE = false;
    this.FF = false;
    this.OP = false;
    this.SA = false;
    this.KR = false;
    this.NA = false;
    this.Name = '';
    this.Version = 0;
    this.MinorVersion = 0;
    this.Platform = '';
    this.userAgent = '';
    this.Language = '';
    this.Parse();
    //alert('Fureteur:' + this.Name + ' ,Version: ' + this.Version);
}
Browser.prototype.Parse = function Parse() {
    try {
        var i;
        var props;
        var prop;

        this.GetBrowser()

        switch (this.Name) {
            case "IE":
                props = navigator.userAgent.split(';');
                if (props[1] != '' || props[1] != 'undefined' || props[1] != null) { this.Version = this.ParseVersion(props[1], 6); }
                break;
            case "FF":
                props = navigator.userAgent.split('/');
                if (props[3] != '' || props[3] != 'undefined' || props[3] != null) { this.Version = this.ParseVersion(props[3], 2); } break;
            case "OP":

                break;
            case "SA":

                break;
            case "NS":

                break;
            case "KR":

                break;
            default:
                break;
        }
        this.GetPlatform();
        this.GetLanguage();
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
}
Browser.prototype.ParseVersion = function ParseVersion(prop, def) {
    try {
        if (prop.indexOf("1.") != -1) { this.Version = 1; return 1; }
        else if (prop.indexOf("2.") != -1) { this.Version = 2; return 2; }
        else if (prop.indexOf("3.") != -1) { this.Version = 3; return 3; }
        else if (prop.indexOf("4.") != -1) { this.Version = 4; return 4; }
        else if (prop.indexOf("5.") != -1) { this.Version = 5; return 5; }
        else if (prop.indexOf("6.") != -1) { this.Version = 6; return 6; }
        else if (prop.indexOf("7.") != -1) { this.Version = 7; return 7; }
        else if (prop.indexOf("8.") != -1) { this.Version = 8; return 8; }
        else if (prop.indexOf("9.") != -1) { this.Version = 9; return 9; }
        else if (prop.indexOf("10.") != -1) { this.Version = 10; return 10; }
    } catch (err) {
        ShowError(err,GetmethodName());
        if (def == '' || def == '' || def == '') { return def; }
        else { return 0; }
    }
};
Browser.prototype.Version = function Version() {
    return this.Version;
};
Browser.prototype.Name = function Name() {
    return this.Name;
};
Browser.prototype.UserAgent = function UserAgent() {
    return this.UserAgent ;
};
Browser.prototype.Platform = function Platform() {
    return this.Platform;
};
Browser.prototype.GetPlatform = function GetPlatform() {
    var OS = navigator.platform.toLowerCase();
    if (OS.indexOf("win") != -1) { this.Platform = 'Windows'; }
    else if (OS.indexOf("mac") != -1) { this.Platform = 'Mac'; }
    else if (OS.indexOf("unix") != -1) { this.Platform = 'Unix'; }
    else if (OS.indexOf("linux") != -1) { this.Platform = 'Linux'; }
    else { this.Platform = 'Unknown'; }
};
Browser.prototype.GetBrowser = function GetBrowser() {
    if (navigator.userAgent.indexOf("MSIE") != -1) { this.IE = true; this.Name = "IE"; }
    else if (navigator.userAgent.indexOf("Firefox") != -1) { this.FF = true; this.Name = "FF"; }
    else if (navigator.userAgent.indexOf("Navigator") != -1 || navigator.userAgent.indexOf("Netscape") != -1) { this.NS = true; this.Name = "NS"; }
    else if (navigator.userAgent.indexOf("Opera") != -1) { this.OP = true; this.Name = "OP"; }
    else if (navigator.userAgent.indexOf("Safari") != -1) { this.SA = true; this.Name = "SA"; }
    else if (navigator.userAgent.indexOf("Konqueror") != -1) { this.KR = true; this.Name = "KR"; }
    else { this.NA = true; this.Name = "NA"; }
    this.userAgent = navigator.userAgent;
};
/*
Browser.prototype.GetBrowserVersion = function(){
if (navigator.userAgent.indexOf("1.") != -1){this.Version=1;}
else if(navigator.userAgent.indexOf("2.") != -1){this.Version = 2;}
else if(navigator.userAgent.indexOf("3.") != -1){this.Version = 3;}
else if(navigator.userAgent.indexOf("4.") != -1){this.Version = 4;}
else if(navigator.userAgent.indexOf("5.") != -1){this.Version = 5;}
else if(navigator.userAgent.indexOf("6.") != -1){this.Version = 6;}
else if(navigator.userAgent.indexOf("7.") != -1){this.Version = 7;}
else if(navigator.userAgent.indexOf("8.") != -1){this.Version = 8;}
else if(navigator.userAgent.indexOf("9.") != -1){this.Version = 9;}
else if(navigator.userAgent.indexOf("10.") != -1){this.Version = 10;}
    
//navigator.appVersion
    
    
};
*/
Browser.prototype.Close = function Close() {
    try {
        // <a href="javascript:window.opener='x';window.close();">Close</a>
        window.opener = 'x';
        window.close();
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
Browser.prototype.PageName = function PageName() {
    try {
        var sPath = window.location.pathname;
        var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
        return sPage;
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    }
};
Browser.prototype.GetLanguage = function Language() {
    try {
        var langCode = navigator.language || navigator.systemLanguage;
        var lang = langCode.toLowerCase();
        lang = lang.substr(0, 2);
        //var dest = window.location.href; 

        //        for (i=langcodes.length-1;i >= 0; i--){
        //            if (lang==langcodes[i]){
        //                dest = dest.substr(0,dest.lastIndexOf('.')) + '-' + lang.substr(0,2) + dest.substr(dest.lastIndexOf('.')); 
        //                window.location.replace ?window.location.replace(dest) :window.location=dest;
        //            }
        //        }	

        this.Language = lang;


        //		// IE.
        //		try{return navigator.userLanguage;}
        //		catch(err){}

        //		// FF.
        //		try{return navigator.language;}
        //		catch(err){}

        return ("NA");
    } catch (err) {
        ShowError(err,GetmethodName());
        return "NA";
    }
};
/* PROPERTIES CLASS  */
function Properties() {
    this.position = 'absolute';
    this.height = '';
    this.width = '';
    this.top = '';
    this.left = '';
    this.top = '';
    this.visibility = 'hidden';
    this.display = 'none';
    this.opacity = 0;
    this.showDelay = 0;
    this.hideDelay = 0;
    this.value = '';
    this.values = '';
    this.checked = false;
    this.src = '';
    this.href = '';
    this.alt = '';
    this.target = '_blank';
    this.background = '';
    this.backgroundImageURL = '';
    this.border = '0px';
    this.zindex = 0;
}
Properties.prototype.GetCenterScreenPosition = function GetCenterScreenPosition(element) {
    var _DOC = new Document();

    try {
        if ((elementID == null || elementID == 'undefined' || elementID == '') || (className == null || className == 'undefined' || className == '')) { return false; }
        ele = this.GetElementById(elementID);
        if (ele == null || ele == 'undefined' || ele == '') { return false; }
        
        
        return true;
    } catch (err) {
        ShowError(err,GetmethodName());
        return false;
    }
};
//  addEvent(window,'load',func1,false);
Properties.prototype.AddEvent = function AddEvent(element, eventName, methodName, useCapture) {

    try {
        if (element.addEventListener) {
            element.addEventListener(eventName, methodName, useCapture);
            return true;
        }
        else if (element.attachEvent) {
            var r = element.attachEvent('on' + eventName, methodName);
            return r;
        }
        else {
            element['on' + eventName] = methodName;
        }
    } catch (err) {

    } finally {

    }
};
/* DOCUMENT CLASS  */
function Document() {
    var iaz_preserved_elements = [];
    var iaz_preserved_zindexes = [];
}
Document.prototype.GetMouseX = function GetMouseX(obj) {
    try {
        var X = 0;
        if (obj != '' && obj != 'undefined' & obj != null) { X = event.x - obj.offsetLeft; }
        else { X = event.x; }
        return X;
    } catch (err) {
        ShowError(err,GetmethodName());
        return 0;
    }
};
Document.prototype.GetMouseY = function GetMouseY(obj) {
    try {
        var Y = 0;
        if (obj != '' && obj != 'undefined' & obj != null) { Y = event.y - obj.offsetTop; }
        else { Y = event.y; }
        return Y;
    } catch (err) {
        ShowError(err,GetmethodName());
        return 0;
    }
};
Document.prototype.GetCursorPosition = function GetCursorPosition(obj) {
    var curleft = 0;
    var curtop = 0;
    try {
        if (obj.offsetParent) {
            do {
                curleft += obj.offsetLeft;
                curtop += obj.offsetTop;
            } while (obj == obj.offsetParent);
            return [curleft, curtop];
        }
    } catch (err) {
        ShowError(err,GetmethodName());
        return 0;
    }
};
Document.prototype.GetElementPosition = function GetElementPosition(parentContainer, elementID) {
    var eID = this.GetElementValueById(elementID);
    try {
        items = parentContainer.getElementsByTagName(eID.tagName);
        found = 0;
        for (p = 0; p < items.length; p++) {
            if (items[p] == eID) { found = 1; break; }
        }
        if (found) { return p; }
        else { return -1; }
    } catch (err) {
        ShowError(err,GetmethodName());
        return 0;
    }
};
Document.prototype.GetElementPositionEx = function GetElementPositionEx(element) {
    var result = new Object();
    result.x = 0;
    result.y = 0;
    result.width = 0;
    result.height = 0;
    if (element.offsetParent) {
        result.x = element.offsetLeft;
        result.y = element.offsetTop;
        var parent = element.offsetParent;
        while (parent) {
            result.x += parent.offsetLeft;
            result.y += parent.offsetTop;
            var parentTagName = parent.tagName.toLowerCase();
            if (parentTagName != "table" &&
                parentTagName != "body" &&
                parentTagName != "html" &&
                parentTagName != "div" &&
                parent.clientTop &&
                parent.clientLeft) {
                result.x += parent.clientLeft;
                result.y += parent.clientTop;
            }
            parent = parent.offsetParent;
        }
    }
    else if (element.left && element.top) {
        result.x = element.left;
        result.y = element.top;
    }
    else {
        if (element.x) { result.x = element.x; }
        if (element.y) { result.y = element.y; }
    }
    if (element.offsetWidth && element.offsetHeight) {
        result.width = element.offsetWidth;
        result.height = element.offsetHeight;
    }
    else if (element.style && element.style.pixelWidth && element.style.pixelHeight) {
        result.width = element.style.pixelWidth;
        result.height = element.style.pixelHeight;
    }
    return result;
};
Document.prototype.GetPosition = function GetPosition(element) {
    var result = new Object();
    result.x = 0;
    result.y = 0;
    var positionX = 0;
    var positionY = 0;
    while (element != null) {
        positionX += element.offsetLeft;
        positionY += element.offsetTop;
        element = element.offsetParent;
    }
    //return [positionX, positionY];
    //return result;
    result.x = positionX;
    result.y = positionY;
    return result;
};
Document.prototype.IsElementExisting = function IsElementExisting(elementName) {
    var obj = null;
    try {
        if (document.getElementById) {
            obj = document.getElementById(elementName);
        } else if (document.layers) {
            obj = document.layers[elementName];
        } else if (document.all) {
            obj = document.all[elementName];
        } else { return false; }
        if (obj != null && obj != 'undefined' & obj != '') {
            return true;
        } else {
            return false;
        }
    } catch (err) {
        ShowError(err,GetmethodName());
        return false;
    }
};
Document.prototype.GetElementsByTagName = function GetElementsByTagName(tag, id) {
    var elements;
    var eles;
    try {
        if (tag == '') { return null; }
        if (id != '') {
            eles = document.getElementsByTagName(tag);
            if (eles != 'undefined' && eles != '' && eles.length > 0) {
                for (i = 0; i < eles.length; i++) {
                    if (eles[i].id == id) {
                        elements.push(eles[i]);
                    }
                }
            } else { return null; }
        } else { elements = document.getElementsByTagName(tag); }
        return elements;
    } catch (err) {
        ShowError(err,GetmethodName());
        return 0;
    }
};
Document.prototype.GetElementByTagNameAndID = function GetElementByTagNameAndID(tag, id) {
    var oStrings = new Strings();
    var elements;
    var eles;
    try {
        if (tag == '') { return null; }
        if (id != '') {
            eles = document.getElementsByTagName(tag);
            if (eles != 'undefined' && eles != '' && eles.length > 0) {
                for (i = 0; i < eles.length; i++) {
                    if (eles[i].id.indexOf(id) > 0) {
                        name = oStrings.Right(eles[i].id, id.length);
                        if (name == id) {
                            return eles[i];
                        }
                    }
                }
            } else { return null; }
        } else { return null; }
        return null;
    } catch (err) {
        ShowError(err,GetmethodName());
        return 0;
    } finally { delete oStrings;}
};
Document.prototype.GetElements = function GetElements(parentName, tag) {
    try {
        var elements;
        var eles;
        var parent = this.GetElementById(parentName);
        if (parent == null || parent == 'undefined' || parent == '') { return null; }
        if (parent.hasChildNodes()) {
            if (tag != '' && tag != 'undefined' && tag != null) {
                eles = parent.getElementsByTagName(tag);
                if (eles != 'undefined' && eles != '' && eles.length > 0) {
                    return eles;
                } else { return null; }
            } else {
                eles = parent.getElementsByTagName("*");
                for (i = 0; i < eles.length; i++) {
                    if (eles[i].nodeValue != 'empty') {
                        elements.push(eles[i]);
                    }
                }
                return elements;
            }
        } else {
            return null;
        }
    } catch (err) {
        ShowError(err,GetmethodName());
        return 'undefined';
    }
};
Document.prototype.GetNodeTextType = function GetNodeTextType(node) {
    if (node == '' || node == 'undefined') { return 0; }
    switch (node.nodeType) {
        case 1: return 'ELEMENT_NODE';
        case 2: return 'ATTRIBUTE_NODE';
        case 3: return 'TEXT_NODE';
        case 4: return 'CDATA_SECTION_NODE';
        case 5: return 'ENTITY_REFERENCE_NODE';
        case 6: return 'ENTITY_NODE';
        case 7: return 'PROCESSING_INSTRUCTION_NODE';
        case 8: return 'COMMENT_NODE';
        case 9: return 'DOCUMENT_NODE';
        case 10: return 'DOCUMENT_TYPE_NODE';
        case 11: return 'DOCUMENT_FRAGMENT_NODE';
        case 12: return 'NOTATION_NODE';
    }
};
Document.prototype.GetElementById = function GetElementById(elementId, tagName) {
    var obj = null;
    try {
        if (elementId == '' || elementId == null || elementId == 'undefined') { return ''; }
        if (document.getElementById) {
            try {
                //if (tagName == '') { tagName = '*'; }
                obj = document.getElementById(elementId);
                if (obj != null && obj != undefined && obj != 'undefined' && obj != '') { return obj; }
                obj = this.GetASPElementByPartOfId(elementId);
                if (obj != null && obj != undefined && obj != 'undefined' && obj != '') { return obj; }
                obj = this.GetElementByPartOfId(elementId);
                if (obj != null && obj != undefined && obj != 'undefined' && obj != '') { return obj; }
                if (tagName != 'undefined' && tagName != undefined && tagName != '' && tagName != null) {
                    obj = this.GetParentElementByTagName(elementId + '_0', tagName.toUpperCase());
                }
                if (obj != null && obj != undefined && obj != 'undefined' && obj != '') { return obj; }
                obj = this.GetASPNetControl(elementId, tagName);
                if (obj != null && obj != undefined && obj != 'undefined' && obj != '') { return obj; }
                return null;

            } catch (Error) {
                return this.GetASPElementByPartOfId(elementId);
            }
        }
        else if (document.all) { return document.all[elementId]; }
        else { return null; }
    } catch (err) {
        ShowError(err,GetmethodName());
        return null;
    }
};
Document.prototype.GetASPElementByPartOfId = function GetASPElementByPartOfId(elementId) {
    var oStrings = new Strings();
    var name = '';

    try {
        if (elementId == '' || elementId == null || elementId == 'undefined') { return null; }
        for (i = 0; i < document.forms[0].elements.length; i++) {
            if (document.forms[0].elements[i].id.indexOf(elementId) > 0) {
                name = oStrings.Right(document.forms[0].elements[i].id, elementId.length);
                if (name == elementId) {
                    return document.forms[0].elements[i];
                }
            }
        }
        return null;
    } catch (err) {
        ShowError(err,GetmethodName());
        return null;
    } finally { delete oStrings; }
};
Document.prototype.GetElementByPartOfId = function GetElementByPartOfId(elementId) {
    var oStrings = new Strings();
    var obj;
    var name = '';
    var cnt = 0;

    try {
        if (elementId == '' || elementId == null || elementId == 'undefined') { return null; }
        for (i = 0; i < document.forms[0].elements.length; i++) {
            obj = document.forms[0].elements[i];
            name = obj.getAttribute("name");  // UniqueID
            if (name != null && name != '' && name != 'undefined') {
                if (name.toLowerCase() == elementId.toLowerCase()) {
                    return document.forms[0].elements[i];
                }
            }
        }
        return null;
    } catch (err) {
        //ShowError(err,GetmethodName());
        return null;
    } finally { delete oStrings; }
};
Document.prototype.GetASPNetControl = function GetASPNetControl(elementId, tagName) {
    try {
        if (tagName == 'undefined' || tagName == undefined || tagName == '' || tagName == null) { tagName = "*"; }
        var arObj = document.getElementsByTagName(tagName);
        var serverCtrlName = elementId.replace(/_/g, "$");
        var regExId = new RegExp(elementId + "$", "ig");

        for (var i = 0; i < arObj.length; i++) {
            if (arObj[i].id) {
                if (arObj[i].id.match(regExId))
                    return arObj[i];
            } else if (arObj[i].name) {
                arObj[i].name == serverCtrlName;
                return arObj[i];
            }
        }
        return null;
    } catch (err) {

    } finally {

    }
};
Document.prototype.GetAllChildsElement = function GetAllChildsElement(obj, tagName) {
    var oStrings = new Strings();
    try {
        if (obj == '' || obj == null || obj == 'undefined') { return; }
        if (!this.IsObject(obj)) {
            obj = this.GetElementById(obj, tagName);
            if (obj == '' || obj == null || obj == 'undefined') { return; }
        }

        if (returnElements == null || returnElements == '' || returnElements == 'undefined' || returnElements == undefined) { returnElements = []; }

        for (var i = 0; i < obj.childNodes.length; ++i) {
            returnElements.push(obj.childNodes[i]);
            if (obj.childNodes.length > 0) {
                this.GetAllChildsElement(obj.childNodes[i]);
            }
        }
        return;
    } catch (err) {
        ShowError(err,GetmethodName());
        return null;
    } finally { delete oStrings; }
};
Document.prototype.GetASPListCheckCountById = function GetASPListCheckCountById(elementId) {
    var oStrings = new Strings();
    var name = '';
    var cnt = 0;

    try {
        if (elementId == '' || elementId == null || elementId == 'undefined') { return null; }
        for (i = 0; i < document.forms[0].elements.length; i++) {
            if (document.forms[0].elements[i].id.indexOf(elementId + '_') > 0) {
                if (document.forms[0].elements[i].checked) {
                    cnt = cnt + 1
                }
            }
        }
        return cnt;
    } catch (err) {
        ShowError(err,GetmethodName());
        return null;
    } finally { delete oStrings; }
};
Document.prototype.GetASPListItemsCountById = function GetASPListItemsCountById(elementId) {
    var oStrings = new Strings();
    var name = '';
    var cnt = 0;
    var TagName;

    try {
        if (elementId == '' || elementId == null || elementId == 'undefined') { return null; }
        for (i = 0; i < document.forms[0].elements.length; i++) {
            if (document.forms[0].elements[i].id.indexOf(elementId + '_') > 0) {
                TagName = document.forms[0].elements[i].tagName;
                if (document.forms[0].elements[i].tagName == 'INPUT') {
                    var attr = document.forms[0].elements[i].getAttribute("type").toUpperCase();
                    if (attr != null && attr != 'undefined' && attr != '' && (attr == 'CHECKBOX' || attr == 'RADIOBUTTON')) {
                        cnt = cnt + 1
                    }
                }
            }
        }
        return cnt;
    } catch (err) {
        ShowError(err,GetmethodName());
        return null;
    } finally { delete oStrings; }
};
Document.prototype.GetElementClassNameById = function GetElementClassNameById(elementId) {
    var e;
    try {
        if (elementId == '' || elementId == null || elementId == 'undefined') { return ''; }
        if (document.getElementById) { e = document.getElementById(elementId); }
        else if (document.all) { e = document.all[elementId]; }
        else { return ''; }
        return e.className;
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    }
};
Document.prototype.GetParentElementClassNameById = function GetParentElementClassNameById(elementId, parentTagName) {
    var p, o;
    try {
        if (elementId == '' || elementId == null || elementId == 'undefined') { return ''; }
        o = this.GetElementById(elementId);
        p = this.FindParentWithTagFromElement(o, parentTagName);
        return p.className;
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    }
};
Document.prototype.GetParentElementByTagName = function GetParentElementByTagName(elementId, parentTagName) {
    var p, o;
    try {
        if (elementId == '' || elementId == null || elementId == 'undefined') { return ''; }
        o = this.GetElementById(elementId);
        p = this.FindParentWithTagFromElement(o, parentTagName);
        return p;
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    }
};
Document.prototype.GetElementTagName = function GetElementTagName(elementId) {
    try {
        if (elementId == '' || elementId == null || elementId == 'undefined') { return ''; }
        return this.GetElementById(elementId).tagName;
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    }
};
Document.prototype.GetElementsByClassName = function GetElementsByClassName(className, tag, elm) {
    var testClass;
    var elements;
    var returnElements = [];
    var current;
    var length;
    try {
        testClass = new RegExp("(^|\\\\s)" + className + "(\\\\s|$)");
        tag = tag || "*";
        elm = elm || document;
        elements = (tag == "*" && elm.all) ? elm.all : elm.getElementsByTagName(tag);
        length = elements.length;

        for (var i = 0; i < length; i++) {
            current = elements[i];
            if (testClass.test(current.className)) { returnElements.push(current); }
        }
        return returnElements;
    } catch (err) {
        ShowError(err,GetmethodName());
        return 0;
    }
};
Document.prototype.GetElementByClassName = function GetElementByClassName(className, tag, elm) {
    var testClass;
    var elements;
    var current;
    var length;
    try {
        testClass = new RegExp("(^|\\\\s)" + className + "(\\\\s|$)");
        tag = tag || "*";
        elm = elm || document;
        elements = (tag == "*" && elm.all) ? elm.all : elm.getElementsByTagName(tag);
        length = elements.length;

        for (var i = 0; i < length; i++) {
            current = elements[i];
            if (testClass.test(current.className)) {
                return current;
            }
        }
        return null;
    } catch (err) {
        ShowError(err,GetmethodName());
        return null;
    }
};
Document.prototype.SetElementClassName = function SetElementClassName(elementID, className) {
    var testClass;
    var ele;
    var current;
    var length;
    try {
        if ((elementID == null || elementID == 'undefined' || elementID == '') || (className == null || className == 'undefined' || className == '')) { return false; }
        ele = this.GetElementById(elementID);
        if (ele == null || ele == 'undefined' || ele == '') { return false; }
        ele.className = className;
        return true;
    } catch (err) {
        ShowError(err,GetmethodName());
        return false;
    }
};
Document.prototype.FindParentWithTagFromName = function FindParentWithTagFromName(elementName, parentTagName) {
    try {
        var el = this.GetElementById(elementName);
        if (el == null || el == 'undefined' || el == '') { return 'undefined'; }
        var parent = el.parentNode;
        if (parent == null || parent == 'undefined' || parent == '') { return 'undefined'; }
        if (parent) {
            if (parent.tagName == parentTagName) {
                return parent;
            } else {
                return this.FindParentWithTagFromName(parent.id, parentTagName);
            }
        } else {
            return null;
        }
    } catch (err) {
        ShowError(err,GetmethodName());
        return 'undefined';
    }
};
Document.prototype.FindParentWithTagFromElement = function FindParentWithTagFromElement(element, parentTagName) {
    try {
        if (element == null || element == 'undefined' || element == '') { return 'undefined'; }
        var parent = element.parentNode;
        if (parent == null || parent == 'undefined' || parent == '') { return 'undefined'; }
        if (parent) {
            if (parent.tagName == parentTagName) {
                return parent;
            } else {
                return this.FindParentWithTagFromElement(parent, parentTagName);
            }
        } else {
            return null;
        }
    } catch (err) {
        ShowError(err,GetmethodName());
        return 'undefined';
    }
};
Document.prototype.SetElementValueById = function SetElementValueById(elementId, value) {
    var oString;
    try {
        var obj = this.GetElementById(elementId);
        if (obj != 'undefined' && obj != '' && obj != null) {
            var tagName = this.GetElementTagName(elementId);
            tagName = tagName.toUpperCase();
            switch (tagName) {
                case 'LABEL':
                    if (value == 'undefined' || value == null) { return; }
                    //obj.innerText=value;
                    obj.innerHTML = value;
                    break;
                case 'INPUT':
                    var attr = obj.getAttribute("type").toUpperCase();
                    switch (attr) {
                        case 'TEXT':
                            if (value == 'undefined' || value == null) { value = ''; }
                            obj.value = value;
                            break;
                        case 'CHECKBOX':
                            if (value == '' || value == 'undefined' || value == null) { obj.checked = false; }
                            if (value == true || value == 'true' || value == 'checked') { obj.checked = true; }
                            else if (value == false || value == 'false' || value == 'unchecked') { obj.checked = false; }
                            else { obj.checked = false; }
                            break;
                        case 'HIDDEN':
                            if (value == 'undefined' || value == null) { value = ''; }
                            obj.value = value;
                            break;
                        default:
                            obj.value = value;
                            break;
                    }
                    break;
                case 'P':
                    if (value == 'undefined' || value == null) { return; }
                    obj.innerHTML = value;
                    break;
                case 'SELECT':
                    var list = this.GetElementById(elementId);
                    oString = new Strings;
                    var index;
                    if (oString.IsNumericKey(value)) {
                        list.selectedIndex = value;
                    } else {
                        for (index = 0; index < list.options.length; index++) {
                            if (list.options[index].text.toLowerCase() == value.toLowerCase()) {
                                list.selectedIndex = index;
                                break;
                            }
                        }
                    }
                    break;
                default:
                    obj.value = value;
                    break;
            }
        }
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    } finally { delete oString; }
};
Document.prototype.IsElementAttribute = function IsElementAttribute(elementId, attribute) {
    try {
        var obj = this.GetElementById(elementId);
        if (obj != 'undefined' && obj != '' && obj != null) {
            return obj.hasAttribute(attribute);
        }
        return false;
    } catch (err) {
        ShowError(err,GetmethodName());
        return false;
    }
    return isset;
};
Document.prototype.SetElementAttributeById = function SetElementAttributeById(elementId, attribute, value) {
    try {
        var obj = this.GetElementById(elementId);
        if (obj != 'undefined' && obj != '' && obj != null) {
            obj.setAttribute(attribute, value);
        }
        return true;
    } catch (err) {
        ShowError(err,GetmethodName());
        return false;
    }
};
Document.prototype.GetElementAttributeById = function GetElementAttributeById(elementId, attribute) {
    try {
        var obj = this.GetElementById(elementId);
        if (obj != 'undefined' && obj != '' && obj != null) {
            return obj.getAttribute(attribute);
        }
        return '';
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    }
};
Document.prototype.GetElementValueById = function GetElementValueById(elementId) {
    var element = null;
    try {
        /*
        element = this.GetElementById(elementId);
        if (element != null && element != undefined && element != 'undefined' && element != '') {
        return element.value;
        } else {
        return '';
        }
        
        if (document.getElementById) { return document.getElementById(elementId).value; }
        else if (document.all) { return document.all[elementId].value; }
        else { return ''; }
        */


        var obj = this.GetElementById(elementId);
        if (obj != 'undefined' && obj != '' && obj != null) {
            var tagName = this.GetElementTagName(elementId);
            tagName = tagName.toUpperCase();
            switch (tagName) {
                case 'LABEL': return obj.innerHTML; break;
                case 'INPUT':
                    var attr = obj.getAttribute("type").toUpperCase();
                    switch (attr) {
                        case 'TEXT': return obj.value; break;
                        case 'CHECKBOX': return obj.checked; break;
                        case 'HIDDEN': return obj.value; break;
                        default: return obj.value; break;
                    }
                    break;
                case 'SELECT':
                    var value = '';
                    if (-1 < obj.selectedIndex) {
                        var opt = obj.options[obj.selectedIndex];
                        value = opt.value;
                        if (!value && !('value' in opt))
                            value = opt.text;
                    }
                    return value;

                    //return obj.value; break;
                case "TEXTAREA":
                    return obj.value; 
                    break;
                default: obj.value = value; break;
            }
        }
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    }
};
Document.prototype.GetElementTextById = function GetElementTextById(elementId) {
    var element = null;
    try {
        var obj = this.GetElementById(elementId);
        if (obj != 'undefined' && obj != '' && obj != null) {
            var tagName = this.GetElementTagName(elementId);
            tagName = tagName.toUpperCase();
            switch (tagName) {
                case 'LABEL': return obj.innerHTML; break;
                case 'INPUT':
                    var attr = obj.getAttribute("type").toUpperCase();
                    switch (attr) {
                        case 'TEXT': return obj.value; break;
                        case 'CHECKBOX': return obj.checked; break;
                        case 'HIDDEN': return obj.value; break;
                        default: return obj.value; break;
                    }
                    break;
                case 'SELECT':
                    var value = '';
                    if (-1 < obj.selectedIndex) {
                        var opt = obj.options[obj.selectedIndex];
                        value = opt.innerHTML;
                        if (!value && !('value' in opt))
                            value = opt.innerHTML;
                    }
                    return value;

                    return obj.value; break;
                default: obj.value = value; break;
            }
        }
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    }
};
Document.prototype.GetElementValueByIdEx = function GetElementValueByIdEx(elementId) {
    try {
        return this.GetElementById(elementId).value;
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    }
};
Document.prototype.IsObject = function IsObject(obj) {
    if (obj != '' && obj != 'undefined' && obj != null) {
        if (typeof (obj) == 'undefined') { return false; }
        else if (typeof (obj) == 'object') { return true; }
        else if (typeof (obj) == 'string') { return false; }
        else { return false; }
    } else { return false; }
};
Document.prototype.GetTargetElementByEvent = function GetTargetElementByEvent(evt) {
    var elem = null;
    try {
        if (evt.target) {
            elem = (evt.target.nodeType == 3) ? evt.target.parentNode : evt.target
        } else {
            elem = evt.srcElement
        }
        return elem
    } catch (err) {
        ShowError(err,GetmethodName());
        return null;
    }
};
Document.prototype.CreateElementByTagName = function CreateElementByTagName(tag, id, runat, cssclass, height, width, top, left, href, target, src, alt) {
    var elem = null;
    try {
        if (tag == undefined) { return null; }
        if (id == 'undefined' || id == undefined || id == '' || id == null) { id = DynamicID(); }
        elem = document.createElement(tag);
        if (elem == 'undefined' || elem == undefined || elem == '' || elem == null) { return null; }
        if ((runat != 'undefined' || runat != undefined || runat != '' || runat != null) && runat == true) { elem.setAttribute("runat", "server"); }
        if (cssclass != 'undefined' || cssclass != undefined || cssclass != '' || cssclass != null) {
            if ((runat != 'undefined' || runat != undefined || runat != '' || runat != null) && runat == true) { elem.setAttribute("cssclass", cssclass); }
            else { elem.setAttribute("class", cssclass); }
        }

        if (height == 'undefined' || height == undefined || height == '' || height == null) { elem.style.height = height; }
        if (width == 'undefined' || width == undefined || width == '' || width == null) { elem.style.width = width; }
        if (top == 'undefined' || top == undefined || top == '' || top == null) { elem.style.top = top; }
        if (left == 'undefined' || left == undefined || left == '' || href == null) { elem.style.left = left; }

        if (href == 'undefined' || href == undefined || href == '' || href == null) { elem.setAttribute("href", href); }
        if (target == 'undefined' || target == undefined || target == '' || target == null) { elem.setAttribute("target", target); }
        if (src == 'undefined' || src == undefined || src == '' || src == null) { elem.setAttribute("src", src); }
        if (alt == 'undefined' || alt == undefined || alt == '' || alt == null) { elem.setAttribute("alt", alt); }

        if (href == 'undefined' || href == undefined || href == '' || href == null) { elem.setAttribute("href", href); }
        if (href == 'undefined' || href == undefined || href == '' || href == null) { elem.setAttribute("href", href); }
        if (href == 'undefined' || href == undefined || href == '' || href == null) { elem.setAttribute("href", href); }
        if (href == 'undefined' || href == undefined || href == '' || href == null) { elem.setAttribute("href", href); }

        return elem
    } catch (err) {
        ShowError(err,GetmethodName());
        return null;
    }
};
Document.prototype.AddElement = function AddElement(parentID, tagName, ID, props) {
    var elem = null;
    try {
        if (parentID == undefined || parentID == 'undefined' || parentID == '' || parentID == null) { parentID = document.body; }
        if (ID == undefined) { ID = DynamicID(); }
        switch (tagName.toUpperCase()) {
            case "DIV":
                var div = document.createElement("DIV");
                div.style.position = props.position;
                div.style.top = props.top;
                div.style.left = props.left;
                div.style.height = props.height;
                div.style.width = props.width;
                div.style.visibility = props.visibility;
                div.style.display = props.display;
                div.style.backgroundImage = "url(" + props.backgroundImageURL + ")";
                div.style.zIndex = props.zindex;
                div.style.borderWidth = '0px';
                div.style.borderStyle = 'none';
                //div.style.borderColor = 'transparent';
                div.id = "oDynDiv_" + this.DynamicID()

                //div.setAttribute("", path);

                parentID.appendChild(div);

                var ancestor = GetElementAncestor(div.id);
                var Zindex = GetNextHighestZindex(ancestor);

                //this.SetElementZindex(div.id, Zindex, document.body);

                break;
            case 'IFRAME':

                break;
            case 'LINK':
                var link = document.createElement("img");
                linkPDF.setAttribute("href", path);
                linkPDF.setAttribute("target", "_blank");
                linkPDF.appendChild(document.createTextNode(text));


                break;
            case 'TABLE':

                break;
            case 'TBODY':

                break;
            case 'TR':

                break;
            case 'TD':

                break;
            case 'LABEL':

                break;
            case 'TEXT':

                break;
            case 'P':

                break;
            case 'UL':

                break;
            case 'LI':

                break;
            case 'LIST':

                break;
            case 'HIDDEN':

                break;
            case 'SELECT':

                break;
            case 'OPTION':

                break;
            case 'IMG':
                var img = document.createElement("img");
                img.style.position = props.position;
                img.style.top = props.top;
                img.style.left = props.left;
                img.style.height = props.height;
                img.style.width = props.width;
                img.style.visibility = props.visibility;
                img.style.display = props.display;
                img.style.src = props.backgroundImageURL;
                img.style.zIndex = props.zindex;
                img.style.borderWidth = '0px';
                img.style.borderStyle = 'none';
                //div.style.borderColor = 'transparent';
                img.id = "oDynImg_" + this.DynamicID()

                //div.setAttribute("", path);

                parentID.appendChild(img);

                //elem.style.backgroundImage = "url(" + DOC_PIC + ")";
                break;
            default:
                return null;
        }
        return elem
    } catch (err) {
        ShowError(err,GetmethodName());
        return null;
    }
};
Document.prototype.SetElementZindex = function SetElementZindex(element_id, zindex, context_id) {
// http://mahzeh.org/?p=23
    
    // Element Position Style Must be 'Absolute' to work... 
    
    try {
        if (undefined == zindex) { zindex = 1; }
        //var context = (undefined == context_id ? $(context_id) : $(document.body));
        var context = document.body;
        var element = $(element_id);
        var elements = document.getElementsByTagName('html')[0].ancestors(); 
        
        

        // undo past ie_apply_zindex()
        for (i = iaz_preserved_elements.length - 1; i >= 0; i--) {
            iaz_preserved_elements[i].setStyle({ 'z-index': iaz_preserved_zindexes[i] });
        }
        iaz_preserved_elements = [];
        iaz_preserved_zindexes = [];

        // find relative-positioned ancestors of element within context
        element.ancestors().each(
          function(ancestor) {
              if ('relative' == ancestor.getStyle('position')) {
                  // preserve ancestor's current z-index
                  iaz_preserved_elements.push(ancestor);
                  iaz_preserved_zindexes.push(ancestor.getStyle('z-index'));

                  // apply z-index to ancestor
                  ancestor.setStyle({ 'z-index': zindex });
              }
              if (ancestor == context) { throw $break; }
          }
        )
    } catch (err) {
      ShowError(err,GetmethodName());
      return null;
    }   
};
Document.prototype.GetNextHighestZindex = function GetNextHighestZindex(obj) {
    var highestIndex = 0;
    var currentIndex = 0;
    var elArray;
    try {
        elArray = Array();
        if (obj) { elArray = obj.getElementsByTagName('*'); } else { elArray = document.getElementsByTagName('*'); }
        for (var i = 0; i < elArray.length; i++) {
            if (elArray[i].currentStyle) {
                currentIndex = parseFloat(elArray[i].currentStyle['zIndex']);
            } else if (window.getComputedStyle) {
                currentIndex = parseFloat(document.defaultView.getComputedStyle(elArray[i], null).getPropertyValue('z-index'));
            }
            if (!isNaN(currentIndex) && currentIndex > highestIndex) { highestIndex = currentIndex; }
        }
        return (highestIndex + 1);
    } catch (err) {
        ShowError(err,GetmethodName());
        return 10000;
    } finally {

    }
};
Document.prototype.GetElementAncestor = function GetElementAncestor(objID) {
    try {
        var obj = GetElementById(objID);
        if (obj == undefined || obj == 'undefined' || obj == '' || obj == null) { return document.body; }
        obj = obj.parentNode;
        while (!obj.id && obj != document.body)
            obj = obj.parentNode;
        return obj;
    } catch (err) {
        ShowError(err,GetmethodName());
        return document.body;
    }
}; 
Document.prototype.DynamicID = function DynamicID() {

    try {
        var randNumber = Math.random() + '';
        return randNumber.substring(2, randNumber.length - 2); 
    } catch (err) {
        ShowError(err,GetmethodName());
        return 0;
    }
};
Document.prototype.AddEventListener = function AddEventListener(elementID, event, handlerFunction) {
    //    if (element == undefined || element == 'undefined' || element == '' || element == null) { return false; }
    //    if (element == undefined || element == 'undefined' || element == '' || element == null) { return false; }
    //    if (element == undefined || element == 'undefined' || element == '' || element == null) { return false; }
    if (!IsValidParams(arguments, 3)) { return false; }
    var oDOC = new Document();
    var element = this.GetElementById(elementID);
    
    try {
        if (element == undefined || element == 'undefined' || element == '' || element == null) { return false; }
        if (element.addEventListener) { // DOM W3C
            element.addEventListener(event, handlerFunction, false);
        }
        else if (element.attachEvent) { // IE5.x
            element.attachEvent('on' + event, handlerFunction);
        }
    } catch (err) {
        ShowError(err,GetmethodName());
    } finally {
        delete oDOC;

    }
};
Document.prototype.GetElementShortName = function GetElementShortName(obj) {
    var oObj;
    var oStrings = new Strings();
    try {
        if (this.IsObject(obj)) { oObj = obj; }
        else { oObj = this.GetElementById(obj); }

        if (oObj != 'undefined' && oObj != '' && oObj != null) {
            if (oStrings.Left(oObj.id, 6) == "ctl00_") {
                return oStrings.Right(oObj.id, oObj.id.length - oObj.id.lastIndexOf("_") - 1);
            } else { return oObj.id; }
        } else { return ''; }
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    } finally { delete oStrings; }
};
Document.prototype.SetFocus = function SetFocus(elementID) {
    try {
        aField = this.GetASPElementByPartOfId(elementID);
        setTimeout("aField.focus()", 50);

    } catch (err) {
        ShowError(err,GetmethodName());
    }
}
/* COOKIES CLASS  */
function Cookies() { }
Cookies.prototype.DelCookie = function DelCookie(sName) {

    try {
        document.cookie = sName + "=" + getCookie(sName) + "; expires=" + (new Date()).toGMTString() + ";";
        return true;
    } catch (err) {
        ShowError(err,GetmethodName());
        return false;
    }
};
Cookies.prototype.SetCookie = function SetCookie(name, value) {
    if (document.cookie != document.cookie) { index = document.cookie.indexOf(name); }
    else { index = -1; }

    if (index == -1) {
        var _value = (value == '' || value == 'undefined' || value == null) ? '' : value;
        document.cookie = name + "=" + _value + "; expires=Monday, 04-Apr-2010 05:00:00 GMT";
    }
};
Cookies.prototype.GetCookie = function GetCookie(name) {
    var i, index;
    var value = '';
    try {
        if (document.cookie) {
            index = document.cookie.indexOf(name);
            if (index != -1) {
                var sections = document.cookie.split(';');
                for (i = 0; i < sections.length; i++) {
                    var section = sections[i].split('=');
                    if (section[0].replace(" ", "") == name.replace(" ", "")) {
                        value = section[1];
                        if (value != '' && value != 'undefined' && value != null) { return value; }
                    }
                }
            }
        }
        return '';
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    }
};

/* STRING CLASS  */
function Strings() {
    this._Document = new Document();
}
Strings.prototype.SubString = function SubString(value, start, length) {
    return String(value).substring(start, length);
};
Strings.prototype.Left = function Left(value, length) {
    if (length <= 0) {
        return "";
    } else if (length > String(value).length) {
        return str;
    } else {
        return String(value).substring(0, length);
    }
};
Strings.prototype.Right = function Right(value, length) {
    if (length <= 0) {
        return "";
    } else if (length > String(value).length) {
        return str;
    } else {
        var iLen = String(value).length;
        return String(value).substring(iLen, iLen - length);
    }
};
Strings.prototype.Trim = function Trim(value) {
    try {
        return RTrim(LTrim(value));
    } catch (err) {
        ShowError(err,GetmethodName());
        return value.replace(/^\s+|\s+$/g, '');
    }
};
Strings.prototype.LTrim = function LTrim(value) {
    var whitespace = new String(" \t\n\r");
    var s = new String(value);

    if (whitespace.indexOf(s.charAt(0)) != -1) {
        var j = 0, i = s.length;
        while (j < i && whitespace.indexOf(s.charAt(j)) != -1) {
            j++;
            s = s.substring(j, i);
        }
    }
    return s;
};
Strings.prototype.RTrim = function RTrim(value) {
    var whitespace = new String(" \t\n\r");
    var s = new String(value);

    if (whitespace.indexOf(s.charAt(s.length - 1)) != -1) {
        var i = s.length - 1;

        while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) {
            i--;
            s = s.substring(0, i + 1);
        }
    }
    return s;
};
Strings.prototype.InStr = function InStr(strSearch, SearchFor) {
    var i;
    try {
        for (i = 0; i < strSearch.length; i++) {
            if (SearchFor == strSearch.charAt(i)) {
                return i;
            }
        }
        return -1;
    } catch (err) {
        ShowError(err,GetmethodName());
    }
};
Strings.prototype.InStrRev = function InStrRev(strSearch, SearchFor) {
    var i;
    var c;
    try {
        for (i = ((strSearch.length) - 1); i >= 0; i--) {
            c = strSearch.charAt(i);
            if (SearchFor == c) {
                return i;
            }
        }
        return -1;
    } catch (err) {
        ShowError(err,GetmethodName());
    }
};
/*
Strings.prototype.IsEmpty = function IsEmpty(elementID) {
    var obj = this._Document.GetElementById(elementID);
    var value = '';

    try {
        if (obj != '' && obj != 'undefined' && obj != null) {
            return true;
        } else {
            value = obj.value;

        }
    } catch (err) {
        ShowError(err,GetmethodName());
        if (this.Trim(elementID) == '') { return true; }
        else { return false; }
    }
};*/
//Strings.prototype.IsNumeric = function IsNumeric(n){if(n*1==NaN)return false;else return true;};
Strings.prototype.IsNumeric = function isNumeric(x) {
    var RegExp = /^(-)?(\d*)(\.?)(\d*)$/; // Note: this WILL allow a number that ends in a decimal: -452. 
    var result = x.match(RegExp);
    if (result == null) { result = false; }
    return result;
};

/* CONVERT CLASS  */
function Convert(obj) { }
Convert.prototype.Dec2Hex = function Dec2Hex(s) { return (s < 15.5 ? '0' : '') + Math.round(s).toString(16); };
Convert.prototype.Hex2Dec = function Hex2Dec(s) { return parseInt(s, 16); };
Convert.prototype.Val2Hex = function Val2Hex(s) { return s.value.toLowerCase().replace(/[^\da-f]/g, '').replace(/^(\w)(\w)(\w)$/, '$1$1$2$2$3$3'); };

/* GUI CLASS  */
function GUI(obj) {
    /* Inherits Document Class.*/
    /* GUI.prototype = new Document; */
    var _Document = new Document();
    this._Document = new Document();
    this._Timer = 0;
    this._element = null;
    var hideMilliseconds;
    /* this.ClassName=cname; */

    if (obj != '' && obj != 'undefined' && obj != null) {
        if (typeof (obj) == 'undefined') {
            this._element = null;
            return;
        } else if (typeof (obj) == 'object') {
            this._element = obj;
            this.Name = obj.id;
        } else if (typeof (obj) == 'string') {
            this._element = _Document.GetElementById(obj);
            //this._element=this.GetElementById(obj);
            this.Name = obj;
        } else {
            this._element = null;
            return;
        }
    }
}
// correct the constructor pointer because it points to GUI
//GUI.prototype.constructor = GUI;
GUI.prototype.ClearTimer = function ClearTimer() {
    try {
        clearTimeout(this._Timer);
        this._Timer = null;
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
GUI.prototype.Show = function Show(opacity) {
    try {
        if (this._element == '' || this._element == 'undefined' || this._element == null) { return; }
        this.ChangeVisibility(true);
        if (opacity > 0) {
            if (opacity != '' && opacity != 'undefined' && opacity != null) { this.ChangeOpacity(opacity); }
        }
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
GUI.prototype.Hide = function Hide() {
    try {
        if (this._element == '' || this._element == 'undefined' || this._element == null) { return; }
        this.ChangeVisibility(false);
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
GUI.prototype.ShowDelay = function ShowDelay(value) {
    try {
        if (this._element == '' || this._element == 'undefined' || this._element == null) { return; }
        //this.ChangeVisibility(true);
        //this.SetOpacityEx(

    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
GUI.prototype.HideDelay = function HideDelay(milliseconds) {
    var thisObj;
    try {
        if (this._element == '' || this._element == 'undefined' || this._element == null) { return; }
        thisObj = this;
        this._Timer = setTimeout(function() { thisObj.Hide(); }, milliseconds);
        //_Timer=setTimeout(function(){thisObj.SetOpacityEx(85,0,1000);}, milliseconds);
        //_Timer=setTimeout("GUI.prototype.Hide()",milliseconds);
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
GUI.prototype.SetOpacity = function SetOpacity(value) {
    try {
        if (this._element == '' || this._element == 'undefined' || this._element == null) { return; }
        if (value > 10) { value = 10; }
        this._element.style.opacity = value / 10;
        this._element.style.filter = 'alpha(opacity=' + value * 10 + ')';
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
GUI.prototype.SetOpacityEx = function SetOpacityEx(opacityStart, opacityEnd, milliseconds) {
    var speed;
    var opacityTimer = 0;
    var i;
    var thisObj;
    try {
        if (this._element == '' || this._element == 'undefined' || this._element == null) { return; }
        speed = Math.round(milliseconds / 100);
        thisObj = this;

        if (opacityStart > opacityEnd) {
            if (!thisObj.IsVisible()) {
                thisObj.ChangeOpacity(0);
                thisObj.ChangeVisibility(true);
            }
            for (i = opacityStart; i >= opacityEnd; i--) {
                //setTimeout("this.ChangeOpacity(" + i + "," + this._element.id + ")",(opacityTimer * speed));
                setTimeout(function() { thisObj.ChangeOpacity(i, thisObj._element.id); }, (opacityTimer * speed));
                opacityTimer++;
                this._Document.SetElementValueById("Y", i);
            }
        } else if (opacityStart < opacityEnd) {
            if (!thisObj.IsVisible()) {
                thisObj.ChangeVisibility(true);
                if (opacityStart <= 0) { thisObj.ChangeOpacity(0); }
            }
            for (i = opacityStart; i <= opacityEnd; i++) {
                //setTimeout("this.ChangeOpacity(" + i + "," + this._element.id + ")",(opacityTimer * speed));
                setTimeout(function() { thisObj.ChangeOpacity(i, thisObj._element.id); }, (opacityTimer * speed));
                opacityTimer++;
                this._Document.SetElementValueById("Y", i);
            }
        }
    } catch (err) {
        ShowError(err,GetmethodName());
        return 0;
    }
};
GUI.prototype.ChangeOpacity = function ChangeOpacity(opacity, elementID, displayStyle) {
    var obj;
    try {
        if (this._element == '' || this._element == 'undefined' || this._element == null) { obj = elementID; }
        if (this._element == '' || this._element == 'undefined' || this._element == null) { if (obj == '' || obj == 'undefined' || obj == null) { return; } }
        else { obj = this._element; }

        if (opacity > 0) { if (!this.IsVisible()) { this.ChangeVisibility(true); } }
        else if (opacity <= 0) { if (this.IsVisible()) { this.ChangeVisibility(false); } }

        obj.style.opacity = (opacity / 100);
        obj.style.MozOpacity = (opacity / 100);
        obj.style.KhtmlOpacity = (opacity / 100);
        obj.style.filter = "alpha(opacity=" + opacity + ")";

        this._Document.SetElementValueById("X", opacity)

        if (opacity > 0) {
            if (displayStyle != '' && displayStyle != 'undefined' & displayStyle != null) {
                obj.style.display = displayStyle;
            } else {
                obj.style.display = 'block';
            }
        } else { obj.style.display = 'none'; }
    } catch (err) {
        ShowError(err,GetmethodName());
        return 0;
    }
};
GUI.prototype.ChangeVisibility = function ChangeVisibility(visible) {
    try {
        if (this._Document.IsElementExisting(this._element.id)) {
            if (this._element == '' || this._element == 'undefined' || this._element == null) { return; }
            if (document.getElementById) {
                if (visible == true) { this._element.style.visibility = "visible"; }
                else { this._element.style.visibility = "hidden"; }
            } else if (document.layers) {
                if (visible == true) { document.layers[this._element.id].visibility = "show"; }
                else { document.layers[this._element.id].visibility = "hide"; }
            } else if (document.all) {
                if (visible == true) { document.all[this._element.id].style.visibility = "visible"; }
                else { document.all[this._element.id].style.visibility = "hidden"; }
            } else { return; }
        } else { return; }
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
GUI.prototype.IsVisible = function IsVisible() {
    try {
        if (this._Document.IsElementExisting(this._element.id)) {
            if (this._element == '' || this._element == 'undefined' || this._element == null) { return; }
            if (document.getElementById) {
                if (this._element.style.visibility == "visible") { return true; }
                else if (this._element.style.visibility == "hidden") { return false; }
                else { return false; }
            } else if (document.layers) {
                if (document.layers[this._element.id].visibility == "show") { return true; }
                else if (document.layers[this._element.id].visibility == "hide") { return false }
                else { return false; }
            } else if (document.all) {
                if (document.all[this._element.id].style.visibility == "visible") { return true; }
                else if (document.all[this._element.id].style.visibility == "hidden") { return false }
                else { return false; }
            } else { return; }
        } else { return; }
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
GUI.prototype.SetElementBGcolor = function SetElementBGcolor(elementId, color) {
    var _doc = new Document;
    var obj;
    try {
        if (document.getElementById) { obj = _doc.GetElementById(elementId); }
        else if (document.all) { obj = document.all[elementId]; }
        else { return false; }

        if (obj != '' && obj != 'undefined' && obj != null) {
            if (color == '' || color == 'undefined' || color == null) { return false; }
            else {
                switch (obj.tagName.toUpperCase()) {
                    case 'TABLE':
                        obj.style.border = '1';
                        obj.style.borderColor = color;
                        break;
                    default:
                        obj.style.backgroundColor = color;
                        obj.style.bgColor = color;
                        obj.bgColor = color;
                        break;
                }
            }
        }
    } catch (err) {
        ShowError(err, GetmethodName());
        return null;
    } finally {
        delete _doc;
    }
};
GUI.prototype.SetListElementBGColor = function SetListElementBGColor(elementId, color) {
    var _doc = new Document;
    var obj;
    try {
        returnElements = [];

        _doc.GetAllChildsElement(elementId, 'TABLE');
        for (var i = 0; i < returnElements.length; i++) {
            try {
                returnElements[i].style.backgroundColor = color;
                returnElements[i].style.borderColor = color;
                returnElements[i].bgColor = color;
            } catch (err) { }
        }
        return;
    } catch (err) {
        ShowError(err,GetmethodName());
        return null;
    } finally {
        delete _doc;
    }
};
GUI.prototype.RGBToHex = function RGBToHex(rgb) {
    try {
        var chars = "0123456789ABCDEF"
        return String(chars.charAt(Math.floor(rgb / 16))) + String(chars.charAt(rgb - (Math.floor(rgb / 16) * 16)));
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    }
};

/*  VALIDATION CLASS  */
function Validation() {
    this._Document = new Document();
    this._GUI = new GUI();
    this._String = new Strings();
}
Validation.prototype.IsEmpty = function IsEmpty(objName, highlightBG) {
    try {
        var obj = this._Document.GetElementById(objName);
        if (obj == '' || obj == 'undefined' || obj == null) { return false; }
        var Value = this._Document.GetElementValueById(objName);

        if (Value == '') {
            Value = this._Document.GetElementValueByIdEx(objName);
        }
        if (Value != '') {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
            return false;
        } else {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return true;
        }
    } catch (err) {
        ShowError(err,GetmethodName());
        return true;
    }
};
Validation.prototype.IsNumericValue = function IsNumericValue(IsNumericValueobjName, highlightBG) {
    try {
        var obj = this._Document.GetElementById(objName);
        var n = this._Document.GetElementValueById(objName);

        if (n == '') { return false; }
        if (this.TestRegex(obj, "10")) {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
            return true;
        } else {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return false;
        }
    } catch (err) {
        if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); };
        ShowError(err,GetmethodName());
        return true;
    }
};
/*
Validation.prototype.IsTextValue = function(objName,highlightBG){
try{
var obj=this._Document.GetElementById(objName);
var v=obj.value;
var IsText=true;
var c,i;
		
while(i < v.length){
    		c=v.charAt(i);
    		if(TextValues.indexOf(c) == -1){IsText=false;break;}
    		i++;
}
if(IsText){
if(highlightBG==true){this._GUI.SetElementBGcolor(objName,ReqNormalColor);}
return true;
}else{
if(highlightBG == true){this._GUI.SetElementBGcolor(objName,ReqValueColor);}
return false;
}
}catch(err){return true;}
};*/
Validation.prototype.IsTextMatch = function IsTextMatch(sourceElementID, compareElementID) {
    try {
        var source = this._Document.GetElementById(sourceElementID);
        var compare = this._Document.GetElementById(compareElementID);

        if (this._Document.IsObject(source) && this._Document.IsObject(compare)) {
            if (this._Document.GetElementValueById(sourceElementID) == this._Document.GetElementValueById(compareElementID)) { return true; }
            else { return false; }
        } else { return true; }
    } catch (err) {
        ShowError(err,GetmethodName());
        return true;
    }
};
Validation.prototype.IsNumericKey = function IsNumericKey() {
    try {
        if (window.event.keyCode < 48 || window.event.keyCode > 57) { window.event.keyCode = 0; }
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
Validation.prototype.IsTextKey = function IsTextKey() {
    try {
        if ((window.event.keyCode < 65 || window.event.keyCode > 90) && (window.event.keyCode < 97 || window.event.keyCode > 122)) { window.event.keyCode = 0; }
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
Validation.prototype.IsNumericOrTextKey = function IsNumericOrTextKey() {
    try {
        if ((window.event.keyCode < 65 || window.event.keyCode > 90) && (window.event.keyCode < 97 || window.event.keyCode > 122) && (window.event.keyCode < 48 || window.event.keyCode > 57)) { window.event.keyCode = 0; }
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
Validation.prototype.IsValidIP = function IsValidIP(objName, highlightBG) {
    try {
        var obj = this._Document.GetElementById(objName);
        var email = this._Document.GetElementValueById(objName);

        if (email == '') { return false; }
        if (TestRegex(obj, "1")) {
            obj.value = email.toLowerCase();
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
            return true;
        } else {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return false;
        }
    } catch (err) {
        if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
        return true;
    }
};
Validation.prototype.isValidEmail = function isValidEmail(objName, highlightBG) {
    try {
        var obj = this._Document.GetElementById(objName);
        var emails = this._Document.GetElementValueById(objName);
        var email;
        var i = 0;
        var regmask = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
        var regex = new RegExp(regmask);

        if (emails == '') {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return false;
        }
        email = emails.split(";");
        if (email.length > 0) {
            for (i = 0; i < email.length; i++) {
                if (regex.test(email[i]) == false) {
                    if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
                    return false;
                }
            }
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
            return true;
        } else {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return false;
        }
    } catch (err) {
        if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
        ShowError(err,GetmethodName());
        return true;
    } finally { delete regex; delete obj; }
};
Validation.prototype.isValidEmailCount = function isValidEmailCount(objName, maxCount, highlightBG) {
    try {
        var obj = this._Document.GetElementById(objName);
        var emails = this._Document.GetElementValueById(objName);
        var email;
        var i = 0;


        if (emails == '') {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return false;
        }

        email = emails.split(";");
        if (email.length <= maxCount) {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
            return true;
        } else {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return false;
        }
    } catch (err) {
        if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
        ShowError(err,GetmethodName());
        return true;
    }
};
Validation.prototype.isValidPhone = function isValidPhone(objName, highlightBG) {
    try {
        var obj = this._Document.GetElementById(objName);
        var phone = this._Document.GetElementValueById(objName);

        if (phone == '') { return false; }
        if (this.TestRegex(obj, "2")) {
            obj.value = phone.toLowerCase();
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
            return true;
        } else {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return false;
        }
    } catch (err) {
        if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
        ShowError(err,GetmethodName());
        return true;
    }
};
Validation.prototype.isValidPostalCode = function isValidPostalCode(objName, highlightBG) {
    try {
        var obj = this._Document.GetElementById(objName);
        var pc = this._Document.GetElementValueById(objName);

        if (pc == '') { return false; }
        if (this.TestRegex(obj, "5")) {
            obj.value = pc.toUpperCase();
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
            return true;
        } else {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return false;
        }
    } catch (err) {
        if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
        ShowError(err,GetmethodName());
        return true;
    }
};
Validation.prototype.isValidDoc = function isValidDoc(objName, highlightBG) {
    try {
        //var obj = this._Document.GetElementById(objName);
        var value = this._Document.GetElementValueById(objName);
        var ext = this._String.Right(value, 4);

        if (ext == '' || ext == 'undefined' || ext == null) { return false; }
        if (ext == '.doc' || ext == '.rtf' || ext == '.pdf' || ext == '.txt' || ext == 'docx') {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
            return true;
        } else {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return false;
        }
    } catch (err) {
        if (objName == '' || objName == 'undefined' || objName == null) { alert('Element name missing or not specified!'); }
        _GUI.SetElementBGcolor(objName, '#ffffff');
        ShowError(err,GetmethodName());
        return true;
    }
};
Validation.prototype.isValidSelection = function isValidSelection(objName, highlightBG) {
    try {
        var value = this._Document.GetElementValueById(objName);

        if (value == '' || value == 'undefined' || value == null) { return false; }
        if (value == '' || value == '0' || value == 0) {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return false;
        } else {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
            return true;
        }
    } catch (err) {
        _GUI.SetElementBGcolor(objName, '#ffffff');
        ShowError(err,GetmethodName());
        return true;
    }
};
Validation.prototype.isChecked = function isChecked(objName, highlightBG) {
    try {
        var checkBox = this._Document.GetElementById(objName);

        if (checkBox == '' || checkBox == 'undefined' || checkBox == null) { return false; }
        if (checkBox.checked) {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
            return true;
        } else {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return false;
        }
    } catch (err) {
        _GUI.SetElementBGcolor(objName, '#ffffff');
        ShowError(err,GetmethodName());
        return true;
    }
};
Validation.prototype.isListChecked = function isListChecked(objName, highlightBG) {
    try {
        var obj = this._Document.GetElementById(objName);
        var checkBox;
        var i = 0;
        var isChecked = false

        if (obj == '' || obj == 'undefined' || obj == null) { return false; }
        for (i = 0; i < 30; i++) {
            checkBox = this._Document.GetElementById(objName + '_' + i);
            if (checkBox != '' && checkBox != 'undefined' & checkBox != null) {
                if (checkBox.checked) { isChecked = true; }
            } else { break; }
        }
        if (isChecked) {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
            return true;
        } else {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return false;
        }
    } catch (err) {
        _GUI.SetElementBGcolor(objName, '#ffffff');
        ShowError(err,GetmethodName());
        return true;
    }
};
Validation.prototype.isRadioListSel = function isRadioListSel(objName, highlightBG) {
    try {
        var obj = this._Document.GetElementById(objName);
        var radioButton;
        var i = 0;
        var isSel = false

        if (obj == '' || obj == 'undefined' || obj == null) { return false; }
        for (i = 0; i < 30; i++) {
            radioButton = this._Document.GetElementById(objName + '_' + i);
            if (radioButton != '' && radioButton != 'undefined' & radioButton != null) {
                if (radioButton.checked) { isSel = true; }
            } else { break; }
        }
        if (isSel) {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
            return false;
        } else {
            if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqValueColor); }
            return true;
        }
    } catch (err) {
        _GUI.SetElementBGcolor(objName, '#ffffff');
        ShowError(err,GetmethodName());
        return true;
    }
};
Validation.prototype.TestRegex = function TestRegex(obj, regmaskid) {
    // Test Regular expressions: http://www.roblocher.com/technotes/regexp.aspx
    var regmask = "";

    try {
        switch (regmaskid.toString()) {
            case "1":    // IP Address.
                regmask = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
                break;
            case "2":    // Phone No.
                regmask = /^\d\d\d-\d\d\d-\d\d\d\d$/;
                break;
            case "4":    // Email. "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$"
                //regmask = "/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/";
                regmask = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
                break;
            case "5":    // Postal Code.   /^\D{1}\d{1}\D{1}\-?\d{1}\D{1}\d{1}$/;
                regmask = /^[a-ceghj-npr-tvxyA-CEGHJ-NPR-TVXY]\d[a-zA-Z]\s\d[a-zA-Z]\d\s*/;
                break;
            case "9":    // Alpha.
                regmask = /^([a-zA-Z])+$/;
                break;
            case "10":    // Numeric.
                regmask = /^([0-9_\.\-])+$/;
                break;
            default:
                break;
        }

        if (regmask == null) {
            return true;
        } else {
            var regex = new RegExp(regmask);
            var incomming = obj.value;

            if (regex.test(incomming)) {
                return true;
            } else {
                return false;
            }
        }
    } catch (err) {
        if (highlightBG == true) { _GUI.SetElementBGcolor(objName, ReqNormalColor); }
        ShowError(err,GetmethodName());
        return true;
    }
};
Validation.prototype.IsMaxLength = function IsMaxLength(objID, len, highlightBG, trim) {
    var mlength = 0;
    var obj;

    try {
        if (objID == '' || objID == 'undefined' || objID == null) { return true; }
        obj = _DOC.GetElementById(objID);
        if (len == '' || len == 'undefined' || len == null || len == 0 || isNaN(len)) {
            mlength = obj.getAttribute ? parseInt(obj.getAttribute("maxlength")) : ""
        } else {
            mlength = len;
        }
        if ((mlength != '' && mlength != 'undefined' && mlength != null) && mlength > 0) {
            if (obj.getAttribute && obj.value.length > mlength) {
                if (highlightBG == true) { _GUI.SetElementBGcolor(objID, ReqValueColor); }
                return true;
            } else {
                if (highlightBG == true) { _GUI.SetElementBGcolor(objID, ReqNormalColor); }
                return false;
            }
        }
    } catch (err) {
        if (highlightBG == true) { _GUI.SetElementBGcolor(objID, ReqNormalColor); }
        ShowError(err,GetmethodName());
        return true;
    }
};
Validation.prototype.IsMinLength = function IsMinLength(objID, len, highlightBG) {
    var mlength = 0;
    var obj;

    try {
        if (objID == '' || objID == 'undefined' || objID == null) { return true; }
        obj = _DOC.GetElementById(objID);
        if (len == '' || len == 'undefined' || len == null || len == 0 || isNaN(len)) {
            mlength = obj.getAttribute ? parseInt(obj.getAttribute("maxlength")) : ""
        } else {
            mlength = len;
        }
        if ((mlength != '' && mlength != 'undefined' && mlength != null) && mlength > 0) {
            if (obj.getAttribute && obj.value.length < mlength) {
                if (highlightBG == true) { _GUI.SetElementBGcolor(objID, ReqValueColor); }
                return false;
            }
            else {
                if (highlightBG == true) { _GUI.SetElementBGcolor(objID, ReqNormalColor); }
                return true;
            }
        }
    } catch (err) {
        if (highlightBG == true) { _GUI.SetElementBGcolor(objID, ReqNormalColor); }
        ShowError(err,GetmethodName());
        return true;
    }
};

/*  CLIENT CLASS  */
function Client() {
    this._Document = new Document();
    this._Browser = new Browser();
}
Client.prototype.Prompt = function Prompt(msg) {
    try {
        var input = prompt(msg, "");
        return input;
    } catch (err) {
        ShowError(err,GetmethodName());
        return '';
    }
};
Client.prototype.Highlight = function Highlight(id) {
    try {
        var text = this._Document.GetElementById(id);
        text.style.color = '#ff0000';
        text.style.fontWeight = 'bold';
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
/*
Client.prototype.SetFocus = function SetFocus(id) {
    try {
        var obj = this._Document.GetElementById(id);
        obj.focus();
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};*/
Client.prototype.Restore = function Restore(id) {
    try {
        var text = this._Document.GetElementById(id);
        text.style.color = '#909090';
        text.style.fontWeight = 'normal';
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
Client.prototype.Maximize = function Maximize() {
    try {
        top.window.moveTo(-4, -4);
        if (document.all) { top.window.resizeTo(screen.availWidth + 8, screen.availHeight + 8); }
        else if (document.layers || document.getElementById) {
            if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth) {
                top.window.outerHeight = screen.availHeight + 8;
                top.window.outerWidth = screen.availWidth + 8;
            }
        }

    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
Client.prototype.ResizeWindow = function ResizeWindow(h, w, t, l) {
    try {
        top.window.moveTo(t, l);
        if (document.all) { top.window.resizeTo(w, h); }
        return true;
    } catch (err) {
        ShowError(err,GetmethodName());
        return false;
    }
};
Client.prototype.AssignCSSfiles = function AssignCSSfiles() {
    try {
        this._Browser.GetBrowser();
        if (this._Browser.IE) {
            if (this._Browser.Version == 6) { this.AddStylesheet("text/css", "stylesheet", "../css/ie/style-ie6.css", "screen"); }
            else if (this._Browser.Version == 7) { this.AddStylesheet("text/css", "stylesheet", "../css/ie/style-ie7.css", "screen"); }
            else if (this._Browser.Version == 8) { this.AddStylesheet("text/css", "stylesheet", "../css/ie/style-ie8.css", "screen"); }
            else { this.AddStylesheet("text/css", "stylesheet", "../css/ie/style-ie6.css", "screen"); }
        }
        else if (this._Browser.FF) {
            this.AddStylesheet("text/css", "stylesheet", "../css/ff/style-ff.css", "screen");
            this.AddStylesheet("text/css", "stylesheet", "../css/ff/scroller-ff.css", "screen"); 
        }
        else if (this._Browser.NS) { this.AddStylesheet("text/css", "stylesheet", "../css/ns/style-ns.css", "screen"); }
        else if (this._Browser.OP) { this.AddStylesheet("text/css", "stylesheet", "../css/op/style-op.css", "screen"); }
        else if (this._Browser.KR) { this.AddStylesheet("text/css", "stylesheet", "../css/kr/style-kr.css", "screen"); }
        else if (this._Browser.SA) { this.AddStylesheet("text/css", "stylesheet", "../css/kr/style-kr.css", "screen"); }
        else { this.AddStylesheet("text/css", "stylesheet", "../css/ie/style-ie6.css", "screen"); }
        return true;
    } catch (err) {
        ShowError(err,GetmethodName());
        return false;
    }
};
Client.prototype.AddStylesheet = function AddStylesheet(type, rel, href, media) {
    try {
        var headID = document.getElementsByTagName("head")[0];
        var cssNode = document.createElement('link');
        cssNode.type = type;
        cssNode.rel = rel;
        cssNode.href = href;
        cssNode.media = media;
        headID.appendChild(cssNode);
        return true;
    } catch (err) {
        ShowError(err,GetmethodName());
        return false;
    }
};
Client.prototype.MsgBox = function MsgBox(msg) {
    try {
        alert(msg);
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    }
};
Client.prototype.DisableAutoComplete = function DisableAutoComplete(id) {
    var obj = null;
    try {
        if (id == undefined || id == "undefined" || id == null) { id = ''; }
        if (id == '') {
            for (var i = 0, l = document.getElementsByTagName('input').length; i < l; i++) {
                if (document.getElementsByTagName('input').item(i).type == 'text') {
                    document.getElementsByTagName('input').item(i).setAttribute('autocomplete', 'off');
                }
            }
            return true;
        } else {
            obj = this._Document.GetElementById(id);
            if (obj.type == 'text') {
                obj.setAttribute('autocomplete', 'off');
                return true;
            }
        }
        return false;
    } catch (Error) {
        ShowError(err,GetmethodName());
        return false;
    } finally {
        delete obj;
    }
};

/*
Client.prototype.Confirm = function Confirm(msg){
try{
var anwser = confirm(msg);
if(anwser){return true;}else{return false;}
}catch(err){
if(isDebug){alert(err + '\n\n(' + GetmethodName() + ')');}
return false;
}
};*/
Client.prototype.PopUp = function PopUp(url, name, height, width, top, left, location, menubar, resizable, scrollbars, status, toolbar, center, param) {
    var _Window;
    var params = '';
    var _left = 0;
    var _top = 0;

    try {
        if (url == "" || url == "undefined" || url == null) { return; }

        if (name == undefined) { name = 'Adecco'; }
        if (center == undefined) { center = true; }
        if (height == undefined) { height = 200; }
        if (width == undefined) { width = 300; }
        if (top == undefined) { _top = 100; }
        if (left == undefined) { _left = 100; }
        if (location == undefined) { location = 'no'; }
        if (menubar == undefined) { menubar = 'no'; }
        if (resizable == undefined) { resizable = 'no'; }
        if (scrollbars == undefined) { scrollbars = 'no'; }
        if (status == undefined) { status = 'no'; }
        if (toolbar == undefined) { toolbar = 'no'; }

        if (center == true) {
            _left = (screen.width - width) / 2;
            _top = (screen.height - height) / 2;
            params += 'top=' + _top + ', left=' + _left;
        } else { params += 'top=' + _top + ', left=' + _left; }

        params += ', width=' + width + ', height=' + height;
        params += ', directories=no';
        params += ', location=' + location;
        params += ', menubar=' + menubar;
        params += ', resizable=' + resizable;
        params += ', scrollbars=' + scrollbars;
        params += ', status=' + status;
        params += ', toolbar=' + toolbar;

        _Window = window.open(url, name, params);
        if (_Window.focus) { _Window.focus(); }
        return _Window;
    } catch (err) {
        ShowError(err,GetmethodName());
        return;
    } finally { delete _Window; }
};
/*
Client.prototype.Prompt = function Prompt(msg,validate){
try{
if(msg == "" || msg == "undefined" || msg == null){return '';}
if(validate == undefined){validate = false;}
var input = prompt(msg, '');
if(validate && (input == "" || input == "undefined" || input == null)){
if(this.Confirm('Une valeur est requise pour continuer, désirez vous continuer?')){
input = prompt(msg, '');
return input;
}else{
return '';
}
}else{
return input;
}
}catch(Error){
if(isDebug){alert(err + '\n\n(' + GetmethodName() + ')');}
return '';    
}
};
*/
function GetmethodName() {
    var ownName;
    try {
        // When Method is in Class, must double naming Method Name else this method will not work!!
        //ownName = arguments.callee.toString();         // Current Method Name.
        ownName = arguments.callee.caller.toString()   // Calling Method Name.
        ownName = ownName.substr('function '.length);      // trim off "function "
        ownName = ownName.substr(0, ownName.indexOf('(')); // trim off everything after the function name
        return ownName;
    } catch (ex) { if (isDebug) { alert(ex.message + '\n(GetmethodName)'); return 'N/A'; } }
}
function IsValidParams(arguments, minRequiredArgs) {
    var p;
    var args = 0;

    try {
        //if (arguments != null && arguments != '' && arguments != 'undefined' && arguments != undefined) { return false; }
        for (var i = 0; i < arguments.length; i++) {
            if (arguments[i] != null && arguments[i] != '' && arguments[i] != 'undefined' && arguments[i] != undefined) {
                args++;
            }
        }
        if(minRequiredArgs != null && minRequiredArgs != '' && minRequiredArgs != 'undefined' && minRequiredArgs != undefined){
            return args >= minRequiredArgs; 
        } else {
            return args > 0;
        }
    } catch (err) {return false; }
}
function isFunction(f) {
    return typeof f === "function";
}
function Postback(objID, arg) {
    try {
        if (objID == null || objID == 'undefined' || objID == '') { return; }
        if (arg == null || arg == 'undefined' || arg == '') { arg = ''; }
        __doPostBack(objID, arg);
    }catch(err){
        if (isDebug) { alert(ex.message + '\n(GetmethodName)'); return; }
    }
}
function ShowError(err,source) {
    var msg = 'An Error Occured...\n\n';
    try {
        if (isDebug) {
            if (source == null || source == 'undefined' || source == undefined || source == '') { source = "Unable to retreive error source!"; }
            if (err == null || err == 'undefined' || err == undefined || err == '') {
                msg = 'Unable to retreive error details! \n\n' + source;
            } else {
                msg += 'Error Description: ' + err.description + '\n';
                msg += 'Error Number: ' + err.number + '\n';
                msg += 'Error Message: ' + err.message + '\n';
                msg += 'Error Source: ' + source;
            }
            alert(msg);
        }
        return;
    } catch (err) {
        if (isDebug) { alert(ex.message + '\n(GetmethodName)'); return; }
    } 
}