if (window.SIGI) throw ("SIGI.js is included in this document multiple times. There can be only one!");
var ie = document.all
var ns6 = document.getElementById && !document.all
asciiValsToConvert = new Array(8216, 8217, 8220, 8221, 8211, 61663, 61664, 61514, 61516);
asciiConvertVals = new Array(String.fromCharCode(39), String.fromCharCode(39), String.fromCharCode(34), String.fromCharCode(34), String.fromCharCode(45), "<--", "-->", ":)", ":(");

// Basic Prototypes

/*
Type.prototype.initializeBase = function(baseClass, parms) {

if (!parms)
this.apply(baseClass);
else
this.apply(alert, baseClass);
}
*/

// here we expand the String Object to add a trim function
String.prototype.trim = function() {
    // Use a regular expression to replace leading and trailing 
    // spaces with the empty string
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
function trim(value) {
    return value.toString().trim();
}
String.prototype.ltrim = function() {
    // Use a regular expression to replace leading and trailing 
    // spaces with the empty string
    return this.replace(/(^\s*)/g, "");
}
function ltrim(value) {
    return value.toString().ltrim();
}
String.prototype.rtrim = function() {
    // Use a regular expression to replace trailing 
    // spaces with the empty string
    return this.replace(/(\s*$)/g, "");
}
function rtrim(value) {
    return value.toString().rtrim();
}
function replaceInString(string, start, length, value) {
    return string.substring(0, start) + value + string.substring(start + length);
}

String.prototype.qtrim = function() {
    // Use a regular expression to replace leading and trailing spaces
    // as well as any quotes that might be surrounding, but leaves 
    // spaces inside quotes
    var value = this.trim();
    if (/(^\x27|\x22)[\s\S]*(\x27|\x22$)/.test(value)) {
        value = value.slice(1, value.length - 1);
    }
    return value;
}
function qtrim(value) {
    return value.toString().qtrim();
}
String.prototype.left = function(length) {
    if (this.length > length) {
        return this.slice(0, length);
    } else {
        return this;
    }
}
function left(value, length) {
    return value.toString().left(length);
}
String.prototype.right = function(length) {
    if (this.length > length)
        return this.slice(this.length - length);
    else
        return this;
}
function right(value, length) {
    return value.toString().right(length);
}
String.prototype.mid = function(start, length) {
    if (length != null)
        return this.substr(start - 1, length);
    else
        return this.substr(start - 1);
}
function mid(value, start, length) {
    return value.toString().mid(start, length);
}
String.prototype.fill = function(value, length) {
    var ret = value;
    if (value == null) ret = "";
    while (ret.length < length) {
        ret = ret.concat(value);
    }
    return ret;
}
String.prototype.repeat = function(iterations) {
    var ret = this;
    for (var i = 1; i < iterations; i++) {
        ret = ret.concat(this);
    }
    return ret;
}
String.prototype.pad = function(padChar, length, direction) {
    var sPadding = padChar.fill(padChar, length);
    var value = this;
    if (direction == "left") {
        value = sPadding + value;
        value = value.slice(value.length - length);
    } else {
        value += sPadding;
        value = value.slice(0, length);
    }
    return value;
}
String.prototype.encode = function(values) {
    // Encodes a string so that it is safe to pass in a URL
    // Supports encoding specified characters by passing as 
    // a parameter
    var chars = "^{}|><][`";
    var value = this;
    if (values != null) chars = values + chars;
    for (var i = 0; i < chars.length; i++) {
        var ch = chars.charCodeAt(i).toString(16);
        var xch = "x" + ch;
        var re = new RegExp("\x5c" + xch, "g");
        value = value.replace(re, "%" + ch);
    }
    return value;
}
// strips out any non-digit charachters from a string
String.prototype.getNumbers = function() {
    return this.replace(/[^0-9.]/g, "");
}
// strips out any non-digit charachters from a string
String.prototype.removeCommas = function() {
    return this.trim().replace(/,/g, "");
}
//checks to see if the string is in a list of values
String.prototype.strIn = function() {
    for (var i = 0; i < arguments.length; i++) {
        if (this.valueOf() == arguments[i])
            return true;
    }
    return false;
}
String.prototype.insertCommas = function() {
    /*  Inserts commas into a given string every 
    3rd charachter from the right, or from the 
    left-most decimal point */
    var value = this;
    if (value.removeCommas().isNumeric()) {
        value = new Number(value.removeCommas()).toString();
        var len = value.search(/\./);
        if (len < 0) len = value.length;
        for (var i = 1; i < len; i++) {
            if (i % 3 == 0)
                value = value.slice(0, len - i) + "," + value.slice(len - i);
        }
    }
    return value;
}
String.prototype.isNumeric = function() {
    var value = this.removeCommas();
    if (value.length == 0) return false;
    return /^(-)?\d*(\.\d*)?$/.test(value);
}
String.prototype.toBoolean = function() {
    var value = this.toString().trim().toLowerCase();
    if (value.isNumeric()) {
        if (parseInt(value) != 0)
            return true;
        else
            return false;
    }
    switch (value) {
        case "true":
        case "yes":
            return true;
        default:
            return false;
    }
}
function toBoolean(value) {
    if (value)
        return value.toString().toBoolean();
    else
        return false;
}
String.prototype.toNumber = function() {
    if (this.isNumeric()) {
        var value = this.removeCommas();
        return new Number(value);
    } else {
        return 0;
    }
}
function toNumber(value) {
    return value.toString().toNumber();
}
String.prototype.format = function() {
    if (this.test) {
        if (this.test(/{\d+}/g)) {
            var string = this;
            if (arguments.length > 1) {
                for (var i = 0; i < arguments.length; i++) {
                    var token = "{" + (i).toString() + "}";
                    string = string.replace(token, arguments[i]);
                }
            }
            return string;
        } else {
            return this;
        }
    }
    else {
        return this;
    }
}
String.prototype.formatCurrency = function(displayCents) {

    var bDisplayCents = true;

    if (arguments.length > 0) {
        if (arguments[0] == false)
            bDisplayCents = false;
    }

    num = this.toString().replace(/\$|\,/g, '');

    if (isNaN(num))
        num = "0";

    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num * 100 + 0.50000000001);
    cents = num % 100;

    num = Math.floor(num / 100).toString();

    if (cents < 10)
        cents = "0" + cents;

    for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
        num = num.substring(0, num.length - (4 * i + 3)) + ',' +
		num.substring(num.length - (4 * i + 3));

    if (bDisplayCents)
        return (((sign) ? '' : '-') + '$' + num + '.' + cents);
    else
        return (((sign) ? '' : '-') + '$' + num);
}
String.prototype.ValidNumericLengthWithMask = function(maskChar, minLength) {
    val = this
    firstSpace = val.indexOf(maskChar);
    if (firstSpace > -1)
        val = val.substring(0, firstSpace);
    return (val.getNumbers().length >= minLength);
}

