var STR_PAD_LEFT = 1;
var STR_PAD_RIGHT = 2;
var STR_PAD_BOTH = 3;
function pad(value, len, character, dir)
{
    if (typeof (len) == "undefined")
    {
        var len = 0;
    }
    if (typeof (pad) == "undefined")
    {
        var character = " ";
    }
    if (typeof (dir) == "undefined")
    {
        var dir = STR_PAD_LEFT;
    }
    if (len + 1 >= value.length)
    {
        switch (dir)
        {
            case STR_PAD_LEFT:
                return Array(len + 1 - value.length).join(character) + value;
                break;
            case STR_PAD_BOTH:
                var right = Math.ceil((padlen = len - value.length) / 2);
                var left = padlen - right;
                return Array(left + 1).join(character) + value + Array(right + 1).join(character);
                break;
            default:
                return value + Array(len + 1 - value.length).join(character);
                break;
        }
    }
    return this;
}
String.prototype.pad = function(len, character, dir)
{
    return pad(this, len, character, dir);
};
function trim(value)
{
    return value.replace(/^\s+|\s+$/g, "");
}
String.prototype.trim = function()
{
    return trim(this);
};
String.prototype.toBool = function()
{
    switch (this.toLowerCase())
    {
        case "true":
        case "t":
        case "yes":
        case "y":
        case "1":
        case "on":
        case "affirmative":
        case "a":
            return true;
    }
    return false;
};
Number.prototype.toBool = function()
{
    return this != 0;
};
Date.prototype.toBool = function()
{
    return this.valueOf() != 0;
};
var Framework_Dialog = undefined;
function Framework_Dialog_Close(evt)
{
    if (Framework_Dialog)
    {
        Framework_Dialog.Close();
    }
}
function Framework_Dialog_MouseDown(evt)
{
    if (Framework_Dialog)
    {
        Framework_Dialog._MouseDown(new Framework_Event(evt));
    }
}
function Framework_Dialog_MouseMove(evt)
{
    if (Framework_Dialog)
    {
        Framework_Dialog._MouseMove(new Framework_Event(evt));
    }
}
function Framework_Dialog_MouseUp(evt)
{
    if (Framework_Dialog)
    {
        Framework_Dialog._MouseUp(new Framework_Event(evt));
    }
}
function Framework_Dialog_KeyDown(evt)
{
    if (Framework_Dialog)
    {
        Framework_Dialog._KeyDown(new Framework_Event(evt));
    }
}
function Framework_Dialog_KeyPress(evt)
{
    if (Framework_Dialog)
    {
        Framework_Dialog._KeyPress(new Framework_Event(evt));
    }
}
function Framework_Dialog_KeyUp(evt)
{
    if (Framework_Dialog)
    {
        Framework_Dialog._KeyUp(new Framework_Event(evt));
    }
}
function Framework_Dialog_Handler(caption, x, y, width, height, resizeable, moveable, buttons, okEvent, cancelEvent, closeEvent)
{
    this._FrameworkDialog = null;
    this._FrameworkDimmer = null;
    this._Direction = "";
    this._OriginalMouseX = 0;
    this._OriginalMouseY = 0;
    this._OriginalWidth = 0;
    this._OriginalHeight = 0;
    this._OriginalLeft = 0;
    this._OriginalTop = 0;
    this._IsResizeable = true;
    this._IsMoveable = true;
    this._Buttons = new Array();
    this.Caption = "";
    this._CancelEvent = undefined;
    this._CloseEvent = undefined;
    this._OkEvent = undefined;
    {
        this.Initialize = function(caption, x, y, width, height, resizeable, moveable, buttons, okEvent, cancelEvent, closeEvent)
        {
            var X = 0;
            var Y = 0;
            var Width = 0;
            var Height = 0;
            this.SetOkEvent(okEvent);
            this.SetCancelEvent(cancelEvent);
            this.SetCloseEvent(closeEvent);
            if (!caption)
            {
                return;
            }
            this.Caption = caption;
            Framework_Dialog_Close();
            Framework_Dialog = this;
            if (typeof (resizeable) != "boolean")
            {
                this._IsResizeable = true;
            }
            else
            {
                this._IsResizeable = resizeable;
            }
            if (typeof (moveable) != "boolean")
            {
                this._IsMoveable = true;
            }
            else
            {
                this._IsMoveable = moveable;
            }
            if (typeof (width) != "number")
            {
                Width = 500;
            }
            else
            {
                Width = width;
            }
            if (typeof (height) != "number")
            {
                Height = 500;
            }
            else
            {
                Height = height;
            }
            if (Width < 100)
            {
                Width = 100;
            }
            if (Height < 100)
            {
                Height = 100;
            }
            if (typeof (x) != "number")
            {
                X = Math.max(0, Math.round((document.documentElement.clientWidth - Width) / 2)) + document.documentElement.scrollLeft;
            }
            else
            {
                X = x;
            }
            if (typeof (y) != "number")
            {
                Y = Math.max(0, Math.round((document.documentElement.clientHeight - Height) / 2)) + document.documentElement.scrollTop;
            }
            else
            {
                Y = y;
            }
            if (typeof (buttons) == "string")
            {
                this._Buttons = buttons.toLowerCase().split(/\s*[,;|]\s*/ig);
            }
            this._FrameworkDimmer = document.getElementById("FrameworkDimmer");
            this._FrameworkDialog = document.getElementById("FrameworkDialog");
            this._FrameworkDialog.style.left = X.toString() + "px";
            this._FrameworkDialog.style.top = Y.toString() + "px";
            this._FrameworkDialog.style.width = Width.toString() + "px";
            this._FrameworkDialog.style.height = Height.toString() + "px";
            this.Refresh();
            this.Enable();
            this._FrameworkDialog.style.visibility = "visible";
            this._FrameworkDimmer.style.visibility = "visible";
            this._InternalShow();
        };
        this._IsGrip = function(className)
        {
            if (className == "FrameworkDialogCaption")
            {
                return this._IsMoveable;
            }
            if (className == "FrameworkDialogUpperLeft")
            {
                return this._IsResizeable;
            }
            if (className == "FrameworkDialogUpperRight")
            {
                return this._IsResizeable;
            }
            if (className == "FrameworkDialogLowerLeft")
            {
                return this._IsResizeable;
            }
            if ((className == "FrameworkDialogLowerRight") || (className == "FrameworkDialogSizeGrip"))
            {
                return this._IsResizeable;
            }
            if (className == "FrameworkDialogTop")
            {
                return this._IsResizeable;
            }
            if (className == "FrameworkDialogBottom")
            {
                return this._IsResizeable;
            }
            if (className == "FrameworkDialogLeft")
            {
                return this._IsResizeable;
            }
            if (className == "FrameworkDialogRight")
            {
                return this._IsResizeable;
            }
            return false;
        };
        this._KeyDown = function(event)
        {
        };
        this._KeyPress = function(event)
        {
            if ((event._Event.keyCode == 13) && (event.Target.tagName != "TEXTAREA"))
            {
                event._Event.keyCode = 0;
                event.Cancel();
            }
        };
        this._KeyUp = function(event)
        {
        };
        this._MouseDown = function(event)
        {
            if (event.Target.className == "FrameworkDialogSystemControls")
            {
                Framework_Dialog_Close();
                return;
            }
            if (!this._IsGrip(event.Target.className))
            {
                return;
            }
            this._Direction = event.Target.className;
            this._OriginalMouseX = event.MousePosition.X;
            this._OriginalMouseY = event.MousePosition.Y;
            this._OriginalWidth = this._FrameworkDialog.offsetWidth;
            this._OriginalHeight = this._FrameworkDialog.offsetHeight;
            this._OriginalLeft = this._FrameworkDialog.offsetLeft;
            this._OriginalTop = this._FrameworkDialog.offsetTop;
            event.Cancel();
        };
        this._MouseMove = function(event)
        {
            var DifferenceX;
            var DifferenceY;
            if (!this._IsGrip(this._Direction))
            {
                return;
            }
            DifferenceX = event.MousePosition.X - this._OriginalMouseX;
            DifferenceY = event.MousePosition.Y - this._OriginalMouseY;
            if (this._Direction == "FrameworkDialogCaption")
            {
                this._FrameworkDialog.style.left = (this._OriginalLeft + DifferenceX).toString() + "px";
                this._FrameworkDialog.style.top = (this._OriginalTop + DifferenceY).toString() + "px";
            }
            if (this._Direction == "FrameworkDialogUpperLeft")
            {
                if ((this._OriginalWidth - DifferenceX) < 100)
                {
                    this._FrameworkDialog.style.left = (this._OriginalLeft + this._OriginalWidth - 100).toString() + "px";
                    this._FrameworkDialog.style.width = "100px";
                }
                else
                {
                    this._FrameworkDialog.style.left = (this._OriginalLeft + DifferenceX).toString() + "px";
                    this._FrameworkDialog.style.width = (this._OriginalWidth - DifferenceX).toString() + "px";
                }
                if ((this._OriginalHeight - DifferenceY) < 100)
                {
                    this._FrameworkDialog.style.top = (this._OriginalTop + this._OriginalHeight - 100).toString() + "px";
                    this._FrameworkDialog.style.height = "100px";
                }
                else
                {
                    this._FrameworkDialog.style.top = (this._OriginalTop + DifferenceY).toString() + "px";
                    this._FrameworkDialog.style.height = (this._OriginalHeight - DifferenceY).toString() + "px";
                }
            }
            if (this._Direction == "FrameworkDialogUpperRight")
            {
                if ((this._OriginalHeight - DifferenceY) < 100)
                {
                    this._FrameworkDialog.style.top = (this._OriginalTop + this._OriginalHeight - 100).toString() + "px";
                    this._FrameworkDialog.style.height = "100px";
                }
                else
                {
                    this._FrameworkDialog.style.top = (this._OriginalTop + DifferenceY).toString() + "px";
                    this._FrameworkDialog.style.height = (this._OriginalHeight - DifferenceY).toString() + "px";
                }
                this._FrameworkDialog.style.width = Math.max(100, this._OriginalWidth + DifferenceX).toString() + "px";
            }
            if (this._Direction == "FrameworkDialogLowerLeft")
            {
                if ((this._OriginalWidth - DifferenceX) < 100)
                {
                    this._FrameworkDialog.style.left = (this._OriginalLeft + this._OriginalWidth - 100).toString() + "px";
                    this._FrameworkDialog.style.width = "100px";
                }
                else
                {
                    this._FrameworkDialog.style.left = (this._OriginalLeft + DifferenceX).toString() + "px";
                    this._FrameworkDialog.style.width = (this._OriginalWidth - DifferenceX).toString() + "px";
                }
                this._FrameworkDialog.style.height = Math.max(100, this._OriginalHeight + DifferenceY).toString() + "px";
            }
            if ((this._Direction == "FrameworkDialogLowerRight") || (this._Direction == "FrameworkDialogSizeGrip"))
            {
                this._FrameworkDialog.style.height = Math.max(100, this._OriginalHeight + DifferenceY).toString() + "px";
                this._FrameworkDialog.style.width = Math.max(100, this._OriginalWidth + DifferenceX).toString() + "px";
            }
            if (this._Direction == "FrameworkDialogTop")
            {
                if ((this._OriginalHeight - DifferenceY) < 100)
                {
                    this._FrameworkDialog.style.top = (this._OriginalTop + this._OriginalHeight - 100).toString() + "px";
                    this._FrameworkDialog.style.height = "100px";
                }
                else
                {
                    this._FrameworkDialog.style.top = (this._OriginalTop + DifferenceY).toString() + "px";
                    this._FrameworkDialog.style.height = (this._OriginalHeight - DifferenceY).toString() + "px";
                }
            }
            if (this._Direction == "FrameworkDialogBottom")
            {
                this._FrameworkDialog.style.height = Math.max(100, this._OriginalHeight + DifferenceY).toString() + "px";
            }
            if (this._Direction == "FrameworkDialogLeft")
            {
                if ((this._OriginalWidth - DifferenceX) < 100)
                {
                    this._FrameworkDialog.style.left = (this._OriginalLeft + this._OriginalWidth - 100).toString() + "px";
                    this._FrameworkDialog.style.width = "100px";
                }
                else
                {
                    this._FrameworkDialog.style.left = (this._OriginalLeft + DifferenceX).toString() + "px";
                    this._FrameworkDialog.style.width = (this._OriginalWidth - DifferenceX).toString() + "px";
                }
            }
            if (this._Direction == "FrameworkDialogRight")
            {
                this._FrameworkDialog.style.width = Math.max(100, this._OriginalWidth + DifferenceX).toString() + "px";
            }
            this._InternalResize();
            event.Cancel();
        };
        this._MouseUp = function(event)
        {
            this._Direction = "";
        };
        this._InternalDraw = function()
        {
            var Html = "";
            Html += "<div id=\"Framework_Dialog_Background\" class=\"FrameworkDialogBackground\"><img src=\"/Framework/pixel.gif\" width=\"6\" height=\"6\" alt=\"\" /></div>";
            if (this._IsMoveable)
            {
                Html += "<div id=\"Framework_Dialog_Caption\" class=\"FrameworkDialogCaption\" style=\"cursor: move\">";
            }
            else
            {
                Html += "<div id=\"Framework_Dialog_Caption\" class=\"FrameworkDialogCaption\">";
            }
            Html += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"FrameworkDialogCaption\">";
            Html += "<col /><col width=\"20px\" />";
            Html += "<tr>";
            Html += "<td class=\"FrameworkDialogCaption\" style=\"padding-left: 5px\">" + this.Caption + "</td>";
            Html += "<td class=\"FrameworkDialogSystemControls\" style=\"text-align: center\"><img id=\"Framework_Dialog_Close\" src=\"/Framework/dialog_close.png\" width=\"10\" height=\"10\" alt=\"Close\" class=\"FrameworkDialogSystemControls\" onclick=\"Framework_Dialog._InternalClose()\" style=\"cursor: pointer\" /></td>";
            Html += "</tr>";
            Html += "</table>";
            Html += "</div>";
            Html += "<div id=\"Framework_Dialog_Content\" class=\"FrameworkDialogContent\">" + this.GetContent() + "</div>";
            if (this._Buttons.length > 0)
            {
                Html += "<div id=\"Framework_Dialog_Controls\" class=\"FrameworkDialogControls\">";
                for (var i = 0; i < this._Buttons.length; i++)
                {
                    if (i > 0)
                    {
                        Html += "<img src=\"/Framework/pixel.gif\" width=\"2\" height=\"30\" alt=\"\" />";
                    }
                    switch (this._Buttons[i])
                    {
                        case "ok":
                            Html += "<img id=\"Framework_Dialog_OkButton\" src=\"/Framework/ok_normal.png\" alt=\"Ok\" onclick=\"Framework_Dialog._InternalOk()\" style=\"cursor: pointer\" onmouseover=\"this.src = '/Framework/ok_over.png'\" onmouseout=\"this.src = '/Framework/ok_normal.png'\" onmousedown=\"this.src = '/Framework/ok_down.png'\" onmouseup=\"this.src = '/Framework/ok_over.png'\" />";
                            break;
                        case "cancel":
                            Html += "<img id=\"Framework_Dialog_CancelButton\" src=\"/Framework/cancel_normal.png\" alt=\"Cancel\" onclick=\"Framework_Dialog._InternalCancel()\" style=\"cursor: pointer\" onmouseover=\"this.src = '/Framework/cancel_over.png'\" onmouseout=\"this.src = '/Framework/cancel_normal.png'\" onmousedown=\"this.src = '/Framework/cancel_down.png'\" onmouseup=\"this.src = '/Framework/cancel_over.png'\" />";
                            break;
                        case "close":
                            Html += "<img id=\"Framework_Dialog_CloseButton\" src=\"/Framework/close_normal.png\" alt=\"Close\" onclick=\"Framework_Dialog._InternalClose()\" style=\"cursor: pointer\" onmouseover=\"this.src = '/Framework/close_over.png'\" onmouseout=\"this.src = '/Framework/close_normal.png'\" onmousedown=\"this.src = '/Framework/close_down.png'\" onmouseup=\"this.src = '/Framework/close_over.png'\" />";
                            break;
                    }
                }
                if (this._IsResizeable)
                {
                    Html += "<img src=\"/Framework/pixel.gif\" width=\"30\" height=\"30\" alt=\"\" /></div>";
                }
                Html += "</div>";
            }
            if (this._IsResizeable)
            {
                Html += "<div id=\"Framework_Dialog_UpperLeft\" class=\"FrameworkDialogUpperLeft\" style=\"cursor: nw-resize\"><img class=\"FrameworkDialogUpperLeft\" src=\"/Framework/dialog_upperleft.png\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_UpperRight\" class=\"FrameworkDialogUpperRight\" style=\"cursor: ne-resize\"><img class=\"FrameworkDialogUpperRight\" src=\"/Framework/dialog_upperright.png\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_LowerLeft\" class=\"FrameworkDialogLowerLeft\" style=\"cursor: sw-resize\"><img class=\"FrameworkDialogLowerLeft\" src=\"/Framework/dialog_lowerleft.png\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_LowerRight\" class=\"FrameworkDialogLowerRight\" style=\"cursor: se-resize\"><img class=\"FrameworkDialogLowerRight\" src=\"/Framework/dialog_lowerright.png\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_Top\" class=\"FrameworkDialogTop\" style=\"cursor: n-resize\"><img class=\"FrameworkDialogTop\" src=\"/Framework/pixel.gif\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_Bottom\" class=\"FrameworkDialogBottom\" style=\"cursor: s-resize\"><img class=\"FrameworkDialogBottom\" src=\"/Framework/pixel.gif\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_Left\" class=\"FrameworkDialogLeft\" style=\"cursor: w-resize\"><img class=\"FrameworkDialogLeft\" src=\"/Framework/pixel.gif\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_Right\" class=\"FrameworkDialogRight\" style=\"cursor: e-resize\"><img class=\"FrameworkDialogRight\" src=\"/Framework/pixel.gif\" width=\"6\" height=\"6\" alt=\"\" /></div>";
            }
            else
            {
                Html += "<div id=\"Framework_Dialog_UpperLeft\" class=\"FrameworkDialogUpperLeft\"><img class=\"FrameworkDialogUpperLeft\" src=\"/Framework/dialog_upperleft.png\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_UpperRight\" class=\"FrameworkDialogUpperRight\"><img class=\"FrameworkDialogUpperRight\" src=\"/Framework/dialog_upperright.png\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_LowerLeft\" class=\"FrameworkDialogLowerLeft\"><img class=\"FrameworkDialogLowerLeft\" src=\"/Framework/dialog_lowerleft.png\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_LowerRight\" class=\"FrameworkDialogLowerRight\"><img class=\"FrameworkDialogLowerRight\" src=\"/Framework/dialog_lowerright.png\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_Top\" class=\"FrameworkDialogTop\"><img class=\"FrameworkDialogTop\" src=\"/Framework/pixel.gif\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_Bottom\" class=\"FrameworkDialogBottom\"><img class=\"FrameworkDialogBottom\" src=\"/Framework/pixel.gif\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_Left\" class=\"FrameworkDialogLeft\"><img class=\"FrameworkDialogLeft\" src=\"/Framework/pixel.gif\" width=\"6\" height=\"6\" alt=\"\" /></div>";
                Html += "<div id=\"Framework_Dialog_Right\" class=\"FrameworkDialogRight\"><img class=\"FrameworkDialogRight\" src=\"/Framework/pixel.gif\" width=\"6\" height=\"6\" alt=\"\" /></div>";
            }
            if (this._IsResizeable)
            {
                Html += "<div id=\"Framework_Dialog_SizeGrip\" class=\"FrameworkDialogSizeGrip\" style=\"cursor: se-resize\"><img class=\"FrameworkDialogSizeGrip\" src=\"/Framework/dialog_sizegrip.png\" width=\"24\" height=\"24\" alt=\"\" /></div>";
            }
            this._FrameworkDialog.innerHTML = Html;
        };
        this._InternalCancel = function()
        {
            var Result;
            Result = true;
            try
            {
                Result = this.OnCancel();
                Result = (Result == undefined ? true : Result);
                if (Result && (this._CancelEvent != undefined))
                {
                    Result = this._CancelEvent(this);
                    Result = (Result == undefined ? true : Result);
                }
            }
            catch (e)
            {
            }
            if (Result)
            {
                this.Close();
            }
        };
        this._InternalClose = function()
        {
            var Result;
            Result = true;
            try
            {
                Result = this.OnClose();
                Result = (Result == undefined ? true : Result);
                if (Result && (this._CloseEvent != undefined))
                {
                    Result = this._CloseEvent(this);
                    Result = (Result == undefined ? true : Result);
                }
            }
            catch (e)
            {
            }
            if (Result)
            {
                this.Close();
            }
        };
        this._InternalOk = function()
        {
            var Result;
            Result = true;
            try
            {
                Result = this.OnOk();
                Result = (Result == undefined ? true : Result);
                if (Result && (this._OkEvent != undefined))
                {
                    Result = this._OkEvent(this);
                    Result = (Result == undefined ? true : Result);
                }
            }
            catch (e)
            {
            }
            if (Result)
            {
                this.Close();
            }
        };
        this._InternalResize = function()
        {
            var Width = this._FrameworkDialog.offsetWidth;
            var Height = this._FrameworkDialog.offsetHeight;
            var Framework_Dialog_Background = document.getElementById("Framework_Dialog_Background");
            var Framework_Dialog_SizeGrip = document.getElementById("Framework_Dialog_SizeGrip");
            var Framework_Dialog_Caption = document.getElementById("Framework_Dialog_Caption");
            var Framework_Dialog_Content = document.getElementById("Framework_Dialog_Content");
            var Framework_Dialog_Controls = document.getElementById("Framework_Dialog_Controls");
            var Framework_Dialog_UpperLeft = document.getElementById("Framework_Dialog_UpperLeft");
            var Framework_Dialog_UpperRight = document.getElementById("Framework_Dialog_UpperRight");
            var Framework_Dialog_LowerLeft = document.getElementById("Framework_Dialog_LowerLeft");
            var Framework_Dialog_LowerRight = document.getElementById("Framework_Dialog_LowerRight");
            var Framework_Dialog_Top = document.getElementById("Framework_Dialog_Top");
            var Framework_Dialog_Bottom = document.getElementById("Framework_Dialog_Bottom");
            var Framework_Dialog_Left = document.getElementById("Framework_Dialog_Left");
            var Framework_Dialog_Right = document.getElementById("Framework_Dialog_Right");
            this._FrameworkDialog.style.width = Width.toString() + "px";
            this._FrameworkDialog.style.height = Height.toString() + "px";
            Framework_Dialog_UpperLeft.style.left = "0px";
            Framework_Dialog_UpperLeft.style.top = "0px";
            Framework_Dialog_UpperRight.style.left = (Width - 6).toString() + "px";
            Framework_Dialog_UpperRight.style.top = "0px";
            Framework_Dialog_LowerLeft.style.left = "0px";
            Framework_Dialog_LowerLeft.style.top = (Height - 6).toString() + "px";
            Framework_Dialog_LowerRight.style.left = (Width - 6).toString() + "px";
            Framework_Dialog_LowerRight.style.top = (Height - 6).toString() + "px";
            Framework_Dialog_Background.style.left = "6px";
            Framework_Dialog_Background.style.top = "6px";
            Framework_Dialog_Background.style.width = (Width - 12).toString() + "px";
            Framework_Dialog_Background.style.height = (Height - 12).toString() + "px";
            if (this._IsResizeable)
            {
                Framework_Dialog_SizeGrip.style.left = (Width - 30).toString() + "px";
                Framework_Dialog_SizeGrip.style.top = (Height - 30).toString() + "px";
                Framework_Dialog_SizeGrip.style.width = "24px";
                Framework_Dialog_SizeGrip.style.height = "24px";
            }
            Framework_Dialog_Top.style.left = "6px";
            Framework_Dialog_Top.style.top = "0px";
            Framework_Dialog_Top.style.width = (Width - 12).toString() + "px";
            Framework_Dialog_Top.style.height = "6px";
            Framework_Dialog_Bottom.style.left = "6px";
            Framework_Dialog_Bottom.style.top = (Height - 6).toString() + "px";
            Framework_Dialog_Bottom.style.width = (Width - 12).toString() + "px";
            Framework_Dialog_Bottom.style.height = "6px";
            Framework_Dialog_Left.style.left = "0px";
            Framework_Dialog_Left.style.top = "6px";
            Framework_Dialog_Left.style.width = "6px";
            Framework_Dialog_Left.style.height = (Height - 12).toString() + "px";
            Framework_Dialog_Right.style.left = (Width - 6).toString() + "px";
            Framework_Dialog_Right.style.top = "6px";
            Framework_Dialog_Right.style.width = "6px";
            Framework_Dialog_Right.style.height = (Height - 12).toString() + "px";
            Framework_Dialog_Caption.style.width = (Width - 12).toString() + "px";
            if (this._Buttons.length > 0)
            {
                Framework_Dialog_Content.style.width = (Width - 24).toString() + "px";
                Framework_Dialog_Content.style.height = (Height - 85).toString() + "px";
            }
            else
            {
                Framework_Dialog_Content.style.width = (Width - 24).toString() + "px";
                Framework_Dialog_Content.style.height = (Height - 50).toString() + "px";
            }
            if (this._Buttons.length > 0)
            {
                Framework_Dialog_Controls.style.width = (Width - 12).toString() + "px";
                Framework_Dialog_Controls.style.top = (Height - 41).toString() + "px";
            }
            this._ResizeDimmer();
            try
            {
                this.OnResize(Width - 12, Height - 38);
            }
            catch (e)
            {
            }
        };
        this._InternalShow = function()
        {
            try
            {
                this.OnShow();
            }
            catch (e)
            {
            }
        };
        this._ResizeDimmer = function()
        {
            var Width = 0;
            var Height = 0;
            Width = document.body.scrollWidth;
            if (Framework_IsMSIE)
            {
                if (document.body.scrollHeight > (window.screen.height - window.screenTop))
                {
                    Height = document.body.scrollHeight;
                }
                else
                {
                    Height = window.screen.height - window.screenTop;
                }
            }
            else
            {
                if (window.scrollMaxY > window.screen.height)
                {
                    Height = window.scrollMaxY + window.screen.height;
                }
                else
                {
                    Height = window.screen.height;
                }
            }
            if (this._FrameworkDialog.offsetLeft + this._FrameworkDialog.offsetWidth > Width)
            {
                Width = this._FrameworkDialog.offsetLeft + this._FrameworkDialog.offsetWidth;
            }
            if (this._FrameworkDialog.offsetTop + this._FrameworkDialog.offsetHeight > Height)
            {
                Height = this._FrameworkDialog.offsetTop + this._FrameworkDialog.offsetHeight;
            }
            this._FrameworkDimmer.style.width = Width.toString() + "px";
            this._FrameworkDimmer.style.height = Height.toString() + "px";
        };
        this.Close = function()
        {
            this._FrameworkDimmer.style.visibility = "hidden";
            this._FrameworkDialog.style.visibility = "hidden";
            this._FrameworkDialog.innerHTML = "";
            Framework_Dialog = undefined;
        };
        this.GetContent = function()
        {
            return "";
        };
        this.Refresh = function()
        {
            this._InternalDraw();
            this._InternalResize();
            try
            {
                this.OnRefresh();
            }
            catch (e)
            {
            }
        };
        this.Enable = function()
        {
            var Framework_Dialog_Close = document.getElementById("Framework_Dialog_Close");
            Framework_Dialog_Close.onclick = Framework_Dialog_Close;
            Framework_Dialog_Close.disabled = false;
            this._FrameworkDimmer.onclick = Framework_Dialog_Close;
            this._FrameworkDimmer.disabled = false;
        };
        this.Disable = function()
        {
            var Framework_Dialog_Close = document.getElementById("Framework_Dialog_Close");
            Framework_Dialog_Close.onclick = null;
            Framework_Dialog_Close.disabled = true;
            this._FrameworkDimmer.onclick = null;
            this._FrameworkDimmer.disabled = true;
        };
        this.OnCancel = function()
        {
        };
        this.OnClose = function()
        {
        };
        this.OnOk = function()
        {
        };
        this.OnRefresh = function()
        {
        };
        this.OnResize = function(width, height)
        {
        };
        this.OnShow = function()
        {
        };
        this.SetCancelEvent = function(handler)
        {
            if (typeof (handler) == "function")
            {
                this._CancelEvent = handler;
            }
        };
        this.SetCloseEvent = function(handler)
        {
            if (typeof (handler) == "function")
            {
                this._CloseEvent = handler;
            }
        };
        this.SetOkEvent = function(handler)
        {
            if (typeof (handler) == "function")
            {
                this._OkEvent = handler;
            }
        };
    }
    this.Initialize(caption, x, y, width, height, resizeable, moveable, buttons, okEvent, cancelEvent, closeEvent);
}
function Framework_AjaxDialog(caption, url, x, y, width, height, resizeable, moveable, buttons)
{
    this.Url = url;
    {
        this.GetContent = function()
        {
            var Ajax = new Framework_Ajax();
            Ajax.SendRequest(this.Url);
            if (Ajax.GetStatus() == 200)
            {
                return Ajax.GetResponseAsText();
            }
            return "";
        };
    }
    this.Initialize(caption, x, y, width, height, resizeable, moveable, buttons);
}
Framework_AjaxDialog.prototype = new Framework_Dialog_Handler;
function Framework_GenericDialog(caption, content, x, y, width, height, resizeable, moveable, buttons, okEvent, cancelEvent, closeEvent)
{
    this._Content = content;
    {
        this.GetContent = function()
        {
            return this._Content;
        };
    }
    this.Initialize(caption, x, y, width, height, resizeable, moveable, buttons, okEvent, cancelEvent, closeEvent);
}
Framework_GenericDialog.prototype = new Framework_Dialog_Handler;
function Framework_DateFieldDialog(fieldId, name, updateScript)
{
    this._TextBox = document.getElementById(fieldId);
    this._UpdateScript = updateScript;
    this._CurrentDate = new Date(this._TextBox.value);
    if (isNaN(this._CurrentDate))
    {
        this._CurrentDate = new Date();
    }
    this._CurrentDate = new Date(this._CurrentDate.getFullYear(), this._CurrentDate.getMonth(), this._CurrentDate.getDate());
    this._SelectedDate = this._CurrentDate;
    {
        this.UpdateUI = function()
        {
            if (this._UpdateScript)
            {
                eval(this._UpdateScript);
            }
        };
        this.PreviousMonth = function()
        {
            this._CurrentDate = new Date(this._CurrentDate.getFullYear(), this._CurrentDate.getMonth() - 1, this._CurrentDate.getDate());
            this.Refresh();
        };
        this.NextMonth = function()
        {
            this._CurrentDate = new Date(this._CurrentDate.getFullYear(), this._CurrentDate.getMonth() + 1, this._CurrentDate.getDate());
            this.Refresh();
        };
        this.Select = function(date)
        {
            this._TextBox.value = date;
            Framework_Dialog_Close();
            this.UpdateUI();
        };
        this.MonthToString = function(month)
        {
            switch (month)
            {
                case 0:
                    return "January";
                case 1:
                    return "February";
                case 2:
                    return "March";
                case 3:
                    return "April";
                case 4:
                    return "May";
                case 5:
                    return "June";
                case 6:
                    return "July";
                case 7:
                    return "August";
                case 8:
                    return "September";
                case 9:
                    return "October";
                case 10:
                    return "November";
                case 11:
                    return "December";
            }
        };
        this.DateToString = function(date)
        {
            return (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear();
        };
        this.GetContent = function(content)
        {
            var Today = new Date();
            var FirstDayOfMonth = new Date(this._CurrentDate.getFullYear(), this._CurrentDate.getMonth(), 1);
            var LastDayOfMonth = new Date(this._CurrentDate.getFullYear(), this._CurrentDate.getMonth() + 1, 0);
            var FirstDay = new Date(FirstDayOfMonth.getFullYear(), FirstDayOfMonth.getMonth(), FirstDayOfMonth.getDate() - FirstDayOfMonth.getDay());
            var Html = "";
            Html += "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" style=\"table-layout: fixed\">";
            Html += "<col width=\"25\" /><col width=\"25\" /><col width=\"25\" /><col width=\"25\" /><col width=\"25\" /><col width=\"25\" /><col width=\"25\" />";
            Html += "<tr>";
            Html += "<th class=\"Normal\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: bold; cursor: pointer\" onclick=\"Framework_Dialog.PreviousMonth(" + this.DateToString(this._CurrentDate) + ")\">&laquo;</th>";
            Html += "<th class=\"Normal\" height=\"25\" colspan=\"5\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: bold; cursor: default\">" + this.MonthToString(this._CurrentDate.getMonth()) + " " + this._CurrentDate.getFullYear() + "</th>";
            Html += "<th class=\"Normal\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: bold; cursor: pointer\" onclick=\"Framework_Dialog.NextMonth(" + this.DateToString(this._CurrentDate) + ")\">&raquo;</th>";
            Html += "</tr>";
            for (var i = 0; i < 6; i++)
            {
                Html += "<tr>";
                for (var j = 0; j < 7; j++)
                {
                    var CurrentDay = new Date(FirstDay.getFullYear(), FirstDay.getMonth(), FirstDay.getDate() + i * 7 + j);
                    if (Date.parse(this._SelectedDate.toDateString()) == Date.parse(CurrentDay.toDateString()))
                    {
                        if (Date.parse(Today.toDateString()) == Date.parse(CurrentDay.toDateString()))
                        {
                            Html += "<td class=\"Highlight\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: bold; cursor: pointer\" onclick=\"Framework_Dialog.Select('" + this.DateToString(CurrentDay) + "')\">" + CurrentDay.getDate() + "</td>";
                        }
                        else
                        {
                            Html += "<td class=\"Highlight\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: normal; cursor: pointer\" onclick=\"Framework_Dialog.Select('" + this.DateToString(CurrentDay) + "')\">" + CurrentDay.getDate() + "</td>";
                        }
                    }
                    else
                    {
                        if ((Date.parse(CurrentDay.toDateString()) < Date.parse(FirstDayOfMonth.toDateString())) || (Date.parse(CurrentDay.toDateString()) > Date.parse(LastDayOfMonth.toDateString())))
                        {
                            if (Date.parse(Today.toDateString()) == Date.parse(CurrentDay.toDateString()))
                            {
                                Html += "<td class=\"Disabled\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: bold; cursor: pointer\">" + CurrentDay.getDate() + "</td>";
                            }
                            else
                            {
                                Html += "<td class=\"Disabled\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: normal; cursor: pointer\">" + CurrentDay.getDate() + "</td>";
                            }
                        }
                        else
                        {
                            if (Date.parse(Today.toDateString()) == Date.parse(CurrentDay.toDateString()))
                            {
                                Html += "<td class=\"Normal\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: bold; cursor: pointer\" onclick=\"Framework_Dialog.Select('" + this.DateToString(CurrentDay) + "')\">" + CurrentDay.getDate() + "</td>";
                            }
                            else
                            {
                                Html += "<td class=\"Normal\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: normal; cursor: pointer\" onclick=\"Framework_Dialog.Select('" + this.DateToString(CurrentDay) + "')\">" + CurrentDay.getDate() + "</td>";
                            }
                        }
                    }
                }
                Html += "</tr>";
            }
            Html += "</table>";
            return Html;
        };
    }
    this.Initialize(name, null, null, 207, 269, false, true, "close");
}
Framework_DateFieldDialog.prototype = new Framework_Dialog_Handler;
function Framework_CalendarDialog(startDate, endDate)
{
    this._StartDate = new Date(startDate);
    this._EndDate = new Date(endDate);
    if (isNaN(this._StartDate))
    {
        this._StartDate = new Date();
    }
    if (isNaN(this._EndDate))
    {
        this._EndDate = new Date();
    }
    this._StartDate = new Date(this._StartDate.getFullYear(), this._StartDate.getMonth(), this._StartDate.getDate());
    this._EndDate = new Date(this._EndDate.getFullYear(), this._EndDate.getMonth(), this._EndDate.getDate());
    if (Date.parse(this._StartDate.toDateString()) > Date.parse(this._EndDate.toDateString()))
    {
        var Temp;
        Temp = this._EndDate;
        this._EndDate = this._StartDate;
        this._StartDate = Temp;
    }
    this._CurrentDate = new Date(this._StartDate.getFullYear(), 1, 1);
    {
        this.PreviousYear = function()
        {
            this._CurrentDate = new Date(this._CurrentDate.getFullYear() - 1, 1, 1);
            this.Refresh();
        };
        this.NextYear = function()
        {
            this._CurrentDate = new Date(this._CurrentDate.getFullYear() + 1, 1, 1);
            this.Refresh();
        };
        this.MonthToString = function(month)
        {
            switch (month)
            {
                case 0:
                    return "January";
                case 1:
                    return "February";
                case 2:
                    return "March";
                case 3:
                    return "April";
                case 4:
                    return "May";
                case 5:
                    return "June";
                case 6:
                    return "July";
                case 7:
                    return "August";
                case 8:
                    return "September";
                case 9:
                    return "October";
                case 10:
                    return "November";
                case 11:
                    return "December";
            }
        };
        this.DateToString = function(date)
        {
            return (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear();
        };
        this.GetContent = function(content)
        {
            var Html = "";
            Html += "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"Normal\" style=\"table-layout: fixed>";
            Html += "<col width=\"183\" /><col width=\"183\" /><col width=\"183\" /><col width=\"183\" />";
            Html += "<tr>";
            Html += "<th class=\"Normal\" height=\"25\" style=\"vertical-align: middle; text-align: left; font-family: verdana; font-size: 11px; font-weight: bold; cursor: pointer\" onclick=\"Framework_Dialog.PreviousYear(" + this.DateToString(this._CurrentDate) + ")\">&nbsp;&nbsp;&laquo;</th>";
            Html += "<th class=\"Normal\" height=\"25\" colspan=\"2\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: bold; cursor: default\">" + this._CurrentDate.getFullYear() + "</th>";
            Html += "<th class=\"Normal\" height=\"25\" style=\"vertical-align: middle; text-align: right; font-family: verdana; font-size: 11px; font-weight: bold; cursor: pointer\" onclick=\"Framework_Dialog.NextYear(" + this.DateToString(this._CurrentDate) + ")\">&raquo;&nbsp;&nbsp;</th>";
            Html += "</tr>";
            for (var i = 0; i < 3; i++)
            {
                Html += "<tr>";
                for (var j = 0; j < 4; j++)
                {
                    var CurrentMonth = new Date(this._CurrentDate.getFullYear(), i * 4 + j, 1);
                    Html += "<td>";
                    Html += this.DrawMonth(CurrentMonth);
                    Html += "</td>";
                }
                Html += "</tr>";
            }
            Html += "</table>";
            return Html;
        };
        this.DrawMonth = function(month)
        {
            var Today = new Date();
            var FirstDayOfMonth = new Date(month.getFullYear(), month.getMonth(), 1);
            var LastDayOfMonth = new Date(month.getFullYear(), month.getMonth() + 1, 0);
            var FirstDay = new Date(FirstDayOfMonth.getFullYear(), FirstDayOfMonth.getMonth(), FirstDayOfMonth.getDate() - FirstDayOfMonth.getDay());
            var Html = "";
            Html += "<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\" style=\"table-layout: fixed\">";
            Html += "<col width=\"25\" /><col width=\"25\" /><col width=\"25\" /><col width=\"25\" /><col width=\"25\" /><col width=\"25\" /><col width=\"25\" />";
            Html += "<tr>";
            Html += "<th class=\"Normal\" height=\"25\" colspan=\"7\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: bold; cursor: default\">" + this.MonthToString(month.getMonth()) + "</th>";
            Html += "</tr>";
            for (var i = 0; i < 6; i++)
            {
                Html += "<tr>";
                for (var j = 0; j < 7; j++)
                {
                    var CurrentDay = new Date(FirstDay.getFullYear(), FirstDay.getMonth(), FirstDay.getDate() + i * 7 + j);
                    if ((Date.parse(CurrentDay.toDateString()) < Date.parse(FirstDayOfMonth.toDateString())) || (Date.parse(CurrentDay.toDateString()) > Date.parse(LastDayOfMonth.toDateString())))
                    {
                        if (Date.parse(Today.toDateString()) == Date.parse(CurrentDay.toDateString()))
                        {
                            Html += "<td class=\"Disabled\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: bold\">" + CurrentDay.getDate() + "</td>";
                        }
                        else
                        {
                            Html += "<td class=\"Disabled\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: normal\">" + CurrentDay.getDate() + "</td>";
                        }
                    }
                    else
                    {
                        if ((Date.parse(this._StartDate.toDateString()) <= Date.parse(CurrentDay.toDateString())) && (Date.parse(CurrentDay.toDateString()) <= Date.parse(this._EndDate.toDateString())))
                        {
                            if (Date.parse(Today.toDateString()) == Date.parse(CurrentDay.toDateString()))
                            {
                                Html += "<td class=\"Highlight\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: bold\">" + CurrentDay.getDate() + "</td>";
                            }
                            else
                            {
                                Html += "<td class=\"Highlight\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: normal\">" + CurrentDay.getDate() + "</td>";
                            }
                        }
                        else
                        {
                            if (Date.parse(Today.toDateString()) == Date.parse(CurrentDay.toDateString()))
                            {
                                Html += "<td class=\"Normal\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: bold\">" + CurrentDay.getDate() + "</td>";
                            }
                            else
                            {
                                Html += "<td class=\"Normal\" height=\"25\" style=\"vertical-align: middle; text-align: center; font-family: verdana; font-size: 11px; font-weight: normal\">" + CurrentDay.getDate() + "</td>";
                            }
                        }
                    }
                }
                Html += "</tr>";
            }
            Html += "</table>";
            return Html;
        };
    }
    this.Initialize("Calendar: " + this.DateToString(this._StartDate) + " - " + this.DateToString(this._EndDate), null, null, 758, 661, false, true, "close");
}
Framework_CalendarDialog.prototype = new Framework_Dialog_Handler;
var Framework_Resize_CurrentObject = null;
function Framework_Resize_Object(element, direction, mouseX, mouseY)
{
    this._Element = null;
    this._Direction = "";
    this._OriginalMouseX = null;
    this._OriginalMouseY = null;
    this._OriginalWidth = null;
    this._OriginalHeight = null;
    this._OriginalLeft = null;
    this._OriginalTop = null;
    {
        this._Initialize = function(element, direction, mouseX, mouseY)
        {
            if (direction != "")
            {
                this._Element = element;
                this._Direction = direction;
                this._OriginalMouseX = mouseX;
                this._OriginalMouseY = mouseY;
                this._OriginalWidth = this._Element.offsetWidth;
                this._OriginalHeight = this._Element.offsetHeight;
                this._OriginalLeft = this._Element.offsetLeft;
                this._OriginalTop = this._Element.offsetTop;
                Framework_Resize_CurrentObject = this;
            }
        };
        this.Resize = function(mouseX, mouseY)
        {
            var DifferenceX;
            var DifferenceY;
            DifferenceX = mouseX - this._OriginalMouseX;
            DifferenceY = mouseY - this._OriginalMouseY;
            Framework_Resize_SetCursor(this._Element, this._Direction);
            if (this._Direction == "move")
            {
                this._Element.style.left = (this._OriginalLeft + DifferenceX).toString() + "px";
                this._Element.style.top = (this._OriginalTop + DifferenceY).toString() + "px";
                return;
            }
            if (this._Direction.indexOf("e") != -1)
            {
                this._Element.style.width = Math.max(10, this._OriginalWidth + DifferenceX).toString() + "px";
            }
            if (this._Direction.indexOf("s") != -1)
            {
                this._Element.style.height = Math.max(10, this._OriginalHeight + DifferenceY).toString() + "px";
            }
            if (this._Direction.indexOf("w") != -1)
            {
                this._Element.style.left = (this._OriginalLeft + DifferenceX).toString() + "px";
                this._Element.style.width = Math.max(10, this._OriginalWidth - DifferenceX).toString() + "px";
            }
            if (this._Direction.indexOf("n") != -1)
            {
                this._Element.style.top = (this._OriginalTop + DifferenceY).toString() + "px";
                this._Element.style.height = Math.max(10, this._OriginalHeight - DifferenceY).toString() + "px";
            }
        };
        this.Finish = function()
        {
            Framework_Resize_CurrentObject = null;
        };
    }
    this._Initialize(element, direction, mouseX, mouseY);
}
function Framework_Resize_GetElement(element)
{
    var Element;
    var Attribute;
    var ClassNames;
    Element = element;
    while (Element && (Element.tagName != "BODY"))
    {
        ClassNames = Element.className.toLowerCase().split(" ");
        for (var i = 0; i < ClassNames.length; i++)
        {
            if ((ClassNames[i] == "resizeable") || (ClassNames[i] == "moveable"))
            {
                return Element;
            }
        }
        Element = Element.parentElement;
    }
    return null;
}
function Framework_Resize_IsElementResizeable(element)
{
    var ClassNames;
    ClassNames = element.className.toLowerCase().split(" ");
    for (var i = 0; i < ClassNames.length; i++)
    {
        if (ClassNames[i] == "resizeable")
        {
            return true;
        }
    }
    return false;
}
function Framework_Resize_IsElementMoveable(element)
{
    var ClassNames;
    ClassNames = element.className.toLowerCase().split(" ");
    for (var i = 0; i < ClassNames.length; i++)
    {
        if (ClassNames[i] == "moveable")
        {
            return true;
        }
    }
    return false;
}
function Framework_Resize_GetDirection(element, mouseX, mouseY)
{
    var Result;
    var IsAbsolute;
    if (Framework_IsMSIE)
    {
        IsAbsolute = (element.currentStyle.position.toLowerCase() == "absolute");
    }
    else
    {
        IsAbsolute = (element.style.position.toLowerCase() == "absolute");
    }
    Result = "";
    if (Framework_Resize_IsElementResizeable(element))
    {
        if (IsAbsolute && (mouseY < 5))
        {
            Result += "n";
        }
        else
        {
            if (mouseY > element.offsetHeight - 5)
            {
                Result += "s";
            }
        }
        if (IsAbsolute && (mouseX < 5))
        {
            Result += "w";
        }
        else
        {
            if (mouseX > element.offsetWidth - 5)
            {
                Result += "e";
            }
        }
    }
    if (IsAbsolute && (Result == "") && Framework_Resize_IsElementMoveable(element))
    {
        Result = "move";
    }
    return Result;
}
function Framework_Resize_SetCursor(element, direction)
{
    switch (direction)
    {
        case "":
            element.style.cursor = "default";
            break;
        case "move":
            element.style.cursor = "move";
            break;
        default:
            element.style.cursor = direction + "-resize";
            break;
    }
}
function Framework_Resize_Down(event)
{
    var Element;
    var Direction;
    var ElementPosition;
    var OffsetPosition;
    var Scrollbars;
    if (Framework_Resize_CurrentObject)
    {
        Framework_Resize_CurrentObject.Finish();
    }
    Scrollbars = Framework_GetElementScrollbars(event.Target);
    ElementPosition = Framework_GetElementPosition(event.Target);
    OffsetPosition = new Framework_Point(event.MousePosition.X - ElementPosition.X, event.MousePosition.Y - event.MousePosition.Y);
    if (Framework_IsMSIE)
    {
        if (Scrollbars.Vertical && (OffsetPosition.X > (event.Target.offsetWidth - 17)) && (OffsetPosition.X < event.Target.offsetWidth))
        {
            if (Scrollbars.Horizontal && (OffsetPosition.Y <= (event.Target.offsetHeight - 17)))
            {
                return;
            }
        }
        if (Scrollbars.Horizontal && (OffsetPosition.Y > (event.Target.offsetHeight - 17)) && (OffsetPosition.Y < event.Target.offsetHeight))
        {
            if (Scrollbars.Vertical && (OffsetPosition.X <= (event.Target.offsetWidth - 17)))
            {
                return;
            }
        }
    }
    else
    {
        if (Scrollbars.Vertical && (OffsetPosition.X > (event.Target.offsetWidth - 17)) && (OffsetPosition.X < (event.Target.offsetWidth - 1)))
        {
            if (Scrollbars.Horizontal && (OffsetPosition.Y <= (event.Target.offsetHeight - 17)))
            {
                return;
            }
        }
        if (Scrollbars.Horizontal && (OffsetPosition.Y > (event.Target.offsetHeight - 17)) && (OffsetPosition.Y < (event.Target.offsetHeight - 1)))
        {
            if (Scrollbars.Vertical && (OffsetPosition.X <= (event.Target.offsetWidth - 17)))
            {
                return;
            }
        }
    }
    Element = Framework_Resize_GetElement(event.Target);
    if (Element)
    {
        ElementPosition = Framework_GetElementPosition(Element);
        OffsetPosition = new Framework_Point(event.MousePosition.X - ElementPosition.X, event.MousePosition.Y - ElementPosition.Y);
        Direction = Framework_Resize_GetDirection(Element, OffsetPosition.X, OffsetPosition.Y);
        new Framework_Resize_Object(Element, Direction, event.MousePosition.X, event.MousePosition.Y);
        event.Cancel();
    }
}
function Framework_Resize_Up()
{
    if (Framework_Resize_CurrentObject)
    {
        Framework_Resize_CurrentObject.Finish();
    }
}
function Framework_Resize_Move(event)
{
    var Element;
    var Direction;
    var ElementPosition;
    Element = Framework_Resize_GetElement(event.Target);
    if (Element)
    {
        ElementPosition = Framework_GetElementPosition(Element);
        OffsetPosition = new Framework_Point(event.MousePosition.X - ElementPosition.X, event.MousePosition.Y - ElementPosition.Y);
        Direction = Framework_Resize_GetDirection(Element, OffsetPosition.X, OffsetPosition.Y);
        Framework_Resize_SetCursor(Element, Direction);
    }
    if (Framework_Resize_CurrentObject)
    {
        Framework_Resize_CurrentObject.Resize(event.MousePosition.X, event.MousePosition.Y);
        event.Cancel();
    }
}
function Framework_Ajax()
{
    this._RequestMethod = 'GET';
    this._Control = null;
    {
        this._Initialize = function()
        {
            if (window.XMLHttpRequest)
            {
                this._Control = new XMLHttpRequest();
            }
            else
            {
                if (window.ActiveXObject)
                {
                    this._Control = new ActiveXObject("Microsoft.XMLHTTP");
                }
            }
        };
        this.GetHeader = function(header)
        {
            if (this._Control)
            {
                return this._Control.getResponseHeader(header);
            }
            return undefined;
        };
        this.GetResponseAsBytes = function()
        {
            if (this._Control)
            {
                return this._Control.responseBody;
            }
            return undefined;
        };
        this.GetResponseAsText = function()
        {
            if (this._Control)
            {
                return this._Control.responseText;
            }
            return undefined;
        };
        this.GetResponseAsXml = function()
        {
            if (this._Control)
            {
                return this._Control.responseXML;
            }
            return undefined;
        };
        this.GetStatus = function()
        {
            if (this._Control)
            {
                return this._Control.status;
            }
            return undefined;
        };
        this.GetStatusText = function()
        {
            if (this._Control)
            {
                return this._Control.statusText;
            }
            return undefined;
        };
        this.SendRequest = function(url)
        {
            var BaseUrl;
            if (this._Control)
            {
                BaseUrl = document.location.href;
                BaseUrl = BaseUrl.substring(0, BaseUrl.lastIndexOf("/") + 1);
                if (url.substring(0, 1) == "/")
                {
                    BaseUrl = BaseUrl.substring(0, BaseUrl.indexOf("/", 8));
                }
                if ((url.substring(0, 7) == "http://") || (url.substring(0, 8) == "https://"))
                {
                    this._Control.open(this._RequestMethod, url, false);
                }
                else
                {
                    this._Control.open(this._RequestMethod, BaseUrl + url, false);
                }
                this._Control.send(null);
            }
        };
        this.SetHeader = function(header, value)
        {
            if (this._Control)
            {
                this._Control.setRequestHeader(header, value);
            }
        };
        this.SetRequestMethod = function(method)
        {
            if ((method === "GET") || (method === "POST"))
            {
                this._RequestMethod = method;
            }
        };
    }
    this._Initialize();
}
function Framework_Scrollbars(horizontal, vertical)
{
    this.Horizontal = horizontal;
    this.Vertical = vertical;
}
function Framework_Point(x, y)
{
    this.X = x;
    this.Y = y;
}
function Framework_Event(evt)
{
    this._Event = null;
    this.MousePosition = new Framework_Point(0, 0);
    this.ClientMousePosition = new Framework_Point(0, 0);
    this.Target = null;
    {
        this._Initialize = function(evt)
        {
            this._Event = evt;
            if (!evt)
            {
                this._Event = window.event;
            }
            if (!this._Event)
            {
                return;
            }
            if (Framework_IsMSIE)
            {
                this.Target = this._Event.srcElement;
            }
            else
            {
                this.Target = this._Event.target;
            }
            if (Framework_IsMSIE)
            {
                this.MousePosition = new Framework_Point(this._Event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft), this._Event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop));
            }
            else
            {
                this.MousePosition = new Framework_Point(this._Event.pageX, this._Event.pageY);
            }
            this.ClientMousePosition = new Framework_Point(this._Event.clientX, this._Event.clientY);
        };
        this.Cancel = function()
        {
            try
            {
                if (this._Event)
                {
                    if (Framework_IsMSIE)
                    {
                        this._Event.returnValue = false;
                        this._Event.cancelBubble = true;
                    }
                    else
                    {
                        this._Event.preventDefault();
                        this._Event.stopPropagation();
                    }
                }
            }
            catch (ex)
            {
            }
        };
        this.GetFrameEvent = function()
        {
            var Event;
            Event = new Framework_Event(this._Event);
            Event.Target = window.frameElement;
            if (Framework_IsMSIE)
            {
                Event.MousePosition.X = this.MousePosition.X + this._Event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
                Event.MousePosition.Y = this.MousePosition.Y + this._Event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
            }
            else
            {
                Event.MousePosition.X = this.MousePosition.X + this._Event.pageX;
                Event.MousePosition.Y = this.MousePosition.Y + this._Event.pageY;
            }
            return Event;
        };
    }
    this._Initialize(evt);
}
function Framework_Collection(data)
{
    this._Items = new Array();
    this.Count = 0;
    {
        this.Initialize = function(data)
        {
            var Items;
            var Item;
            if (typeof (data) == "string")
            {
                Items = data.split("|");
                for (var i = 0; i < Items.length; i++)
                {
                    Item = Items[i].trim();
                    if (Item.length > 0)
                    {
                        this.Add(Item);
                    }
                }
            }
        };
        this.Add = function(item)
        {
            this._Items.push(item);
            this.Count = this._Items.length;
        };
        this.CompareItems = function(item1, item2)
        {
            if (item1 < item2)
            {
                return -1;
            }
            else
            {
                if (item1 > item2)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
        };
        this.Contains = function(item)
        {
            return this.IndexOf(item) > -1;
        };
        this.IndexOf = function(item)
        {
            var Result = "";
            for (var i = 0; i < this._Items.length; i++)
            {
                if (this.CompareItems(this._Items[i], item) == 0)
                {
                    return i;
                }
            }
            return -1;
        };
        this.Item = function(index)
        {
            if (typeof (index) == "number")
            {
            }
            if ((index > -1) & (index < this._Items.length))
            {
                return this._Items[index];
            }
            return null;
        };
        this.ItemToString = function(item)
        {
            return item.toString();
        };
        this.Remove = function(item)
        {
            this.RemoveAt(this.IndexOf(item));
        };
        this.RemoveAt = function(index)
        {
            if (typeof (index) == "number")
            {
            }
            if ((index > -1) & (index < this._Items.length))
            {
                this._Items.splice(index, 1);
                this.Count = this._Items.length;
            }
        };
        this.ToString = function(seperator)
        {
            var Result = "";
            if (seperator == undefined)
            {
                seperator = "|";
            }
            for (var i = 0; i < this._Items.length; i++)
            {
                if (Result.length != 0)
                {
                    Result += seperator;
                }
                Result += this.ItemToString(this._Items[i]);
            }
            return Result;
        };
    }
    this.Initialize(data);
}
var Framework_ActiveToolTip = undefined;
var Framework_ActiveToolTipTimer = undefined;
function Framework_HideToolTip()
{
    window.clearTimeout(Framework_ActiveToolTipTimer);
    Framework_ActiveToolTipTimer = undefined;
    if (Framework_ActiveToolTip)
    {
        Framework_ActiveToolTip.Hide();
        Framework_ActiveToolTip = undefined;
    }
}
function Framework_ShowToolTip()
{
    window.clearTimeout(Framework_ActiveToolTipTimer);
    Framework_ActiveToolTipTimer = undefined;
    if (Framework_ActiveToolTip)
    {
        Framework_ActiveToolTip.Show();
        Framework_ActiveToolTipTimer = window.setTimeout(Framework_HideToolTip, 5000);
    }
}
function Framework_ToolTip(anchorObject, id)
{
    this._AnchorObject = anchorObject;
    this._Id = id;
    this._ToolTip = undefined;
    {
        this.Initialize = function()
        {
            this._ToolTip = document.getElementById(this._Id);
            if (Framework_ActiveToolTip)
            {
                if (Framework_ActiveToolTip._Id == this._Id)
                {
                    return;
                }
                Framework_HideToolTip();
            }
            if (this._ToolTip)
            {
                Framework_ActiveToolTip = this;
                Framework_ActiveToolTipTimer = window.setTimeout(Framework_ShowToolTip, 500);
            }
        };
        this.Show = function()
        {
            var AnchorPosition = Framework_GetElementPosition(this._AnchorObject);
            var WindowWidth = 0;
            var WindowHeight = 0;
            var ToolTipWidth = 0;
            var ToolTipHeight = 0;
            WindowWidth = document.body.scrollWidth;
            if (Framework_IsMSIE)
            {
                if (document.body.scrollHeight > (window.screen.height - window.screenTop))
                {
                    WindowHeight = document.body.scrollHeight;
                }
                else
                {
                    WindowHeight = (window.screen.height - window.screenTop);
                }
            }
            else
            {
                if (document.body.scrollHeight > window.screen.height)
                {
                    WindowHeight = document.body.scrollHeight;
                }
                else
                {
                    WindowHeight = window.screen.height.toString();
                }
            }
            this._ToolTip.style.left = "0px";
            this._ToolTip.style.top = "0px";
            this._ToolTip.style.display = "inline";
            ToolTipWidth = this._ToolTip.offsetWidth;
            ToolTipHeight = this._ToolTip.offsetHeight;
            if (ToolTipWidth > 250)
            {
                this._ToolTip.style.width = "250px";
                ToolTipWidth = this._ToolTip.offsetWidth;
            }
            if ((AnchorPosition.X + 5 + ToolTipWidth + 5) > WindowWidth)
            {
                this._ToolTip.style.left = (WindowWidth - ToolTipWidth - 5).toString() + "px";
            }
            else
            {
                this._ToolTip.style.left = (AnchorPosition.X + 5).toString() + "px";
            }
            if ((AnchorPosition.Y + this._AnchorObject.offsetHeight + 5 + ToolTipHeight + 5) > WindowHeight)
            {
                this._ToolTip.style.top = (WindowHeight - ToolTipHeight - 5).toString() + "px";
            }
            else
            {
                this._ToolTip.style.top = (AnchorPosition.Y + this._AnchorObject.offsetHeight + 5).toString() + "px";
            }
        };
        this.Hide = function()
        {
            this._ToolTip.style.display = "none";
        };
    }
    this.Initialize();
}
var Framework_FrameworkPath = "/Framework/";
var Framework_IsMSIE = navigator.appName == "Microsoft Internet Explorer";
function Framework_HtmlEncode(text)
{
    var Result;
    Result = text;
    Result = Result.replace(/&/g, "&amp;");
    Result = Result.replace(/</g, "&lt;");
    Result = Result.replace(/>/g, "&gt;");
    Result = Result.replace(/"/g, "&quot;");
    return Result;
}
function Framework_XmlEncode(text)
{
    var Result;
    Result = text;
    Result = Result.replace(/&/g, "&amp;");
    Result = Result.replace(/</g, "&lt;");
    Result = Result.replace(/>/g, "&gt;");
    Result = Result.replace(/"/g, "&quot;");
    return Result;
}
function Framework_UrlEncode(text)
{
    return encodeURIComponent(text);
}
function Framework_JavaScriptEncode(text)
{
    var Result;
    Result = text;
    Result = Result.replace(/\\/g, "\\\\");
    Result = Result.replace(/'/g, "\\'");
    Result = Result.replace(/"/g, "\\\"");
    return Result;
}
function Framework_GetElementPosition(element)
{
    var ParentPosition;
    if (element.offsetParent)
    {
        ParentPosition = Framework_GetElementPosition(element.offsetParent);
        return new Framework_Point(ParentPosition.X + element.offsetLeft, ParentPosition.Y + element.offsetTop);
    }
    else
    {
        return new Framework_Point(element.offsetLeft, element.offsetTop);
    }
}
function Framework_GetElementScrollbars(element)
{
    return new Framework_Scrollbars(element.clientWidth < element.scrollWidth, element.clientHeight < element.scrollHeight);
}
function Framework_ScrollLeft()
{
    if (Framework_IsMSIE)
    {
        return document.documentElement.scrollLeft;
    }
    else
    {
        return window.pageXOffset;
    }
}
function Framework_ScrollTop()
{
    if (Framework_IsMSIE)
    {
        return document.documentElement.scrollTop;
    }
    else
    {
        return window.pageYOffset;
    }
}
function Framework_ChangeClass(id, className)
{
    var objElement = document.getElementById(id);
    if (objElement)
    {
        objElement.className = className;
    }
}
function Framework_ChangeDisabled(id, disabled)
{
    var objElement = document.getElementById(id);
    if (objElement)
    {
        objElement.disabled = disabled;
    }
}
function Framework_OpenWindow(strName, strURL, intWidth, intHeight, bolScrollBars, bolStretch)
{
    var intLeft = 0;
    if (window.screen.width > intWidth)
    {
        intLeft = Math.round((window.screen.width - intWidth) / 2);
    }
    var intTop = 0;
    if (window.screen.height > intHeight)
    {
        intTop = Math.round((window.screen.height - intHeight) / 2);
    }
    var strOptions = "left=" + intLeft + ",top=" + intTop + ",directories=no,height=" + intHeight + ",width=" + intWidth + ",location=no,menubar=no,status=no,titlebar=no,toolbar=no,";
    if (bolStretch == true)
    {
        strOptions += "resizable=yes,";
    }
    else
    {
        strOptions += "resizable=no,";
    }
    if (bolScrollBars != false)
    {
        strOptions += "scrollbars=yes";
    }
    else
    {
        strOptions += "scrollbars=no";
    }
    return window.open(strURL, strName, strOptions, false);
}
function Framework_OpenDialog(url, width, height, arguments)
{
    return window.showModalDialog(url, arguments, "dialogHeight: " + height + "px; dialogWidth: " + width + "px; dialogTop: px; dialogLeft: px; center: Yes; help: No; resizable: No; status: No; unadorned: Yes; edge: raised; scroll: No");
}
function Framework_DateToStr(value)
{
    return (value.getMonth() + 1).toString().pad(2, "0") + "-" + value.getDate().toString().pad(2, "0") + "-" + value.getYear().toString().pad(4, "0");
}
function Framework_TimeToStr(value)
{
    return value.getHours().toString().pad(2, "0") + ":" + value.getMinutes().toString().pad(2, "0") + ":" + value.getSeconds().toString().pad(2, "0");
}
function Framework_DateTimeToStr(value)
{
    return Framework_DateToStr(value) + " " + Framework_TimeToStr(value);
}
function Framework_BoolToStr(value)
{
    return value ? "Yes" : "No";
}
function Framework_FocusFirstField(formName)
{
    var Form = document.getElementById(formName);
    if (Form)
    {
        for (i = 0; i < Form.elements.length - 1; i++)
        {
            var Element = Form.elements[i];
            if (Element.tagName == "INPUT")
            {
                if (Element.type != "hidden")
                {
                    Element.focus();
                    Element.select();
                    break;
                }
            }
            if (Element.tagName == "SELECT")
            {
                Element.focus();
                break;
            }
            if (Element.tagName == "TEXTAREA")
            {
                Element.focus();
                Element.select();
                break;
            }
            if (Element.tagName == "OBJECT")
            {
                if (Element.enabled)
                {
                    Element.focus();
                }
                else
                {
                    window.setTimeout("Framework_FocusField('" + Element.id + "')", 100);
                }
                break;
            }
        }
    }
}
function Framework_FocusField(id)
{
    var Field = document.getElementById(id);
    if (Field)
    {
        if (Field.tagName == "OBJECT")
        {
            if (Field.enabled)
            {
                Field.focus();
            }
            else
            {
                window.setTimeout("Framework_FocusField('" + id + "')", 100);
            }
        }
        else
        {
            Field.focus();
        }
        if (Field.tagName == "INPUT")
        {
            if ((Field.type == "text") || (Field.type == "password") || (Field.type == "file"))
            {
                Field.select();
            }
        }
        if (Field.tagName == "TEXTAREA")
        {
            Field.select();
        }
    }
}
function Framework_Debug()
{
    debugger;
}
function Framework_IsDebugging()
{
    return false;
}
function Framework_Window_OnLoad(evt)
{
}
function Framework_Window_OnResize(evt)
{
    if (Framework_Dialog)
    {
        Framework_Dialog._ResizeDimmer();
    }
    Framework_HideToolTip();
}
function Framework_Document_KeyDown(evt)
{
    Framework_Dialog_KeyDown(evt);
}
function Framework_Document_KeyPress(evt)
{
    Framework_Dialog_KeyPress(evt);
}
function Framework_Document_KeyUp(evt)
{
    Framework_Dialog_KeyUp(evt);
}
function Framework_Document_MouseDown(evt)
{
    Framework_Dialog_MouseDown(evt);
}
function Framework_Document_MouseUp(evt)
{
    Framework_Dialog_MouseUp(evt);
}
function Framework_Document_MouseMove(evt)
{
    Framework_Dialog_MouseMove(evt);
}
window.onload = Framework_Window_OnLoad;
window.onresize = Framework_Window_OnResize;
document.onmousedown = Framework_Document_MouseDown;
document.onmouseup = Framework_Document_MouseUp;
document.onmousemove = Framework_Document_MouseMove;
document.onkeydown = Framework_Document_KeyDown;
document.onkeypress = Framework_Document_KeyPress;
document.onkeyup = Framework_Document_KeyUp;