function keyCodeByCase(keyCode, inputCase) {
    switch (inputCase.toLowerCase()) {
        case "casemixed":
            break;
        case "caselower":
            if (keyCode > 64 && keyCode < 91) {
                keyCode = keyCode + 32;
            }
            break;
        case "caseupper":
            if (keyCode > 96 && keyCode < 123) {
                keyCode = keyCode - 32;
            }
            break;
    }
    return keyCode;
}
String.prototype.formatCase = function(inputCase) {
    output = "";
    for (i = 0; i < this.length; i++) {
        keyCode = this.charCodeAt(i);
        keyCode = keyCodeByCase(keyCode, inputCase);
        output += String.fromCharCode(keyCode);
    }
    return output;
}
String.prototype.formatPrintable = function(modified) {
    modified = false;
    output = "";
    for (i = 0; i < this.length; i++) {
        keyCode = this.charCodeAt(i);
        //if (((keyCode > 31) && (keyCode < 127)) || ((keyCode > 159) && (keyCode < 256))) {
        if (((keyCode > 31) && (keyCode < 127)) || (keyCode == 10) || (keyCode == 13) || (keyCode == 169) || (keyCode == 174) || (keyCode == 8226) || (keyCode == 8480) || (keyCode == 8482)) {
            output += String.fromCharCode(keyCode);
        }
        else {
            idx = asciiValsToConvert.find(keyCode);
            if (idx > -1) {
                output += asciiConvertVals[idx];
            }
            else {
                modified = true;
            }
        }
    }
    return output;
}
String.prototype.uniqueChars = function() {
    var UsedPhoneDigits = ""
    for (i = 0; i < this.length; i++) {
        if (UsedPhoneDigits.indexOf(this.charAt(i)) == -1) {
            UsedPhoneDigits += this.charAt(i);
        }
    }
    return UsedPhoneDigits.length;
};

Number.prototype.formatNumber = function() {
    /*  formats a number, parameters are based on and are identical
    to VB's format number with the exception of the vbTriState 
    Enums being mere booleans. Currency is an added parameter 
    to support formatting as currency. */
    var num = this;
    var anum = Math.abs(this);
    var value = anum.toString();

    if (arguments.length > 0 && arguments[0] > 0)
        value = anum.toFixed(arguments[0]);
    if (arguments.length > 1) {
        if (arguments[1] == true) {
            if (anum < 1 && anum >= 0 && value.slice(0, 1) != "0")
                value = "0" + value;
        } else if (anum < 1 && anum >= 0 && value.slice(0, 1) == "0") {
            value = value.slice(1);
        }
    }
    if (arguments.length > 3 && arguments[3] == true)
        value = value.insertCommas();
    if (arguments.length > 4 && arguments[4] == "currency")
        value = "$" + value;
    if (arguments.length > 2 && arguments[2] == true && num < 0) {
        value = "(" + value + ")";
    } else if (num < 0) {
        value = "-" + value;
    }
    return value;
}
Number.prototype.formatCurrency = function() {
    // Formats a number, as currency 
    // Parameters are based on and are identical
    // to VB's FormatCurrency number with the exception of the vbTriState 
    // Enums being mere booleans.
    return this.formatNumber(arguments[0], arguments[1], arguments[2], arguments[3], "currency");
}

Array.prototype.find = function(value) {
    for (var i = 0; i < this.length; i++) {
        if (value == this[i]) return i;
    }
    return -1;
}
Array.prototype.count = function() {
    return this.length;
}

/***************************************************************/
/*	SIGI Object Model
/*	Create the Root Object that all objects inherit from
/*	in the SIGI Model
/***************************************************************/
function Base() { }
// Provides a context for methods called on events that 
// by default end up in the global context
Base.prototype.context = function(method) {
    var self = this;
    return function() { return method.apply(self, arguments) };
};
/*Base.prototype.timeout = function(handler, delay){
var wrapper = obj.context(handler);
return window.setTimeout(wrapper, delay ? delay : 0);
};
Base.prototype.clone = function(){
if (this._clone.prototype!==this) {
this._clone = function(){};
this._clone.prototype = this;
}
return new this._clone();
};
*/
// This method allows any class to inherit from a specified class
Function.prototype.inherits = function(baseClass) {
    var prop;
    if (this == baseClass) {
        throw ("Error - cannot derive from self");
        return;
    }
    var self = this;
    for (prop in baseClass.prototype) {
        /*if (typeof(baseClass.prototype[prop]) == "function" && !this.prototype[prop]) {
        this.prototype[prop] = baseClass.prototype[prop];
        }
        */
        if (typeof (baseClass.prototype[prop]) == "function") {
            if (prop.substring(0, 5) != "base_") {
                var methodName = "base_" + prop;
                this.prototype[methodName] = baseClass.prototype[prop];
            }
            if (!this.prototype[prop]) {
                this.prototype[prop] = baseClass.prototype[prop];
            }
        }
    }

    var name = baseClass.toString();
    var re = /function\s+(\w+)\s*\(.*/;
    if (re.test) {
        name = re.exec(name)[1];
        this.prototype[name] = baseClass;
    }
}


// Create the Root for the SIGI Client Object Model
function SIGIObject() {
    this.Base();
    this.Base = Base;
    this.clientPath = this.getClientThemePath();
    this.instanceId = null;
    this.Form = null;
    this.inputCase = "CaseMixed";
    this.preventBackspace = false;
    this.allowContextMenu = true;
    this.transitionFrame = null;
    this.transitionDocument = null;
    this.progressFrame = null;
    //this.transitionControl = null;
    this._AJAXenabled = false;
    this._bodyCursor = "";
    this.skipForcedFocus = false
    /*
    RTS 1301860
    add value to prevent info tooltip overriding validation failure tooltip
    */
    this.skipTooltipDueToValFailure = false;
};

SIGIObject.inherits(Base);


SIGIObject.prototype.attachEvent = function(object, eventName, eventHandler) {
    if (window.attachEvent) {
        if (!/^on/.test(eventName)) eventName = "on" + eventName;
        object.attachEvent(eventName, eventHandler);
    } else if (window.addEventListener) {
        eventName = eventName.replace(/^on/, "");
        object.addEventListener(eventName, eventHandler, false);
    }
}
SIGIObject.prototype.detachEvent = function(object, eventName, eventHandler) {
    if (window.detachEvent) {
        object.detachEvent(eventName, eventHandler);
    } else if (window.removeEventListener) {
        eventName = eventName.replace(/^on/, "");
        object.removeEventListener(eventName, eventHandler, false);
    }
}
SIGIObject.prototype.cancelEvent = function(e) {
    // Stop an event from bubbling up the event DOM
    e = e || window.event;
    if (e.stopPropagation) {
        e.stopPropagation();
        e.preventDefault();
    } else if (typeof e.cancelBubble != "undefined") {
        e.cancelBubble = true;
        e.returnValue = false;
    }
    return false;
}
SIGIObject.prototype.ieEvent = function(e) {
    if (e && !this.Browser.isIE) {
        window.event = e;
        window.event.srcElement = e.target;
    }
}
SIGIObject.prototype.getClientPath = function(pathType) {
    if (pathType)
        return this.clientPath + pathType + "/";
    else
        return this.clientPath;
}

SIGIObject.prototype.getClientThemePath = function() {
    var head = document.getElementById("PageStyleSheet")
    var path;
    var bNotFound = false;
    if (head) {
        var startIndex;
        var endIndex;
        startIndex = head.href.indexOf("Theme_");
        if (startIndex > 0) {
            endIndex = head.href.indexOf("/", startIndex)
            path = head.href.substr(0, endIndex)
        }
        else
            bNotFound = true;
    }
    else
        bNotFound = true;

    if (bNotFound)
        path = "/WebApplications/Enterprise/ClientShared/Theme_2"

    return path;
}

SIGIObject.prototype.formatURL = function(url) {
    if (this.Form && this.instanceId) {
        var re = /instanceid=[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}/gi;

        // if query string anchors found make sure the anchors stay at the end of the query string
        var iAnchor;
        if ((iAnchor = url.indexOf("#")) != -1) {
            if (/\?/.test(url)) {
                url = url.substr(0, iAnchor) + "&InstanceID=" + this.instanceId + url.substr(iAnchor, url.length);
            }
            else {
                url = url.substr(0, iAnchor) + "?InstanceID=" + this.instanceId + url.substr(iAnchor, url.length);
            }
        }
        else {
            if (!re.test(url)) {
                if (/\?/.test(url)) {
                    url += "&InstanceID=" + this.instanceId;
                } else {
                    url += "?InstanceID=" + this.instanceId;
                }
            }
        }

        if (this.Form.allowBrowserNavigation == false) {
            // set a page transaction ID to prevent user browser navigation
            var transactionID = this.newGuid();
            var cookieName = "TID" + this.instanceId.replace(/\-/g, "");
            this.removeCookie(cookieName);
            this.setCookie(cookieName, escape(transactionID), null, "/");
            url = this.addQueryString(url, "TID=" + transactionID);
        }
    }

    return url;
}

SIGIObject.prototype.setCookie = function(cookieName, cookieValue, expireDate, cookiePath) {
    // Pass in three strings - the name of the cookie, the value,
    // and the expire date.
    // Pass in a "" empty string for expireDate to set a session 
    // cookie (no expires date).
    // Pass in any other date for expire as a number of days to 
    // be added to today's date.

    strCookie = cookieName + "=";
    if (cookieValue != null)
        strCookie += escape(cookieValue);
    if (expireDate != null) {
        var expires = expireDate.toGMTString();
        strCookie += ";expires=" + expires;
    }
    if (cookiePath != null) {
        strCookie += ";path=" + cookiePath;
    }
    document.cookie = strCookie;
}

SIGIObject.prototype.removeCookie = function(cookieName) {
    // Pass in the name of the cookie as a string and it will be removed.
    var expireDate = new Date();
    expireDate.setDate(expireDate.getDate() - 1);
    this.setCookie(cookieName, " ", expireDate);
}


SIGIObject.prototype.toHex = function(number, length) {
    var arr = "0123456789ABCDEF";
    var hex = arr.substr(number & 15, 1);
    while (number > 15) { number >>= 4; hex = arr.substr(number & 15, 1) + hex; }
    if (length != null) {
        if (hex.length < length) hex = hex.pad("0", length, "left");
    }
    return hex;
}

SIGIObject.prototype.newGuid = function() {
    //111BF2E8-299A-4727-9331-CA6E2E2A9470
    var g1 = this.toHex(Math.floor(Math.random() * 4294967295), 8);
    var g2 = this.toHex(Math.floor(Math.random() * 65535), 4);
    var g3 = this.toHex(Math.floor(Math.random() * 65535), 4);
    var g4 = this.toHex(Math.floor(Math.random() * 65535), 4);
    var g5 = this.toHex(Math.floor(Math.random() * 281474976710655), 12);
    return g1 + "-" + g2 + "-" + g3 + "-" + g4 + "-" + g5;
}

SIGIObject.prototype.addQueryString = function(url, queryString) {

    var testQueryString = queryString.encode().replace(/([\[\]\\\?\$\*\+\{\}\(\)])/g, "\\$1");
    var regEx = new RegExp(testQueryString, "i");
    if (regEx.test(url)) {
        return url;
    }
    if (url.search(/\?/) == -1) {
        return url + "?" + queryString.encode();
    } else {
        var name = queryString.substring(0, queryString.indexOf("="));
        var re = new RegExp(name + "=.*?(&|$)");
        if (name.length && re.test(url)) {
            return url.replace(re, queryString.encode() + "\$1");
        } else {
            return url + "&" + queryString.encode();
        }
    }
}

SIGIObject.prototype.navigateURL = function(url, target) {
    url = this.formatURL(url);
    if (target != null && target != "_top") {
        window.open(url, target);
    } else {
        window.location = url;
    }
}
SIGIObject.prototype.showPageTransition = function() {

    if (this.transitionFrame) {
        //save the cursor for the document body - needed for ajax postback
        this._bodyCursor = window.document.body.style.cursor;
        this.transitionFrame.style.display = "block";
        this.transitionFrame.style.top = "0px";
        this.transitionFrame.style.left = "0px";
        this.transitionFrame.style.height = "100%";
        this.transitionFrame.style.width = "100%";
    }
}
//SIGIObject.prototype.hidePageTransition = function() {
//    
//    if (this.transitionFrame) {
//        this.transitionFrame.style.display = "hidden";
//        this.transitionFrame.style.top = "0px";
//        this.transitionFrame.style.left = "0px";
//        this.transitionFrame.style.height = "0%";
//        this.transitionFrame.style.width = "0%";
//    }
//}
SIGIObject.prototype.hidePageTransition = function() {
    if (this.transitionFrame) {
        this.transitionFrame.style.display = "none";
    }
}
SIGIObject.prototype.showProgressBar = function(msg, left, top, width, height, progressBarStyle) {
    var sframeSrc = "";
    if (this.progressFrame) {
        if (!progressBarStyle)
            progressBarStyle = "progressbarstyle1";

        //        switch (progressBarStyle.toLowerCase()) {
        //            case "progressbarstyle1":
        //                sframeSrc = SIGI.getClientThemePath() + "/Pages/SIGI.ProgressScreen2.htm";
        //            default:
        //                sframeSrc = SIGI.getClientThemePath() + "/Pages/SIGI.ProgressScreen2.htm";
        //        }

        //        sframeSrc = SIGI.getClientThemePath() + "/Pages/SIGI.ProgressScreen1.htm";
        //        if (SIGI.Browser.isIE)
        //            document.frames("SIGI_ProgressScreen").location.href = sframeSrc;
        //        else
        //            document.getElementById('SIGI_ProgressScreen').src = sframeSrc;
        //this.progressFrame.src = sframeSrc;
        document.getElementById('SIGI_ProgressScreen').style.display = "block";
        if (SIGI.Browser.isIE)
            this.progressFrame.ProgressBar.WaitScreen.style.display = "inline";
        else
            this.progressFrame.ProgressBar.WaitScreen.style.display = "inline-table";


        if (!msg) { msg = "Processing request ..."; }
        if (!width) { width = "100%" }
        if (!height) { height = "100%" }
        if (!left) { left = 0; }
        if (!top) { top = 0; }

        this.progressFrame.ProgressBar.WaitMsg.innerHTML = msg;

        this.progressFrame.style.display = "block";
        this.progressFrame.style.width = width;
        this.progressFrame.style.height = height;
        this.progressFrame.style.left = left;
        this.progressFrame.style.top = top;
        this.progressFrame.waitScreen = true;
        this.progressFrame.ProgressBar.startProgress();
        for (var i = 0; i < 1000000; i++) {
            //document.write(i);
        }
    }
}
SIGIObject.prototype.hideProgressBar = function() {
    if ((this.progressFrame) && ((this.progressFrame.ProgressBar.stopProgress))) {
        this.progressFrame.ProgressBar.stopProgress();
        this.progressFrame.style.display = "none";
    }
}
SIGIObject.prototype.openWindowOnload = function(url, target, features) {
    //this.attachEvent(window, "onload", function() { window.open(url, target, features); });
    SIGI.Event.addEventListener(window, "load", function() { window.open(url, target, features); });
}
SIGIObject.prototype.showModalDialog = function(url, vArguments, width, height, scroll, center) {
    var scrollValue = scroll ? scroll : "no";
    var centerValue = center ? center : "yes";
    var sFeatures = "dialogHeight:" + height + "px; dialogWidth:" + width + "px;status: yes; scroll: " + scrollValue + "; help: no; ";
    if (SIGI.Browser.isIE) {
        sFeatures += "center: " + centerValue;
    }
    else {
        var left = (window.screen.width / 2) - (width / 2);
        var top = (window.screen.height / 2) - (height / 2);
        sFeatures += "dialogTop: " + top + "px; dialogLeft:" + left + "px";
    }
    var page = this.formatURL(url);
    return window.showModalDialog(page, vArguments, sFeatures);

}
SIGIObject.prototype.showModelessDialog = function(url, vArguments, width, height) {
    var sFeatures = "dialogHeight:" + height + "px; dialogWidth:" + width + "px;status: yes; scroll: no; help: no"
    var date = new Date();
    var page = this.formatURL(url);

    page = this.addQueryString(page, "dt=" + date.getTime());

    return window.showModelessDialog(page, vArguments, sFeatures);

    //return raiseOnDialogClose(url, ret);
}
SIGIObject.prototype.msgBox = function(messageText, buttons, title) {
    var sResponse;

    //var w = 300;
    //var h = 150;

    var w = 600;
    var h = 300;

    if (arguments.length > 3) {
        w = arguments[3];
        if (arguments.length > 4) {
            h = arguments[4];
        }
    }
    sResponse = this.showModalDialog(SIGI.getClientThemePath() + "/Pages/SIGI.Msgbox.htm", messageText + "|" + buttons + "|" + title, w, h);

    if (sResponse == null)
        sResponse = "cancel"

    return sResponse.toLowerCase();
}
SIGIObject.prototype.messageBox = SIGIObject.prototype.msgBox;
/*
SIGIObject.prototype.addQueryString = function (url, queryString) {
var testQueryString = queryString.encode().replace(/([\[\]\\\?\$\*\+\{\}\(\)])/g,"\\$1");
var regEx = new RegExp(testQueryString,"i");
if (regEx.test(url)) return url;
if (url.search(/\?/) == -1)
return url + "?" + queryString;
else
return url + "&" + queryString;
}
*/
SIGIObject.prototype.getValue = function(control, trim) {
    if (trim == null) trim = true;
    if (control) {
        if (typeof (control.value) == "string") {
            if (control.tagName.toLowerCase() == "dropdownlist") {
                if (control.value.length == 0) {
                    var text = control.text;
                    if (trim) text = text.trim();
                    if (text.toLowerCase() == control.emptySelectionText.toLowerCase()) {
                        text = "";
                    }
                    return text;
                }
            } else if (control.className.toLowerCase().substring(0, 10) == "maskededit") {
                var cliptext = $SIGIfind(control.id).get_text();
                return cliptext;
            } else if (control.className.toLowerCase() == "combobox") {
                if ($SIGIfind(control.id.toString().replace("_Text", "")).get_emptyOptionText()) {
                    if ($SIGIfind(control.id.toString().replace("_Text", "")).get_value().trim() == $SIGIfind(control.id.toString().replace("_Text", "")).get_emptyOptionText().trim())
                        return "";
                    else
                        return $SIGIfind(control.id.toString().replace("_Text", "")).get_value();
                }
                else {
                    return $SIGIfind(control.id.toString().replace("_Text", "")).get_value();
                }
            }

            if (trim)
                return control.value.trim();
            else
                return control.value;
        }
        if (typeof (control.tagName) == "undefined" && typeof (control.length) == "number") {
            var j;
            for (j = 0; j < control.length; j++) {
                var inner = control[j];
                if (typeof (inner.value) == "string" && (inner.type != "radio" || inner.status == true)) {
                    if (trim)
                        return inner.value.trim();
                    else
                        return inner.value;
                }
            }
        } else {
            return this.getValueRecursive(control, trim);
        }
        return "";
    }
}
SIGIObject.prototype.getValueRecursive = function(control, trim) {
    if (trim == null) trim = true;

    if (typeof (control.value) == "string" && (control.type != "radio" || control.status == true)) {
        if (trim)
            return control.value.trim();
        else
            return control.value;
    }
    var i, value;
    for (i = 0; i < control.childNodes.length; i++) {
        value = this.getValueRecursive(control.childNodes[i]);
        if (value != "") {
            if (trim)
                return value.trim();
            else
                return value;
        }
    }
    return "";
}
SIGIObject.prototype.getCurrentStyle = function(element, styleName) {
    var style = null;
    if (element.currentStyle) {
        if (/\-[a-z]/.test(styleName)) {
            styleName = styleName.replace(/\-([a-z])/gi, function(match) { return match.toUpperCase().replace("-", "") });
        }
        style = element.currentStyle[styleName];
    } else if (window.getComputedStyle) {
        if (/\[A-Z]/.test(styleName)) {
            styleName = styleName.replace(/\[A-Z]/g, function(match) { return "-" + match.toLowerCase() });
        }
        style = document.defaultView.getComputedStyle(element, null).getPropertyValue(styleName);
    }
    return style;
}
SIGIObject.prototype.addCssClass = function(element, className) {
    if (!this.hasCssClass(element, className)) {
        if (element.className.length > 0)
            element.className += " " + className;
        else
            element.className = className;
    }
}
SIGIObject.prototype.removeCssClass = function(element, className) {
    if (this.hasCssClass(element, className)) {
        element.className = element.className.replace(className, "").trim();
    }
}
SIGIObject.prototype.hasCssClass = function(element, className) {
    if (element && element.className) {
        var regEx = new RegExp(className, "i");
        return regEx.test(element.className);
    } else {
        return false;
    }
}
SIGIObject.prototype.hasChildren = function(element) {
    return (element && element.childNodes && element.childNodes.length > 0);
}
SIGIObject.prototype.isEditable = function(element) {
    if (element) {
        if (element.isContentEditable) return true;
        switch (element.tagName.toUpperCase()) {
            case "INPUT": case "TEXTAREA": case "DROPDOWNLIST":
                return true;
        }
    }
    return false;
}
SIGIObject.prototype.isChanged = function(element) {
    if (!element || !element.tagName) return false;

    switch (element.tagName) {
        case "FORM":
            if (this.Form) return this.Form.isFormChanged(element);
        default:
            if (element.type) {
                switch (element.type) {
                    case "hidden":
                        return false;
                    case "checkbox":
                    case "radio":
                        return (element.checked != element.defaultChecked);
                    case "select-one":
                        //if (element.defaultIndex) return (element.selectedIndex != parseInt(element.defaultIndex))                        
                        if (element.defaultIndex) return ((element.selectedIndex != parseInt(element.defaultIndex)) && (element.selectedIndex > -1))
                }
            }
            if (element.defaultValue != null) {
                var value = "";
                if (($SIGIfind(element.id)) && ($SIGIfind(element.id).get_textWithMask)) {
                    if ($SIGIfind(element.id).get_text().length > 0)
                        value = $SIGIfind(element.id).get_textWithMask();
                }
                else
                    value = this.getValue(element, false);
                return (value != null && value != element.defaultValue);
            }
    }
    return false;
}
SIGIObject.prototype.isFocusable = function(element) {
    if (element.tabIndex != null &&
		element.tabIndex > -1 &&
		element.disabled != null &&
		element.disabled == false &&
		this.getCurrentStyle(element, "visibility") != "hidden" &&
		this.getCurrentStyle(element, "display") != "none") {
        return true;
    } else {
        return false;
    }
}
SIGIObject.prototype.setFocus = function(element) {
    if (SIGI.skipForcedFocus == true) {
        SIGI.skipForcedFocus = false;
        return false;
    }
    retVal = false;
    SIGI.skipForcedFocus = true;
    el = element;
    reDir = element.getAttribute("focusRedirect");
    if (reDir != null) {
        el = document.getElementById(reDir);
    }
    if (this.isFocusable(el)) {
        try {
            el.focus();
            retVal = true;
        }
        catch (exc) {
        }
    }
    window.setTimeout("SIGI.skipForcedFocus = false;", 200)
    return retVal;
}

SIGIObject.prototype.setFocusAndFireValidation = function(element) {
    SIGI.setFocus(element);
    SIGI.skipForcedFocus = false;
    parentId = element.getAttribute("compositeParentId");
    if (parentId) {
        SIGI.Validation.CompositeControlUnderValidation = parentId;
    }
    var evt = document.createEventObject("ValidationEvents");
    //this will bring out the tooptip for a validation error
    element.fireEvent("onbeforedeactivate", evt);
}

SIGIObject.prototype.setFocusForValidationFailure = function(element) {
    validationFailure = element.getAttribute("validationFailure");
    if ((validationFailure == null) || (validationFailure.toLowerCase() != "continue")) {
        /*
        RTS 1301860
        prevent the info tooltip from overriding a validation failure tooltip
        */
        this.skipTooltipDueToValFailure = true;
        return SIGI.setFocus(element);
        this.skipTooltipDueToValFailure = false;
    }
    else {
        return false;
    }
}

SIGIObject.prototype.setNextFocus = function(startElement, stayInElement) {
    if (!startElement) return null;

    if (this.setFocus(startElement)) {
        return startElement;
    } else {
        var focusElement;
        if (this.hasChildren(startElement)) {
            focusElement = this.setNextFocus(startElement, stayInElement);
        }
        if (!focusElement && !stayInElement && startElement.nextSibling) {
            focusElement = this.setNextFocus(startElement.nextSibling, stayInElement);
        }
        return focusElement;
    }
}
SIGIObject.prototype.findChildOfTagName = function(srcElement, tagName) {
    if (srcElement == null || tagName == null) return null;

    if (this.hasChildren(srcElement)) {
        for (var i = 0; i < srcElement.childNodes.length; i++) {
            var child = srcElement.childNodes[i];
            if (child && child.tagName && child.tagName.toLowerCase() == tagName.toLowerCase()) {
                return child;
            } else if (this.hasChildren(child)) {
                child = this.findChildOfTagName(child, tagName);
                if (child) return child;
            }
        }
    }
}
SIGIObject.prototype.findParentOfTagName = function(srcElement, tagName) {
    if (srcElement == null || tagName == null) return null;

    while (srcElement.parentNode != null) {
        if (srcElement.tagName) {
            if (srcElement.tagName.toLowerCase() == tagName.toLowerCase()) {
                return srcElement;
            }
        } else {
            return null;
        }
        srcElement = srcElement.parentNode;
    }
}
SIGIObject.prototype.findChildOfClassName = function(srcElement, className) {
    if (srcElement == null || className == null) return null;

    if (this.hasChildren(srcElement)) {
        for (var i = 0; i < srcElement.childNodes.length; i++) {
            var child = srcElement.childNodes[i];
            if (SIGI.hasCssClass(child, className)) {
                return child;
            } else if (this.hasChildren(child)) {
                child = this.findChildOfClassName(child, className);
                if (child) return child;
            }
        }
    }
}
SIGIObject.prototype.findParentOfClassName = function(srcElement, className) {
    if (srcElement == null || className == null) return null;

    while (srcElement.parentNode != null) {
        if (SIGI.hasCssClass(srcElement)) {
            return srcElement;
        }
        srcElement = srcElement.parentNode;
    }
}
/*
These two methods commented out as part of splitting up SIGI.js
SIGI.Rectangle is found in SIGI.UI.js
These methods are in that sheet, added after SIGI.Rectangle is defined
*/
//SIGIObject.prototype.getElementPosition = function(element) {
//    var rect = null;
//    if (element.getBoundingClientRect) {
//        rect = new SIGI.Rectangle(element.getBoundingClientRect());
//    } else if (document.getBoxObjectFor) {
//        rect = new SIGI.Rectangle(document.getBoxObjectFor(element));
//    }
//    SIGI.Window.refresh();
//    rect.top += SIGI.Window.scrollY;
//    rect.bottom += SIGI.Window.scrollY;
//    rect.left += SIGI.Window.scrollX;
//    rect.right += SIGI.Window.scrollX;
//    return rect;
//}
//SIGIObject.prototype.getElementRelativePosition = function(element) {
//    var rect = new SIGI.Rectangle();
//    if (element) {
//        rect.left += element.offsetLeft - (element.scrollLeft || 0);
//        rect.top += element.offsetTop - (element.scrollTop || 0);
//        rect.width = (element.offsetWidth || 0);
//        rect.height = (element.offsetHeight || 0);
//        rect.right = rect.left + rect.width;
//        rect.bottom = rect.top + rect.height;
//    }
//    return rect;
//}
SIGIObject.prototype.getIFrameDocument = function(frameId) {
    // if contentDocument exists, W3C compliant (Mozilla)
    if (document.getElementById(frameId).contentDocument) {
        return document.getElementById(frameId).contentDocument;
    } else {
        // IE
        return document.frames[frameId].document;
    }
}
SIGIObject.prototype.insertElement = function(target, element, where) {
    if (target && element) {
        switch (where) {
            case "before":
                if (target.insertAdjacentElement) {
                    target.insertAdjacentElement("beforeBegin", element)
                } else if (target.parentNode && target.parentNode.insertBefore) {
                    target.parentNode.insertBefore(element, target);
                } else {
                    throw ("Cannot insert element. Browser not supported");
                }
                break;
            case "after":
                if (target.insertAdjacentElement) {
                    target.insertAdjacentElement("afterEnd", element)
                } else if (target.parentNode && target.parentNode.insertBefore) {
                    if (target.nextSibling)
                        target.parentNode.insertBefore(element, target.nextSibling);
                    else
                        target.parentNode.appendChild(element);
                } else {
                    throw ("Cannot insert element. Browser not supported");
                }
                break;
            case "afterBegin":
                if (target.insertAdjacentElement) {
                    target.insertAdjacentElement("afterBegin", element)
                } else if (target.insertBefore) {
                    if (target.childNodes.length > 0 && target.childNodes[0] != null)
                        target.insertBefore(element, target.childNodes[0]);
                    else
                        target.appendChild(element);
                } else {
                    throw ("Cannot insert element. Browser not supported");
                }
            default:
                target.appendChild(element);
                break;
        }
    }

}
SIGIObject.prototype.watchProperty = function(element, propertyName, handler) {
    if (SIGI.Browser.isIE) {
        if (!element.__watchedProperties) element.__watchedProperties = new Array();
        var prop = new Object();
        prop.handling = false;
        prop.propertyName = propertyName;
        prop.oldValue = element[propertyName];
        prop.handler = handler;
        element.__watchedProperties.push(prop);
        element.attachEvent("onpropertychange", this.context(this._onelementpropertychange));
    } else if (element.watch) {
        element.watch(propertyName, handler);
    }
}
SIGIObject.prototype._onelementpropertychange = function() {
    var element = event.srcElement;
    if (element.__watchedProperties) {
        for (var i = 0; i < element.__watchedProperties.length; i++) {

            if (event.propertyName == element.__watchedProperties[i].propertyName && !element.__watchedProperties[i].handling) {
                element.__watchedProperties[i].handling = true;
                element[element.__watchedProperties[i].propertyName] = element.__watchedProperties[i].handler(element.__watchedProperties[i].propertyName, element.__watchedProperties[i].oldValue, element[event.propertyName], element);
                element.__watchedProperties[i].handling = false;
                return;
            }
        }
    }
}
SIGIObject.prototype.changeState = function(element, disabled) {
    if (!element || !element.tagName) return;

    var tagName = element.tagName.toLowerCase();
    var type = (element.type != null) ? element.type : null;


    if (element.onclick && !element.enabledOnClick) {
        element.enabledOnClick = element.onclick;
    }

    if (element.label) {
        if (SIGI.Validation.hideLabelWithElement(element)) {
            if (typeof element.label == "string") {
                var label = document.getElementById(element.label);
                if (label)
                    element.label = label
            }
            element.label.disabled = disabled;
            if (!disabled)
                element.label.className = "FormLabel";
        }
    }
    //element.onclick = function() {if (this.disabled) return false; else if (this.enabledOnClick) return this.enabledOnClick();}

    switch (tagName) {
        case "input":
            switch (type) {
                case "text":
                    /*
                    RTS 1301860:
                    Add special case for MaskedEdit, also handling composites
                    */
                    if (element.className != "MaskedEdit") {
                        if (disabled) {
                            element.className = "TextBoxDisabled";
                        } else {
                            element.className = "TextBox";
                        }
                    }
                    else {
                        if (disabled) {
                            element.className = "MaskedEditDisabled";
                        } else {
                            element.className = "MaskedEdit";
                        }
                    }
                case "password":
                    if (disabled) {
                        SIGI.addCssClass(element, "DISABLEDINPUT");
                    } else {
                        SIGI.removeCssClass(element, "DISABLEDINPUT");
                    }
                default:
                    element.disabled = disabled;
            }
            return;
            break;
        case "textarea":
            if (disabled) {
                element.className = "TextBoxDisabled";
            } else {
                element.className = "MultLineTextBox";
            }
            element.disabled = disabled;
            return;
            break;
        case "a":
            if (disabled) {
                if (element.href) {
                    element.enabledHref = element.href;
                    element.href = "javascript: var i=0;"; // this is dumb, but I needed something completely innocuous;
                }
            } else {
                if (element.enabledHref) element.href = element.enabledHref;
            }
        default:
            if (this.hasChildren(element)) {
                for (var i = 0; i < element.childNodes.length; i++) {
                    this.changeState(element.childNodes[i], disabled);
                }
            }
            element.disabled = disabled;

    }
}
SIGIObject.prototype.disable = function(element) {
    this.changeState(element, true);
}
SIGIObject.prototype.enable = function(element) {
    this.changeState(element, false);
}
SIGIObject.prototype.isHidden = function(control) {
    var ctl = control;
    var running = true;
    var retVal = false;
    while (running) {
        try {
            if (ctl.style.display == "none") {
                running = false;
                retVal = true;
            }
            if (ctl.id == "PageContentArea") {
                running = false;
            }
        }
        catch (e) { }
        try {
            ctl = ctl.parentNode;
        }
        catch (e) {
            running = false;
        }

    }
    return retVal;
}
// Checks to see if a given keycode is allowed for a control
SIGIObject.prototype.isKeyCodeAllowed = function(element, keyCode) {
    var allowKeys = element.getAttribute("allowKeys");
    var ignoreKeys = element.getAttribute("ignoreKeys");
    var allow = true;

    // check if keyCode is in defined list of allowed keys
    if (allowKeys && allowKeys.length > 0) {
        allowKeys = "[" + allowKeys + "]";
        var sTest = String.fromCharCode(keyCode);
        var template = new RegExp(allowKeys, "g");
        allow = template.test(sTest);
    }
    // check if keyCode is in defined list of ignored keys
    if (ignoreKeys && ignoreKeys.length > 0) {
        ignoreKeys = "[" + ignoreKeys + "]";
        var sTest = String.fromCharCode(keyCode);
        var template = new RegExp(ignoreKeys, "g");
        allow = !template.test(sTest);
    }
    return allow;
}
/******************* Global Event handling *******************/
SIGIObject.prototype._onstatustext = function(e) {
    try {
        //this.ieEvent(e);
        e = SIGI.Event.format(e);

        var statusText = null;
        //var element = event.srcElement;
        var element = e.target;

        while (element && !statusText && element != document.body) {
            statusText = element.getAttribute("statusText");
            if (!statusText) statusText = element.getAttribute("title");
            if (!statusText || statusText.length == 0) statusText = element.getAttribute("alt");
            element = element.parentNode;
        }

        if (statusText) {
            window.status = statusText;
            //event.returnValue = true;
            e.preventDefault();
            return true;
        }
    } catch (ex) { }
}
SIGIObject.prototype._onclearstatustext = function(e) {

    //this.ieEvent(e);
    e = SIGI.Event.format(e);
    window.status = window.defaultStatus;
    //event.returnValue = true;
    e.preventDefault();
    return true;
}
// Handles the user pressing backspace to prevent
// the page from returning to the previous page.
SIGIObject.prototype._onkeydown = function(e) {

    //this.ieEvent(e);
    e = SIGI.Event.format(e);

    //var keyCode = event.keyCode;
    //var element = event.srcElement;
    var keyCode = e.keyCode;
    var element = e.target;

    if (keyCode == 8 && !this.isEditable(element)) {
        //event.keyCode = 0;
        //event.returnValue = false
        e.keyCode = 0;
        e.preventDefault();
    }
}

// Handles case transformation on a given control
SIGIObject.prototype._onkeypress = function(e) {
    //this.ieEvent(e);
    e = SIGI.Event.format(e);

    //var element = event.srcElement;
    var element = e.target;
    if (!this.isEditable(element)) return;

    var keyCode
    //if (e.keyCode != 0)
    //    keyCode = e.keyCode;
    //else
    //    keyCode = e.charCode;
    keyCode = e.charCode;

    //alert(event.charCode);
    var inputCase = element.getAttribute("inputCase");
    if (inputCase == null) inputCase = this.inputCase;

    keyCode = keyCodeByCase(keyCode, inputCase);
    //    switch (inputCase.toLowerCase()) {
    //        case "casemixed":
    //            break;
    //        case "caselower":
    //            if (keyCode > 64 && keyCode < 91) {
    //                keyCode = keyCode + 32;
    //            }
    //            break;
    //        case "caseupper":
    //            if (keyCode > 96 && keyCode < 123) {
    //                keyCode = keyCode - 32;
    //            }
    //            break;
    //    }
    if (!this.isKeyCodeAllowed(element, keyCode)) {
        //e.keyCode.value = 0;
        //event.returnValue = false;
        //if (event.preventDefault) event.preventDefault();
        //if (event.stopPropagation) event.stopPropagation();

        if (SIGI.Browser.isIE)
            e.keyCode = 0;
        //        else
        //            e.charCode = 0;

        e.preventDefault();
        e.stopPropagation();
        return false;
    } else {
        if (SIGI.Browser.isIE)
            e.keyCode = keyCode;
        //        else
        //            e.charCode = keyCode;

        return true;
    }
}

SIGIObject.prototype._onbeforepaste = function(e) {
}

SIGIObject.prototype._onpaste = function(e) {
    if (ie != null) {
        e = SIGI.Event.format(e);
        var element = e.target;
        var inputCase = element.getAttribute("inputCase");
        if (inputCase == null) inputCase = this.inputCase;
        output = "";
        try {
            output = window.clipboardData.getData("text");
        }
        catch (e) { }
        output = output.formatPrintable();

        output = output.formatCase(inputCase);
        window.clipboardData.setData("text", output);
    }
}



SIGIObject.prototype._oncontrolactivate = function(e) {

    //this.ieEvent(e);
    e = SIGI.Event.format(e);

    //if (this.isEditable(event.srcElement)) {
    if (this.isEditable(e.target)) {
        try {
            // store the current background color
            //event.srcElement.__backgroundColor = this.getCurrentStyle(event.srcElement, "background-color");
            e.target.__backgroundColor = this.getCurrentStyle(e.target, "background-color");
            e.target.__color = this.getCurrentStyle(e.target, "color");

            // set background color to highlighted
            //if (event.srcElement.type != "button")
            //    event.srcElement.style.backgroundColor = "#E2EFFF";

            if (e.target.type != "button")
                e.target.style.backgroundColor = "#E2EFFF"; // todo: this should be set using theme style
            e.target.style.color = "#000";
            e.target.style.fontStyle = "normal";

            // set controls case transformation
        } catch (ex) { }
    }
}
SIGIObject.prototype._oncontroldeactivate = function(e) {
    //this.ieEvent(e);
    e = SIGI.Event.format(e);

    //if (this.isEditable(event.srcElement)) {
    if (this.isEditable(e.target)) {
        // restore the control's background color
        //event.srcElement.style.backgroundColor = event.srcElement.__backgroundColor;
        e.target.style.backgroundColor = e.target.__backgroundColor;
        e.target.style.color = e.target.__color;
    }
}
SIGIObject.prototype._ontextboxkeydown = function(e) {
    //this.ieEvent(e);
    e = SIGI.Event.format(e);

    //if (event.srcElement.maxLength && event.srcElement.maxLength > -1 && event.srcElement.value.length >= event.srcElement.maxLength) {
    if (e.target.maxLength && e.target.maxLength > -1 && e.target.value.length >= e.target.maxLength) {
        var allow = new Array(8, 9, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46);
        /*
        if (event.ctrlKey == false && allow.find(event.keyCode) == -1) {
        event.returnValue = false;
        event.keyCode = 0;
        }
        */
        if (e.ctrlKey == false && allow.find(e.keyCode) == -1) {
            //event.returnValue = false;
            e.preventDefault();
            e.keyCode = 0;
        }
    }
}
SIGIObject.prototype._ontextboxbeforepaste = function(e) {
    //this.ieEvent(e);
    e = SIGI.Event.format(e);

    //if (event.srcElement.maxLength && event.srcElement.maxLength > -1) {
    if (e.target.maxLength && e.target.maxLength > -1) {
        var pasteText = window.clipboardData.getData("Text");
        /*
        if ((event.srcElement.value.length + pasteText.length) > event.srcElement.maxLength) {
        event.returnValue = false;
        }
        */
        if ((e.target.value.length + pasteText.length) > e.target.maxLength) {
            e.preventDefault();
        }
    }
}
SIGIObject.prototype._ontextboxpaste = function(e) {
    //this.ieEvent(e);
    e = SIGI.Event.format(e);

    //if (event.srcElement.maxLength && event.srcElement.maxLength > -1) {
    if (e.target.maxLength && e.target.maxLength > -1) {
        var pasteText = window.clipboardData.getData("Text");
        /*
        if ((event.srcElement.value.length + pasteText.length) > event.srcElement.maxLength) {
        event.returnValue = false;
        }
        */
        if ((e.target.value.length + pasteText.length) > e.target.maxLength) {
            e.preventDefault();
        }
    }
}
SIGIObject.prototype._oncontextmenu = function(e) {
    //this.ieEvent(e);
    e = SIGI.Event.format(e);

    //if (event.altKey == true && event.ctrlKey == true) {
    if (e.altKey == true && e.ctrlKey == true) {
        return true;
    }
    try {
        /*
        if (this.allowContextMenu != true && !((event.srcElement.tagName == "INPUT" && event.srcElement.type == "text") || event.srcElement.tagName == "TEXTAREA")) {
        event.returnValue = false;
        }
        */
        if (this.allowContextMenu != true && !((e.target.tagName == "INPUT" && e.target.type == "text") || e.target.tagName == "TEXTAREA")) {
            e.preventDefault();
        }

    } catch (exc) {
        //event.returnValue = false;
        e.preventDefault();
    }
}
SIGIObject.prototype._onreadystatechange = function(e) {
    //this.ieEvent(e);
    e = SIGI.Event.format(e);
    try {
        if (document.getElementById("SIGI_Transition")) {
            this.transitionFrame = document.getElementById("SIGI_Transition");
            this.transitionDocument = SIGI.getIFrameDocument("SIGI_Transition");
            this.transitionDocument.body.style.cursor = "wait";
        }

        if (document.getElementById("SIGI_ProgressScreen")) {

            this.progressFrame = document.getElementById("SIGI_ProgressScreen");
            this.progressFrame.ProgressBar = SIGI.getIFrameDocument("SIGI_ProgressScreen");

            this.progressFrame.ProgressBar.Icon = this.progressFrame.ProgressBar.getElementById("icon");
            this.progressFrame.ProgressBar.Message = this.progressFrame.ProgressBar.getElementById("txtMessage");
            this.progressFrame.ProgressBar.ToolTip = this.progressFrame.ProgressBar.getElementById("ToolTip");
            this.progressFrame.ProgressBar.WaitScreen = this.progressFrame.ProgressBar.getElementById("WaitScreen");
            this.progressFrame.ProgressBar.WaitMsg = this.progressFrame.ProgressBar.getElementById("WaitMsg");

            this.progressFrame.ProgressBar.startProgress = window.frames["SIGI_ProgressScreen"].start_Progress;
            this.progressFrame.ProgressBar.stopProgress = window.frames["SIGI_ProgressScreen"].stop_Progress;
            this.progressFrame.ProgressBar.showProgress = window.frames["SIGI_ProgressScreen"].set_Progress;
            this.progressFrame.ProgressBar.body.style.cursor = "wait";
        }

    } catch (ex) { }

    if ((this.Browser.isIE && document.readyState == "complete") || !this.Browser.isIE) {
        this.hidePageTransition();
        this.hideProgressBar();
    }
}
SIGIObject.prototype._AJAXpageLoaded = function() {

    this.hidePageTransition();
    this.hideProgressBar();

    //reset the cursor for the document body - needed for ajax postback
    window.document.body.style.cursor = " "
    window.document.body.style.cursor = this._bodyCursor

}

SIGIObject.prototype.setTextBoxMaxLength = function(textbox, maxLength, maxLengthError) {
    textbox.maxLength = maxLength;

    //this.attachEvent(textbox, "onkeydown", this.context(this._ontextboxkeydown));
    //this.attachEvent(textbox, "onbeforepaste", this.context(this._ontextboxbeforepaste));
    //this.attachEvent(textbox, "onpaste", this.context(this._ontextboxpaste));

    SIGI.Event.addEventListener(textbox, "keydown", this.context(this._ontextboxkeydown));
    SIGI.Event.addEventListener(textbox, "beforepaste", this.context(this._ontextboxbeforepaste));
    SIGI.Event.addEventListener(textbox, "paste", this.context(this._ontextboxpaste));

    textbox.maxLengthError = maxLengthError;
}
SIGIObject.prototype._setForm = function(form) {
    if (form && SIGI.FormObject) {
        this.Form = new SIGI.FormObject(form);
        this.instanceId = this.Form.InstanceID;
    }
}
SIGIObject.prototype._attachEvents = function() {

    /*
    if (!this.Browser.isIE) {
    this.attachEvent(window, "onload", this.context(this._onreadystatechange));
    } else {
    this.attachEvent(document, "onreadystatechange", this.context(this._onreadystatechange));
    }
    this.attachEvent(document.body, "onmouseover", this.context(this._onstatustext));
    this.attachEvent(document.body, "onmouseout", this.context(this._onclearstatustext));
    this.attachEvent(document.body, "onactivate", this.context(this._onstatustext));
    this.attachEvent(document.body, "ondeactivate", this.context(this._onclearstatustext));
    this.attachEvent(document.body, "onactivate", this.context(this._oncontrolactivate));
    this.attachEvent(document.body, "ondeactivate", this.context(this._oncontroldeactivate));
    this.attachEvent(document.body, "onkeypress", this.context(this._onkeypress));
    if (this.preventBackspace) this.attachEvent(document.body, "onkeydown", this.context(this._onkeydown));
    if (!this.allowContextMenu) this.attachEvent(document.body, "oncontextmenu", this.context(this._oncontextmenu));
    */

    if (!this.Browser.isIE) {
        SIGI.Event.addEventListener(window, "load", this.context(this._onreadystatechange));
    } else {
        SIGI.Event.addEventListener(document, "readystatechange", this.context(this._onreadystatechange));
    }
    SIGI.Event.addEventListener(document.body, "mouseover", this.context(this._onstatustext));
    SIGI.Event.addEventListener(document.body, "mouseout", this.context(this._onclearstatustext));
    SIGI.Event.addEventListener(document.body, "activate", this.context(this._onstatustext));
    SIGI.Event.addEventListener(document.body, "deactivate", this.context(this._onclearstatustext));
    SIGI.Event.addEventListener(document.body, "activate", this.context(this._oncontrolactivate));
    SIGI.Event.addEventListener(document.body, "deactivate", this.context(this._oncontroldeactivate));
    SIGI.Event.addEventListener(document.body, "keypress", this.context(this._onkeypress));
    SIGI.Event.addEventListener(document.body, "beforepaste", this.context(this._onbeforepaste));
    SIGI.Event.addEventListener(document.body, "paste", this.context(this._onpaste));
    if (this.preventBackspace) SIGI.Event.addEventListener(document.body, "keydown", this.context(this._onkeydown));
    if (!this.allowContextMenu) SIGI.Event.addEventListener(document.body, "contextmenu", this.context(this._oncontextmenu));


}
SIGIObject.prototype.init = function(mainForm, clientPath) {
    if (clientPath) this.clientPath = clientPath;
    SIGI._setForm(mainForm);
    if (SIGI.CallbackObject) SIGI.Callback = new SIGI.CallbackObject();
    // Added for compatibility with ASP.net validators;
    if (SIGI.Validation) Page_ClientValidate = function() { return SIGI.Validation.Validate(); };
    this._attachEvents();

    //set default callback function
    SIGI.callServer = function() { throw ("Callback must be defined server-side using SIGI.Web.UI.Page.RegisterPageCallback"); };

    if (!(typeof (Sys) == "undefined")) {
        this._AJAXenabled = true;
    }

    if (this._AJAXenabled) {
        Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(this.context(this._AJAXpageLoaded));
    }

}
SIGI = new SIGIObject();
Base = null;

//SIGI.Type
function _SIGI_TypeClass() {
}

_SIGI_TypeClass.prototype.registerClass = function(typeName, baseType, interfaceTypes) {

    if (baseType) {
        typeName.inherits(baseType);
    }

}
SIGI.Type = _SIGI_TypeClass;


// == SIGI.Application Class ==
function _SIGIApplicationClass() {
    this._components = Array();
    this._componentCount = 0;
}

_SIGIApplicationClass.prototype.addComponent = function(component) {

    var id = component.get_id();
    if (!this._components[id]) {
        this._componentCount++;
    }
    this._components[id] = component;
}
_SIGIApplicationClass.prototype.get_componentCount = function() {
    return this._componentCount;
}


_SIGIApplicationClass.prototype.componentIDMatchLeftSide = function(componentId, componentIdReduced) {

    if (!componentId) {
        return null;
    }
    var componentIdReducedLength = componentIdReduced.length;
    //Backwards compatibility
    //Match on left end plus next character is underscore - only ListView controls get SIGIcreated 
    //this way, with a name that matches on left end with previous naming convention and follows with underscore
    return ((componentId.substring(0, componentIdReducedLength) == componentIdReduced) && (componentId.substring(componentIdReducedLength, componentIdReducedLength + 1) == "_"));
}

_SIGIApplicationClass.prototype.findComponent = function(componentId) {

    var component = this._components[componentId];
    if (component == null) {
        component = this._components[componentId + "_Composite"];
    }
    if (component == null) {
        var compToCheck;
        for (compToCheck in this._components) {
            if (_SIGIApplicationClass.prototype.componentIDMatchLeftSide(compToCheck, componentId)) {
                component = $SIGIfind(compToCheck);
                break;
            }
        }
    }
    return component;
}

SIGI.Application = new _SIGIApplicationClass();

