/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
var eCWState = { Normal:1, Minimized:2, Collapsed:4, Docked:8, Maximized:16 };
var eCWStyle = { Normal:1, Tool:2, Popout:4, Menu:8 };
//  eCWSide and eCDPosition values (Top, Right, Bottom, Left) must match
var eCWSide = { Top:1, Right:2, Bottom:4, Left:8 };
var eCDPosition = { Float:0, Top:1, Right:2, Bottom:4, Left:8, All:15 };
////////////////////////////////////////////
var eCCDirection = { None:0, Up:1, Right:2, Down:4, Left:8 };
var eCDCType = { Unknown:0, Multiple:1, String:2, Number:4, Currency:8, DateTime:16, Color:32, Font:64, Enumeration:128, Selection:256 };
var eCCOrientation = { Float:0, Horizontal:1, Vertical:2 };
var eCCAlign = { Default:0, Left:1, Center:2, Right:4, Stretch:8, Float:16 };
var eCCVAlign = { Default:0, Top:1, Middle:2, Bottom:4, Stretch:8, Float:16 };
var eCBState = { Normal:1, Hover:2, Down:4 };
var eCMIType = { Header:1, Normal:2, Separator:4, Radio:8, Check:16 };
var eCCBorderStyle = { Solid:0, Raised:1, Lowered:2, LoweredBevel:6, RaisedBevel: 5, LoweredOutline:10, RaisedOutline:9, Inset:16, Sizeable:32 };
var bufferChars = new Array('#', '|', '~', '[', ']', '(', ')', ';', ':', '!', '@', '$', '^', '*', '(', ')', '-', '_');//, '/', '?', '+');
var eCObjectType = { None:0, Browser:1, Session:2, Window:4, Control:8 };
var eCDataObjectType = { Undefined:0, Database:1, Index:2, Hashfile:4, Table:8, Transformation:16, Pattern:32, MetaPattern:64, Object:128 };
var eCColorShade = { Unknown:0, White:1, Grey:2, Blue:4, Green:8, Purple:16, Yellow:32, Orange:64, Pink:128, Red:256, Brown:512 };

    //         number, number
function cWCord(x, y) {
    if(isNaN(x)) { if((x.indexOf('%') >= 0) || (x.toLowerCase() == 'auto')) { this.X = x; } else { this.X = 0; } } else { this.X = x - 0; }
    if(isNaN(y)) { if((y.indexOf('%') >= 0) || (y.toLowerCase() == 'auto')) { this.Y = y; } else { this.Y = 0; } } else { this.Y = y - 0; }
}
function BufferAsArray(data, level) {
    if(data.indexOf(BufferChar(level)) >= 0) { return(true); }
    if(level >= bufferChars.length - 2) {
        if(data.indexOf(bufferChars[bufferChars.length - 2]) >= 0) { return(true); }
        if(data.indexOf(bufferChars[bufferChars.length - 1]) >= 0) { return(true); }
    } else {
        for(var i = level; i < bufferChars.length; i++) {
            if(data.indexOf(bufferChars[i]) >= 0) { return(true); }
        }
    }
    return(false);
}
function BufferChar(level) {
	if(level >= (this.bufferChars.length - 2)) {
		return(bufferChars[bufferChars.length - 2] + (level - (bufferChars.length - 2)) + bufferChars[bufferChars.length - 1]);
	} else {
		return(bufferChars[level]);
	}
}
function BufferIn(data) {
    return(RealBufferIn(data, 1));
}
function BufferOut(data) {
    return(RealBufferOut(data, 1));
}
function RealBufferIn(data, level) {
	var ret;
	if(BufferAsArray(data, level)) {
		ret = data.split(BufferChar(level));
		if(ret.length > 0) {
			for(var i = 0; i < ret.length; i++) {
				ret[i] = RealBufferIn(ret[i], level + 1);
			}
		}
	} else {
	    data = data+'';
		for(var i = (bufferChars.length - 1); i >= 0; i--) {
			data.replace(bufferChars[0] + i, bufferChars[i]);
		}
		ret = base64_decode(data)+'';
	}
	return(ret);
}
function RealBufferOut(data, level) {
	var ret = '';
	if((typeof(data) == 'object') && (data instanceof Array)) {
		if(data.length > 0) {
			for(var i = 0; i < data.length; i++) {
				data[i] = RealBufferOut(data[i], level + 1);
			}
		}
		ret = data.join(BufferChar(level));
	} else {
		ret = base64_encode(data+'');
		for(var i = 0; i < bufferChars.length; i++) {
			ret.replace(bufferChars[i], bufferChars[0] + i);
		}
	}
	return(ret);
}
function ControlsAreEqual(control1, control2) {
    if((control1 == null) && (control2 == null)) { return(true); }
    if((control1 == null) || (control2 == null)) { return(false); }
    if(control1.TypeOf != control2.TypeOf) { return(false); }
    if(control1.BaseType != control2.BaseType) { return(false); }
    switch(control1.BaseType) {
        case "Browser":
            return(true);
            break;
        case "Session":
            if(control1.ID == control2.ID) { return(true); }
            break;
        case "Window":
            if((control1.Parent.ID == control2.Parent.ID) && (control1.ID == control2.ID)) { return(true); }
            break;
        case "Control":
            if((control1.ParentWindow.Parent.ID == control2.ParentWindow.Parent.ID) && (control1.ParentWindow.ID == control2.ParentWindow.ID) && (control1.ID == control2.ID)) { return(true); }
            break;
    }
    return(false);
}
function ObjectReference(obj) {
    var a = new Array();
    switch(obj.BaseType) {
        case "Browser":
            return(new cReference(obj.BaseType, a));
            break;
        case "Session":
            a.push(obj.ID);
            return(new cReference(obj.BaseType, a));
            break;
        case "Window":
            a.push(obj.Parent.ID);
            a.push(obj.ID);
            return(new cReference(obj.BaseType, a));
            break;
        case "Control":
            a.push(obj.ParentWindow.Parent.ID);
            a.push(obj.ParentWindow.ID);
            a.push(obj.ID);
            return(new cReference(obj.BaseType, a));
            break;
    }
}
function ReverseObjectType(type) {
    switch(type) {
        case "Browser":
            return(eCObjectType.Browser);
        case "Session":
            return(eCObjectType.Session);
        case "Window":
            return(eCObjectType.Window);
        case "Control":
            return(eCObjectType.Control);
        case eCObjectType.Browser:
            return("Browser");
        case eCObjectType.Session:
            return("Session");
        case eCObjectType.Window:
            return("Window");
        case eCObjectType.Control:
            return("Control");
    }
}
function EventObj(e) {
    if(!e) { e = event; }
    return e.target || e.srcElement;
}
function GetAlignmentCords(align, defaultalign, fixed, x, width, prefwidth, minwidth, allowx, allowwidth) {
    var ret = new Object();
    var pw = prefwidth; var w = width; var mw = minwidth; var aw = allowwidth;
    if((pw+'').toLowerCase() == 'auto') { pw = aw; }
    if((w+'').toLowerCase() == 'auto') { w = pw; }
    if((mw+'').toLowerCase() == 'auto') { mw = pw; }
    if((aw+'').toLowerCase() == 'auto') { aw = pw; }
    if(align == eCCAlign.Default) { align = defaultalign; }
    if((w+'').indexOf('%') >= 0) { w = (parseInt(w.replace('%', '')) / 100) * aw; }
    if((mw+'').indexOf('%') >= 0) { mw = (parseInt(mw.replace('%', '')) / 100) * aw; }
    if(isNaN(pw)) { pw = aw; }
    if((!isNaN(pw)) && (pw < 0)) { if(!isNaN(w)) { pw = w; } else { pw = aw; } }
    if(fixed == true) { mw = w; }
    if(isNaN(mw)) {
        if(w < prefwidth) {
            if(w < aw) {
                mw = w;
            } else {
                mw = aw;
            }
        } else {
            if(pw < aw) {
                mw = pw;
            } else {
                mw = aw;
            }
        }
    }
    if(width < mw) { width = mw; }
    ret.X = allowx; ret.Width = aw; ret.MinWidth = mw; ret.FixedWidth = 0; ret.StretchWidth = 0; ret.StretchPreCalcWidth = 0;
    if(align == eCCAlign.Float) {
        if((x + w) <= aw) {
            ret.X = allowx + x;
            ret.Width = w;
        } else {
            if(w <= aw) {
                ret.X = (allowx + aw) - w;
                ret.Width = w;
            }
        }
    } else {
        if(w <= aw) {
            switch(align) {
                case eCCAlign.Left:
                    if((x + w) > aw) {
                        ret.X = (allowx + aw) - w;
                    } else if(x < 0) {
                        ret.X = allowx;
                    } else {
                        ret.X = allowx + x;
                    }
                    break;
                case eCCAlign.Center:
                    if((x + ((aw / 2) + (w / 2))) > aw) {
                        ret.X = (allowx + aw) - w;
                    } else if((x + ((aw / 2) - (w / 2))) < 0) {
                        ret.X = allowx;
                    } else {
                        ret.X = allowx + x + ((aw / 2) - (w / 2));
                    }
                    break;
                case eCCAlign.Right:
                    if((aw - x) > aw) {
                        ret.X = (allowx + aw) - w;
                    } else if((aw - (x + w)) < 0) {
                        ret.X = allowx;
                    } else {
                        ret.X = allowx + (aw - (x + w));
                    }
                    break;
            }
            ret.Width = w;
        }
    }
    if(fixed == true) { ret.MinWidth = ret.Width; ret.FixedWidth = ret.Width; } else { ret.StretchWidth = ret.Width; ret.StretchPreCalcWidth = pw; }
    return(ret);
}
function GetAlignmentFromString(align) {
    var ret = eCCAlign.Default;
    if(align.length > 0) {
        switch(align.substring(0, 1).toLowerCase()) {
            case 'l':
                ret = eCCAlign.Left;
                break;
            case 'c':
                ret = eCCAlign.Center;
                break;
            case 'r':
                ret = eCCAlign.Right;
                break;
            case 's':
                ret = eCCAlign.Stretch;
                break;
            case 'f':
                ret = eCCAlign.Float;
                break;
        }
    }
    return(ret);
}
function GetBorderStyleFromString(borderstyle) {
    var ret = new Object();
    ret.Style = eCCBorderStyle.None;
    ret.Size = 0;
    ret.Color = '#000000';
    if(borderstyle.length > 1) {
        var tA = borderstyle.split(' ');
        switch(borderstyle.substring(0, 2).toLowerCase()) {
            case 'so':
                ret.Style = eCCBorderStyle.Solid;
                if(tA.length > 1) {
                    ret.Size = parseInt(tA[1]);
                    if(tA.length > 2) { ret.Color = tA[2]; }
                }
                break;
            case 'rn':
                ret.Style = eCCBorderStyle.Raised;
                break;
            case 'ln':
                ret.Style = eCCBorderStyle.Lowered;
                break;
            case 'lb':
                ret.Style = eCCBorderStyle.LoweredBevel;
                break;
            case 'rb':
                ret.Style = eCCBorderStyle.RaisedBevel;
                break;
            case 'lo':
                ret.Style = eCCBorderStyle.LoweredOutline;
                break;
            case 'ro':
                ret.Style = eCCBorderStyle.RaisedOutline;
                break;
            case 'in':
                ret.Style = eCCBorderStyle.Inset;
                break;
            case 'sz':
                ret.Style = eCCBorderStyle.Sizeable;
                break;
        }
    }
    return(ret);
}
function GetDockPositionFromString(position) {
    var ret = eCDPosition.Float;
    position = position.toLowerCase();
    if(position.indexOf('all') >= 0) {
        ret = eCDPosition.All;
    } else {
        if(position.indexOf('top') >= 0) { ret = ret + eCDPosition.Top; }
        if(position.indexOf('right') >= 0) { ret = ret + eCDPosition.Right; }
        if(position.indexOf('bottom') >= 0) { ret = ret + eCDPosition.Bottom; }
        if(position.indexOf('left') >= 0) { ret = ret + eCDPosition.Left; }
    }
    return(ret);
}
function GetFirstDefined(num1, num2) {
    if(typeof(num1) != "undefined") {
        return(num1);
    } else {
        return(num2);
    }
}
function GetOrientationFromString(orientation) {
    var ret = eCCOrientation.Float;
    if(orientation.length > 0) {
        switch(orientation.substring(0, 1).toLowerCase()) {
            case 'h':
                ret = eCCOrientation.Horizontal;
                break;
            case 'v':
                ret = eCCOrientation.Vertical;
                break;
        }
    }
    return(ret);
}
function GetSizeOfMax(size, max) {
    if(size == 'auto') {
        return(max);
    } else {
        if((size+'').indexOf('%') >= 0) {
            return((parseInt(size.replace('%', '')) / 100) * max);
        } else {
            return(size);
        }
    }
}
function GetSizeOfPrefMax(size, pref, max) {
    if(size == 'auto') {
        return(pref);
    } else {
        if((size+'').indexOf('%') >= 0) {
            return((parseInt(size.replace('%', '')) / 100) * max);
        } else {
            return(size);
        }
    }
}
function GetVerticalAlignmentCords(valign, defaultvalign, fixed, y, height, prefheight, minheight, allowy, allowheight) {
    var ret = new Object();
    var ph = prefheight; var h = height; var mh = minheight; var ah = allowheight;
    if((ph+'').toLowerCase() == 'auto') { ph = ah; }
    if((h+'').toLowerCase() == 'auto') { h = ph; }
    if((mh+'').toLowerCase() == 'auto') { mh = ph; }
    if((ah+'').toLowerCase() == 'auto') { ah = ph; }
    if(valign == eCCVAlign.Default) { valign = defaultvalign; }
    if((h+'').indexOf('%') >= 0) { h = (parseInt(h.replace('%', '')) / 100) * ah; }
    if((mh+'').indexOf('%') >= 0) { mh = (parseInt(mh.replace('%', '')) / 100) * ah; }
    if(isNaN(ph)) { ph = ah; }
    if((!isNaN(ph)) && (ph < 0)) { if(!isNaN(h)) { ph = h; } else { ph = ah; } }
    if(fixed == true) { mh = h; }
    if(isNaN(mh)) {
        if(h < ph) {
            if(h < ah) {
                mh = h;
            } else {
                mh = ah;
            }
        } else {
            if(ph < ah) {
                mh = ph;
            } else {
                mh = ah;
            }
        }
    }
    if(h < mh) { h = mh; }
    ret.Y = allowy; ret.Height = ah; ret.MinHeight = mh; ret.FixedHeight = 0; ret.StretchHeight = 0; ret.StretchPreCalcHeight = 0;
    if(valign == eCCVAlign.Float) {
        if((y + h) <= ah) {
            ret.Y = allowy + y;
            ret.Height = h;
        } else {
            if(h <= ah) {
                ret.Y = (allowy + ah) - h;
                ret.Height = h;
            }
        }
    } else {
        if(h <= ah) {
            switch(valign) {
                case eCCVAlign.Top:
                    if((y + h) > ah) {
                        ret.Y = (allowy + ah) - h;
                    } else if(y < 0) {
                        ret.Y = allowy;
                    } else {
                        ret.Y = allowy + y;
                    }
                    break;
                case eCCVAlign.Middle:
                    if((y + ((ah / 2) + (h / 2))) > ah) {
                        ret.Y = (allowy + ah) - h;
                    } else if((y + ((ah / 2) - (h / 2))) < 0) {
                        ret.Y = allowy;
                    } else {
                        ret.Y = allowy + y + ((ah / 2) - (h / 2));
                    }
                    break;
                case eCCVAlign.Bottom:
                    if((ah - y) > ah) {
                        ret.Y = (allowy + ah) - h;
                    } else if((ah - (y + h)) < 0) {
                        ret.Y = allowy;
                    } else {
                        ret.Y = allowy + (ah - (y + h));
                    }
                    break;
            }
            ret.Height = h;
        }
    }
    if(fixed == true) { ret.MinHeight = ret.Height; ret.FixedHeight = ret.Height; } else { ret.StretchHeight = ret.Height; ret.StretchPreCalcHeight = ph; }
    return(ret);
}
function GetVerticalAlignmentFromString(valign) {
    var ret = eCCVAlign.Default;
    if(valign.length > 0) {
        switch(valign.substring(0, 1).toLowerCase()) {
            case 't':
                ret = eCCVAlign.Top;
                break;
            case 'm':
                ret = eCCVAlign.Middle;
                break;
            case 'b':
                ret = eCCVAlign.Bottom;
                break;
            case 's':
                ret = eCCVAlign.Stretch;
                break;
            case 'f':
                ret = eCCVAlign.Float;
                break;
        }
    }
    return(ret);
}
function GetWindowStateFromString(state) {
    var ret = eCWState.Normal;
    if(state.length > 0) {
        switch(state.substring(1, 1).toLowerCase()) {
            case 'm':
                if(state.length > 1) {
                    switch(state.substring(0, 1).toLowerCase()) {
                        case 'i':
                            ret = eCWState.Minimized;
                            break;
                        case 'a':
                            ret = eCWState.Maximized;
                            break;
                    }
                }
                break;
            case 'c':
                ret = eCWState.Collapsed;
                break;
            case 'd':
                ret = eCWState.Docked;
                break;
        }
    }
    return(ret);
}
function GetWindowStyleFromString(style) {
    var ret = eCWStyle.Normal;
    if(style.length > 0) {
        switch(style.substring(0, 1).toLowerCase()) {
            case 't':
                ret = eCWStyle.Tool;
                break;
            case 'p':
                ret = eCWStyle.Popout;
                break;
            case 'm':
                ret = eCWStyle.Menu;
                break;
        }
    }
    return(ret);
}

function InArray(arr, val) {
	if((typeof(arr) == 'object') && (arr instanceof Array)) {
        if(arr.length > 0) {
            for(var i = arr.length - 1; i >= 0; i--) {
                if(arr[i] == val) { return(true); }
            }
        }
    } else { if(arr == val) { return(true); } }
    return(false);
}
function LastInArray(arr, val, arrall) {
	if((typeof(arr) == 'object') && (arr instanceof Array)) {
        if(arr.length > 0) {
            for(var i = arr.length - 1; i >= 0; i--) {
                if(arr[i] == val) { return(true); }
                if(InArray(arrall, arr[i]) == true) { return(false); }
            }
        }
    } else { if(arr == val) { return(true); } }
    return(false);
}
function WithInArray(arr, val) {
	if((typeof(arr) == 'object') && (arr instanceof Array)) {
        if(arr.length > 0) {
            for(var i = arr.length - 1; i >= 0; i--) {
                if(arr[i] == val) { return(i + 1); }
            }
        }
    } else { if(arr == val) { return(0); } }
    return(-1);
}

var base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

function base64_encode(data) {
   var ret = ""; var c1, c2, c3; var e1, e2, e3, e4;
   var i = 0;
   do {
      c1 = data.charCodeAt(i++); c2 = data.charCodeAt(i++); c3 = data.charCodeAt(i++);
 
      e1 = c1 >> 2; e2 = ((c1 & 3) << 4) | (c2 >> 4); e3 = ((c2 & 15) << 2) | (c3 >> 6); e4 = c3 & 63;
 
      if (isNaN(c2)) {
         e3 = e4 = 64;
      } else if (isNaN(c3)) {
         e4 = 64;
      }
      ret = ret + base64Chars.charAt(e1) + base64Chars.charAt(e2) + base64Chars.charAt(e3) + base64Chars.charAt(e4);
   } while (i < data.length);
   return ret;
}
 
function base64_decode(data) {
   var ret = ""; var c1, c2, c3; var e1, e2, e3, e4;
   var i = 0;
   data = data.replace(/[^A-Za-z0-9\+\/\=]/g, "");
   do {
      e1 = base64Chars.indexOf(data.charAt(i++)); e2 = base64Chars.indexOf(data.charAt(i++));
      e3 = base64Chars.indexOf(data.charAt(i++)); e4 = base64Chars.indexOf(data.charAt(i++));
 
      c1 = (e1 << 2) | (e2 >> 4); c2 = ((e2 & 15) << 4) | (e3 >> 2); c3 = ((e3 & 3) << 6) | e4;
 
      ret = ret + String.fromCharCode(c1);
 
      if (e3 != 64) { ret = ret + String.fromCharCode(c2); }
      if (e4 != 64) { ret = ret + String.fromCharCode(c3); }
   } while (i < data.length);
   return ret;
}

function eventPop(obj, e, handler) {
  if (obj.addEventListener && (!window.opera)) {
    obj.removeEventListener(e, function(ev) { handler(ev); }, false);
  } else if (obj.attachEvent && (!window.opera)) {
    obj.detachEvent('on'+e, function(ev) { handler(ev); });
  } else {
    switch(e) {
        case 'blur':
            obj.onblur = null;
            break;
        case 'click':
            obj.onclick = null;
            break;
        case 'dblclick':
            obj.ondblclick = null;
            break;
        case 'focus':
            obj.onfocus = null;
            break;
        case 'load':
            obj.onload = null;
            break;
        case 'mousedown':
            obj.onmousedown = null;
            break;
        case 'mousemove':
            obj.onmousemove = null;
            break;
        case 'mouseout':
            obj.onmouseout = null;
            break;
        case 'mouseover':
            obj.onmouseover = null;
            break;
        case 'mouseup':
            obj.onmouseup = null;
            break;
    }
  }
}
function eventPush(obj, e, handler) {
  if (obj.addEventListener && (!window.opera)) {
    obj.addEventListener(e, function(ev) { handler(ev); }, false);
  } else if (obj.attachEvent && (!window.opera)) {
    obj.attachEvent('on'+e, function(ev) { handler(ev); });
  } else {
    switch(e) {
        case 'blur':
            obj.onblur = handler;
            break;
        case 'click':
            obj.onclick = handler;
            break;
        case 'dblclick':
            obj.ondblclick = handler;
            break;
        case 'focus':
            obj.onfocus = handler;
            break;
        case 'load':
            obj.onload = handler;
            break;
        case 'mousedown':
            obj.onmousedown = handler;
            break;
        case 'mousemove':
            obj.onmousemove = handler;
            break;
        case 'mouseout':
            obj.onmouseout = handler;
            break;
        case 'mouseover':
            obj.onmouseover = handler;
            break;
        case 'mouseup':
            obj.onmouseup = handler;
            break;
    }
  }
}
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cStyleInfo() {
    this.PreCacheImages = new Array('style/default/img/bullets.png', 'style/default/img/expandcollapsebullet.png', 'style/default/img/hovericon.png', 'style/default/img/menuglyphs.png', 'style/default/img/menuitem.png', 'style/default/img/sessionbutton.png', 'style/default/img/textbox_gradient.png', 'style/default/img/vheadertext.png', 'style/default/img/window/1_buttons.png', 'style/default/img/window/2_buttons.png', 'style/default/img/window/4_buttons.png', 'style/default/img/window/bl_br.png', 'style/default/img/window/bt_bb.png', 'style/default/img/window/corners.png', 'style/default/img/window/header.png', 'style/default/img/window/vheader.png');
    this.BorderStyleData = {
        Solid:{ Click:{BT:1, BR:1, BB:1, BL:1}, NoClick:{BT:1, BR:1, BB:1, BL:1}, CTL:{ X:0, Y:0 }, CTR:{ X:0, Y:0 }, CBL:{ X:0, Y:0 }, CBR:{ X:0, Y:0 } },
        Raised:{ Click:{BT:2, BR:2, BB:2, BL:2}, NoClick:{BT:2, BR:2, BB:2, BL:2}, CTL:{ X:2, Y:2 }, CTR:{ X:2, Y:2 }, CBL:{ X:2, Y:2 }, CBR:{ X:2, Y:2 } },
        Lowered:{ Click:{BT:3, BR:1, BB:1, BL:3}, NoClick:{BT:2, BR:2, BB:2, BL:2}, CTL:{ X:3, Y:3 }, CTR:{ X:2, Y:2 }, CBL:{ X:2, Y:2 }, CBR:{ X:1, Y:1 } },
        LoweredBevel:{ Click:{BT:3, BR:3, BB:3, BL:3}, NoClick:{BT:3, BR:3, BB:3, BL:3}, CTL:{ X:3, Y:3 }, CTR:{ X:3, Y:3 }, CBL:{ X:3, Y:3 }, CBR:{ X:3, Y:3 } },
        RaisedBevel:{ Click:{BT:3, BR:3, BB:3, BL:3}, NoClick:{BT:3, BR:3, BB:3, BL:3}, CTL:{ X:3, Y:3 }, CTR:{ X:3, Y:3 }, CBL:{ X:3, Y:3 }, CBR:{ X:3, Y:3 } },
        LoweredOutline:{ Click:{BT:3, BR:3, BB:3, BL:3}, NoClick:{BT:3, BR:3, BB:1, BL:3}, CTL:{ X:3, Y:3 }, CTR:{ X:3, Y:3 }, CBL:{ X:3, Y:3 }, CBR:{ X:3, Y:3 } },
        RaisedOutline:{ Click:{BT:3, BR:3, BB:3, BL:3}, NoClick:{BT:3, BR:3, BB:1, BL:3}, CTL:{ X:3, Y:3 }, CTR:{ X:3, Y:3 }, CBL:{ X:3, Y:3 }, CBR:{ X:3, Y:3 } },
        Inset:{ Click:{BT:2, BR:2, BB:2, BL:2}, NoClick:{BT:2, BR:2, BB:2, BL:2}, CTL:{ X:2, Y:2 }, CTR:{ X:2, Y:2 }, CBL:{ X:2, Y:2 }, CBR:{ X:2, Y:2 } },
        Sizeable:{ Click:{BT:3, BR:3, BB:3, BL:3}, NoClick:{BT:3, BR:3, BB:3, BL:3}, CTL:{ X:16, Y:16 }, CTR:{ X:16, Y:16 }, CBL:{ X:16, Y:16 }, CBR:{ X:16, Y:16 } }
    };
    this.BrowserStyleData = {
        IE:{
            Window:{
                Normal:{ Icon:{ Margin:'3px 3px 3px 1px' } },
                Tool:{ Icon:{ Margin:'3px 3px 3px -1px' } },
                Popout:{ Icon:{ Margin:'3px 3px 3px 1px' } }
            },
            WindowListButton:{
                TABHeader:{Height:'14px', Margin:'-1px 0px 0px 0px'},
                SPANButton:{Height:'20px'},
                SPANIcon:{Margin:'0px 0px 0px -1px'},
                SPANCaption:{Margin:'-1px 0px 0px 0px', Padding:'0px 0px 0px 0px'}
            },
            MenuItem:{
                TextSizeAdjustment:{X:18},
                Header:{
                    LeftIndent:{ Position:'absolute' },
                    Icon:{ Margin:{ Left:2, Top:-1 } },
                    Text:{ Position:'relative', Left: -4, Margin:{ Left:0, Top:-1 } },
                    Glyph:{ Margin:{ Right:4, Top:-1 } },
                    RightIndent:{ Position:'absolute', Right:0 }
                },
                Normal:{
                    LeftIndent:{ Position:'absolute' },
                    Icon:{ Margin:{ Left:2, Top:-2 } },
                    Text:{ Position:'relative', Left: -4, Margin:{ Left:0, Top:-2 } },
                    Glyph:{ Margin:{ Right:4, Top:-1 } },
                    RightIndent:{ Position:'absolute', Right:0 }
                },
                Separator:{
                    LeftIndent:{ Position:'absolute' },
                    Icon:{ Margin:{ Left:2, Top:-2 } },
                    Text:{ Position:'relative', Left: -4, Margin:{ Left:0, Top:-2 } },
                    Glyph:{ Margin:{ Right:4, Top:-2 } },
                    RightIndent:{ Position:'absolute', Right:0 }
                },
                Radio:{
                    LeftIndent:{ Position:'absolute' },
                    Icon:{ Position:'relative', Top:-2, Margin:{ Left:11, Top:0 } },
                    Text:{ Position:'relative', Left: -4, Top:-3, Margin:{ Left:0 } },
                    Glyph:{ Position:'relative', Top:-3, Margin:{ Right:4, Top:-4 } },
                    RightIndent:{ Position:'absolute', Right:0 }
                },
                Check:{
                    LeftIndent:{ Position:'absolute' },
                    Icon:{ Margin:{ Left:2, Top:-2 } },
                    Text:{ Position:'relative', Left: -4, Margin:{ Left:0, Top:-2 } },
                    Glyph:{ Margin:{ Right:4, Top:-2 } },
                    RightIndent:{ Position:'absolute', Right:0 }
                }
            }
        },
        FF:{
            Window:{
                Normal:{ Icon:{ Margin:'3px 1px 3px 2px' } },
                Tool:{ Icon:{ Margin:'3px 3px 3px 2px' } },
                Popout:{ Icon:{ Margin:'3px 1px 3px 2px' } }
            },
            WindowListButton:{
                TABHeader:{Height:'16px', Margin:'2px 0px 0px 0px'},
                SPANButton:{Height:'18px'},
                SPANIcon:{Margin:'0px 0px 0px 0px'},
                SPANCaption:{Margin:'0px 0px 0px 0px', Padding:'0px 0px 0px 5px'}
            },
            MenuItem:{
                TextSizeAdjustment:{X:18},
                Header:{
                    LeftIndent:{ Position:'inherit' },
                    Icon:{ Margin:{ Left:0, Top:0 } },
                    Text:{ Position:'inherit', Left: 0, Margin:{ Left:5, Top:0 } },
                    Glyph:{ Margin:{ Right:0, Top:0 } },
                    RightIndent:{ Position:'inline', Right:-1 }
                },
                Normal:{
                    LeftIndent:{ Position:'inherit' },
                    Icon:{ Margin:{ Left:0, Top:0 } },
                    Text:{ Position:'inherit', Left: 0, Margin:{ Left:5, Top:0 } },
                    Glyph:{ Margin:{ Right:0, Top:0 } },
                    RightIndent:{ Position:'inherit', Right:-1 }
                },
                Separator:{
                    LeftIndent:{ Position:'inherit' },
                    Icon:{ Margin:{ Left:0, Top:0 } },
                    Text:{ Position:'inherit', Left: 0, Margin:{ Left:5, Top:0 } },
                    Glyph:{ Margin:{ Right:0, Top:0 } },
                    RightIndent:{ Position:'inherit', Right:-1 }
                },
                Radio:{
                    LeftIndent:{ Position:'inherit' },
                    Icon:{ Position:'inherit', Top:0, Margin:{ Left:0, Top:0 } },
                    Text:{ Position:'inherit', Left: 0, Top:0, Margin:{ Left:5, Top:0 } },
                    Glyph:{ Position:'inherit', Top:0, Margin:{ Right:0, Top:0 } },
                    RightIndent:{ Position:'inherit', Right:-1 }
                },
                Check:{
                    LeftIndent:{ Position:'inherit' },
                    Icon:{ Margin:{ Left:0, Top:0 } },
                    Text:{ Position:'inherit', Left: 0, Margin:{ Left:5, Top:0 } },
                    Glyph:{ Margin:{ Right:0, Top:0 } },
                    RightIndent:{ Position:'inherit', Right:-1 }
                }
            }
        },
        Default:{
            Window:{
                Normal:{ Icon:{ Margin:'3px 1px 3px 2px' } },
                Tool:{ Icon:{ Margin:'4px 2px 2px 3px' } },
                Popout:{ Icon:{ Margin:'3px 1px 3px 2px' } }
            },
            WindowListButton:{
                TABHeader:{Height:'16px', Margin:'2px 0px 0px 0px'},
                SPANButton:{Height:'18px'},
                SPANIcon:{Margin:'0px 0px 0px 0px'},
                SPANCaption:{Margin:'0px 0px 0px 0px', Padding:'0px 0px 0px 5px'}
            },
            MenuItem:{
                TextSizeAdjustment:{X:18},
                Header:{
                    LeftIndent:{ Position:'inherit' },
                    Icon:{ Margin:{ Left:4, Top:0 } },
                    Text:{ Position:'inherit', Left: 0, Margin:{ Left:5, Top:0 } },
                    Glyph:{ Margin:{ Right:4, Top:0 } },
                    RightIndent:{ Position:'inherit', Right:-1 }
                },
                Normal:{
                    LeftIndent:{ Position:'inherit' },
                    Icon:{ Margin:{ Left:4, Top:0 } },
                    Text:{ Position:'inherit', Left: 0, Margin:{ Left:5, Top:0 } },
                    Glyph:{ Margin:{ Right:4, Top:0 } },
                    RightIndent:{ Position:'inherit', Right:-1 }
                },
                Separator:{
                    LeftIndent:{ Position:'inherit' },
                    Icon:{ Margin:{ Left:4, Top:0 } },
                    Text:{ Position:'inherit', Left: 0, Margin:{ Left:5, Top:0 } },
                    Glyph:{ Margin:{ Right:4, Top:0 } },
                    RightIndent:{ Position:'inherit', Right:-1 }
                },
                Radio:{
                    LeftIndent:{ Position:'inherit' },
                    Icon:{ Position:'inherit', Top:0, Margin:{ Left:4, Top:0 } },
                    Text:{ Position:'inherit', Left: 0, Top:0, Margin:{ Left:5, Top:0 } },
                    Glyph:{ Position:'inherit', Top:0, Margin:{ Right:4, Top:0 } },
                    RightIndent:{ Position:'inherit', Right:-1 }
                },
                Check:{
                    LeftIndent:{ Position:'inherit' },
                    Icon:{ Margin:{ Left:4, Top:0 } },
                    Text:{ Position:'inherit', Left: 0, Margin:{ Left:5, Top:0 } },
                    Glyph:{ Margin:{ Right:4, Top:0 } },
                    RightIndent:{ Position:'inherit', Right:-1 }
                }
            }
        }
    };
    
    this.MenuItemStyleData = {
        Header:{
            Height:24,
            Normal:{
                Font:{Family:'Verdana', Size:12, Bold:true, Decoration:'none', Style:'normal'}
            },
            Disabled:{
                Font:{Family:'Verdana', Size:12, Bold:true, Decoration:'none', Style:'italic'}
            },
            Icon:{Size:16},
            Glyph:{Size:11},
            Indent:{Left:5, Right:6},
            Spacing:{Left:4, Right:12}
        },
        Normal:{
            Height:20,
            Normal:{
                Font:{Family:'Verdana', Size:11, Bold:false, Decoration:'none', Style:'normal'}
            },
            Disabled:{
                Font:{Family:'Verdana', Size:11, Bold:false, Decoration:'none', Style:'italic'}
            },
            Icon:{Size:16},
            Glyph:{Size:11},
            Indent:{Left:3, Right:3},
            Spacing:{Left:4, Right:4}
        },
        Separator:{
            Height:4,
            Normal:{
                Font:{Family:'Verdana', Size:0, Bold:false, Decoration:'none', Style:'normal'}
            },
            Disabled:{
                Font:{Family:'Verdana', Size:0, Bold:false, Decoration:'none', Style:'italic'}
            },
            Icon:{Size:0},
            Glyph:{Size:0},
            Indent:{Left:4, Right:4},
            Spacing:{Left:0, Right:0}
        },
        Radio:{
            Height:15,
            Normal:{
                Font:{Family:'Verdana', Size:7, Bold:false, Decoration:'none', Style:'normal'}
            },
            Disabled:{
                Font:{Family:'Verdana', Size:7, Bold:false, Decoration:'none', Style:'italic'}
            },
            Icon:{Size:11},
            Glyph:{Size:0},
            Indent:{Left:14, Right:3},
            Spacing:{Left:4, Right:0}
        },
        Check:{
            Height:20,
            Normal:{
                Font:{Family:'Verdana', Size:11, Bold:false, Decoration:'none', Style:'normal'}
            },
            Disabled:{
                Font:{Family:'Verdana', Size:11, Bold:false, Decoration:'none', Style:'italic'}
            },
            Icon:{Size:11},
            Glyph:{Size:0},
            Indent:{Left:3, Right:3},
            Spacing:{Left:4, Right:4}
        }
    };
    this.HoverIconStyleData = {
        s8:{X:-2, Y:-2, Width: 15, Height: 13,
            Icon:{
                Normal:{X: 2, Y: 2, Width:8, Height:8},
                Hover:{X: 2, Y: 2, Width:8, Height:8},
                Down:{X: 3, Y: 3, Width:8, Height:8}
            }
        },
        s10:{X:-2, Y:-2, Width: 17, Height: 15,
            Icon:{
                Normal:{X: 2, Y: 2, Width:10, Height:10},
                Hover:{X: 2, Y: 2, Width:10, Height:10},
                Down:{X: 3, Y: 3, Width:10, Height:10}
            }
        },
        s12:{X:-2, Y:-2, Width: 20, Height: 17,
            Icon:{
                Normal:{X: 2, Y: 2, Width:12, Height:12},
                Hover:{X: 2, Y: 2, Width:12, Height:12},
                Down:{X: 3, Y: 3, Width:12, Height:12}
            }
        },
        s14:{X:-2, Y:-2, Width: 22, Height: 19,
            Icon:{
                Normal:{X: 2, Y: 2, Width:14, Height:14},
                Hover:{X: 2, Y: 2, Width:14, Height:14},
                Down:{X: 3, Y: 3, Width:14, Height:14}
            }
        },
        s16:{X:-2, Y:-2, Width: 25, Height: 21,
            Icon:{
                Normal:{X: 2, Y: 2, Width:16, Height:16},
                Hover:{X: 2, Y: 2, Width:16, Height:16},
                Down:{X: 3, Y: 3, Width:16, Height:16}
            }
        }
    };
    this.CooldownOverlayStyleData = {
        s18:{X:0, Y:0, Width: 18, Height: 18, Image:'img/icons/odd/18cooldown_76.png', Count:76 }
    };
    this.WindowStyleData = {
        Normal:{
            Normal:{
                BorderTop:{Height:4},
                BorderRight:{Width:4},
                BorderBottom:{Height:4},
                BorderLeft:{Width:4},
                
                BorderTopLeft:{Width:8, Height:8},
                BorderTopRight:{Width:8, Height:8},
                BorderBottomLeft:{Width:8, Height:8},
                BorderBottomRight:{Width:8, Height:8},
                
                Title:{Height:21},
                Header:{Focus:{Color:'#009900'},Unfocused:{Color:'#669966'}},
                
                Client:{Left:4, Top:27, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:8, Close:'X', Maximize:'M', Collapse:'C', Minimize:'I'},
                WindowListButton:{Display:'block', Visibility:'visible', Icon:{Size:14, Margin:2}},
                Icon:{Size:16, Margin:4}
            },
            Minimized:{
                BorderTop:{Height:4},
                BorderRight:{Width:4},
                BorderBottom:{Height:4},
                BorderLeft:{Width:4},
                
                BorderTopLeft:{Width:8, Height:8},
                BorderTopRight:{Width:8, Height:8},
                BorderBottomLeft:{Width:8, Height:8},
                BorderBottomRight:{Width:8, Height:8},
                
                Title:{Height:21},
                Header:{Focus:{Color:'#009900'},Unfocused:{Color:'#669966'}},
                
                Client:{Left:4, Top:27, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:8, Close:'X', Maximize:'M', Collapse:'C', Minimize:'I'},
                WindowListButton:{Display:'block', Visibility:'visible', Icon:{Size:14, Margin:2}},
                Icon:{Size:16, Margin:4}
            },
            Collapsed:{
                BorderTop:{Height:4},
                BorderRight:{Width:4},
                BorderBottom:{Height:4},
                BorderLeft:{Width:4},
                
                BorderTopLeft:{Width:8, Height:8},
                BorderTopRight:{Width:8, Height:8},
                BorderBottomLeft:{Width:8, Height:8},
                BorderBottomRight:{Width:8, Height:8},
                
                Title:{Height:21},
                Header:{Focus:{Color:'#009900'},Unfocused:{Color:'#669966'}},
                
                Client:{Left:4, Top:27, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:8, Close:'X', Maximize:'M', Collapse:'R', Minimize:'I'},
                WindowListButton:{Display:'block', Visibility:'visible', Icon:{Size:14, Margin:2}},
                Icon:{Size:16, Margin:4}
            },
            Docked:{
                BorderTop:{Height:4},
                BorderRight:{Width:4},
                BorderBottom:{Height:4},
                BorderLeft:{Width:4},
                
                BorderTopLeft:{Width:8, Height:8},
                BorderTopRight:{Width:8, Height:8},
                BorderBottomLeft:{Width:8, Height:8},
                BorderBottomRight:{Width:8, Height:8},
                
                Title:{Height:21},
                Header:{Focus:{Color:'#009900'},Unfocused:{Color:'#669966'}},
                
                Client:{Left:4, Top:27, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:8, Close:'X', Maximize:'M', Collapse:'C', Minimize:'I'},
                WindowListButton:{Display:'none', Visibility:'hidden', Icon:{Size:14, Margin:2}},
                Icon:{Size:16, Margin:4}
            },
            Maximized:{
                BorderTop:{Height:0},
                BorderRight:{Width:0},
                BorderBottom:{Height:0},
                BorderLeft:{Width:0},
                
                BorderTopLeft:{Width:0, Height:0},
                BorderTopRight:{Width:0, Height:0},
                BorderBottomLeft:{Width:0, Height:0},
                BorderBottomRight:{Width:0, Height:0},
                
                Title:{Height:21},
                Header:{Focus:{Color:'#009900'},Unfocused:{Color:'#669966'}},
                
                Client:{Left:0, Top:22, Right:0, Bottom:0, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:4, Close:'X', Maximize:'R', Collapse:'C', Minimize:'I'},
                WindowListButton:{Display:'block', Visibility:'visible', Icon:{Size:14, Margin:2}},
                Icon:{Size:16, Margin:4}
            }
        },
        Tool:{
            Normal:{
                BorderTop:{Height:4},
                BorderRight:{Width:4},
                BorderBottom:{Height:4},
                BorderLeft:{Width:4},
                
                BorderTopLeft:{Width:8, Height:8},
                BorderTopRight:{Width:8, Height:8},
                BorderBottomLeft:{Width:8, Height:8},
                BorderBottomRight:{Width:8, Height:8},
                
                Title:{Height:16},
                Header:{Focus:{Color:'#006699'},Unfocused:{Color:'#669999'}},
                
                Client:{Left:4, Top:22, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:5, Close:'X', Maximize:'M', Collapse:'C', Minimize:'I'},
                WindowListButton:{Display:'block', Visibility:'visible', Icon:{Size:14, Margin:2}},
                Icon:{Size:12, Margin:4}
            },
            Minimized:{
                BorderTop:{Height:4},
                BorderRight:{Width:4},
                BorderBottom:{Height:4},
                BorderLeft:{Width:4},
                
                BorderTopLeft:{Width:8, Height:8},
                BorderTopRight:{Width:8, Height:8},
                BorderBottomLeft:{Width:8, Height:8},
                BorderBottomRight:{Width:8, Height:8},
                
                Title:{Height:16},
                Header:{Focus:{Color:'#006699'},Unfocused:{Color:'#669999'}},
                
                Client:{Left:4, Top:22, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:5, Close:'X', Maximize:'M', Collapse:'C', Minimize:'I'},
                WindowListButton:{Display:'block', Visibility:'visible', Icon:{Size:14, Margin:2}},
                Icon:{Size:12, Margin:4}
            },
            Collapsed:{
                BorderTop:{Height:4},
                BorderRight:{Width:4},
                BorderBottom:{Height:4},
                BorderLeft:{Width:4},
                
                BorderTopLeft:{Width:8, Height:8},
                BorderTopRight:{Width:8, Height:8},
                BorderBottomLeft:{Width:8, Height:8},
                BorderBottomRight:{Width:8, Height:8},
                
                Title:{Height:16},
                Header:{Focus:{Color:'#006699'},Unfocused:{Color:'#669999'}},
                
                Client:{Left:4, Top:22, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:5, Close:'X', Maximize:'M', Collapse:'R', Minimize:'I'},
                WindowListButton:{Display:'block', Visibility:'visible', Icon:{Size:14, Margin:2}},
                Icon:{Size:12, Margin:4}
            },
            Docked:{
                BorderTop:{Height:4},
                BorderRight:{Width:4},
                BorderBottom:{Height:4},
                BorderLeft:{Width:4},
                
                BorderTopLeft:{Width:8, Height:8},
                BorderTopRight:{Width:8, Height:8},
                BorderBottomLeft:{Width:8, Height:8},
                BorderBottomRight:{Width:8, Height:8},
                
                Title:{Height:16},
                Header:{Focus:{Color:'#006699'},Unfocused:{Color:'#669999'}},
                
                Client:{Left:4, Top:22, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:5, Close:'X', Maximize:'M', Collapse:'C', Minimize:'I'},
                WindowListButton:{Display:'none', Visibility:'hidden', Icon:{Size:14, Margin:2}},
                Icon:{Size:12, Margin:4}
            },
            Maximized:{
                BorderTop:{Height:0},
                BorderRight:{Width:0},
                BorderBottom:{Height:0},
                BorderLeft:{Width:0},
                
                BorderTopLeft:{Width:0, Height:0},
                BorderTopRight:{Width:0, Height:0},
                BorderBottomLeft:{Width:0, Height:0},
                BorderBottomRight:{Width:0, Height:0},
                
                Title:{Height:16},
                Header:{Focus:{Color:'#006699'},Unfocused:{Color:'#669999'}},
                
                Client:{Left:0, Top:17, Right:0, Bottom:0, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:1, Close:'X', Maximize:'R', Collapse:'C', Minimize:'I'},
                WindowListButton:{Display:'block', Visibility:'visible', Icon:{Size:14, Margin:2}},
                Icon:{Size:12, Margin:4}
            }
        },
        Popout:{
            Normal:{
                BorderTop:{Height:4},
                BorderRight:{Width:4},
                BorderBottom:{Height:4},
                BorderLeft:{Width:4},
                
                BorderTopLeft:{Width:8, Height:8},
                BorderTopRight:{Width:8, Height:8},
                BorderBottomLeft:{Width:8, Height:8},
                BorderBottomRight:{Width:8, Height:8},
                
                Title:{Height:17},
                Header:{Focus:{Color:'#009900'},Unfocused:{Color:'#669966'}},
                
                Client:{Left:4, Top:21, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:8, Close:'X', Maximize:'M', Collapse:'C', Minimize:'I'},
                WindowListButton:{Display:'block', Visibility:'visible', Icon:{Size:14, Margin:2}},
                Icon:{Size:16, Margin:4}
            },
            Minimized:{
                BorderTop:{Height:4},
                BorderRight:{Width:4},
                BorderBottom:{Height:4},
                BorderLeft:{Width:4},
                
                BorderTopLeft:{Width:8, Height:8},
                BorderTopRight:{Width:8, Height:8},
                BorderBottomLeft:{Width:8, Height:8},
                BorderBottomRight:{Width:8, Height:8},
                
                Title:{Height:17},
                Header:{Focus:{Color:'#009900'},Unfocused:{Color:'#669966'}},
                
                Client:{Left:4, Top:21, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:8, Close:'X', Maximize:'M', Collapse:'C', Minimize:'I'},
                WindowListButton:{Display:'block', Visibility:'visible', Icon:{Size:14, Margin:2}},
                Icon:{Size:16, Margin:4}
            },
            Collapsed:{
                BorderTop:{Height:4},
                BorderRight:{Width:4},
                BorderBottom:{Height:4},
                BorderLeft:{Width:4},
                
                BorderTopLeft:{Width:8, Height:8},
                BorderTopRight:{Width:8, Height:8},
                BorderBottomLeft:{Width:8, Height:8},
                BorderBottomRight:{Width:8, Height:8},
                
                Title:{Height:17},
                Header:{Focus:{Color:'#009900'},Unfocused:{Color:'#669966'}},
                
                Client:{Left:4, Top:21, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:8, Close:'X', Maximize:'M', Collapse:'R', Minimize:'I'},
                WindowListButton:{Display:'block', Visibility:'visible', Icon:{Size:14, Margin:2}},
                Icon:{Size:16, Margin:4}
            },
            Docked:{
                BorderTop:{Height:4},
                BorderRight:{Width:4},
                BorderBottom:{Height:4},
                BorderLeft:{Width:4},
                
                BorderTopLeft:{Width:8, Height:8},
                BorderTopRight:{Width:8, Height:8},
                BorderBottomLeft:{Width:8, Height:8},
                BorderBottomRight:{Width:8, Height:8},
                
                Title:{Height:17},
                Header:{Focus:{Color:'#009900'},Unfocused:{Color:'#669966'}},
                
                Client:{Left:4, Top:21, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:8, Close:'X', Maximize:'M', Collapse:'C', Minimize:'I'},
                WindowListButton:{Display:'none', Visibility:'hidden', Icon:{Size:14, Margin:2}},
                Icon:{Size:16, Margin:4}
            },
            Maximized:{
                BorderTop:{Height:0},
                BorderRight:{Width:0},
                BorderBottom:{Height:0},
                BorderLeft:{Width:0},
                
                BorderTopLeft:{Width:0, Height:0},
                BorderTopRight:{Width:0, Height:0},
                BorderBottomLeft:{Width:0, Height:0},
                BorderBottomRight:{Width:0, Height:0},
                
                Title:{Height:17},
                Header:{Focus:{Color:'#009900'},Unfocused:{Color:'#669966'}},
                
                Client:{Left:4, Top:21, Right:4, Bottom:4, BGColor:'#D4D0C8'},
                
                Button:{Width:16, Height:14, Spacing:2, Top:8, Close:'X', Maximize:'R', Collapse:'C', Minimize:'I'},
                WindowListButton:{Display:'block', Visibility:'visible', Icon:{Size:14, Margin:2}},
                Icon:{Size:16, Margin:4}
            }
        }
    };
}
function cStyleInfo_GetBorderStyleSet(borderstyle) {
    switch(borderstyle) {
        case eCCBorderStyle.Solid:
            return(this.BorderStyleData.Solid);
            break;
        case eCCBorderStyle.Raised:
            return(this.BorderStyleData.Raised);
            break;
        case eCCBorderStyle.Lowered:
            return(this.BorderStyleData.Lowered);
            break;
        case eCCBorderStyle.LoweredBevel:
            return(this.BorderStyleData.LoweredBevel);
            break;
        case eCCBorderStyle.RaisedBevel:
            return(this.BorderStyleData.RaisedBevel);
            break;
        case eCCBorderStyle.LoweredOutline:
            return(this.BorderStyleData.LoweredOutline);
            break;
        case eCCBorderStyle.RaisedOutline:
            return(this.BorderStyleData.RaisedOutline);
            break;
        case eCCBorderStyle.Inset:
            return(this.BorderStyleData.Inset);
            break;
        case eCCBorderStyle.Sizeable:
            return(this.BorderStyleData.Sizeable);
            break;
    }
    return(null);
}
function cStyleInfo_GetBrowserSet(browser) {
    if(browser.isIE == true) {
        return(this.BrowserStyleData.IE);
    } else if (browser.isFF) {
        return(this.BrowserStyleData.FF);
    } else {
        return(this.BrowserStyleData.Default);
    }
}
function cStyleInfo_GetCooldownOverlaySet(size) {
    switch(size) {
        case '18':
            return(this.CooldownOverlayStyleData.s18);
            break;
    }
    return(null);
}
function cStyleInfo_GetHoverIconSet(size) {
    switch(size) {
        case '8':
            return(this.HoverIconStyleData.s8);
            break;
        case '10':
            return(this.HoverIconStyleData.s10);
            break;
        case '12':
            return(this.HoverIconStyleData.s12);
            break;
        case '14':
            return(this.HoverIconStyleData.s14);
            break;
        case '16':
            return(this.HoverIconStyleData.s16);
            break;
    }
    return(null);
}
function cStyleInfo_GetMenuItemSet(type) {
    switch(type) {
        case eCMIType.Header:
            return(this.MenuItemStyleData.Header);
            break;
        case eCMIType.Normal:
            return(this.MenuItemStyleData.Normal);
            break;
        case eCMIType.Separator:
            return(this.MenuItemStyleData.Separator);
            break;
        case eCMIType.Radio:
            return(this.MenuItemStyleData.Radio);
            break;
        case eCMIType.Check:
            return(this.MenuItemStyleData.Check);
            break;
    }
    return(null);
}
function cStyleInfo_GetWindowSet(wStyle, wState) {
    switch(wStyle) {
        case eCWStyle.Normal:
            switch(wState) {
                case eCWState.Normal:
                    return(this.WindowStyleData.Normal.Normal);
                    break;
                case eCWState.Minimized:
                    return(this.WindowStyleData.Normal.Minimized);
                    break;
                case eCWState.Collapsed:
                    return(this.WindowStyleData.Normal.Collapsed);
                    break;
                case eCWState.Docked:
                    return(this.WindowStyleData.Normal.Docked);
                    break;
                case eCWState.Maximized:
                    return(this.WindowStyleData.Normal.Maximized);
                    break;
            }
            break;
        case eCWStyle.Tool:
            switch(wState) {
                case eCWState.Normal:
                    return(this.WindowStyleData.Tool.Normal);
                    break;
                case eCWState.Minimized:
                    return(this.WindowStyleData.Tool.Minimized);
                    break;
                case eCWState.Collapsed:
                    return(this.WindowStyleData.Tool.Collapsed);
                    break;
                case eCWState.Docked:
                    return(this.WindowStyleData.Tool.Docked);
                    break;
                case eCWState.Maximized:
                    return(this.WindowStyleData.Tool.Maximized);
                    break;
            }
            break;
        case eCWStyle.Popout:
            switch(wState) {
                case eCWState.Normal:
                    return(this.WindowStyleData.Popout.Normal);
                    break;
                case eCWState.Minimized:
                    return(this.WindowStyleData.Popout.Minimized);
                    break;
                case eCWState.Collapsed:
                    return(this.WindowStyleData.Popout.Collapsed);
                    break;
                case eCWState.Docked:
                    return(this.WindowStyleData.Popout.Docked);
                    break;
                case eCWState.Maximized:
                    return(this.WindowStyleData.Popout.Maximized);
                    break;
            }
            break;
    }
    return(null);
}
cStyleInfo.prototype.GetBorderStyleSet = cStyleInfo_GetBorderStyleSet;
cStyleInfo.prototype.GetBrowserSet = cStyleInfo_GetBrowserSet;
cStyleInfo.prototype.GetCooldownOverlaySet = cStyleInfo_GetCooldownOverlaySet;
cStyleInfo.prototype.GetHoverIconSet = cStyleInfo_GetHoverIconSet;
cStyleInfo.prototype.GetMenuItemSet = cStyleInfo_GetMenuItemSet;
cStyleInfo.prototype.GetWindowSet = cStyleInfo_GetWindowSet;/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
    //        cBrowser, int, string
function cAjax(parent, id, targeturl) {
    this.Parent = parent;
    this.ID = id;
    this.TargetURL = targeturl;
    this.Loaded = false;
    this.LoadChange = false;
    this.SendQueue = new cQueue();      //  cAjaxMessage
    this.Message = 0;
    this.ActiveMode = 0;
    this.SentMessages = new Array();    //  cAjaxMessage
    this.SyncRate = 10;
    this.Busy = 0;
    this.CommandLimit = 10;
    this.IF = null;
    this.FORM = null;
    this.Load();
}
function cAjax_Dispose() {
    this.UnLoad();
}
function cAjax_GetFreeSendMessageID() {
    var Msg = this.Message;
    this.Message++;
    return(Msg);
}
function cAjax_GetSentMessage(id) {
    if(id < 0) { return(null); }
    if(this.SentMessages.length > 0) {
        for(var i = this.SentMessages.length - 1; i >= 0; i--) {
            if(this.SentMessages[i].ID == id) {
                return(this.SentMessages[i]);
            }
        }
    }
    return(null);
}
function cAjax_Load() {
    if((this.Loading == false) && (this.LoadChange == false)) {
        this.LoadChange = true;
        /*
        this.IF = document.createElement('iframe');
        this.IF.setAttribute('id', 'ifAJAX_' + this.ID);
        document.getElementById('divIFHolder').appendChild(this.IF);
        this.FORM = document.createElement('form');
        this.FORM.method = "POST";
        document.getElementById('divFormHolder').appendChild(this.FORM);
        this.IF.onload = function(id) {
            var a = Browser.GetAjax(parseInt(this.id.substr(7)));
            a.ParseInput(frames[this.id].document.body.innerHTML);
            a.Busy = 0;
            a.SendNext();
        };
        */
        this.Loaded = true;
        this.LoadChange = false;
    }
}
function cAjax_ParseInput(sInput) {
    if(sInput.length > 0) {//alert(sInput.replace(/\=/g, "\n="));
        var alerts = "";
        var tA = sInput.split("=");
        
        //alert(alerts);
    }
}
function cAjax_RemoveSentMessage(id) {
    if(id < 0) { return(null); }
    var bHit = false;
    if(this.SentMessages.length > 0) {
        for(var i = this.SentMessages.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.SentMessages[i] = this.SentMessages[i - 1];
            } else {
                if(this.SentMessages[i].ID == id) {
                    this.SentMessages[i].Dispose();
                    delete this.SentMessages[i];
                    this.SentMessages[i] = this.SentMessages[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.SentMessages[0].ID == id) {
                this.SentMessages[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.SentMessages.shift();
        }
    }
}
function cAjax_Send(persist, sessionid, windowid, controlid, message) {
    var mid = this.GetFreeSendMessageID();
    this.SendQueue.push(new cAjaxMessage(this, mid, persist, sessionid, windowid, controlid, this.TargetURL, message));
    this.SendNext();
}
function cAjax_SendNext() {
    if(this.Busy < this.CommandLimit) {
        if(!this.SendQueue.empty()) {
            this.Busy++;
            var q = this.SendQueue.pop();
            var mid = q.ID;
            if(q.Message.length > 0) {
                this.SentMessages.push(q);
                this.GetSentMessage(mid).Send();
            }
        }
    }
}
function cAjax_UnLoad() {
    if((this.Loading == false) && (this.LoadChange == false)) {
        this.LoadChange = true;
        /*
        var p = document.getElementById('divIFHolder');
        p.removeChild(this.IF);
        p = document.getElementById('divFormHolder');
        p.removeChild(this.FORM);
        */
        this.Loaded = false;
        this.LoadChange = false;
    }
}
cAjax.prototype.Dispose = cAjax_Dispose;
cAjax.prototype.GetFreeSendMessageID = cAjax_GetFreeSendMessageID;
cAjax.prototype.GetSentMessage = cAjax_GetSentMessage;
cAjax.prototype.Load = cAjax_Load;
cAjax.prototype.ParseInput = cAjax_ParseInput;
cAjax.prototype.RemoveSentMessage = cAjax_RemoveSentMessage;
cAjax.prototype.Send = cAjax_Send;
cAjax.prototype.SendNext = cAjax_SendNext;
cAjax.prototype.UnLoad = cAjax_UnLoad;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
    //               cAjax, int, bool, int, int, int, string, string[]
function cAjaxMessage(parent, id, persist, sessionid, windowid, controlid, targeturl, message) {
    this.Parent = parent;
    this.ID = id;
    this.Persist = persist;
    this.SessionID = sessionid;
    this.WindowID = windowid;
    this.ControlID = controlid;
    this.TargetURL = targeturl;
    this.Message = message;
    this.Loaded = false;
    this.LoadChange = false;
    this.Parsed = false;
    this.IF = null;
    this.FORM = null;
    //alert('SEND'+dump(message));
}
function cAjaxMessage_Dispose() {
    this.UnLoad();
}
function cAjaxMessage_IFLoad(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        var tA = obj.id.substr(7);
        tA = tA.split('_');
        var message = Browser.GetAjax(parseInt(tA[0])).GetSentMessage(parseInt(tA[1]));
        message.ParseInput(frames[obj.id].document.body.innerHTML);
        message.Kill();
    }
    return(void(0));
}
function cAjaxMessage_IFLoadLocal() {
    //alert(window.frames['ifAJAX_' + this.Parent.ID + '_' + this.ID].document.getElementById('b').innerHTML);
    this.ParseInput(window.frames['ifAJAX_' + this.Parent.ID + '_' + this.ID].document.getElementById('b').innerHTML);//.body.innerHTML);
    this.Kill();
}
function cAjaxMessage_Kill() {
    this.Parent.Busy--;
    this.IF.setAttribute('src', '');
    this.Parent.SendNext(); 
    this.Parent.RemoveSentMessage(this.ID);
}
function dump(arr,level) {
var dumped_text = "";
if(!level) level = 0;

//The padding given at the beginning of the line.
var level_padding = "";
for(var j=0;j<level+1;j++) level_padding += "    ";

if(typeof(arr) == 'object') { //Array/Hashes/Objects
 for(var item in arr) {
  var value = arr[item];
 
  if(typeof(value) == 'object') { //If it is an array,
   dumped_text += level_padding + "'" + item + "' ...\n";
   dumped_text += dump(value,level+1);
  } else {
   dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
  }
 }
} else { //Stings/Chars/Numbers etc.
 dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
}
return dumped_text;
}
function cAjaxMessage_ParseInput(data) {
//alert(data);
    if(this.Parsed == false) {
        this.Parsed = true;
        var tA = BufferIn(data);
        //alert('RECV'+dump(tA));
        if(this.SessionID >= 0) {
            var Ses = Browser.GetSession(this.SessionID);
            if(Ses) {
                if(this.WindowID >= 0) {
                    var Win = Ses.GetWindow(this.WindowID);
                    if(Win) {
                        if(this.ControlID >= 0) {
                            var Ctl = Win.GetControl(this.ControlID);
                            if(Ctl) {
                                Ctl.AjaxProcess(tA);
                            }
                        } else {
                            Win.AjaxProcess(tA);
                        }
                    }
                } else {
                    Ses.AjaxProcess(tA);
                }
            }
        } else {
            Browser.AjaxProcess(tA);
        }
        tA = [];
    }
}
function cAjaxMessage_Send() {
    if((this.Loaded == false) && (this.LoadChange == false)) {
        this.LoadChange = true;
        var p;
        var dt = ((new Date()).getTimezoneOffset()) / 60;
        
        if(this.Persist) { p = '1'; } else { p = '0'; }
        this.IF = document.createElement('iframe');
        this.IF.setAttribute('id', 'ifAJAX_' + this.Parent.ID + '_' + this.ID);
        this.IF.setAttribute('name', 'ifAJAX_' + this.Parent.ID + '_' + this.ID);
        document.getElementById('divIFHolder').appendChild(this.IF);
        if((Browser.browser.isIE == true) || (window.opera)) { self.frames['ifAJAX_' + this.Parent.ID + '_' + this.ID].name = 'ifAJAX_' + this.Parent.ID + '_' + this.ID; }
        //alert('inc/ajax.php?txtAJAXHeader_' + this.Parent.ID + '_' + this.ID+'='+BufferOut(new Array(Browser.BrowserKey, dt, this.Parent.ID, this.ID, p, this.SessionID, this.WindowID))+'&txtAJAXMessage_' + this.Parent.ID + '_' + this.ID+'='+BufferOut(this.Message));
        this.FORM = document.createElement('form');
        this.FORM.setAttribute('method', 'POST');
        this.FORM.setAttribute('target', 'ifAJAX_' + this.Parent.ID + '_' + this.ID);
        this.FORM.target = 'ifAJAX_' + this.Parent.ID + '_' + this.ID;
        this.FORM.setAttribute('action', this.TargetURL);
        
        this.TXTHeader = document.createElement('input');
        this.TXTHeader.setAttribute('id', 'txtAJAXHeader_' + this.Parent.ID + '_' + this.ID);
        this.TXTHeader.setAttribute('name', 'txtAJAXHeader_' + this.Parent.ID + '_' + this.ID);
        this.TXTHeader.setAttribute('type', 'text');
        this.TXTHeader.setAttribute('value', BufferOut(new Array(Browser.BrowserKey, dt, this.Parent.ID, this.ID, p, this.SessionID, this.WindowID)));
        this.TXTMessage = document.createElement('input');
        this.TXTMessage.setAttribute('id', 'txtAJAXMessage_' + this.Parent.ID + '_' + this.ID);
        this.TXTMessage.setAttribute('name', 'txtAJAXMessage_' + this.Parent.ID + '_' + this.ID);
        this.TXTMessage.setAttribute('type', 'text');
        this.TXTMessage.setAttribute('value', BufferOut(this.Message));
        
            this.FORM.appendChild(this.TXTHeader);
            this.FORM.appendChild(this.TXTMessage);
        document.getElementById('divFormHolder').appendChild(this.FORM);
        
        //if (typeof this.IF.nodeType == "undefined") {
        //    this.IF = document.getElementById('ifAJAX_' + this.Parent.ID + '_' + this.ID);
        //}
        //eventPush(this.IF, 'load', this.IFLoad);
        this.FORM.submit();
        this.Loaded = true;
        this.LoadChange = false;
    }
}
function cAjaxMessage_UnLoad() {
    if((this.Loaded == true) && (this.LoadChange == false)) {
        this.LoadChange = true;
        
        //eventPop(this.IF, 'load', cAjaxMessage_IFLoad);
        
        var p = document.getElementById('divIFHolder');
        //p.removeChild(this.IF);
        p = document.getElementById('divFormHolder');
            this.FORM.removeChild(this.TXTMessage);
            this.FORM.removeChild(this.TXTHeader);
        p.removeChild(this.FORM);
        
        this.Loaded = false;
        this.LoadChange = false;
    }
}
cAjaxMessage.prototype.Dispose = cAjaxMessage_Dispose;
cAjaxMessage.prototype.IFLoad = cAjaxMessage_IFLoad;
cAjaxMessage.prototype.IFLoadLocal = cAjaxMessage_IFLoadLocal;
cAjaxMessage.prototype.Kill = cAjaxMessage_Kill;
cAjaxMessage.prototype.ParseInput = cAjaxMessage_ParseInput;
cAjaxMessage.prototype.Send = cAjaxMessage_Send;
cAjaxMessage.prototype.UnLoad = cAjaxMessage_UnLoad;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function GetBrowserType() {
    var ua, s, i;
    this.isIE       = false;
    this.isNS       = false;
    this.isChrome   = false;
    this.version    = null;
    ua = navigator.userAgent.toLowerCase();
    s = "chrome/";
    if((i = ua.indexOf(s)) >= 0) {
        this.isChrome = true;
        this.version = parseFloat(ua.substr(i + s.length));
        return;
    }
    s = "msie";
    if ((i = ua.indexOf(s)) >= 0) {
        this.isIE = true;
        this.version = parseFloat(ua.substr(i + s.length));
        return;
    }
    s = "netscape6/";
    if ((i = ua.indexOf(s)) >= 0) {
        this.isNS = true;
        this.version = parseFloat(ua.substr(i + s.length));
        return;
    }
    s = "gecko";
    if ((i = ua.indexOf(s)) >= 0) {
        this.isNS = true;
        this.version = 6.1;
        return;
    }
}

function cBrowser() {
    this.BaseType = 'Browser';
    this.TypeOf = 'Browser';
    this.browser = new GetBrowserType();
    this.ScreenMetrics = new Object();
    this.ScreenMetrics.X = 0; this.ScreenMetrics.Y = 0; this.ScreenMetrics.Width = 0; this.ScreenMetrics.Height = 0;
    this.Sizing = false;
    
    this.FocusObj = null;
    this.FocusControl = null;
    this.DownControl = null;
    this.Ajax = new Array();        //  cAjax;
    this.CooldownOverlays = new Array();    //  cCooldownOverlay
    this.HoverIcons = new Array();    //  cHoverIcon
    this.Menus = new Array();    //  cMenu
    this.MenuPoppers = new Array();    //  cMenuPopper
    this.Scripts = new Array();    //  cScript
    this.Sessions = new Array();    //  cSession
    this.Styles = new Array();    //  cStyle
    this.WindowLists = new Array(); //  cWindowList
    this.SysFail = '';
    this.AjaxID = 0;
    this.MenuID = 0;
    this.MenuPopperID = 0;
    this.ScriptID = 0;
    this.SessionID = 0;
    this.StyleID = 0;
    this.WindowListID = 0;
    this.ParamID1 = -1;
    this.ParamID2 = -1;
    this.ParamID3 = -1;
    this.Style = new cStyleInfo();
    this.StyleSet = this.Style.GetBrowserSet(this.browser);
    this.ValidatorField = '';
    this.ValidatorValue = '';
    this.BrowserKey = '';
    this.UserID = -1;
    this.Username = '';
    this.IsAdmin = false;
    this.TXTUsername = null;
    this.TXTPassword = null;
    this.CAPTCHAReloadIcon = null;
    this.CAPTCHAImage = null;
    this.CAPTCHATimeout = '';
    this.CAPTCHACode = 0;
    this.CAPTCHARefreshDelay = 30000;
    this.PreCached = false;
    
    this.dragObj = new Object();
    this.dragObj.zIndex = 0;
    this.dragObj.Session = null;
    this.dragObj.Window = null;
    
    if (typeof document.body.onselectstart!="undefined")
	    document.body.onselectstart=function(){return false}
    else if (typeof document.body.style.MozUserSelect!="undefined")
	    document.body.style.MozUserSelect="none"
    //else
	    //document.body.onmousedown=function(){return false}
    document.body.style.cursor = "default"
    
    this.Palette = new cColorPalette();
}
function cBrowser_Activate(browserkey, userid, username, isadmin) {
    this.BrowserKey = browserkey;
    this.UserID = userid;
    this.Username = username;
    this.IsAdmin = isadmin;
    
    var s = this.CreateSession(this.GetFirstAjaxID());
    this.Sessions[s].CreateWindow(-1, "unnamed", "Window 1", 'application', eCWState.Normal, eCWStyle.Normal, eCDPosition.Float, eCDPosition.Left + eCDPosition.Right, new cWCord('auto', 'auto'), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), false, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    this.Sessions[s].CreateWindow(-1, "unnamed", "Window 2", 'application', eCWState.Normal, eCWStyle.Normal, eCDPosition.Float, eCDPosition.Left + eCDPosition.Right, new cWCord('auto', 'auto'), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), false, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    //this.Sessions[0].CreateWindow("Window 2", 'application', eCWState.Normal, eCWStyle.Normal, eCDPosition.Float, eCDPosition.Float, new cWCord(200, 200), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), -1, true, false, true);
    this.Sessions[s].CreateWindow(-1, "unnamed", "Tool 1", 'application', eCWState.Normal, eCWStyle.Tool, eCDPosition.Float, eCDPosition.All, new cWCord('auto', 'auto'), new cWCord(400, 250), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), false, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    //this.Sessions[0].CreateWindow("Tool 4", 'application', eCWState.Normal, eCWStyle.Tool, eCDPosition.Float, eCDPosition.Float, new cWCord(400, 400), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), -1, true, false, true);
    
    this.Sessions[s].CreateWindow(-1, "unnamed", "Tool 2", 'application', eCWState.Docked, eCWStyle.Tool, eCDPosition.Left, eCDPosition.All, new cWCord('auto', 'auto'), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), false, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    this.Sessions[s].CreateWindow(-1, "unnamed", "Tool 3", 'application', eCWState.Docked, eCWStyle.Tool, eCDPosition.Left, eCDPosition.All, new cWCord('auto', 'auto'), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), true, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    this.Sessions[s].CreateWindow(-1, "unnamed", "Tool 4", 'application', eCWState.Docked, eCWStyle.Tool, eCDPosition.Left, eCDPosition.All, new cWCord('auto', 'auto'), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), false, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    this.Sessions[s].CreateWindow(-1, "unnamed", "Tool 5", 'application', eCWState.Docked, eCWStyle.Tool, eCDPosition.Top, eCDPosition.All, new cWCord('auto', 'auto'), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), false, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    this.Sessions[s].CreateWindow(-1, "unnamed", "Tool 6", 'application', eCWState.Docked, eCWStyle.Tool, eCDPosition.Top, eCDPosition.All, new cWCord('auto', 'auto'), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), false, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    this.Sessions[s].CreateWindow(-1, "unnamed", "Tool 7", 'application', eCWState.Docked, eCWStyle.Tool, eCDPosition.Right, eCDPosition.All, new cWCord('auto', 'auto'), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), false, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    this.Sessions[s].CreateWindow(-1, "unnamed", "Tool 8", 'application', eCWState.Docked, eCWStyle.Tool, eCDPosition.Right, eCDPosition.All, new cWCord('auto', 'auto'), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), false, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    this.Sessions[s].CreateWindow(-1, "unnamed", "Tool 9", 'application', eCWState.Docked, eCWStyle.Tool, eCDPosition.Right, eCDPosition.All, new cWCord('auto', 'auto'), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), false, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    this.Sessions[s].CreateWindow(-1, "unnamed", "Tool 10", 'application', eCWState.Docked, eCWStyle.Tool, eCDPosition.Bottom, eCDPosition.All, new cWCord('auto', 'auto'), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), false, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    this.Sessions[s].CreateWindow(-1, "unnamed", "Tool 11", 'application', eCWState.Docked, eCWStyle.Tool, eCDPosition.Bottom, eCDPosition.All, new cWCord('auto', 'auto'), new cWCord(400, 300), new cWCord(200, 150), new cWCord(250, 162), new cWCord(150, 112), false, -1, true, true, true, false, false, eCCAlign.Stretch, eCCVAlign.Stretch);
    
    this.Sessions[s].LoadWindow(0);
    this.Sessions[s].LoadWindow(1);
    this.Sessions[s].LoadWindow(2);
    /*var msg;
    msg = new Array('session', 'window', 'create', '0');
    this.GetAjax(this.GetFirstAjaxID()).Send(true, s, -1, -1, msg);
    msg = new Array('session', 'window', 'create', '1');
    this.GetAjax(this.GetFirstAjaxID()).Send(true, s, -1, -1, msg);
    msg = new Array('session', 'window', 'create', '2');
    this.GetAjax(this.GetFirstAjaxID()).Send(true, s, -1, -1, msg);*/
    //this.CreateSession(-1);
}
function cBrowser_AjaxArrival(AjaxID, AjaxMessageID) {
    var a = this.GetAjax(AjaxID);
    if(a) {
        a = a.GetSentMessage(AjaxMessageID);
        if(a) {
            a.IFLoadLocal();
        }
    }
}
function cBrowser_AjaxProcess(data) {
    if((typeof(data) == 'object') && (data instanceof Array) && (data.length > 0)) {
        switch(data[0]) {
            case 'auth':
                this.AjaxProcessAuth(data);
                break;
            case 'validator':
                this.AjaxProcessValidator(data);
                break;
        }
    }
}
function cBrowser_AjaxProcessAuth(data) {
    if(data.length > 1) {
        switch(data[1]) {
            case 'blockregemail':
                this.AjaxProcessAuthBlockRegEmail(data);
                break;
            case 'confirmregistration':
                this.AjaxProcessAuthConfirmRegistration(data);
                break;
            case 'login':
                this.AjaxProcessAuthLogin(data);
                break;
            case 'lostpassword':
                this.AjaxProcessAuthLostPassword(data);
                break;
            case 'lostusername':
                this.AjaxProcessAuthLostUsername(data);
                break;
            case 'passwordreset':
                this.AjaxProcessAuthPasswordReset(data);
                break;
            case 'pwaudit':
                this.AjaxProcessAuthPWAudit(data);
                break;
            case 'pwreset':
                this.AjaxProcessAuthPWReset(data);
                break;
            case 'registration':
                this.AjaxProcessAuthRegistration(data);
                break;
            case 'stat':
                this.AjaxProcessAuthStat(data);
                break;
        }
    }
}
function cBrowser_AjaxProcessAuthBlockRegEmail(data) {
    var blocked = false;
    if(data.length > 2) {
        if((typeof(data[2]) == 'object') && (data[2] instanceof Array) && (data[2][0]+'' == '1')) {
            if(data[2].length > 1) {
                this.ShowDirectMessage('novorum', 'Nova Database Authentication', 'Email Blocked', 'Welcome, '+data[2][1], 'Your email address has been blocked.', 'We apologize for any spam you may have received due to an abuse of our<br />system, this issue has been logged and we will look into it.', 'Please note, if you would like to register in the future or if<br />you accidently clicked the block link in your registration email you<br />will have to <a href="mailto: webmaster@inetgui.org?subject=Accidental Registration Block">contact us</a> with the email address that has been blocked<br />in order to register in our system.');
                blocked = true;
            }
        }
    }
    if(blocked == false) {
        this.ShowDirectMessage('novorum', 'Nova Database Authentication', 'Invalid Registration Code', 'Hello', 'This registration code is not valid.', 'If you believe you have received this message in error you may <a href="mailto: webmaster@inetgui.org?subject=Invalid Registration Block">contact us</a><br />and we will work to resolve your issue as soon as possible.', '');
    }
    this.HideLoading();
}
function cBrowser_AjaxProcessAuthConfirmRegistration(data) {
    var displayed = false;
    if(data.length > 2) {
        if((typeof(data[2]) == 'object') && (data[2] instanceof Array) && (data[2].length > 1)) {
            switch(data[2][0]+'') {
                case '0':
                    if(data[2].length > 1) {
                        this.ShowDirectMessage('novorum', 'Nova Database Registration', 'Registration Unknown', 'Welcome, '+data[2][1], 'Your email address has been blocked.', 'We apologize for any spam you may have received due to an abuse of our<br />system, this issue has been logged and we will look into it.', 'Please note, if you would like to register in the future or if<br />you accidently clicked the block link in your registration email you<br />will have to <a href="mailto: webmaster@inetgui.org?subject=Accidental Registration Block">contact us</a> with the email address that has been blocked<br />in order to register in our system.');
                        displayed = true;
                    }
                    break;
                case '1':
                    if(data[2].length > 3) {
                        this.Activate(data[3], data[2][2], data[2][1], (data[2][3]+'' == '1'));
                        this.ShowDirectMessage('novorum', 'Nova Database Registration', 'Registration Complete', 'Welcome, '+data[2][1], 'You have been registered.', 'Please wait while your session is authenticated...', 'If this page does not reload within 10 seconds you may <a href="JavaScript: Browser.HideDirectMessage(); if(Browser.BrowserKey == \'\') { Browser.ShowLogin(); }">click here</a><br />to see if your login was properly authenticated.');
                        setTimeout('Browser.HideDirectMessage(); if(Browser.BrowserKey == \'\') { Browser.ShowLogin(); }', 10000);
                        displayed = true;
                    }
                    break;
                case '2':
                    if(data[2].length > 1) {
                        this.ShowDirectMessage('novorum', 'Nova Database Registration', 'Registration Expired', 'We\'re Sorry', 'Your registration has expired.', 'The 24 hour limit to confirm your email address has expired,<br />You may <a href="JavaScript: Browser.ShowRegistration();">resubmit your registration</a> if you like. <br />If you have registered less than 24 hours ago please <a href="mailto: webmaster@inetgui.org?subject=Registration Expired">contact us</a><br />regaurding this issue.', '');
                        displayed = true;
                    }
                    break;
                case '3':
                    if(data[2].length > 1) {
                        this.ShowDirectMessage('novorum', 'Nova Database Registration', 'Registration Complete', 'Welcome, '+data[2][1], 'You are pending verification.', 'We have been alerted to your registration and it is pending manual<br />validation to ensure authenticity.  You will receive an email once<br />your account has been verified, at which time you will be able to<br />post to our system.  In the meantime you may still browse the site.', '');
                        displayed = true;
                    }
                    break;
            }
        }
    }
    if(displayed == false) {
        this.ShowDirectMessage('novorum', 'Nova Database Registration', 'Invalid Registration Code', 'Hello', 'This registration code is not valid.', 'This registration code may have already been confirmed, in which case you<br />may <a href="JavaScript: Browser.HideDirectMessage(); Browser.ShowLogin();">login here</a>.', 'If you believe you have received this message in error you may <a href="mailto: webmaster@inetgui.org?subject=Invalid Registration">contact us</a><br />and we will work to resolve your issue as soon as possible.');
    }
    this.HideLoading();
}
function cBrowser_AjaxProcessAuthLogin(data) {
    if(data.length > 2) {
        var loaded = false;
        if((typeof(data[2]) == 'object') && (data[2] instanceof Array) && (data[2][0]+'' == '1')) {
            if(data[2].length > 3) {
                this.Activate(data[3], data[2][2], data[2][1], (data[2][3]+'' == '1'));
                this.HideLoading();
                loaded = true;
            }
        }
        if(loaded == false) {
            this.BrowserKey = '';
            this.ShowLogin();
            var o = document.getElementById('form_login_username');
            if(o) { o.value = data[2][1] }
            o = document.getElementById('form_login_username_tag');
            if(o) { o.innerHTML = data[2][2] }
            o = document.getElementById('form_login_password_tag');
            if(o) { o.innerHTML = data[2][3] }
            this.HideLoading();
        }
    }
}
function cBrowser_AjaxProcessAuthLostPassword(data) {
    if(data.length > 2) {
        var displayed = false;
        if((typeof(data[2]) == 'object') && (data[2] instanceof Array)) {
            switch(data[2][0]+'') {
                case '1':
                    this.ShowDirectMessage('novorum', 'Nova Database Authentication', 'Please Check Your Email', 'Hello, '+data[2][1], 'Please check your email to reset your password...', '', 'If you do not receive your password reset instructions via email, please <a href="mailto: webmaster@inetgui.org?subject=Password Retrieval Email Trouble">contact us</a><br />from the email associated with your account in order to reset your password.');
                    this.HideLoading();
                    displayed = true;
                    break;
                case '2':
                    this.ShowDirectMessage('novorum', 'Nova Database Authentication', 'Email Failure', 'Hello, '+data[2][1], 'Email Retrieval Failed', '', 'Your password reset instructions could not be sent via email, please <a href="mailto: webmaster@inetgui.org?subject=Password Retrieval Email Failed">contact us</a><br />from the email associated with your account in order to reset your password.');
                    this.HideLoading();
                    displayed = true;
                    break;
            }
        }
        if(displayed == false) {
            this.ShowLostPassword();
            var o = document.getElementById('form_lostpassword_username');
            if(o) { o.value = data[2][1] }
            o = document.getElementById('form_lostpassword_email');
            if(o) { o.value = data[2][2] }
            o = document.getElementById('form_lostpassword_username_tag');
            if(o) { o.innerHTML = data[2][3] }
            o = document.getElementById('form_lostpassword_email_tag');
            if(o) { o.innerHTML = data[2][4] }
            o = document.getElementById('form_lostpassword_captcha_tag');
            if(o) { o.innerHTML = data[2][5] }
            this.HideLoading();
        }
    }
}
function cBrowser_AjaxProcessAuthLostUsername(data) {
    if(data.length > 2) {
        var displayed = false;
        if((typeof(data[2]) == 'object') && (data[2] instanceof Array)) {
            switch(data[2][0]+'') {
                case '1':
                    this.ShowDirectMessage('novorum', 'Nova Database Authentication', 'Please Check Your Email', 'Hello', 'Please check your email to retrieve your username...', '', 'If you do not receive your username via email, please <a href="mailto: webmaster@inetgui.org?subject=Username Email Retrieval Trouble">contact us</a><br />from the email associated with your account in order to<br />attain your username.');
                    this.HideLoading();
                    displayed = true;
                    break;
                case '2':
                    this.ShowDirectMessage('novorum', 'Nova Database Authentication', 'Email Failure', 'Hello', 'Email Retrieval Failed', '', 'Your username could not be retrieved via email, please <a href="mailto: webmaster@inetgui.org?subject=Username Email Retrieval Failed">contact us</a><br />from the email associated with your account in order to<br />attain your username.');
                    this.HideLoading();
                    displayed = true;
                    break;
            }
        }
        if(displayed == false) {
            this.ShowLostUsername();
            var o = document.getElementById('form_lostusername_email');
            if(o) { o.value = data[2][1] }
            o = document.getElementById('form_lostusername_email_tag');
            if(o) { o.innerHTML = data[2][2] }
            o = document.getElementById('form_lostusername_captcha_tag');
            if(o) { o.innerHTML = data[2][3] }
            this.HideLoading();
        }
    }
}
function cBrowser_AjaxProcessAuthPasswordReset(data) {
    var blocked = false;
    if(data.length > 2) {
        if((typeof(data[2]) == 'object') && (data[2] instanceof Array) && (data[2][0]+'' == '1')) {
            if(data[2].length > 1) {
                this.Activate(data[3], data[2][2], data[2][1], (data[2][3]+'' == '1'));
                this.HideLoading();
                blocked = true;
            }
        }
    }
    if(blocked == false) {
        this.BrowserKey = '';
        this.ShowPasswordReset();
        var o = document.getElementById('form_passwordreset_username');
        if(o) { o.value = data[2][1] }
        o = document.getElementById('form_passwordreset_username_tag');
        if(o) { o.innerHTML = data[2][2] }
        o = document.getElementById('form_passwordreset_password_tag');
        if(o) { o.innerHTML = data[2][3] }
        o = document.getElementById('form_passwordreset_passwordconfirm_tag');
        if(o) { o.innerHTML = data[2][4] }
        o = document.getElementById('form_passwordreset_captcha_tag');
        if(o) { o.innerHTML = data[2][5] }
        this.HideLoading();
    }
    this.HideLoading();
}
function cBrowser_AjaxProcessAuthPWAudit(data) {
    var blocked = false;
    if(data.length > 2) {
        if((typeof(data[2]) == 'object') && (data[2] instanceof Array) && (data[2][0]+'' == '1')) {
            if(data[2].length > 1) {
                this.ShowDirectMessage('novorum', 'Nova Database Authentication', 'Audit Queued', 'Hello, '+data[2][1], 'Security audit has been queued.', 'By visiting this page you have queued a security audit on your account<br />and closed any pending account changes triggered by the associated key<br />of this page.  No further action is needed on your part unless you<br />receive further emails.', 'Thank you for taking the time to ensure our site and your account are secure.');
                blocked = true;
            }
        }
    }
    if(blocked == false) {
        this.ShowDirectMessage('novorum', 'Nova Database Authentication', 'Cannot Initiate Security Audit', 'Hello', 'The reset code you sent is invalid.', 'This could be caused by an expired password reset link or one that has<br />already been used. This attempt has been logged and will be looked into<br /><br />by someone at Novorum inc.', '');
    }
    this.HideLoading();
}
function cBrowser_AjaxProcessAuthPWReset(data) {
    var blocked = false;
    if(data.length > 2) {
        if((typeof(data[2]) == 'object') && (data[2] instanceof Array) && (data[2][0]+'' == '1')) {
            if(data[2].length > 1) {
                this.ShowPasswordReset(data[2][1]);
                blocked = true;
            }
        }
    }
    if(blocked == false) {
        this.ShowDirectMessage('novorum', 'Nova Database Authentication', 'Invalid Reset Code', 'Hello', 'The reset code you sent is invalid.', 'This could be caused by an expired password reset link or one that has<br />already been used. This attempt has been logged and will be looked into<br />by someone at Novorum inc.', '');
    }
    this.HideLoading();
}
function cBrowser_AjaxProcessAuthRegistration(data) {
    if(data.length > 2) {
        var loaded = false;
        if((typeof(data[2]) == 'object') && (data[2] instanceof Array) && (data[2][0]+'' == '1')) {
            if(data[2].length > 1) {
                this.ShowDirectMessage('novorum', 'Nova Database Registration', 'Please Check Your Email', 'Welcome, '+data[2][1], 'Please check your email to complete registration with our system...', '', 'If you do not receive a confirmation email, please <a href="mailto: webmaster@inetgui.org?subject=Registration Trouble">contact us</a><br />from the email you want associated with your account in order to<br />complete your registration.');
                this.HideLoading();
                loaded = true;
            }
        }
        if(loaded == false) {
            this.ShowRegistration();
            var o = document.getElementById('form_registration_name_tag');
            if(o) { o.innerHTML = data[2][10]; }
            o = document.getElementById('form_registration_email_tag');
            if(o) { o.innerHTML = data[2][11]; }
            o = document.getElementById('form_registration_emailconfirm_tag');
            if(o) { o.innerHTML = data[2][12]; }
            o = document.getElementById('form_registration_username_tag');
            if(o) { o.innerHTML = data[2][13]; }
            o = document.getElementById('form_registration_password_tag');
            if(o) { o.innerHTML = data[2][14]; }
            o = document.getElementById('form_registration_passwordconfirm_tag');
            if(o) { o.innerHTML = data[2][15]; }
            o = document.getElementById('form_registration_captcha_tag');
            if(o) { o.innerHTML = data[2][16]; }
            o = document.getElementById('form_registration_system_tag');
            if(o) {
                o.innerHTML = data[2][9];
                o = document.getElementById('td_registration_system');
                if(o) {
                    if(data[2][9].length > 0) { o.style.display = 'block'; o.style.visibility = 'visible'; }
                    else { o.style.display = 'none'; o.style.visibility = 'hidden'; }
                    document.getElementById('td_registration_system_left').style.display = o.style.display;
                    document.getElementById('td_registration_system_right').style.display = o.style.display;
                    document.getElementById('td_registration_system_left').style.visibility = o.style.visibility;
                    document.getElementById('td_registration_system_right').style.visibility = o.style.visibility;
                }
            }
            
            this.TXTNameFirst.value = data[2][1];
            this.TXTNameMiddle.value = data[2][2];
            this.TXTNameLast.value = data[2][3];
            this.TXTEmail.value = data[2][4];
            this.TXTEmailConfirm.value = data[2][5];
            this.TXTUsername.value = data[2][6];
            this.TXTPassword.value = data[2][7];
            this.TXTPasswordConfirm.value = data[2][8];
            this.HideLoading();
        }
    }
}
function cBrowser_AjaxProcessAuthStat(data) {
    var bH = false;
    if(data.length > 2) {
        if((typeof(data[2]) == 'object') && (data[2] instanceof Array) && (data[2][0].length > 0)) {
            this.BrowserKey = data[2][0];
            this.UserID = data[2][1];
            this.Username = data[2][2];
            this.IsAdmin = (data[2][3] == '1');
            bH = true;
        }
    }
    if(bH == false) {
        this.BrowserKey = '';
        this.UserID = -1;
        this.Username = '';
        this.IsAdmin = false;
        this.ClearSessions();
        this.ShowLogin();
    }
}
function cBrowser_AjaxProcessValidator(data) {
    if(data.length > 1) {
        if(data[1].length > 0) {
            this.FValidateEnd(data[2], data[3]);
        }
    }
}
function cBrowser_ClearFocusControl() {
    if(this.FocusControl != null) { this.FocusControl.FireEvent('blur', false, false, null); }
    this.FocusControl = null;
}
function cBrowser_ClearMenuPoppers(startAt) {
    if(this.MenuPoppers.length > 0) {
        var t = null;
        for(var i = this.MenuPoppers.length - 1; i >= startAt; i--) {
            this.MenuPoppers[i].Dispose();
            t = this.MenuPoppers.pop();
            if(t) { delete t; }
        }
        if(startAt == 0) { this.MenuPoppers = []; }
        this.MenuPopperID = startAt;
    }
}
function cBrowser_ClearSessions() {
    if(this.Sessions.length > 0) {
        var s = null;
        for(var i = this.Sessions.length - 1; i >= 0; i--) {
            this.Sessions[i].Dispose();
            s = this.Sessions.pop();
            if(s) { delete s; }
        }
        this.Sessions = [];
        this.SessionID = 0;
    }
}
function cBrowser_CreateAjax() {
    var a = this.GetFreeAjaxID();
    this.Ajax.push(new cAjax(this, a, 'inc/ajax.php'));
    return(a);
}
function cBrowser_CreateMenu(key) {
    var m = this.GetFreeMenuID();
    this.Menus.push(new cMenu(this, m, key));
    return(m);
}
function cBrowser_CreateMenuPopper() {
    var p = this.GetFreeMenuPopperID();
    this.MenuPoppers.push(new cMenuPopper(this, p));
    return(p);
}
function cBrowser_CreateSession(aID) {
    if(aID < 0) { aID = 0; }
    if(this.Ajax.length <= aID) { aID = this.GetFirstAjaxID(); }
    var s = this.GetFreeSessionID();
    this.Sessions.push(new cSession(this, aID, s));
    return(s);
}
function cBrowser_CreateWindowList(div, classname) {
    var l = this.GetFreeWindowListID();
    this.WindowLists.push(new cWindowList(this, l, div, classname));
    return(l);
}
function cBrowser_DragStart(e, id, sides, inverse) {
    var el;
    var mc = Browser.GetMouseCords(e);
    Browser.dragObj.Inverse = (inverse == true);
    if (id) {
        Browser.dragObj.elActualNode = document.getElementById(id);
    } else {
        Browser.dragObj.elActualNode = EventObj(e);
        if (Browser.dragObj.elActualNode.nodeType == 3)
            Browser.dragObj.elActualNode = Browser.dragObj.elActualNode.parentNode;
    }
    var aID = Browser.dragObj.elActualNode.id.split('_');
    Browser.dragObj.Changed = false;
    Browser.dragObj.SessionID = parseInt(aID[aID.length - 2]);
    Browser.dragObj.WindowID = parseInt(aID[aID.length - 1]);
    Browser.dragObj.Session = Browser.GetSession(Browser.dragObj.SessionID);
    Browser.dragObj.Window = Browser.dragObj.Session.GetWindow(Browser.dragObj.WindowID);
    Browser.dragObj.elActualNode = document.getElementById('divWin_' + Browser.dragObj.SessionID + '_' + Browser.dragObj.WindowID);
    Browser.dragObj.ActualPosition = Browser.GetPosition(Browser.dragObj.elActualNode);
    Browser.dragObj.elNode = document.getElementById('divDragRectangle');
    Browser.dragObj.elNode.style.left = Browser.dragObj.ActualPosition.X + 'px';
    Browser.dragObj.elNode.style.top = Browser.dragObj.ActualPosition.Y + 'px';
    Browser.dragObj.elNode.style.width = Browser.dragObj.ActualPosition.Width + 'px';
    Browser.dragObj.elNode.style.height = Browser.dragObj.ActualPosition.Height + 'px';
    Browser.dragObj.Dock = Browser.dragObj.Window.Dock; //eCDPosition.Float;
    Browser.dragObj.Cancel = false;
    if(sides == (eCWSide.Top + eCWSide.Right + eCWSide.Bottom + eCWSide.Left)) {
        if(Browser.dragObj.Window.Moveable == false) { Browser.dragObj.Sizing = false; Browser.dragObj.Moving = false; return; }
        Browser.dragObj.Sides = sides;
        Browser.dragObj.Sizing = false;
        Browser.dragObj.Moving = true;
    } else {
        if(((sides & eCWSide.Top) != (sides & eCWSide.Bottom)) || ((sides & eCWSide.Left) != (sides & eCWSide.Right))) {
            if(Browser.dragObj.Window.Sizeable == false) {
                if(Browser.dragObj.Window.Moveable == false) { Browser.dragObj.Sizing = false; Browser.dragObj.Moving = false; return; }
                Browser.dragObj.Sides = 0;
                if((sides & eCWSide.Top) || (sides & eCWSide.Bottom)) { Browser.dragObj.Sides += eCWSide.Top + eCWSide.Bottom; }
                if((sides & eCWSide.Left) || (sides & eCWSide.Right)) { Browser.dragObj.Sides += eCWSide.Left + eCWSide.Right; }
                Browser.dragObj.Sizing = false;
                Browser.dragObj.Moving = true;
            } else {
                Browser.dragObj.Sides = sides;
                Browser.dragObj.Sizing = true;
                Browser.dragObj.Moving = false;
            }
        } else {
            Browser.dragObj.Sides = eCWSide.Top + eCWSide.Right + eCWSide.Bottom + eCWSide.Left;
            Browser.dragObj.Sizing = false;
            Browser.dragObj.Moving = true;
        }
    }/*
    if (Browser.browser.isIE) {
        x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
        y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
    }
    if (this.browser.isNS) {
        x = e.clientX + window.scrollX;
        y = e.clientY + window.scrollY;
    }*/
    Browser.dragObj.cursorStartX = mc[0];
    Browser.dragObj.cursorStartY = mc[1];
    Browser.dragObj.elStartLeft  = parseInt(Browser.dragObj.elNode.style.left, 10);
    Browser.dragObj.elStartTop   = parseInt(Browser.dragObj.elNode.style.top,  10);
    Browser.dragObj.elStartWidth  = parseInt(Browser.dragObj.elNode.style.width, 10);
    Browser.dragObj.elStartHeight   = parseInt(Browser.dragObj.elNode.style.height,  10);
    Browser.dragObj.Rect = new Object();
    Browser.dragObj.Rect.X = Browser.dragObj.elStartLeft;
    Browser.dragObj.Rect.Y = Browser.dragObj.elStartTop;
    Browser.dragObj.Rect.Width = Browser.dragObj.elStartWidth;
    Browser.dragObj.Rect.Height = Browser.dragObj.elStartHeight;
    Browser.dragObj.InsertIndex = -1;

    if (isNaN(Browser.dragObj.elStartLeft)) Browser.dragObj.elStartLeft = 0;
    if (isNaN(Browser.dragObj.elStartTop))  Browser.dragObj.elStartTop  = 0;
    if (isNaN(Browser.dragObj.elStartWidth)) Browser.dragObj.elStartWidth = 0;
    if (isNaN(Browser.dragObj.elStartHeight))  Browser.dragObj.elStartHeight  = 0;

    //this.dragObj.elNode.style.zIndex = ++Browser.dragObj.zIndex;

    eventPush(document, 'mousemove', Browser.DragGo);
    if(Browser.dragObj.Inverse == true) {
        eventPush(document, 'mousedown', Browser.DragStop);
    } else {
        eventPush(document, 'mouseup', Browser.DragStop);
    }
    
    if(Browser.browser.isIE) {
        if(!id) {
            window.event.cancelBubble = true;
            window.event.returnValue = false;
        }
    } else if(Browser.browser.isNS) {
        if(!id) {
            e.preventDefault();
        }
    } else {
        return(true);
    }
}
 
function cBrowser_DragGo(e) {
    if((Browser.dragObj.Session == null) && (Browser.dragObj.Window == null)) {
        Browser.DragStop(e);
        return;
    }
    var mc = Browser.GetMouseCords(e);/*
    if (Browser.browser.isIE) {
        x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
        y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
    }
    if (Browser.browser.isNS) {
        x = e.clientX + window.scrollX;
        y = e.clientY + window.scrollY;
    }*/
    Browser.dragObj.elNode.style.visibility = 'visible';
    Browser.dragObj.elNode.style.display = 'block';
    Browser.dragObj.elNode.style.visibility = 'visible';
    Browser.dragObj.elNode.style.display = 'block';
    //var left, top, width, height;
    var pR = Browser.GetPosition(Browser.dragObj.Session.DIV);
    pR.X2 = pR.X + pR.Width;
    pR.Y2 = pR.Y + pR.Height;
    var objR = Browser.dragObj.Rect;
    objR.X = objR.X - pR.X;
    objR.Y = objR.Y - pR.Y;
    if(Browser.dragObj.Sides & eCWSide.Left) {
        if(Browser.dragObj.Sides & eCWSide.Right) {
            //Browser.dragObj.Window.PositionX(Browser.dragObj.elStartLeft + x - Browser.dragObj.cursorStartX, false, true);
            objR.X = (Browser.dragObj.elStartLeft + mc[0] - Browser.dragObj.cursorStartX);
        } else {
            ////Browser.dragObj.Window.SizeX(Browser.dragObj.elStartWidth + Browser.dragObj.cursorStartX - x, false, true);
            if(Browser.dragObj.Sizing == true) {
                objR.X = Browser.dragObj.elStartLeft + mc[0] - Browser.dragObj.cursorStartX;
                objR.Width = (Browser.dragObj.elStartWidth + Browser.dragObj.cursorStartX - mc[0]);
                ////Browser.dragObj.Window.PositionX(Browser.dragObj.elStartLeft + x - Browser.dragObj.cursorStartX, true);
                ////Browser.dragObj.Window.PositionX((Browser.dragObj.elStartLeft + Browser.dragObj.elStartWidth) - Browser.dragObj.Window.Size.X, true, true);
            } else if(Browser.dragObj.Moving == true) {
            objR.X = (Browser.dragObj.elStartLeft + Browser.dragObj.elStartWidth) - Browser.dragObj.Window.Size.X;
            objR.Width = (Browser.dragObj.elStartWidth + Browser.dragObj.cursorStartX - mc[0]);
                ////Browser.dragObj.Window.PositionX((Browser.dragObj.elStartLeft + Browser.dragObj.elStartWidth) - Browser.dragObj.Window.Size.X, false, true);
            } else {
            //objR.X = (Browser.dragObj.elStartLeft + x - Browser.dragObj.cursorStartX);
            //objR.Width = (Browser.dragObj.elStartWidth + Browser.dragObj.cursorStartX - x);
            }
        }
    } else {
        if(Browser.dragObj.Sides & eCWSide.Right) {
            //Browser.dragObj.Window.SizeX(Browser.dragObj.elStartWidth + x - Browser.dragObj.cursorStartX, false, true);
            objR.Width = (Browser.dragObj.elStartWidth + mc[0] - Browser.dragObj.cursorStartX);
        }
    }
    if(Browser.dragObj.Sides & eCWSide.Top) {
        if(Browser.dragObj.Sides & eCWSide.Bottom) {
            //Browser.dragObj.Window.PositionY(Browser.dragObj.elStartTop  + y - Browser.dragObj.cursorStartY, false, true);
            objR.Y  = (Browser.dragObj.elStartTop  + mc[1] - Browser.dragObj.cursorStartY);
        } else {
            //Browser.dragObj.Window.SizeY(Browser.dragObj.elStartHeight + Browser.dragObj.cursorStartY - y, false, true);
            if(Browser.dragObj.Sizing == true) {
                //Browser.dragObj.Window.PositionY(Browser.dragObj.elStartTop + y - Browser.dragObj.cursorStartY, true);
                //Browser.dragObj.Window.PositionY((Browser.dragObj.elStartTop + Browser.dragObj.elStartHeight) - Browser.dragObj.Window.Size.Y, true, true);
            } else if(Browser.dragObj.Moving == true) {
                //Browser.dragObj.Window.PositionY((Browser.dragObj.elStartTop + Browser.dragObj.elStartHeight) - Browser.dragObj.Window.Size.Y, false, true);
            }
            objR.Y = (Browser.dragObj.elStartTop + mc[1] - Browser.dragObj.cursorStartY);
            objR.Height = (Browser.dragObj.elStartHeight + Browser.dragObj.cursorStartY - mc[1]);
        }
    } else {
        if(Browser.dragObj.Sides & eCWSide.Bottom) {
            //Browser.dragObj.Window.SizeY(Browser.dragObj.elStartHeight + y - Browser.dragObj.cursorStartY, false, true);
            objR.Height = (Browser.dragObj.elStartHeight + mc[1] - Browser.dragObj.cursorStartY);
        }
    }
    objR.aX = objR.X;
    objR.aY = objR.Y;
    //alert('(' + pR.X + ', ' + pR.Y + ') - (' + pR.Width + ', ' + pR.Height + ') - (' + pR.X2 + ', ' + pR.Y2 + ') ||| (' + objR.X + ', ' + objR.Y + ') - (' + objR.Width + ', ' + objR.Height + ')');
    if(objR.Width < Browser.dragObj.Window.MinimumSize.X) { objR.Width = Browser.dragObj.Window.MinimumSize.X; }
    if(objR.Height < Browser.dragObj.Window.MinimumSize.Y) { objR.Height = Browser.dragObj.Window.MinimumSize.Y; }
    if(Browser.dragObj.Moving == true) {
        if((Browser.dragObj.Window.State == eCWState.Collapsed) || ((Browser.dragObj.Window.State == eCWState.Docked) && (Browser.dragObj.Window.LastState == eCWState.Collapsed))) {
            objR.Height = Browser.dragObj.Window.StyleSet.BorderTop.Height + Browser.dragObj.Window.StyleSet.BorderBottom.Height + Browser.dragObj.Window.StyleSet.Title.Height;
        }
    }
    
    if(pR.X2 < (objR.X + objR.Width)) {
        objR.X = pR.X2 - objR.Width;
    }
    if(pR.Y2 < (objR.Y  + objR.Height)) {
        objR.Y = pR.Y2 - objR.Height;
    }
    
    if(objR.X < pR.X) {
        objR.X = pR.X;
    }
    if(objR.Y < pR.Y) {
        objR.Y = pR.Y;
    }
    
    if(pR.X2 < (objR.X + objR.Width)) {
        objR.X = pR.X;
        objR.Width = pR.Width;
    }
    if(pR.Y2 < (objR.Y  + objR.Height)) {
        objR.Y = pR.Y;
        objR.Height = pR.Height;
    }
    
    Browser.dragObj.Changed = true;
    Browser.dragObj.Rect = objR;
    Browser.dragObj.Rect.X = Browser.dragObj.Rect.X + pR.X;
    Browser.dragObj.Rect.Y = Browser.dragObj.Rect.Y + pR.Y;
    
    if(Browser.dragObj.Dock != eCDPosition.Float) {
        objR.Width = Browser.dragObj.Window.NormalSize.X;
        objR.Height = Browser.dragObj.Window.NormalSize.Y;
    }
    var bDockHover = false;
    if(Browser.dragObj.Moving == true) {
        var cD = Browser.dragObj.Session.CheckDock(objR, Browser.dragObj.Sides, Browser.dragObj.Window);
        if(cD != null) {
            if(cD.Hit == true) {
                objR = cD.Rect;
                Browser.dragObj.InsertIndex = cD.InsertIndex;
                Browser.dragObj.Dock = cD.Position;
                bDockHover = true;
            }
        }
    }// else if(Browser.dragObj.Sizing == true) {
    //    if(Browser.dragObj.Dock &
    //}
    
    Browser.dragObj.Cancel = false;
    if((Browser.dragObj.Moving == true) || (Browser.dragObj.Dock == eCDPosition.Float)) {
        if(bDockHover == false) {
            if(Browser.dragObj.Dock != eCDPosition.Float) {
                objR.Width = Browser.dragObj.Window.NormalSize.X;
                objR.Height = Browser.dragObj.Window.NormalSize.Y;
            }
            if((Browser.dragObj.Window.State == eCWState.Collapsed) || ((Browser.dragObj.Window.State == eCWState.Docked) && (Browser.dragObj.Window.LastState == eCWState.Collapsed))) {
                objR.Height = Browser.dragObj.Window.StyleSet.BorderTop.Height + Browser.dragObj.Window.StyleSet.BorderBottom.Height + Browser.dragObj.Window.StyleSet.Title.Height;
            }
            Browser.dragObj.Dock = eCDPosition.Float;
        }
        if((bDockHover == false) || ((Browser.dragObj.Dock != eCDPosition.Right) && (Browser.dragObj.Dock != eCDPosition.Top) && (Browser.dragObj.Dock != eCDPosition.Bottom))) {
            if((pR.X2 - Browser.dragObj.Session.DockSize.Right) < (objR.X + objR.Width)) {
                objR.X = pR.X2 - Browser.dragObj.Session.DockSize.Right - objR.Width;
            }
        }
        if((bDockHover == false) || (Browser.dragObj.Dock != eCDPosition.Bottom)) {
            if((pR.Y2 - Browser.dragObj.Session.DockSize.Bottom) < (objR.Y  + objR.Height)) {
                objR.Y = pR.Y2 - Browser.dragObj.Session.DockSize.Bottom - objR.Height;
            }
        }
        
        if((bDockHover == false) || ((Browser.dragObj.Dock != eCDPosition.Left) && (Browser.dragObj.Dock != eCDPosition.Top) && (Browser.dragObj.Dock != eCDPosition.Bottom))) {
            if(objR.X < (pR.X + Browser.dragObj.Session.DockSize.Left)) {
                objR.X = pR.X + Browser.dragObj.Session.DockSize.Left;
            }
        }
        if((bDockHover == false) || (Browser.dragObj.Dock != eCDPosition.Top)) {
            if(objR.Y < (pR.Y + Browser.dragObj.Session.DockSize.Top)) {
                objR.Y = pR.Y + Browser.dragObj.Session.DockSize.Top;
            }
        }
            
        if((bDockHover == false) || ((Browser.dragObj.Dock != eCDPosition.Right) && (Browser.dragObj.Dock != eCDPosition.Top) && (Browser.dragObj.Dock != eCDPosition.Bottom))) {
            if(((pR.X2 - Browser.dragObj.Session.DockSize.Right) < (objR.X + objR.Width)) || ((Browser.dragObj.Dock == eCDPosition.Float) && (Browser.dragObj.Window.State == eCWState.Maximized))) {
                objR.X = pR.X + Browser.dragObj.Session.DockSize.Left;
                objR.Width = (pR.Width - (Browser.dragObj.Session.DockSize.Left + Browser.dragObj.Session.DockSize.Right));
            }
        }
        if((bDockHover == false) || (Browser.dragObj.Dock != eCDPosition.Bottom) || ((Browser.dragObj.Dock == eCDPosition.Float) && (Browser.dragObj.Window.State == eCWState.Maximized))) {
            if(((pR.Y2 - Browser.dragObj.Session.DockSize.Bottom) < (objR.Y  + objR.Height)) || ((Browser.dragObj.Dock == eCDPosition.Float) && (Browser.dragObj.Window.State == eCWState.Maximized))) {
                objR.Y = pR.Y + Browser.dragObj.Session.DockSize.Top;
                objR.Height = (pR.Height - (Browser.dragObj.Session.DockSize.Top + Browser.dragObj.Session.DockSize.Bottom));
            }
        }
    } else if(Browser.dragObj.Sizing == true) { //docked only here
        var Dck = Browser.dragObj.Session.GetDockByPosition(Browser.dragObj.Dock);
        if((Browser.dragObj.Dock & eCDPosition.Top) || (Browser.dragObj.Dock & eCDPosition.Bottom)) {
            objR.X = Dck.Rect.X;
            objR.Y = Dck.Rect.Y;
            objR.Width = Dck.Rect.Width;
            objR.Height = Dck.Rect.Height;
            
            if(Browser.dragObj.Sides & eCWSide.Top) {           // Top Border
                if(Browser.dragObj.Dock & eCDPosition.Top) {
                    Browser.dragObj.Cancel = true;
                } else if(Browser.dragObj.Dock & eCDPosition.Bottom) {
                    objR.Y = (Dck.Rect.Y + Dck.Rect.Height) - Dck.Size + (mc[1] - Browser.dragObj.cursorStartY);
                    objR.Height = Dck.Size - (mc[1] - Browser.dragObj.cursorStartY);
                    if(objR.Height < Dck.MinSize) { objR.Y += objR.Height - Dck.MinSize; objR.Height = Dck.MinSize; }
                    
                    if((Dck.PRect.Height - objR.Height) < (Dck.Parent.MinSize.Y + Browser.dragObj.Session.GetDockByPosition(eCDPosition.Top).MinSize)) {
                        objR.Height = Dck.PRect.Height - (Dck.Parent.MinSize.Y + Browser.dragObj.Session.GetDockByPosition(eCDPosition.Top).MinSize);
                        objR.Y = (Dck.PRect.Y + Dck.PRect.Height) - objR.Height;
                    }
                }
            } else if(Browser.dragObj.Sides & eCWSide.Bottom) {    // Bottom Border
                if(Browser.dragObj.Dock & eCDPosition.Bottom) {
                    Browser.dragObj.Cancel = true;
                } else if(Browser.dragObj.Dock & eCDPosition.Top) {
                    objR.Y = Dck.Rect.Y;
                    objR.Height = Dck.Size - (Browser.dragObj.cursorStartY - mc[1]);
                    if(objR.Height < Dck.MinSize) { objR.Height = Dck.MinSize; }
                    
                    if((Dck.PRect.Height - objR.Height) < (Dck.Parent.MinSize.Y + Browser.dragObj.Session.GetDockByPosition(eCDPosition.Bottom).MinSize)) {
                        objR.Height = Dck.PRect.Height - (Dck.Parent.MinSize.Y + Browser.dragObj.Session.GetDockByPosition(eCDPosition.Bottom).MinSize);
                    }
                }
            }
            if(Browser.dragObj.Sides & eCWSide.Right) {    // Right Border
                //objR.X = Browser.dragObj.Window.Position.X;
                objR.Width = Browser.dragObj.Window.Size.X - (Browser.dragObj.cursorStartX - mc[0]);
                if(objR.Width < Browser.dragObj.Window.DockMinimumSize.X) { objR.Width = Browser.dragObj.Window.DockMinimumSize.X; }
                
                if(Browser.dragObj.Window.Position.X > (Dck.Rect.X)) {
                    objR.X = Browser.dragObj.Window.Position.X + (Browser.dragObj.elStartWidth / 2) - (objR.Width / 2);
                } else {
                    objR.X = Browser.dragObj.Window.Position.X;
                }
                if((objR.X + objR.Width) > (Dck.Rect.X + Dck.Rect.Width)) {
                    objR.X = ((Dck.Rect.X + Dck.Rect.Width) - objR.Width);
                }
                if(objR.X < Dck.Rect.X) {
                    objR.X = Dck.Rect.X;
                }
                if(objR.Width > Dck.Rect.Width) {
                    objR.Width = Dck.Rect.Width;
                }
            } else if(Browser.dragObj.Sides & eCWSide.Left) {    // Left Border
                //objR.X = (Browser.dragObj.Window.Position.X + Browser.dragObj.Window.Size.X) - Browser.dragObj.Window.Size.X + (x - Browser.dragObj.cursorStartX);
                objR.Width = Browser.dragObj.Window.Size.X - (mc[0] - Browser.dragObj.cursorStartX);
                if(objR.Width < Browser.dragObj.Window.DockMinimumSize.X) { objR.X += objR.Width - Browser.dragObj.Window.DockMinimumSize.X; objR.Width = Browser.dragObj.Window.DockMinimumSize.X; }
                
                objR.X = ((Browser.dragObj.Window.Position.X + Browser.dragObj.Window.Size.X) - Browser.dragObj.Window.Size.X + (mc[0] - Browser.dragObj.cursorStartX));
                if((Dck.Rect.X + objR.Height) > (Dck.Rect.X + Dck.Rect.Height)) {
                    objR.X = ((Browser.dragObj.Window.Position.X + Browser.dragObj.Window.Size.X) - Browser.dragObj.Window.Size.X + (mc[0] - Browser.dragObj.cursorStartX));
                } else {
                    objR.X = ((Browser.dragObj.Window.Position.X + Browser.dragObj.Window.Size.X) - Browser.dragObj.Window.Size.X + (mc[0] - Browser.dragObj.cursorStartX)) + ((objR.Width / 2) - (Browser.dragObj.elStartWidth / 2));
                }
                if((objR.X + objR.Width) > (Dck.Rect.X + Dck.Rect.Width)) {
                    objR.X = (Dck.Rect.X + Dck.Rect.Width) - objR.Width;
                }
                if(objR.X < Dck.Rect.X) {
                    objR.X = Dck.Rect.X;
                }
                if(objR.Width > Dck.Rect.Width) {
                    objR.Width = Dck.Rect.Width;
                }
            }
        } else if((Browser.dragObj.Dock & eCDPosition.Left) || (Browser.dragObj.Dock & eCDPosition.Right)) {
            objR.Y = Browser.dragObj.cursorStartY - (mc[1] - Browser.dragObj.cursorStartY);
            objR.X = Dck.Rect.X;
            objR.Width = Dck.Rect.Width;
            
            
            
            objR.X = Dck.Rect.X;
            objR.Y = Dck.Rect.Y;
            objR.Width = Dck.Rect.Width;
            objR.Height = Dck.Rect.Height;
            
            if(Browser.dragObj.Sides & eCWSide.Left) {           // Left Border
                if(Browser.dragObj.Dock & eCDPosition.Left) {
                    Browser.dragObj.Cancel = true;
                } else if(Browser.dragObj.Dock & eCDPosition.Right) {
                    objR.X = (Dck.Rect.X + Dck.Rect.Width) - Dck.Size + (mc[0] - Browser.dragObj.cursorStartX);
                    objR.Width = Dck.Size - (mc[0] - Browser.dragObj.cursorStartX);
                    if(objR.Width < Dck.MinSize) { objR.X += objR.Width - Dck.MinSize; objR.Width = Dck.MinSize; }
                    
                    if((Dck.PRect.Width - objR.Width) < (Dck.Parent.MinSize.X + Browser.dragObj.Session.GetDockByPosition(eCDPosition.Left).MinSize)) {
                        objR.Width = Dck.PRect.Width - (Dck.Parent.MinSize.X + Browser.dragObj.Session.GetDockByPosition(eCDPosition.Left).MinSize);
                        objR.X = (Dck.PRect.X + Dck.PRect.Width) - objR.Width;
                    }
                }
            } else if(Browser.dragObj.Sides & eCWSide.Right) {    // Right Border
                if(Browser.dragObj.Dock & eCDPosition.Right) {
                    Browser.dragObj.Cancel = true;
                } else if(Browser.dragObj.Dock & eCDPosition.Left) {
                    objR.X = Dck.Rect.X;
                    objR.Width = Dck.Size - (Browser.dragObj.cursorStartX - mc[0]);
                    if(objR.Width < Dck.MinSize) { objR.Width = Dck.MinSize; }
                    
                    if((Dck.PRect.Width - objR.Width) < (Dck.Parent.MinSize.X + Browser.dragObj.Session.GetDockByPosition(eCDPosition.Right).MinSize)) {
                        objR.Width = Dck.PRect.Width - (Dck.Parent.MinSize.X + Browser.dragObj.Session.GetDockByPosition(eCDPosition.Right).MinSize);
                    }
                }
            }
            
            
            if(Browser.dragObj.Sides & eCWSide.Bottom) {    // Bottom Border
                objR.Height = Browser.dragObj.Window.Size.Y - (Browser.dragObj.cursorStartY - mc[1]);
                if(objR.Height < Browser.dragObj.Window.DockMinimumSize.Y) { objR.Height = Browser.dragObj.Window.DockMinimumSize.Y; }
                
                if(Browser.dragObj.Window.Position.Y > (Dck.Rect.Y)) {
                    objR.Y = Browser.dragObj.Window.Position.Y + (Browser.dragObj.elStartHeight / 2) - (objR.Height / 2);
                } else {
                    objR.Y = Browser.dragObj.Window.Position.Y;
                }
                if((objR.Y + objR.Height) > (Dck.Rect.Y + Dck.Rect.Height)) {
                    objR.Y = ((Dck.Rect.Y + Dck.Rect.Height) - objR.Height);
                }
                if(objR.Y < Dck.Rect.Y) {
                    objR.Y = Dck.Rect.Y;
                }
                if(objR.Height > Dck.Rect.Height) {
                    objR.Height = Dck.Rect.Height;
                }
            } else if(Browser.dragObj.Sides & eCWSide.Top) {    // Top Border
                //objR.Y = ((Browser.dragObj.Window.Position.Y + Browser.dragObj.Window.Size.Y) - Browser.dragObj.Window.Size.Y + (y - Browser.dragObj.cursorStartY));
                objR.Height = Browser.dragObj.Window.Size.Y - (mc[1] - Browser.dragObj.cursorStartY);
                if(objR.Height < Browser.dragObj.Window.DockMinimumSize.Y) { objR.Y += objR.Height - Browser.dragObj.Window.DockMinimumSize.Y; objR.Height = Browser.dragObj.Window.DockMinimumSize.Y; }
                
                objR.Y = ((Browser.dragObj.Window.Position.Y + Browser.dragObj.Window.Size.Y) - Browser.dragObj.Window.Size.Y + (mc[1] - Browser.dragObj.cursorStartY));
                if((Dck.Rect.Y + objR.Height) > (Dck.Rect.Y + Dck.Rect.Height)) {
                    objR.Y = ((Browser.dragObj.Window.Position.Y + Browser.dragObj.Window.Size.Y) - Browser.dragObj.Window.Size.Y + (mc[1] - Browser.dragObj.cursorStartY));
                } else {
                    objR.Y = ((Browser.dragObj.Window.Position.Y + Browser.dragObj.Window.Size.Y) - Browser.dragObj.Window.Size.Y + (mc[1] - Browser.dragObj.cursorStartY)) + ((objR.Height / 2) - (Browser.dragObj.elStartHeight / 2));
                }
                if((objR.Y + objR.Height) > (Dck.Rect.Y + Dck.Rect.Height)) {
                    objR.Y = (Dck.Rect.Y + Dck.Rect.Height) - objR.Height;
                }
                if(objR.Y < Dck.Rect.Y) {
                    objR.Y = Dck.Rect.Y;
                }
                if(objR.Height > Dck.Rect.Height) {
                    objR.Height = Dck.Rect.Height;
                }
            }
        }
    }
    Browser.dragObj.elNode.style.left = objR.X + 'px';
    Browser.dragObj.elNode.style.top = objR.Y + 'px';
    //if(objR.Width < Browser.dragObj.Window.MinimumSize.X) { objR.Width = Browser.dragObj.Window.MinimumSize.X; }
    //if(objR.Height < Browser.dragObj.Window.MinimumSize.Y) { objR.Height = Browser.dragObj.Window.MinimumSize.Y; }
    Browser.dragObj.elNode.style.width = objR.Width + 'px';
    Browser.dragObj.elNode.style.height = objR.Height + 'px';
    ////Browser.dragObj.Window.RenderPosition();
    if (Browser.browser.isIE) {
        window.event.cancelBubble = true;
        window.event.returnValue = false;
    }
    if (Browser.browser.isNS)
        e.preventDefault();
    if(Browser.dragObj.Cancel == true) { Browser.DragStop(e); }
}
 
function cBrowser_DragStop(e) {
    eventPop(document, 'mousemove', Browser.DragGo);
    if(Browser.dragObj.Inverse == true) {
        eventPop(document, 'mousedown', Browser.DragStop);
    } else {
        eventPop(document, 'mouseup', Browser.DragStop);
    }
    if((Browser.dragObj.Session != null) || (Browser.dragObj.Window != null)) {
        if(Browser.dragObj.Cancel != true) {
            if(Browser.dragObj.Changed == true) {
                var pos = Browser.GetPosition(Browser.dragObj.elActualNode);
                var posD = Browser.GetPosition(Browser.dragObj.elNode);
                var pR = Browser.GetPosition(Browser.dragObj.Window.Parent.DIV);
                
                if(Browser.dragObj.Moving == true) {
                    Browser.dragObj.Window.ChangeDock(Browser.dragObj.Dock, Browser.dragObj.InsertIndex);
                }
                
                if(Browser.dragObj.Dock == eCDPosition.Float) {
                    if(Browser.dragObj.Window.Dock != eCDPosition.Float) {
                        if(Browser.dragObj.Moving == true) {
                            Browser.dragObj.Window.PositionX(pR.X + pos.X - (Browser.dragObj.elStartLeft - posD.X), false, true);
                            Browser.dragObj.Window.PositionY(pR.Y + pos.Y - (Browser.dragObj.elStartTop - posD.Y), false, true);
                            Browser.dragObj.Window.SizeX(Browser.dragObj.Window.NormalSize.X, false, true);
                            Browser.dragObj.Window.SizeY(Browser.dragObj.Window.NormalSize.Y, false, true);
                        }
                    } else if(Browser.dragObj.Window.Dock == eCDPosition.Float) {
                        Browser.dragObj.Window.PositionX(pR.X + pos.X - (Browser.dragObj.elStartLeft - posD.X), false, true);
                        Browser.dragObj.Window.PositionY(pR.Y + pos.Y - (Browser.dragObj.elStartTop - posD.Y), false, true);
                        Browser.dragObj.Window.SizeX(posD.Width, false, true);
                        Browser.dragObj.Window.SizeY(posD.Height, false, true);
                    }
                    Browser.dragObj.Window.RenderPosition();
                } else if(Browser.dragObj.Sizing == true) {
                    var Dck = Browser.dragObj.Session.GetDockByPosition(Browser.dragObj.Dock);
                    if((Browser.dragObj.Window.Dock & eCDPosition.Top) || (Browser.dragObj.Window.Dock & eCDPosition.Bottom)) {
                        if((Browser.dragObj.Sides & eCWSide.Top) || (Browser.dragObj.Sides & eCWSide.Bottom)) {
                            Dck.Resize(posD.Height, true);
                        }
                        if((Browser.dragObj.Sides & eCWSide.Left) != (Browser.dragObj.Sides & eCWSide.Right)) {
                            if(Browser.dragObj.Sides & eCWSide.Left) {
                                Browser.dragObj.Window.PositionX(posD.X, true, true, true);
                                Browser.dragObj.Window.SizeX(posD.Width, true, true, true);
                                Dck.ResizeByWindow(Browser.dragObj.Window, posD.Width);
                            } else if(Browser.dragObj.Sides & eCWSide.Right) {
                                Browser.dragObj.Window.PositionX(posD.X, true, true, true);
                                Browser.dragObj.Window.SizeX(posD.Width, true, true, true);
                                Dck.ResizeByWindow(Browser.dragObj.Window, posD.Width);
                            }
                        }
                        
                    } else if((Browser.dragObj.Window.Dock & eCDPosition.Left) || (Browser.dragObj.Window.Dock & eCDPosition.Right)) {
                        if((Browser.dragObj.Sides & eCWSide.Left) || (Browser.dragObj.Sides & eCWSide.Right)) {
                            Dck.Resize(posD.Width, true);
                        }
                        if((Browser.dragObj.Sides & eCWSide.Top) != (Browser.dragObj.Sides & eCWSide.Bottom)) {
                            if(Browser.dragObj.Sides & eCWSide.Top) {
                                Browser.dragObj.Window.PositionY(posD.Y, true, true, true);
                                Browser.dragObj.Window.SizeY(posD.Height, true, true, true);
                                Dck.ResizeByWindow(Browser.dragObj.Window, posD.Height);
                            } else if(Browser.dragObj.Sides & eCWSide.Bottom) {
                                Browser.dragObj.Window.PositionY(posD.Y, true, true, true);
                                Browser.dragObj.Window.SizeY(posD.Height, true, true, true);
                                Dck.ResizeByWindow(Browser.dragObj.Window, posD.Height);
                            }
                        }
                    }
                } else {
                    Browser.dragObj.Window.RenderPosition();
                }
            }
        }
    }
    Browser.dragObj.SessionID = -1;
    Browser.dragObj.WindowID = -1;
    Browser.dragObj.Session = null;
    Browser.dragObj.Window = null;
    Browser.dragObj.elNode.style.display = 'none';
    Browser.dragObj.elNode.style.visibility = 'hidden';
}
function cBrowser_FadeIn(id) {
    this.RealFadeIn(id, 0);
}
function cBrowser_FadeOut(id) {
    this.RealFadeOut(id, 10);
}
function cBrowser_FCaptchaClear() {
    this.CAPTCHACode = -1;
    this.CAPTCHAReloadIcon = null;
    this.CAPTCHAImage = null;
    this.CAPTCHATimeout = 0;
}
function cBrowser_FCaptchaRefresh(captchacode) {
    if(captchacode == this.CAPTCHACode) {
        if(this.CAPTCHAImage != null) {
            if(this.CAPTCHAReloadIcon != null) {
                //this.CAPTCHAReloadIcon.style.cursor = 'default';
                //this.CAPTCHAReloadIcon.style.border = 'solid 1px #EEEEEE';
                //this.CAPTCHAReloadIcon.style.visibility = 'hidden';
                this.GetCooldownOverlay(18).Show(this.CAPTCHAReloadIcon, this.CAPTCHARefreshDelay);
                this.CAPTCHAImage.src = 'img/captchaT.png';
                this.CAPTCHAImage.src = 'inc/captcha.php?d=' + (new Date()).getTime();
                //setTimeout('document.getElementById(\''+this.CAPTCHAReloadIcon.id+'\').style.cursor = \'pointer\'; document.getElementById(\''+this.CAPTCHAReloadIcon.id+'\').style.visibility = \'visible\';', this.CAPTCHARefreshDelay);
            } else {
                this.CAPTCHAImage.src = 'img/captchaT.png';
                this.CAPTCHAImage.src = 'inc/captcha.php?d=' + (new Date()).getTime();
            }
            setTimeout('Browser.FCaptchaRefresh('+captchacode+')', this.CAPTCHATimeout);
        } else {
            this.FCaptchaClear();
        }
    }
}
function cBrowser_FReloadCaptcha() {
    if(this.CAPTCHAReloadIcon.style.cursor == 'pointer') {
        //this.CAPTCHAReloadIcon.style.cursor = 'default';
        //this.CAPTCHAReloadIcon.style.border = 'solid 1px #EEEEEE';
        //this.CAPTCHAReloadIcon.style.visibility = 'hidden';
        this.GetCooldownOverlay(18).Show(this.CAPTCHAReloadIcon, this.CAPTCHARefreshDelay);
        this.CAPTCHAImage.src = 'img/captchaT.png';
        this.CAPTCHAImage.src = 'inc/captcha.php?d=' + (new Date()).getTime();
        //setTimeout('document.getElementById(\''+this.CAPTCHAReloadIcon.id+'\').style.cursor = \'pointer\'; document.getElementById(\''+this.CAPTCHAReloadIcon.id+'\').style.visibility = \'visible\';', this.CAPTCHARefreshDelay);
    }
}
function cBrowser_FSetCaptcha(timeout) {
    this.CAPTCHATimeout = timeout * 1000;
    this.CAPTCHACode++;
    this.CAPTCHAImage.src = 'img/captchaT.png';
    this.CAPTCHAImage.src = 'inc/captcha.php?d=' + (new Date()).getTime();
    setTimeout('Browser.FCaptchaRefresh('+this.CAPTCHACode+')', this.CAPTCHATimeout);
}
function cBrowser_FStartValidate(field, value) {
    this.FocusObj = document.getElementById(field);
    validatorField = field;
    validatorValue = value;
    //return(void(0));
}
function cBrowser_FValidate(tag, field, value, validator, defaultvalue) {
    if((validator.length > 0) && (validator.toLowerCase() != 'password')) {
        var msg = new Array('validator', validator, value, new Array(tag, field, defaultvalue));
        this.GetAjax(this.GetFirstAjaxID()).Send(true, -1, -1, -1, msg);
    } else {
        this.FValidatePassword(tag, '<span class="form_tag_error_user">Invalid Password&nbsp;[<a href="JavaScript: ShowTip(\'2\');">?</a>]</span>', defaultvalue, field);
    }
    //return(void(0));
}
function cBrowser_FValidateCompare(target, tag, field1, field2) {
    if(document.getElementById(field1).value != document.getElementById(field2).value) {
        document.getElementById(target).innerHTML = tag;
    } else {
        document.getElementById(target).innerHTML = '&nbsp;';
    }
}
function cBrowser_FValidateEnd(arrRet, arrState) {
    if((arrRet.length > 1) && (arrState.length > 2)) {
        var oT = document.getElementById(arrState[0]);
        var oV = document.getElementById(arrState[1]);
        if(parseInt(arrRet[0]) == 1) {
            if(oT) { oT.innerHTML = arrState[2]; }
            if(oV) { oV.value = arrRet[1]; }
        } else if(oV && (oV.value.length < 1) && (arrState[0].toLowerCase().indexOf('_login_') >= 0)) {
            if(oT) { oT.innerHTML = arrState[2]; }
        } else {
            if(oT) { oT.innerHTML = arrRet[1]; }
            if(oV) { oV.focus(); }
        }
    }
}
function cBrowser_FValidatePassword(target, tag, defaulttag, field) {
    var pass = document.getElementById(field).value;
    var validated = true;
    if(pass.length > 0) {
        if(pass.length > 7) {
            if(pass.search(/[a-z]/) >= 0) {
                if(pass.search(/[A-Z]/) >= 0) {
                    if(pass.search(/[0-9]/) >= 0) {
                        if(pass.search(/[^a-zA-Z0-9]/) < 0) { validated = false; }
                    } else { validated = false; }
                } else { validated = false; }
            } else { validated = false; }
        } else { validated = false; }
    }
    if(!validated) {
        document.getElementById(target).innerHTML = tag;
    } else {
        if(pass.length < 1) {
            document.getElementById(target).innerHTML = defaulttag;
        } else {
            document.getElementById(target).innerHTML = '&nbsp;';//defaulttag;
        }
    }
}
function cBrowser_RealFadeIn(id, state) {
    if(state < 10) {
        try{ajaxWindows[id].wndbodyloading.style.opacity = state/10;}catch(err){}
	    try{ajaxWindows[id].wndbodyloading.style.filter = 'alpha(opacity='+(state*10)+')';}catch(err){}
	    setTimeout( "Browser.RealFadeIn('"+id+"', "+(state+1)+")", 10);
    }
    else {
        try{ajaxWindows[id].wndbodyloading.style.opacity = state/10;}catch(err){}
	    try{ajaxWindows[id].wndbodyloading.style.filter = 'alpha(opacity='+(state*10)+')';}catch(err){}
        ajaxWindowLoadEnable(id);
    }
}
function cBrowser_RealFadeOut(id, state) {
    if(state > 0) {
        try{ajaxWindows[id].wnd.style.opacity = state/10;}catch(err){}
	    try{ajaxWindows[id].wnd.style.filter = 'alpha(opacity='+(state*10)+')';}catch(err){}
	    setTimeout( "Browser.RealFadeOut('"+id+"', "+(state-1)+")", 10);
    }
    else {
        ajaxRemoveWindow(id);
    }
}
function cBrowser_GetEventKey(e) {
    var ret = new Array();
    ret.push((window.event) ? event.keyCode : (e.which ? e.which : e.keyCode));
    ret.push(String.fromCharCode(ret[0]));
    return(ret);
}
function cBrowser_GetFirstAjaxID() {
    var aID = 0;
    if(this.Ajax.length <= aID) { aID = this.CreateAjax(); }
    return(aID);
}
function cBrowser_GetFreeAjaxID() {
    var Ajx = this.AjaxID;
    this.AjaxID++;
    return(Ajx);
}
function cBrowser_GetFreeMenuID() {
    var Mnu = this.MenuID;
    this.MenuID++;
    return(Mnu);
}
function cBrowser_GetFreeMenuPopperID() {
    var Pop = this.MenuPopperID;
    this.MenuPopperID++;
    return(Pop);
}
function cBrowser_GetFreeScriptID() {
    var Scr = this.ScriptID;
    this.ScriptID++;
    return(Scr);
}
function cBrowser_GetFreeSessionID() {
    var Ses = this.SessionID;
    this.SessionID++;
    return(Ses);
}
function cBrowser_GetFreeStyleID() {
    var Stl = this.StyleID;
    this.StyleID++;
    return(Stl);
}
function cBrowser_GetFreeWindowListID() {
    var Ses = this.WindowListID;
    this.WindowListID++;
    return(Ses);
}
function cBrowser_GetAjax(id) {
    if(id < 0) { return(null); }
    if(this.Ajax.length > 0) {
        for(var i = this.Ajax.length - 1; i >= 0; i--) {
            if(this.Ajax[i].ID == id) {
                return(this.Ajax[i]);
            }
        }
    }
    return(null);
}
function cBrowser_GetCooldownOverlay(size) {
    if(size.length < 0) { return(null); }
    if(this.CooldownOverlays.length > 0) {
        for(var i = this.CooldownOverlays.length - 1; i >= 0; i--) {
            if(this.CooldownOverlays[i].Size == size) {
                return(this.CooldownOverlays[i]);
            }
        }
    }
    return(null);
}
function cBrowser_GetHoverIcon(size) {
    if(size.length < 0) { return(null); }
    if(this.HoverIcons.length > 0) {
        for(var i = this.HoverIcons.length - 1; i >= 0; i--) {
            if(this.HoverIcons[i].Size == size) {
                return(this.HoverIcons[i]);
            }
        }
    }
    return(null);
}
function cBrowser_GetMenu(id) {
    if(id < 0) { return(null); }
    if(this.Menus.length > 0) {
        for(var i = this.Menus.length - 1; i >= 0; i--) {
            if(this.Menus[i].ID == id) {
                return(this.Menus[i]);
            }
        }
    }
    return(null);
}
function cBrowser_GetMenuByKey(key) {
    if(key.length < 1) { return(null); }
    if(this.Menus.length > 0) {
        for(var i = this.Menus.length - 1; i >= 0; i--) {
            if(this.Menus[i].Key == key) {
                return(this.Menus[i]);
            }
        }
    }
    return(null);
}
function cBrowser_GetMenuPopper(id) {
    if(id < 0) { return(null); }
    if(this.MenuPoppers.length > 0) {
        for(var i = this.MenuPoppers.length - 1; i >= 0; i--) {
            if(this.MenuPoppers[i].ID == id) {
                return(this.MenuPoppers[i]);
            }
        }
    }
    return(null);
}
function cBrowser_GetMouseCords(e) {
    e = e || window.event;
    if(e.pageX || e.pageY){ 
        return(new Array(e.pageX, e.pageY)); 
    } 
    return(new Array(e.clientX + document.body.scrollLeft - document.body.clientLeft, e.clientY + document.body.scrollTop  - document.body.clientTop));
}
function cBrowser_GetPosition(obj) {
    var output = new Object();
    var mytop=0, myleft=0;
    output.Width = obj.offsetWidth;
    output.Height = obj.offsetHeight;
    while( obj) {
        mytop+= obj.offsetTop;
        myleft+= obj.offsetLeft;
        obj= obj.offsetParent;
    }
    output.X = myleft;
    output.Y = mytop;
    return(output);
}
function cBrowser_GetTextSize(text, fontFamily, fontSize, fontWeight, textDecoration, fontStyle) {
    var sizer = document.getElementById('spanSizeCalc');
    sizer.innerHTML = text;
    sizer.style.fontFamily = fontFamily;
    sizer.style.fontSize = fontSize;
    sizer.style.fontWeight = fontWeight;
    sizer.style.textDecoration = textDecoration;
    sizer.style.fontStyle = fontStyle;
    sizer = this.GetPosition(sizer);
    return(sizer);
}
function cBrowser_GetScript(id) {
    if(id < 0) { return(null); }
    if(this.Scripts.length > 0) {
        for(var i = this.Scripts.length - 1; i >= 0; i--) {
            if(this.Scripts[i].ID == id) {
                return(this.Scripts[i]);
            }
        }
    }
    return(null);
}
function cBrowser_GetScriptByObject(type, id) {
    if(id < 0) { return(null); }
    if(this.Scripts.length > 0) {
        for(var i = this.Scripts.length - 1; i >= 0; i--) {
            if((this.Scripts[i].ObjectType == type) && (this.Scripts[i].ObjectID == id)) {
                return(this.Scripts[i]);
            }
        }
    }
    return(null);
}
function cBrowser_GetSession(id) {
    if(id < 0) { return(null); }
    if(this.Sessions.length > 0) {
        for(var i = this.Sessions.length - 1; i >= 0; i--) {
            if(this.Sessions[i].ID == id) {
                return(this.Sessions[i]);
            }
        }
    }
    return(null);
}
function cBrowser_GetStyle(id) {
    if(id < 0) { return(null); }
    if(this.Styles.length > 0) {
        for(var i = this.Styles.length - 1; i >= 0; i--) {
            if(this.Styles[i].ID == id) {
                return(this.Styles[i]);
            }
        }
    }
    return(null);
}
function cBrowser_GetStyleByObject(type, id) {
    if(id < 0) { return(null); }
    if(this.Styles.length > 0) {
        for(var i = this.Styles.length - 1; i >= 0; i--) {
            if((this.Styles[i].ObjectType == type) && (this.Styles[i].ObjectID == id)) {
                return(this.Styles[i]);
            }
        }
    }
    return(null);
}
function cBrowser_GetWindowList(id) {
    if(id < 0) { return(null); }
    if(this.WindowLists.length > 0) {
        for(var i = this.WindowLists.length - 1; i >= 0; i--) {
            if(this.WindowLists[i].ID == id) {
                return(this.WindowLists[i]);
            }
        }
    }
    return(null);
}
function cBrowser_HideLoading() {
    var o = document.getElementById('divLoading');
    if(o) {
        o.style.display = 'none';
        o.style.visibility = 'hidden';
    }
}
function cBrowser_HideDirectMessage() {
    var o = document.getElementById('divSystem');
    if(o) {
        document.getElementById('img_sys_directmessage_icon').src = 'img/icons/16/blank.png';
        document.getElementById('spn_sys_directmessage_title').innerHTML = '';
        document.getElementById('spn_sys_directmessage_subtitle').innerHTML = '';
        document.getElementById('spn_sys_directmessage_greeting').innerHTML = '';
        document.getElementById('spn_sys_directmessage_subgreeting').innerHTML = '';
        document.getElementById('spn_sys_directmessage_summary').innerHTML = '';
        document.getElementById('spn_sys_directmessage_detail').innerHTML = '';
        o.style.display = 'none';
        o.style.visibility = 'hidden';
        document.getElementById('spnSystemDirectMessage').style.display = 'none';
        document.getElementById('spnSystemDirectMessage').style.visibility = 'hidden';
    }
}
function cBrowser_HideLogin() {
    var o = document.getElementById('divSystem');
    if(o) {
        eventPop(this.TXTUsername, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTUsername, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTUsername, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTUsername, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTUsername, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTPassword, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTPassword, 'blur', Browser.RawInputPasswordBlur);
        eventPop(this.TXTPassword, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTPassword, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTPassword, 'mouseout', Browser.RawInputMouseOut);
        
        this.TXTUsername.value = '';
        this.TXTPassword.value = '';
        if((this.FocusObj == this.TXTUsername) || (this.FocusObj == this.TXTPassword)) { this.FocusObj = null; }
        document.getElementById('td_login_username').removeChild(this.TXTUsername);
        document.getElementById('td_login_password').removeChild(this.TXTPassword);
        o.style.display = 'none';
        o.style.visibility = 'hidden';
        document.getElementById('spnSystemLogin').style.display = 'none';
        document.getElementById('spnSystemLogin').style.visibility = 'hidden';
        this.FocusObj = null;
    }
}
function cBrowser_HideLostPassword() {
    var o = document.getElementById('divSystem');
    if(o) {
        eventPop(this.TXTUsername, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTUsername, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTUsername, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTUsername, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTUsername, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTEmail, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTEmail, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTEmail, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTEmail, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTEmail, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTCAPTCHA, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTCAPTCHA, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTCAPTCHA, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTCAPTCHA, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTCAPTCHA, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.CAPTCHAReloadIcon, 'click', Browser.ButtonInputClick);
        eventPop(this.CAPTCHAReloadIcon, 'mousedown', Browser.ButtonInputMouseDown);
        eventPop(this.CAPTCHAReloadIcon, 'mouseover', Browser.ButtonInputMouseOver);
        eventPop(this.CAPTCHAReloadIcon, 'mouseout', Browser.ButtonInputMouseOut);
        eventPop(this.CAPTCHAReloadIcon, 'mouseup', Browser.ButtonInputMouseUp);
        
        this.TXTUsername.value = '';
        this.TXTEmail.value = '';
        this.TXTCAPTCHA.value = '';
        if((this.FocusObj == this.TXTUsername) || (this.FocusObj == this.TXTEmail) || (this.FocusObj == this.TXTCAPTCHA)) { this.FocusObj = null; }
        document.getElementById('td_lostpassword_username').removeChild(this.TXTUsername);
        document.getElementById('td_lostpassword_email').removeChild(this.TXTEmail);
        document.getElementById('td_lostpassword_captcha').removeChild(this.TXTCAPTCHA);
        document.getElementById('td_lostpassword_captcha_icon_reload').removeChild(this.CAPTCHAReloadIcon);
        document.getElementById('td_lostpassword_captcha_image').removeChild(this.CAPTCHAImage);
        this.FCaptchaClear();
        o.style.display = 'none';
        o.style.visibility = 'hidden';
        document.getElementById('spnSystemLostPassword').style.display = 'none';
        document.getElementById('spnSystemLostPassword').style.visibility = 'hidden';
        this.FocusObj = null;
    }
}
function cBrowser_HideLostUsername() {
    var o = document.getElementById('divSystem');
    if(o) {
        eventPop(this.TXTEmail, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTEmail, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTEmail, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTEmail, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTEmail, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTCAPTCHA, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTCAPTCHA, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTCAPTCHA, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTCAPTCHA, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTCAPTCHA, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.CAPTCHAReloadIcon, 'click', Browser.ButtonInputClick);
        eventPop(this.CAPTCHAReloadIcon, 'mousedown', Browser.ButtonInputMouseDown);
        eventPop(this.CAPTCHAReloadIcon, 'mouseover', Browser.ButtonInputMouseOver);
        eventPop(this.CAPTCHAReloadIcon, 'mouseout', Browser.ButtonInputMouseOut);
        eventPop(this.CAPTCHAReloadIcon, 'mouseup', Browser.ButtonInputMouseUp);
        
        this.TXTEmail.value = '';
        this.TXTCAPTCHA.value = '';
        if((this.FocusObj == this.TXTEmail) || (this.FocusObj == this.TXTCAPTCHA)) { this.FocusObj = null; }
        document.getElementById('td_lostusername_email').removeChild(this.TXTEmail);
        document.getElementById('td_lostusername_captcha').removeChild(this.TXTCAPTCHA);
        document.getElementById('td_lostusername_captcha_icon_reload').removeChild(this.CAPTCHAReloadIcon);
        document.getElementById('td_lostusername_captcha_image').removeChild(this.CAPTCHAImage);
        this.FCaptchaClear();
        o.style.display = 'none';
        o.style.visibility = 'hidden';
        document.getElementById('spnSystemLostUsername').style.display = 'none';
        document.getElementById('spnSystemLostUsername').style.visibility = 'hidden';
        this.FocusObj = null;
    }
}
function cBrowser_HidePasswordReset() {
    var o = document.getElementById('divSystem');
    if(o) {
        eventPop(this.TXTUsername, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTUsername, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTUsername, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTUsername, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTUsername, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTPassword, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTPassword, 'blur', Browser.RawInputPasswordBlur);
        eventPop(this.TXTPassword, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTPassword, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTPassword, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTPasswordConfirm, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTPasswordConfirm, 'blur', Browser.RawInputPasswordBlur);
        eventPop(this.TXTPasswordConfirm, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTPasswordConfirm, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTPasswordConfirm, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTCAPTCHA, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTCAPTCHA, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTCAPTCHA, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTCAPTCHA, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTCAPTCHA, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.CAPTCHAReloadIcon, 'click', Browser.ButtonInputClick);
        eventPop(this.CAPTCHAReloadIcon, 'mousedown', Browser.ButtonInputMouseDown);
        eventPop(this.CAPTCHAReloadIcon, 'mouseover', Browser.ButtonInputMouseOver);
        eventPop(this.CAPTCHAReloadIcon, 'mouseout', Browser.ButtonInputMouseOut);
        eventPop(this.CAPTCHAReloadIcon, 'mouseup', Browser.ButtonInputMouseUp);
        
        this.TXTCode.value = '';
        this.TXTUsername.value = '';
        this.TXTPassword.value = '';
        this.TXTPasswordConfirm.value = '';
        this.TXTCAPTCHA.value = '';
        if((this.FocusObj == this.TXTUsername) || (this.FocusObj == this.TXTPassword) || (this.FocusObj == this.TXTPasswordConfirm) || (this.FocusObj == this.TXTCAPTCHA)) { this.FocusObj = null; }
        document.getElementById('td_passwordreset_username').removeChild(this.TXTCode);
        document.getElementById('td_passwordreset_username').removeChild(this.TXTUsername);
        document.getElementById('td_passwordreset_password').removeChild(this.TXTPassword);
        document.getElementById('td_passwordreset_passwordconfirm').removeChild(this.TXTPasswordConfirm);
        document.getElementById('td_passwordreset_captcha').removeChild(this.TXTCAPTCHA);
        document.getElementById('td_passwordreset_captcha_icon_reload').removeChild(this.CAPTCHAReloadIcon);
        document.getElementById('td_passwordreset_captcha_image').removeChild(this.CAPTCHAImage);
        this.FCaptchaClear();
        o.style.display = 'none';
        o.style.visibility = 'hidden';
        document.getElementById('spnSystemPasswordReset').style.display = 'none';
        document.getElementById('spnSystemPasswordReset').style.visibility = 'hidden';
        this.FocusObj = null;
    }
}
function cBrowser_HideRegistration() {
    var o = document.getElementById('divSystem');
    if(o) {
        eventPop(this.TXTNameFirst, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTNameFirst, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTNameFirst, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTNameFirst, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTNameFirst, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTNameMiddle, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTNameMiddle, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTNameMiddle, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTNameMiddle, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTNameMiddle, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTNameLast, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTNameLast, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTNameLast, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTNameLast, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTNameLast, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTEmail, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTEmail, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTEmail, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTEmail, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTEmail, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTEmailConfirm, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTEmailConfirm, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTEmailConfirm, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTEmailConfirm, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTEmailConfirm, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTUsername, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTUsername, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTUsername, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTUsername, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTUsername, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTPassword, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTPassword, 'blur', Browser.RawInputPasswordBlur);
        eventPop(this.TXTPassword, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTPassword, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTPassword, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTPasswordConfirm, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTPasswordConfirm, 'blur', Browser.RawInputPasswordBlur);
        eventPop(this.TXTPasswordConfirm, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTPasswordConfirm, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTPasswordConfirm, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.TXTCAPTCHA, 'focus', Browser.RawInputFocus);
        eventPop(this.TXTCAPTCHA, 'blur', Browser.RawInputUsernameBlur);
        eventPop(this.TXTCAPTCHA, 'mousedown', Browser.RawInputMouseDown);
        eventPop(this.TXTCAPTCHA, 'mouseover', Browser.RawInputMouseOver);
        eventPop(this.TXTCAPTCHA, 'mouseout', Browser.RawInputMouseOut);
        
        eventPop(this.CAPTCHAReloadIcon, 'click', Browser.ButtonInputClick);
        eventPop(this.CAPTCHAReloadIcon, 'mousedown', Browser.ButtonInputMouseDown);
        eventPop(this.CAPTCHAReloadIcon, 'mouseover', Browser.ButtonInputMouseOver);
        eventPop(this.CAPTCHAReloadIcon, 'mouseout', Browser.ButtonInputMouseOut);
        eventPop(this.CAPTCHAReloadIcon, 'mouseup', Browser.ButtonInputMouseUp);
        
        this.TXTNameFirst.value = '';
        this.TXTNameMiddle.value = '';
        this.TXTNameLast.value = '';
        this.TXTEmail.value = '';
        this.TXTEmailConfirm.value = '';
        this.TXTUsername.value = '';
        this.TXTPassword.value = '';
        this.TXTPasswordConfirm.value = '';
        this.TXTCAPTCHA.value = '';
        if((this.FocusObj == this.TXTNameFirst) || (this.FocusObj == this.TXTNameMiddle) || (this.FocusObj == this.TXTNameLast) || (this.FocusObj == this.TXTEmail) || (this.FocusObj == this.TXTEmailConfirm) || (this.FocusObj == this.TXTUsername) || (this.FocusObj == this.TXTPassword) || (this.FocusObj == this.TXTPasswordConfirm) || (this.FocusObj == this.TXTCAPTCHA)) { this.FocusObj = null; }
        document.getElementById('spn_registration_name_first').removeChild(this.TXTNameFirst);
        document.getElementById('spn_registration_name_middle').removeChild(this.TXTNameMiddle);
        document.getElementById('spn_registration_name_last').removeChild(this.TXTNameLast);
        document.getElementById('td_registration_email').removeChild(this.TXTEmail);
        document.getElementById('td_registration_emailconfirm').removeChild(this.TXTEmailConfirm);
        document.getElementById('td_registration_username').removeChild(this.TXTUsername);
        document.getElementById('td_registration_password').removeChild(this.TXTPassword);
        document.getElementById('td_registration_passwordconfirm').removeChild(this.TXTPasswordConfirm);
        document.getElementById('td_registration_captcha').removeChild(this.TXTCAPTCHA);
        document.getElementById('td_registration_captcha_icon_reload').removeChild(this.CAPTCHAReloadIcon);
        document.getElementById('td_registration_captcha_image').removeChild(this.CAPTCHAImage);
        this.FCaptchaClear();
        o.style.display = 'none';
        o.style.visibility = 'hidden';
        document.getElementById('spnSystemRegistration').style.display = 'none';
        document.getElementById('spnSystemRegistration').style.visibility = 'hidden';
        this.FocusObj = null;
    }
}
function cBrowser_KeyDown(e) {
    if(Browser.FocusControl != null) {
        var p = Browser.GetEventKey(e);
        return(Browser.FocusControl.FireEvent('keydown', false, false, p));
    }
}
function cBrowser_KeyUp(e) {
    if(Browser.FocusControl != null) {
        var p = Browser.GetEventKey(e);
        return(Browser.FocusControl.FireEvent('keyup', false, false, p));
    }
}
function cBrowser_Load() {
    this.CooldownOverlays.push(new cCooldownOverlay('18'));
    
    this.HoverIcons.push(new cHoverIcon('8'));
    this.HoverIcons.push(new cHoverIcon('10'));
    this.HoverIcons.push(new cHoverIcon('12'));
    this.HoverIcons.push(new cHoverIcon('14'));
    this.HoverIcons.push(new cHoverIcon('16'));
    
    var m = this.GetMenu(this.CreateMenu('sys_session'));
    var m2 = this.GetMenu(this.CreateMenu('sys_window_datalink'));
    var m3 = this.GetMenu(this.CreateMenu('sys_window_datalink_specific'));
    var mi, mi2;
    
    mi = m.CreateMenuItemO(eCMIType.Header, 'header', '', 'Nova Database', false, false, false, false, true);
    mi2 = mi.CreateSubItemO(eCMIType.Normal, 'session', '', 'Session', true, false, false, true, false);
        mi2.CreateSubItem(eCMIType.Radio, 'session_1', '', 'Session One', true, true, false, true, false);
        mi2.CreateSubItem(eCMIType.Radio, 'session_2', '', 'Session II', true, false, false, true, false);
        mi2.CreateSubItem(eCMIType.Radio, 'session_3', '', 'Session 3', true, false, false);
        mi2.CreateSubItem(eCMIType.Radio, 'session_4', '', 'Session Four', true, false, false);
    mi.CreateSubItem(eCMIType.Separator, '', '', '', true, false, false, false, false);
    mi.CreateSubItem(eCMIType.Normal, 'logout', '', 'Log Out', true, false, false, true, false);
    
    var m = this.GetMenu(this.CreateMenu('sys_window'));
    
    m.CreateMenuItem(eCMIType.Normal, 'restore', '', 'Restore', true, false, false, true, false);
    m.CreateMenuItem(eCMIType.Normal, 'move', '', 'Move', true, false, false, true, false);
    m.CreateMenuItem(eCMIType.Normal, 'size', '', 'Size', true, false, false, true, false);
    m.CreateMenuItem(eCMIType.Normal, 'minimize', '', 'Minimize', true, false, false, true, false);
    m.CreateMenuItem(eCMIType.Normal, 'collapse', '', 'Collapse', true, false, false, true, false);
    m.CreateMenuItem(eCMIType.Normal, 'maximize', '', 'Maximize', true, false, false, true, false);
    m.CreateMenuItem(eCMIType.Separator, '', '', '', true, false, false, false, false);
    m.CreateMenuItem(eCMIType.Normal, 'datalink', '', 'Data Link', true, false, false, false, false);
    m.CreateMenuItem(eCMIType.Separator, '', '', '', true, false, false, false, false);
    m.CreateMenuItem(eCMIType.Normal, 'close', '', 'Close', true, false, false, true, false);
    
    mi = m2.CreateMenuItemO(eCMIType.Header, '', '', 'Data Link', false, false, false, false, true);
    mi2 = mi.CreateSubItemO(eCMIType.Normal, '0', 'datalink', 'Red', false, false, false, false, true);
    mi2.IconBGColor = '#FF0000';
    mi2.SubMenu = m3;
    mi2 = mi.CreateSubItemO(eCMIType.Normal, '1', 'datalink', 'Green', false, false, false, false, true);
    mi2.IconBGColor = '#00FF00';
    mi2.SubMenu = m3;
    mi2 = mi.CreateSubItemO(eCMIType.Normal, '2', 'datalink', 'Blue', false, false, false, false, true);
    mi2.IconBGColor = '#0000FF';
    mi2.SubMenu = m3;
    mi2 = mi.CreateSubItemO(eCMIType.Normal, '3', 'datalink', 'White', false, false, false, false, true);
    mi2.IconBGColor = '#FFFFFF';
    mi2.SubMenu = m3;
    mi2 = mi.CreateSubItemO(eCMIType.Normal, '4', 'datalink', 'Black', false, false, false, false, true);
    mi2.IconBGColor = '#000000';
    mi2.SubMenu = m3;
    mi.CreateSubItem(eCMIType.Normal, 'clearfilterkeys', '', 'Clear Filter Keys', true, false, false, true, false);
    mi.CreateSubItem(eCMIType.Normal, 'clearinjectorkeys', '', 'Clear Injector Keys', true, false, false, true, false);
    
    mi = m3.CreateMenuItemO(eCMIType.Header, '', '', 'Data Properties', false, false, false, true, false);
    mi2 = mi.CreateSubItemO(eCMIType.Normal, 'filterkeys', 'find', 'Filter Keys', true, false, false, true, false);
        mi2.CreateSubItem(eCMIType.Check, '0', '', 'Parameter 0', true, true, true, true, false);
        mi2.CreateSubItem(eCMIType.Check, '1', '', 'Parameter 1', true, true, true, true, false);
        mi2.CreateSubItem(eCMIType.Check, '2', '', 'Parameter 2', true, true, false, true, false);
        mi2.CreateSubItem(eCMIType.Check, '3', '', 'Parameter 3', true, true, true, true, false);
        mi2.CreateSubItem(eCMIType.Check, '4', '', 'Parameter 4', true, true, false, true, false);
        mi2.CreateSubItem(eCMIType.Check, '5', '', 'Parameter 5', true, true, false, true, false);
        mi2.CreateSubItem(eCMIType.Check, '6', '', 'Parameter 6', true, true, false, true, false);
    mi2 = mi.CreateSubItemO(eCMIType.Normal, 'injectorkeys', 'transmit_blue', ' Injector Keys', true, false, false, true, false);
        mi2.CreateSubItem(eCMIType.Check, '0', '', 'Parameter 0', true, true, true, true, false);
        mi2.CreateSubItem(eCMIType.Check, '1', '', 'Parameter 1', true, true, true, true, false);
        mi2.CreateSubItem(eCMIType.Check, '2', '', 'Parameter 2', true, true, false, true, false);
        mi2.CreateSubItem(eCMIType.Check, '3', '', 'Parameter 3', true, true, true, true, false);
    mi2 = mi.CreateSubItem(eCMIType.Separator, '', '', '', true, false, true, false);
    mi2 = mi.CreateSubItemO(eCMIType.Normal, 'persistence', '', 'Scope Persistence', true, false, false, true, false);
        mi2.CreateSubItem(eCMIType.Radio, 'persistence_session', '', 'Session', true, true, false, true, false);
        mi2.CreateSubItem(eCMIType.Radio, 'persistence_browser', '', 'Browser', true, false, false, true, false);
        mi2.CreateSubItem(eCMIType.Radio, 'persistence_localmachine', '', 'Local Machine', true, false, false);
        mi2.CreateSubItem(eCMIType.Radio, 'persistence_alluserspace', '', 'All User Space', true, false, false);
}
function cBrowser_LoadScript(objectType, objectID, usingControl) {
    var Scr = this.GetScriptByObject(objectType, objectID);
    if(Scr == null) {
        var s = this.GetFreeScriptID();
        this.Scripts.push(new cScript(this, s, objectType, objectID, usingControl));
        return(s);
    } else {
        Scr.AddUsingControl(usingControl);
        return(Scr.ID);
    }
}
function cBrowser_LoadStyle(objectType, objectID, usingControl) {
    var Stl = this.GetStyleByObject(objectType, objectID);
    if(Stl == null) {
        var s = this.GetFreeStyleID();
        this.Styles.push(new cStyle(this, s, objectType, objectID, usingControl));
        return(s);
    } else {
        Stl.AddUsingControl(usingControl);
        return(Stl.ID);
    }
}
function cBrowser_Login(sUser, sPass, rememberme) {
    this.ShowLoading();
    this.HideLogin();
    var msg;
    if(rememberme != true) { msg = new Array('auth', 'login', sUser, sPass, '0'); }
    else                   { msg = new Array('auth', 'login', sUser, sPass, '1'); }
    this.GetAjax(this.GetFirstAjaxID()).Send(true, -1, -1, -1, msg);
    return(false);
}
function cBrowser_Logout() {
    this.GetAjax(this.GetFirstAjaxID()).Send(true, -1, -1, -1, new Array('auth', 'logout'));
}
function cBrowser_MouseDown(e) {
    var mc = Browser.GetMouseCords(e);
    var i;
    if(Browser.HoverIcons.length > 0) {
        for(i = 0; i < Browser.HoverIcons.length; i++) {
            if((Browser.HoverIcons[i].Active == true) && (Browser.HoverIcons[i].Hovering == false)) {
                Browser.HoverIcons[i].Hide();
            }
        }
    }
    if(Browser.MenuPoppers.length > 0) {
        var bHit = false;
        for(i = Browser.MenuPoppers.length - 1; i >= 0; i--) {
            if((Browser.MenuPoppers[i].X1 <= mc[0]) && (Browser.MenuPoppers[i].Y1 <= mc[1]) && (Browser.MenuPoppers[i].X2 >= mc[0]) && (Browser.MenuPoppers[i].Y2 >= mc[1])) {
                bHit = true;
                break;
            }
        }
        if(i < (Browser.MenuPoppers.length - 1)) {
            Browser.ClearMenuPoppers(i + 1);
        }
        if(bHit == false) { Browser.ClearMenuPoppers(0); }
    }
}
function cBrowser_MouseMove(e) {
    var mc = Browser.GetMouseCords(e);
    Browser.MouseX = mc[0];
    Browser.MouseY = mc[1];
}
function cBrowser_MouseUp(e) {
    if((Browser.dragObj.Session != null) || (Browser.dragObj.Window != null)) { Browser.DragStop(); }
    if(Browser.FocusObj != null) { Browser.FocusObj.focus(); }
    else { document.getElementById('iptKeyTrap').focus(); }
    if(Browser.DownControl != null) { var p = Browser.GetMouseCords(e); Browser.DownControl.FireEvent('mouseup', false, false, p); }//Browser.DownControl.IsDown = false; Browser.DownControl.Render(); Browser.DownControl = null; }
}
function cBrowser_PreCache() {
    if(this.PreCached != true) {
        this.PreCached = true;
        if(this.Style.PreCacheImages.length > 0) {
            var img = null;
            var p = document.getElementById('divResources');
            for(var i = 0; i < this.Style.PreCacheImages.length; i++) {
                img = document.createElement('img');
                img.setAttribute('id', 'imgPreCache_' + i);
                img.setAttribute('src', this.Style.PreCacheImages[i]);
                p.appendChild(img);
            }
        }
    }
}
function cBrowser_RawButtonClick(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.focus();
        Browser.FReloadCaptcha();
    }
}
function cBrowser_RawButtonMouseDown(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.style.border = ((obj.style.cursor == 'pointer') ? 'solid 1px #000000' : 'solid 1px #EEEEEE');
    }
}
function cBrowser_RawButtonMouseOver(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.style.border = ((obj.style.cursor == 'pointer') ? 'solid 1px #888888' : 'solid 1px #EEEEEE');
    }
}
function cBrowser_RawButtonMouseOut(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.style.border = 'solid 1px #EEEEEE';
    }
}
function cBrowser_RawButtonMouseUp(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.style.border = ((obj.style.cursor == 'pointer') ? 'solid 1px #888888' : 'solid 1px #EEEEEE');
    }
}
function cBrowser_RawInputChangeConfirm(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.focused = false;
        obj.className='form_raw_input';
        var a = obj.id.split('_');
        var b = false;
        var ao = obj.id;
        var ac = obj.id;
        if(a[2].length < 7) { a[2] = a[2] + 'confirm'; ac = a.join('_'); }
        else {
            if(a[2].substr(a[2].length - 7, 7).toLowerCase() != 'confirm') { a[2] = a[2] + 'confirm'; ac = a.join('_'); }
            else { if(a[2].length > 7) { a[2] = a[2].substr(0, a[2].length - 7); } else { a[2] = ''; } ao = a.join('_'); }
        }
        Browser.FValidateCompare(ac+'_tag', '<span class=\'form_tag_error_user\'>Does Not Match&nbsp;[<a href=&quot;JavaScript: ShowTip(\'12\');&quot;>?</a>]</span>', ao, ac);
    }
}
function cBrowser_RawInputFocus(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.focused = true;
        obj.lastValue = obj.value;
        obj.className='form_raw_input_focus';
        Browser.FStartValidate(obj.id, obj.value);
    }
}
function cBrowser_RawInputMouseDown(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.focus();
    }
}
function cBrowser_RawInputMouseOver(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.className=(obj.focused == true ? 'form_raw_input_focus_hover' : 'form_raw_input_hover');
    }
}
function cBrowser_RawInputMouseOut(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.className=(obj.focused == true ? 'form_raw_input_focus' : 'form_raw_input');
    }
}
function cBrowser_RawInputBlur(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.focused = false;
        obj.className='form_raw_input';
        if(obj.value != obj.lastValue) {
            var a = obj.id.split('_');
            Browser.FValidate(a[0]+'_'+a[1]+'_'+a[2]+'_tag', obj.id, obj.value, ((a.length > 3) ? a[2]+'_'+a[3] : a[2]), '&nbsp;');
        }
    }
}
function cBrowser_RawInputPasswordBlur(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.focused = false;
        obj.className='form_raw_input';
        if(obj.value != obj.lastValue) {
            var a = obj.id.split('_');
            if(a[1].toLowerCase() == 'login') {
                Browser.FValidate(obj.id+'_tag', obj.id, obj.value, 'password', '&nbsp;');
            } else {
                Browser.FValidate(obj.id+'_tag', obj.id, obj.value, 'password', '<span class="form_tag_error_user">Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'9\');">?</a>]</span>');
            }
        }
    }
}
function cBrowser_RawInputUsernameBlur(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        obj.focused = false;
        obj.className='form_raw_input';
        if(obj.value != obj.lastValue) {
            Browser.FValidate(obj.id+'_tag', obj.id, obj.value.replace(/ /g, ''), 'username', '&nbsp;');
        }
    }
}
function cBrowser_Register(sNameFirst, sNameMiddle, sNameLast, sEmail, sEmailConfirm, sUser, sPass, sPassConfirm, sCAPTCHA) {
    this.ShowLoading();
    this.HideRegistration();
    var msg = new Array('auth', 'register', sNameFirst, sNameMiddle, sNameLast, sEmail, sEmailConfirm, sUser, sPass, sPassConfirm, sCAPTCHA);
    this.GetAjax(this.GetFirstAjaxID()).Send(true, -1, -1, -1, msg);
    return(false);
}
function cBrowser_RemoveAjax(id) {
    if(id < 0) { return(null); }
    var bHit = false;
    if(this.Ajax.length > 0) {
        for(var i = this.Ajax.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.Ajax[i] = this.Ajax[i - 1];
            } else {
                if(this.Ajax[i].ID == id) {
                    this.Ajax[i].Dispose();
                    this.Ajax[i] = this.Ajax[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.Ajax[0].ID == id) {
                this.Ajax[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.Ajax.shift();
        }
    }
}
function cBrowser_RemoveMenu(id) {
    if(id < 0) { return(null); }
    var bHit = false;
    if(this.Menus.length > 0) {
        for(var i = this.Menus.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.Menus[i] = this.Menus[i - 1];
            } else {
                if(this.Menus[i].ID == id) {
                    this.Menus[i].Dispose();
                    this.Menus[i] = this.Menus[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.Menus[0].ID == id) {
                this.Menus[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.Menus.shift();
        }
    }
}
function cBrowser_RemoveMenuPopper(id) {
    if(id < 0) { return(null); }
    var bHit = false;
    if(this.MenuPoppers.length > 0) {
        for(var i = this.MenuPoppers.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.MenuPoppers[i] = this.MenuPoppers[i - 1];
            } else {
                if(this.MenuPoppers[i].ID == id) {
                    this.MenuPoppers[i].Dispose();
                    this.MenuPoppers[i] = this.MenuPoppers[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.MenuPoppers[0].ID == id) {
                this.MenuPoppers[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.MenuPoppers.shift();
        }
    }
}
function cBrowser_RemoveScript(id) {
    if(id < 0) { return(null); }
    var bHit = false;
    if(this.Scripts.length > 0) {
        for(var i = this.Scripts.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.Scripts[i] = this.Scripts[i - 1];
            } else {
                if(this.Scripts[i].ID == id) {
                    this.Scripts[i].Dispose();
                    this.Scripts[i] = this.Scripts[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.Scripts[0].ID == id) {
                this.Scripts[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.Scripts.shift();
        }
    }
}
function cBrowser_RemoveSession(id) {
    if(id < 0) { return(null); }
    var bHit = false;
    if(this.Sessions.length > 0) {
        for(var i = this.Sessions.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.Sessions[i] = this.Sessions[i - 1];
            } else {
                if(this.Sessions[i].ID == id) {
                    this.Sessions[i].Dispose();
                    this.Sessions[i] = this.Sessions[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.Sessions[0].ID == id) {
                this.Sessions[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.Sessions.shift();
        }
    }
}
function cBrowser_RemoveStyle(id) {
    if(id < 0) { return(null); }
    var bHit = false;
    if(this.Styles.length > 0) {
        for(var i = this.Styles.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.Styles[i] = this.Styles[i - 1];
            } else {
                if(this.Styles[i].ID == id) {
                    this.Styles[i].Dispose();
                    this.Styles[i] = this.Styles[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.Styles[0].ID == id) {
                this.Styles[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.Styles.shift();
        }
    }
}
function cBrowser_RemoveWindowList(id) {
    if(id < 0) { return(null); }
    var bHit = false;
    if(this.WindowLists.length > 0) {
        for(var i = this.WindowLists.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.WindowLists[i] = this.WindowLists[i - 1];
            } else {
                if(this.WindowLists[i].ID == id) {
                    this.WindowLists[i].Dispose();
                    this.WindowLists[i] = this.WindowLists[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.WindowLists[0].ID == id) {
                this.WindowLists[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.WindowLists.shift();
        }
    }
}
function cBrowser_RequestLostPassword(sUser, sEmail, sCAPTCHA) {
    this.ShowLoading();
    this.HideLostPassword();
    var msg = new Array('auth', 'requestlostpassword', sUser, sEmail, sCAPTCHA);
    this.GetAjax(this.GetFirstAjaxID()).Send(true, -1, -1, -1, msg);
    return(false);
}
function cBrowser_RequestLostUsername(sEmail, sCAPTCHA) {
    this.ShowLoading();
    this.HideLostUsername();
    var msg = new Array('auth', 'requestlostusername', sEmail, sCAPTCHA);
    this.GetAjax(this.GetFirstAjaxID()).Send(true, -1, -1, -1, msg);
    return(false);
}
function cBrowser_ResetPassword(sCode, sUser, sPass, sPassConfirm, sCAPTCHA, rememberme) {
    this.ShowLoading();
    this.HidePasswordReset();
    var msg;
    if(rememberme != true) { msg = new Array('auth', 'passwordreset', sCode, sUser, sPass, sPassConfirm, sCAPTCHA, '0'); }
    else                   { msg = new Array('auth', 'passwordreset', sCode, sUser, sPass, sPassConfirm, sCAPTCHA, '1'); }
    this.GetAjax(this.GetFirstAjaxID()).Send(true, -1, -1, -1, msg);
    return(false);
}
function cBrowser_SetFocusControl(control) {
    if(this.FocusControl != control) {
        if(this.FocusControl != null) { this.FocusControl.FireEvent('blur', false, false, null); }
        this.FocusControl = control;
        if(this.FocusControl != null) { this.FocusControl.FireEvent('focus', false, false, null); }
    }
}
function cBrowser_ShowLoading() {
    var o = document.getElementById('divLoading');
    if(o) {
        o.style.display = 'block';
        o.style.visibility = 'visible';
    }
}
function cBrowser_ShowDirectMessage(icon, title, subtitle, greeting, subgreeting, summary, detail) {
    var o = document.getElementById('divSystem');
    if(o) {
        document.getElementById('img_sys_directmessage_icon').src = 'img/icons/32/'+icon+'.png';
        document.getElementById('spn_sys_directmessage_title').innerHTML = title;
        document.getElementById('spn_sys_directmessage_subtitle').innerHTML = subtitle;
        document.getElementById('spn_sys_directmessage_greeting').innerHTML = greeting;
        document.getElementById('spn_sys_directmessage_subgreeting').innerHTML = subgreeting;
        document.getElementById('spn_sys_directmessage_summary').innerHTML = summary;
        document.getElementById('spn_sys_directmessage_detail').innerHTML = detail;
        
        o.style.display = 'block';
        o.style.visibility = 'visible';
        document.getElementById('spnSystemDirectMessage').style.display = 'block';
        document.getElementById('spnSystemDirectMessage').style.visibility = 'visible';
    }
}
function cBrowser_ShowLogin() {
    var o = document.getElementById('divSystem');
    if(o) {
		this.TXTUsername = document.createElement('input');
        this.TXTUsername.setAttribute('id', 'form_login_username');
        this.TXTUsername.setAttribute('type', 'text');
        this.TXTUsername.setAttribute('tabindex', 1);
        this.TXTUsername.focused = false;
        this.TXTUsername.className = 'form_raw_input';
        this.TXTUsername.style.width = '170px';
        this.TXTUsername.value = '';
        this.TXTPassword = document.createElement('input');
        this.TXTPassword.setAttribute('id', 'form_login_password');
        this.TXTPassword.setAttribute('type', 'password');
        this.TXTPassword.setAttribute('tabindex', 2);
        this.TXTPassword.focused = false;
        this.TXTPassword.className = 'form_raw_input';
        this.TXTPassword.style.width = '170px';
        this.TXTPassword.value = '';
        document.getElementById('td_login_username').appendChild(this.TXTUsername);
        document.getElementById('td_login_password').appendChild(this.TXTPassword);
        
        document.getElementById('form_login_username_tag').innerHTML = '&nbsp;';
        document.getElementById('form_login_password_tag').innerHTML = '&nbsp;';
        
        o.style.display = 'block';
        o.style.visibility = 'visible';
        document.getElementById('spnSystemLogin').style.display = 'block';
        document.getElementById('spnSystemLogin').style.visibility = 'visible';
        
        eventPush(this.TXTUsername, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTUsername, 'blur', Browser.RawInputUsernameBlur);
        eventPush(this.TXTUsername, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTUsername, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTUsername, 'mouseout', Browser.RawInputMouseOut);
        eventPush(this.TXTPassword, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTPassword, 'blur', Browser.RawInputPasswordBlur);
        eventPush(this.TXTPassword, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTPassword, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTPassword, 'mouseout', Browser.RawInputMouseOut);
        
        //o = document.getElementById('form_login_username');
        //if(o) {
            this.TXTUsername.focus();
            this.FocusObj = this.TXTUsername;
        //} else {
        //    this.FocusObj = null;
        //}
    }
}
function cBrowser_ShowLostPassword() {
    var o = document.getElementById('divSystem');
    if(o) {
		this.TXTUsername = document.createElement('input');
        this.TXTUsername.setAttribute('id', 'form_lostpassword_username');
        this.TXTUsername.setAttribute('type', 'text');
        this.TXTUsername.setAttribute('tabindex', 1);
        this.TXTUsername.focused = false;
        this.TXTUsername.className = 'form_raw_input';
        this.TXTUsername.style.width = '270px';
        this.TXTUsername.value = '';
        
		this.TXTEmail = document.createElement('input');
        this.TXTEmail.setAttribute('id', 'form_lostpassword_email');
        this.TXTEmail.setAttribute('type', 'text');
        this.TXTEmail.setAttribute('tabindex', 2);
        this.TXTEmail.focused = false;
        this.TXTEmail.className = 'form_raw_input';
        this.TXTEmail.style.width = '270px';
        this.TXTEmail.value = '';
        
		this.TXTCAPTCHA = document.createElement('input');
        this.TXTCAPTCHA.setAttribute('id', 'form_lostpassword_captcha');
        this.TXTCAPTCHA.setAttribute('type', 'text');
        this.TXTCAPTCHA.setAttribute('tabindex', 3);
        this.TXTCAPTCHA.focused = false;
        this.TXTCAPTCHA.className = 'form_raw_input';
        this.TXTCAPTCHA.style.width = '270px';
        this.TXTCAPTCHA.value = '';
        
		this.CAPTCHAReloadIcon = document.createElement('img');
        this.CAPTCHAReloadIcon.setAttribute('id', 'form_lostpassword_captcha_icon_reload');
        this.CAPTCHAReloadIcon.className = 'InlineIcon16';
        this.CAPTCHAReloadIcon.src = 'img/icons/16/refresh.png';
        this.CAPTCHAReloadIcon.style.border = 'solid 1px #EEEEEE';
        this.CAPTCHAReloadIcon.style.margin = '0px 4px 0px 2px';
        this.CAPTCHAReloadIcon.style.cursor = 'pointer';
        this.CAPTCHAReloadIcon.style.visibility = 'visible';
        this.CAPTCHAReloadIcon.alt = 'Get New CAPTCHA';
        this.CAPTCHAReloadIcon.title = 'Get New CAPTCHA';
        
		this.CAPTCHAImage = document.createElement('img');
        this.CAPTCHAImage.setAttribute('id', 'form_lostpassword_captcha_image');
        this.CAPTCHAImage.setAttribute('name', 'form_lostpassword_captcha_image');
        this.CAPTCHAImage.className = 'form_raw_captcha';
        this.CAPTCHAImage.alt = 'Loading CAPTCHA...';
        this.CAPTCHAImage.src = '';
        
        document.getElementById('td_lostpassword_username').appendChild(this.TXTUsername);
        document.getElementById('td_lostpassword_email').appendChild(this.TXTEmail);
        document.getElementById('td_lostpassword_captcha').appendChild(this.TXTCAPTCHA);
        document.getElementById('td_lostpassword_captcha_icon_reload').appendChild(this.CAPTCHAReloadIcon);
        document.getElementById('td_lostpassword_captcha_image').appendChild(this.CAPTCHAImage);
        
        document.getElementById('form_lostpassword_username_tag').innerHTML = '<span class=\'form_tag_error_user\'>Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'17\');">?</a>]</span>';
        document.getElementById('form_lostpassword_email_tag').innerHTML = '<span class=\'form_tag_error_user\'>Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'17\');">?</a>]</span>';
        document.getElementById('form_lostpassword_captcha_tag').innerHTML = '<span class=\'form_tag_error_user\'>Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'17\');">?</a>]</span>';
        
        o.style.display = 'block';
        o.style.visibility = 'visible';
        document.getElementById('spnSystemLostPassword').style.display = 'block';
        document.getElementById('spnSystemLostPassword').style.visibility = 'visible';
        
        eventPush(this.TXTUsername, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTUsername, 'blur', Browser.RawInputUsernameBlur);
        eventPush(this.TXTUsername, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTUsername, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTUsername, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTEmail, 'change', Browser.RawInputChangeConfirm);
        eventPush(this.TXTEmail, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTEmail, 'blur', Browser.RawInputBlur);
        eventPush(this.TXTEmail, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTEmail, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTEmail, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTCAPTCHA, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTCAPTCHA, 'blur', Browser.RawInputBlur);
        eventPush(this.TXTCAPTCHA, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTCAPTCHA, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTCAPTCHA, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.CAPTCHAReloadIcon, 'click', Browser.RawButtonClick);
        eventPush(this.CAPTCHAReloadIcon, 'mousedown', Browser.RawButtonMouseDown);
        eventPush(this.CAPTCHAReloadIcon, 'mouseover', Browser.RawButtonMouseOver);
        eventPush(this.CAPTCHAReloadIcon, 'mouseout', Browser.RawButtonMouseOut);
        eventPush(this.CAPTCHAReloadIcon, 'mouseup', Browser.RawButtonMouseUp);
        
        //o = document.getElementById('form_login_username');
        //if(o) {
            this.TXTUsername.focus();
            this.FocusObj = this.TXTUsername;
        //} else {
        //    this.FocusObj = null;
        //}
        this.FSetCaptcha(290);
    }
}
function cBrowser_ShowLostUsername() {
    var o = document.getElementById('divSystem');
    if(o) {
		this.TXTEmail = document.createElement('input');
        this.TXTEmail.setAttribute('id', 'form_lostusername_email');
        this.TXTEmail.setAttribute('type', 'text');
        this.TXTEmail.setAttribute('tabindex', 1);
        this.TXTEmail.focused = false;
        this.TXTEmail.className = 'form_raw_input';
        this.TXTEmail.style.width = '270px';
        this.TXTEmail.value = '';
        
		this.TXTCAPTCHA = document.createElement('input');
        this.TXTCAPTCHA.setAttribute('id', 'form_lostusername_captcha');
        this.TXTCAPTCHA.setAttribute('type', 'text');
        this.TXTCAPTCHA.setAttribute('tabindex', 2);
        this.TXTCAPTCHA.focused = false;
        this.TXTCAPTCHA.className = 'form_raw_input';
        this.TXTCAPTCHA.style.width = '270px';
        this.TXTCAPTCHA.value = '';
        
		this.CAPTCHAReloadIcon = document.createElement('img');
        this.CAPTCHAReloadIcon.setAttribute('id', 'form_lostusername_captcha_icon_reload');
        this.CAPTCHAReloadIcon.className = 'InlineIcon16';
        this.CAPTCHAReloadIcon.src = 'img/icons/16/refresh.png';
        this.CAPTCHAReloadIcon.style.border = 'solid 1px #EEEEEE';
        this.CAPTCHAReloadIcon.style.margin = '0px 4px 0px 2px';
        this.CAPTCHAReloadIcon.style.cursor = 'pointer';
        this.CAPTCHAReloadIcon.style.visibility = 'visible';
        this.CAPTCHAReloadIcon.alt = 'Get New CAPTCHA';
        this.CAPTCHAReloadIcon.title = 'Get New CAPTCHA';
        
		this.CAPTCHAImage = document.createElement('img');
        this.CAPTCHAImage.setAttribute('id', 'form_lostusername_captcha_image');
        this.CAPTCHAImage.setAttribute('name', 'form_lostusername_captcha_image');
        this.CAPTCHAImage.className = 'form_raw_captcha';
        this.CAPTCHAImage.alt = 'Loading CAPTCHA...';
        this.CAPTCHAImage.src = '';
        
        document.getElementById('td_lostusername_email').appendChild(this.TXTEmail);
        document.getElementById('td_lostusername_captcha').appendChild(this.TXTCAPTCHA);
        document.getElementById('td_lostusername_captcha_icon_reload').appendChild(this.CAPTCHAReloadIcon);
        document.getElementById('td_lostusername_captcha_image').appendChild(this.CAPTCHAImage);
        
        document.getElementById('form_lostusername_email_tag').innerHTML = '<span class=\'form_tag_error_user\'>Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'17\');">?</a>]</span>';
        document.getElementById('form_lostusername_captcha_tag').innerHTML = '<span class=\'form_tag_error_user\'>Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'17\');">?</a>]</span>';
        
        o.style.display = 'block';
        o.style.visibility = 'visible';
        document.getElementById('spnSystemLostUsername').style.display = 'block';
        document.getElementById('spnSystemLostUsername').style.visibility = 'visible';
        
        eventPush(this.TXTEmail, 'change', Browser.RawInputChangeConfirm);
        eventPush(this.TXTEmail, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTEmail, 'blur', Browser.RawInputBlur);
        eventPush(this.TXTEmail, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTEmail, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTEmail, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTCAPTCHA, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTCAPTCHA, 'blur', Browser.RawInputBlur);
        eventPush(this.TXTCAPTCHA, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTCAPTCHA, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTCAPTCHA, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.CAPTCHAReloadIcon, 'click', Browser.RawButtonClick);
        eventPush(this.CAPTCHAReloadIcon, 'mousedown', Browser.RawButtonMouseDown);
        eventPush(this.CAPTCHAReloadIcon, 'mouseover', Browser.RawButtonMouseOver);
        eventPush(this.CAPTCHAReloadIcon, 'mouseout', Browser.RawButtonMouseOut);
        eventPush(this.CAPTCHAReloadIcon, 'mouseup', Browser.RawButtonMouseUp);
        
        //o = document.getElementById('form_login_username');
        //if(o) {
            this.TXTEmail.focus();
            this.FocusObj = this.TXTEmail;
        //} else {
        //    this.FocusObj = null;
        //}
        this.FSetCaptcha(290);
    }
}
function cBrowser_ShowPasswordReset(sCode) {
    var o = document.getElementById('divSystem');
    if(o) {
		this.TXTCode = document.createElement('input');
        this.TXTCode.setAttribute('id', 'form_passwordreset_code');
        this.TXTCode.setAttribute('type', 'hidden');
        this.TXTCode.value = sCode;
        
		this.TXTUsername = document.createElement('input');
        this.TXTUsername.setAttribute('id', 'form_passwordreset_username');
        this.TXTUsername.setAttribute('type', 'text');
        this.TXTUsername.setAttribute('tabindex', 6);
        this.TXTUsername.focused = false;
        this.TXTUsername.className = 'form_raw_input';
        this.TXTUsername.style.width = '270px';
        this.TXTUsername.value = '';
        
        this.TXTPassword = document.createElement('input');
        this.TXTPassword.setAttribute('id', 'form_passwordreset_password');
        this.TXTPassword.setAttribute('type', 'password');
        this.TXTPassword.setAttribute('tabindex', 7);
        this.TXTPassword.focused = false;
        this.TXTPassword.className = 'form_raw_input';
        this.TXTPassword.style.width = '270px';
        this.TXTPassword.value = '';
        
        this.TXTPasswordConfirm = document.createElement('input');
        this.TXTPasswordConfirm.setAttribute('id', 'form_passwordreset_passwordconfirm');
        this.TXTPasswordConfirm.setAttribute('type', 'password');
        this.TXTPasswordConfirm.setAttribute('tabindex', 8);
        this.TXTPasswordConfirm.focused = false;
        this.TXTPasswordConfirm.className = 'form_raw_input';
        this.TXTPasswordConfirm.style.width = '270px';
        this.TXTPasswordConfirm.value = '';
        
		this.TXTCAPTCHA = document.createElement('input');
        this.TXTCAPTCHA.setAttribute('id', 'form_passwordreset_captcha');
        this.TXTCAPTCHA.setAttribute('type', 'text');
        this.TXTCAPTCHA.setAttribute('tabindex', 9);
        this.TXTCAPTCHA.focused = false;
        this.TXTCAPTCHA.className = 'form_raw_input';
        this.TXTCAPTCHA.style.width = '270px';
        this.TXTCAPTCHA.value = '';
        
		this.CAPTCHAReloadIcon = document.createElement('img');
        this.CAPTCHAReloadIcon.setAttribute('id', 'form_passwordreset_captcha_icon_reload');
        this.CAPTCHAReloadIcon.className = 'InlineIcon16';
        this.CAPTCHAReloadIcon.src = 'img/icons/16/refresh.png';
        this.CAPTCHAReloadIcon.style.border = 'solid 1px #EEEEEE';
        this.CAPTCHAReloadIcon.style.margin = '0px 4px 0px 2px';
        this.CAPTCHAReloadIcon.style.cursor = 'pointer';
        this.CAPTCHAReloadIcon.style.visibility = 'visible';
        this.CAPTCHAReloadIcon.alt = 'Get New CAPTCHA';
        this.CAPTCHAReloadIcon.title = 'Get New CAPTCHA';
        
		this.CAPTCHAImage = document.createElement('img');
        this.CAPTCHAImage.setAttribute('id', 'form_passwordreset_captcha_image');
        this.CAPTCHAImage.setAttribute('name', 'form_passwordreset_captcha_image');
        this.CAPTCHAImage.className = 'form_raw_captcha';
        this.CAPTCHAImage.alt = 'Loading CAPTCHA...';
        this.CAPTCHAImage.src = '';
        
        document.getElementById('td_passwordreset_username').appendChild(this.TXTCode);
        document.getElementById('td_passwordreset_username').appendChild(this.TXTUsername);
        document.getElementById('td_passwordreset_password').appendChild(this.TXTPassword);
        document.getElementById('td_passwordreset_passwordconfirm').appendChild(this.TXTPasswordConfirm);
        document.getElementById('td_passwordreset_captcha').appendChild(this.TXTCAPTCHA);
        document.getElementById('td_passwordreset_captcha_icon_reload').appendChild(this.CAPTCHAReloadIcon);
        document.getElementById('td_passwordreset_captcha_image').appendChild(this.CAPTCHAImage);
        
        document.getElementById('form_passwordreset_username_tag').innerHTML = '<span class=\'form_tag_error_user\'>Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'17\');">?</a>]</span>';
        document.getElementById('form_passwordreset_password_tag').innerHTML = '<span class=\'form_tag_error_user\'>Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'17\');">?</a>]</span>';
        document.getElementById('form_passwordreset_passwordconfirm_tag').innerHTML = '&nbsp;';
        document.getElementById('form_passwordreset_captcha_tag').innerHTML = '<span class=\'form_tag_error_user\'>Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'17\');">?</a>]</span>';
        
        o.style.display = 'block';
        o.style.visibility = 'visible';
        document.getElementById('spnSystemPasswordReset').style.display = 'block';
        document.getElementById('spnSystemPasswordReset').style.visibility = 'visible';
        
        eventPush(this.TXTUsername, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTUsername, 'blur', Browser.RawInputUsernameBlur);
        eventPush(this.TXTUsername, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTUsername, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTUsername, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTPassword, 'change', Browser.RawInputChangeConfirm);
        eventPush(this.TXTPassword, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTPassword, 'blur', Browser.RawInputPasswordBlur);
        eventPush(this.TXTPassword, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTPassword, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTPassword, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTPasswordConfirm, 'change', Browser.RawInputChangeConfirm);
        eventPush(this.TXTPasswordConfirm, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTPasswordConfirm, 'blur', Browser.RawInputPasswordBlur);
        eventPush(this.TXTPasswordConfirm, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTPasswordConfirm, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTPasswordConfirm, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTCAPTCHA, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTCAPTCHA, 'blur', Browser.RawInputBlur);
        eventPush(this.TXTCAPTCHA, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTCAPTCHA, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTCAPTCHA, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.CAPTCHAReloadIcon, 'click', Browser.RawButtonClick);
        eventPush(this.CAPTCHAReloadIcon, 'mousedown', Browser.RawButtonMouseDown);
        eventPush(this.CAPTCHAReloadIcon, 'mouseover', Browser.RawButtonMouseOver);
        eventPush(this.CAPTCHAReloadIcon, 'mouseout', Browser.RawButtonMouseOut);
        eventPush(this.CAPTCHAReloadIcon, 'mouseup', Browser.RawButtonMouseUp);
        
        //o = document.getElementById('form_login_username');
        //if(o) {
            this.TXTUsername.focus();
            this.FocusObj = this.TXTUsername;
        //} else {
        //    this.FocusObj = null;
        //}
        this.FSetCaptcha(290);
    }
}
function cBrowser_ShowRegistration() {
    var o = document.getElementById('divSystem');
    if(o) {
		this.TXTNameFirst = document.createElement('input');
        this.TXTNameFirst.setAttribute('id', 'form_registration_name_first');
        this.TXTNameFirst.setAttribute('type', 'text');
        this.TXTNameFirst.setAttribute('tabindex', 1);
        this.TXTNameFirst.focused = false;
        this.TXTNameFirst.className = 'form_raw_input';
        this.TXTNameFirst.style.width = '100px';
        this.TXTNameFirst.style.marginRight = '0px';
        this.TXTNameFirst.style.borderRight = '0px';
        this.TXTNameFirst.value = '';
        
		this.TXTNameMiddle = document.createElement('input');
        this.TXTNameMiddle.setAttribute('id', 'form_registration_name_middle');
        this.TXTNameMiddle.setAttribute('type', 'text');
        this.TXTNameMiddle.setAttribute('tabindex', 2);
        this.TXTNameMiddle.focused = false;
        this.TXTNameMiddle.className = 'form_raw_input';
        this.TXTNameMiddle.style.width = '30px';
        this.TXTNameMiddle.style.marginRight = '0px';
        this.TXTNameMiddle.style.marginLeft = '0px';
        this.TXTNameMiddle.value = '';
        
		this.TXTNameLast = document.createElement('input');
        this.TXTNameLast.setAttribute('id', 'form_registration_name_last');
        this.TXTNameLast.setAttribute('type', 'text');
        this.TXTNameLast.setAttribute('tabindex', 3);
        this.TXTNameLast.focused = false;
        this.TXTNameLast.className = 'form_raw_input';
        this.TXTNameLast.style.width = '140px';
        this.TXTNameLast.style.marginLeft = '0px';
        this.TXTNameLast.style.borderLeft = '0px';
        this.TXTNameLast.value = '';
        
		this.TXTEmail = document.createElement('input');
        this.TXTEmail.setAttribute('id', 'form_registration_email');
        this.TXTEmail.setAttribute('type', 'text');
        this.TXTEmail.setAttribute('tabindex', 4);
        this.TXTEmail.focused = false;
        this.TXTEmail.className = 'form_raw_input';
        this.TXTEmail.style.width = '270px';
        this.TXTEmail.value = '';
        
		this.TXTEmailConfirm = document.createElement('input');
        this.TXTEmailConfirm.setAttribute('id', 'form_registration_emailconfirm');
        this.TXTEmailConfirm.setAttribute('type', 'text');
        this.TXTEmailConfirm.setAttribute('tabindex', 5);
        this.TXTEmailConfirm.focused = false;
        this.TXTEmailConfirm.className = 'form_raw_input';
        this.TXTEmailConfirm.style.width = '270px';
        this.TXTEmailConfirm.value = '';
        
		this.TXTUsername = document.createElement('input');
        this.TXTUsername.setAttribute('id', 'form_registration_username');
        this.TXTUsername.setAttribute('type', 'text');
        this.TXTUsername.setAttribute('tabindex', 6);
        this.TXTUsername.focused = false;
        this.TXTUsername.className = 'form_raw_input';
        this.TXTUsername.style.width = '270px';
        this.TXTUsername.value = '';
        
        this.TXTPassword = document.createElement('input');
        this.TXTPassword.setAttribute('id', 'form_registration_password');
        this.TXTPassword.setAttribute('type', 'password');
        this.TXTPassword.setAttribute('tabindex', 7);
        this.TXTPassword.focused = false;
        this.TXTPassword.className = 'form_raw_input';
        this.TXTPassword.style.width = '270px';
        this.TXTPassword.value = '';
        
        this.TXTPasswordConfirm = document.createElement('input');
        this.TXTPasswordConfirm.setAttribute('id', 'form_registration_passwordconfirm');
        this.TXTPasswordConfirm.setAttribute('type', 'password');
        this.TXTPasswordConfirm.setAttribute('tabindex', 8);
        this.TXTPasswordConfirm.focused = false;
        this.TXTPasswordConfirm.className = 'form_raw_input';
        this.TXTPasswordConfirm.style.width = '270px';
        this.TXTPasswordConfirm.value = '';
        
		this.TXTCAPTCHA = document.createElement('input');
        this.TXTCAPTCHA.setAttribute('id', 'form_registration_captcha');
        this.TXTCAPTCHA.setAttribute('type', 'text');
        this.TXTCAPTCHA.setAttribute('tabindex', 9);
        this.TXTCAPTCHA.focused = false;
        this.TXTCAPTCHA.className = 'form_raw_input';
        this.TXTCAPTCHA.style.width = '270px';
        this.TXTCAPTCHA.value = '';
        
		this.CAPTCHAReloadIcon = document.createElement('img');
        this.CAPTCHAReloadIcon.setAttribute('id', 'form_registration_captcha_icon_reload');
        this.CAPTCHAReloadIcon.className = 'InlineIcon16';
        this.CAPTCHAReloadIcon.src = 'img/icons/16/refresh.png';
        this.CAPTCHAReloadIcon.style.border = 'solid 1px #EEEEEE';
        this.CAPTCHAReloadIcon.style.margin = '0px 4px 0px 2px';
        this.CAPTCHAReloadIcon.style.cursor = 'pointer';
        this.CAPTCHAReloadIcon.style.visibility = 'visible';
        this.CAPTCHAReloadIcon.alt = 'Get New CAPTCHA';
        this.CAPTCHAReloadIcon.title = 'Get New CAPTCHA';
        
		this.CAPTCHAImage = document.createElement('img');
        this.CAPTCHAImage.setAttribute('id', 'form_registration_captcha_image');
        this.CAPTCHAImage.setAttribute('name', 'form_registration_captcha_image');
        this.CAPTCHAImage.className = 'form_raw_captcha';
        this.CAPTCHAImage.alt = 'Loading CAPTCHA...';
        this.CAPTCHAImage.src = '';
        
        document.getElementById('spn_registration_name_first').appendChild(this.TXTNameFirst);
        document.getElementById('spn_registration_name_middle').appendChild(this.TXTNameMiddle);
        document.getElementById('spn_registration_name_last').appendChild(this.TXTNameLast);
        document.getElementById('td_registration_email').appendChild(this.TXTEmail);
        document.getElementById('td_registration_emailconfirm').appendChild(this.TXTEmailConfirm);
        document.getElementById('td_registration_username').appendChild(this.TXTUsername);
        document.getElementById('td_registration_password').appendChild(this.TXTPassword);
        document.getElementById('td_registration_passwordconfirm').appendChild(this.TXTPasswordConfirm);
        document.getElementById('td_registration_captcha').appendChild(this.TXTCAPTCHA);
        document.getElementById('td_registration_captcha_icon_reload').appendChild(this.CAPTCHAReloadIcon);
        document.getElementById('td_registration_captcha_image').appendChild(this.CAPTCHAImage);
        
        document.getElementById('form_registration_system_tag').innerHTML = '';
        document.getElementById('td_registration_system').style.display = 'none';
        document.getElementById('td_registration_system_left').style.display = 'none';
        document.getElementById('td_registration_system_right').style.display = 'none';
        document.getElementById('td_registration_system').style.visibility = 'hidden';
        document.getElementById('td_registration_system_left').style.visibility = 'hidden';
        document.getElementById('td_registration_system_right').style.visibility = 'hidden';
        
        document.getElementById('form_registration_name_tag').innerHTML = '<span class="form_tag_error_user">Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'6\');">?</a>]</span>';
        document.getElementById('form_registration_email_tag').innerHTML = '<span class="form_tag_error_user">Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'7\');">?</a>]</span>';
        document.getElementById('form_registration_emailconfirm_tag').innerHTML = '&nbsp;';
        document.getElementById('form_registration_username_tag').innerHTML = '<span class="form_tag_error_user">Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'10\');">?</a>]</span>';
        document.getElementById('form_registration_password_tag').innerHTML = '<span class="form_tag_error_user">Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'9\');">?</a>]</span>';
        document.getElementById('form_registration_passwordconfirm_tag').innerHTML = '&nbsp;';
        document.getElementById('form_registration_captcha_tag').innerHTML = '<span class=\'form_tag_error_user\'>Incomplete&nbsp;[<a href="JavaScript: ShowTip(\'17\');">?</a>]</span>';
        
        o.style.display = 'block';
        o.style.visibility = 'visible';
        document.getElementById('spnSystemRegistration').style.display = 'block';
        document.getElementById('spnSystemRegistration').style.visibility = 'visible';
        
        eventPush(this.TXTNameFirst, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTNameFirst, 'blur', Browser.RawInputBlur);
        eventPush(this.TXTNameFirst, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTNameFirst, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTNameFirst, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTNameMiddle, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTNameMiddle, 'blur', Browser.RawInputBlur);
        eventPush(this.TXTNameMiddle, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTNameMiddle, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTNameMiddle, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTNameLast, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTNameLast, 'blur', Browser.RawInputBlur);
        eventPush(this.TXTNameLast, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTNameLast, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTNameLast, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTEmail, 'change', Browser.RawInputChangeConfirm);
        eventPush(this.TXTEmail, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTEmail, 'blur', Browser.RawInputBlur);
        eventPush(this.TXTEmail, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTEmail, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTEmail, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTEmailConfirm, 'change', Browser.RawInputChangeConfirm);
        eventPush(this.TXTEmailConfirm, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTEmailConfirm, 'blur', Browser.RawInputBlur);
        eventPush(this.TXTEmailConfirm, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTEmailConfirm, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTEmailConfirm, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTUsername, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTUsername, 'blur', Browser.RawInputUsernameBlur);
        eventPush(this.TXTUsername, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTUsername, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTUsername, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTPassword, 'change', Browser.RawInputChangeConfirm);
        eventPush(this.TXTPassword, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTPassword, 'blur', Browser.RawInputPasswordBlur);
        eventPush(this.TXTPassword, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTPassword, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTPassword, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTPasswordConfirm, 'change', Browser.RawInputChangeConfirm);
        eventPush(this.TXTPasswordConfirm, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTPasswordConfirm, 'blur', Browser.RawInputPasswordBlur);
        eventPush(this.TXTPasswordConfirm, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTPasswordConfirm, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTPasswordConfirm, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.TXTCAPTCHA, 'focus', Browser.RawInputFocus);
        eventPush(this.TXTCAPTCHA, 'blur', Browser.RawInputBlur);
        eventPush(this.TXTCAPTCHA, 'mousedown', Browser.RawInputMouseDown);
        eventPush(this.TXTCAPTCHA, 'mouseover', Browser.RawInputMouseOver);
        eventPush(this.TXTCAPTCHA, 'mouseout', Browser.RawInputMouseOut);
        
        eventPush(this.CAPTCHAReloadIcon, 'click', Browser.RawButtonClick);
        eventPush(this.CAPTCHAReloadIcon, 'mousedown', Browser.RawButtonMouseDown);
        eventPush(this.CAPTCHAReloadIcon, 'mouseover', Browser.RawButtonMouseOver);
        eventPush(this.CAPTCHAReloadIcon, 'mouseout', Browser.RawButtonMouseOut);
        eventPush(this.CAPTCHAReloadIcon, 'mouseup', Browser.RawButtonMouseUp);
        
        //o = document.getElementById('form_login_username');
        //if(o) {
            this.TXTNameFirst.focus();
            this.FocusObj = this.TXTNameFirst;
        //} else {
        //    this.FocusObj = null;
        //}
        this.FSetCaptcha(290);
    }
}
function cBrowser_Size(obj) {
    if(this.Sizing == true) { return; }
    var oW = this.ScreenMetrics.Width;
    var oH = this.ScreenMetrics.Height;
    this.ScreenMetrics = this.GetPosition(obj);
    if(this.Sessions.length > 0) {
        for(var i = 0; i < this.Sessions.length; i++) {
            this.Sessions[i].Resize();
        }
    }
    if((oW > this.ScreenMetrics.Width) || (oH > this.ScreenMetrics.Height)) {
        Browser.Size(obj);
    }
}
function cBrowser_SystemCommand(command, code) {
    this.ShowLoading();
    var bH = false;
    var msg;
    switch(command.toLowerCase()) {
        case 'blockreg':
            msg = new Array('auth', 'registrationblock', code);
            this.GetAjax(this.GetFirstAjaxID()).Send(true, -1, -1, -1, msg);
            bH = true;
            break;
        case 'confirmreg':
            msg = new Array('auth', 'registrationconfirm', code);
            this.GetAjax(this.GetFirstAjaxID()).Send(true, -1, -1, -1, msg);
            bH = true;
            break;
        case 'pwaudit':
            msg = new Array('auth', 'pwaudit', code);
            this.GetAjax(this.GetFirstAjaxID()).Send(true, -1, -1, -1, msg);
            bH = true;
            break;
        case 'pwreset':
            msg = new Array('auth', 'pwreset', code);
            this.GetAjax(this.GetFirstAjaxID()).Send(true, -1, -1, -1, msg);
            bH = true;
            break;
    }
    if(bH == false) {
        if(this.SysFail.length > 0) {
            setTimeout('Browser.HideLoading();' + this.SysFail, 1);
        }
    }
}
function cBrowser_TickSize(itr) {
    this.Sizing = false;
    if(itr <= 0) {
        this.Size(document.getElementById('divSize'));
    } else {
        this.Sizing = true;
        setTimeout('Browser.TickSize(' + (itr - 1) + ')', 1000);
    }
}
function cBrowser_UnLoadScript(objectType, objectID, usingControl) {
    var Scr = this.GetScriptByObject(objectType, objectID);
    if(Scr != null) {
        Scr.RemoveUsingControl(usingControl);
    }
}
function cBrowser_UnLoadStyle(objectType, objectID, usingControl) {
    var Stl = this.GetStyleByObject(objectType, objectID);
    if(Stl != null) {
        Stl.RemoveUsingControl(usingControl);
    }
}
cBrowser.prototype.Activate = cBrowser_Activate;
cBrowser.prototype.AjaxArrival = cBrowser_AjaxArrival;
cBrowser.prototype.AjaxProcess = cBrowser_AjaxProcess;
cBrowser.prototype.AjaxProcessAuth = cBrowser_AjaxProcessAuth;
cBrowser.prototype.AjaxProcessAuthBlockRegEmail = cBrowser_AjaxProcessAuthBlockRegEmail;
cBrowser.prototype.AjaxProcessAuthConfirmRegistration = cBrowser_AjaxProcessAuthConfirmRegistration;
cBrowser.prototype.AjaxProcessAuthLogin = cBrowser_AjaxProcessAuthLogin;
cBrowser.prototype.AjaxProcessAuthLostPassword = cBrowser_AjaxProcessAuthLostPassword;
cBrowser.prototype.AjaxProcessAuthLostUsername = cBrowser_AjaxProcessAuthLostUsername;
cBrowser.prototype.AjaxProcessAuthPasswordReset = cBrowser_AjaxProcessAuthPasswordReset;
cBrowser.prototype.AjaxProcessAuthPWAudit = cBrowser_AjaxProcessAuthPWAudit;
cBrowser.prototype.AjaxProcessAuthPWReset = cBrowser_AjaxProcessAuthPWReset;
cBrowser.prototype.AjaxProcessAuthRegistration = cBrowser_AjaxProcessAuthRegistration;
cBrowser.prototype.AjaxProcessAuthStat = cBrowser_AjaxProcessAuthStat;
cBrowser.prototype.AjaxProcessValidator = cBrowser_AjaxProcessValidator;
cBrowser.prototype.ClearFocusControl = cBrowser_ClearFocusControl;
cBrowser.prototype.ClearMenuPoppers = cBrowser_ClearMenuPoppers;
cBrowser.prototype.ClearSessions = cBrowser_ClearSessions;
cBrowser.prototype.CreateAjax = cBrowser_CreateAjax;
cBrowser.prototype.CreateMenu = cBrowser_CreateMenu;
cBrowser.prototype.CreateMenuPopper = cBrowser_CreateMenuPopper;
cBrowser.prototype.CreateSession = cBrowser_CreateSession;
cBrowser.prototype.CreateWindowList = cBrowser_CreateWindowList;
cBrowser.prototype.DragGo = cBrowser_DragGo;
cBrowser.prototype.DragStart = cBrowser_DragStart;
cBrowser.prototype.DragStop = cBrowser_DragStop;
cBrowser.prototype.FCaptchaClear = cBrowser_FCaptchaClear;
cBrowser.prototype.FCaptchaRefresh = cBrowser_FCaptchaRefresh;
cBrowser.prototype.FReloadCaptcha = cBrowser_FReloadCaptcha;
cBrowser.prototype.FSetCaptcha = cBrowser_FSetCaptcha;
cBrowser.prototype.FStartValidate = cBrowser_FStartValidate;
cBrowser.prototype.FValidate = cBrowser_FValidate;
cBrowser.prototype.FValidateCompare = cBrowser_FValidateCompare;
cBrowser.prototype.FValidateEnd = cBrowser_FValidateEnd;
cBrowser.prototype.FValidatePassword = cBrowser_FValidatePassword;
cBrowser.prototype.GetEventKey = cBrowser_GetEventKey;
cBrowser.prototype.GetFirstAjaxID = cBrowser_GetFirstAjaxID;
cBrowser.prototype.GetFreeAjaxID = cBrowser_GetFreeAjaxID;
cBrowser.prototype.GetFreeMenuID = cBrowser_GetFreeMenuID;
cBrowser.prototype.GetFreeMenuPopperID = cBrowser_GetFreeMenuPopperID;
cBrowser.prototype.GetFreeScriptID = cBrowser_GetFreeScriptID;
cBrowser.prototype.GetFreeSessionID = cBrowser_GetFreeSessionID;
cBrowser.prototype.GetFreeStyleID = cBrowser_GetFreeStyleID;
cBrowser.prototype.GetFreeWindowListID = cBrowser_GetFreeWindowListID;
cBrowser.prototype.GetAjax = cBrowser_GetAjax;
cBrowser.prototype.GetCooldownOverlay = cBrowser_GetCooldownOverlay;
cBrowser.prototype.GetMenu = cBrowser_GetMenu;
cBrowser.prototype.GetMenuByKey = cBrowser_GetMenuByKey;
cBrowser.prototype.GetMenuPopper = cBrowser_GetMenuPopper;
cBrowser.prototype.GetMouseCords = cBrowser_GetMouseCords;
cBrowser.prototype.GetHoverIcon = cBrowser_GetHoverIcon;
cBrowser.prototype.GetPosition = cBrowser_GetPosition;
cBrowser.prototype.GetScript = cBrowser_GetScript;
cBrowser.prototype.GetScriptByObject = cBrowser_GetScriptByObject;
cBrowser.prototype.GetSession = cBrowser_GetSession;
cBrowser.prototype.GetStyle = cBrowser_GetStyle;
cBrowser.prototype.GetStyleByObject = cBrowser_GetStyleByObject;
cBrowser.prototype.GetTextSize = cBrowser_GetTextSize;
cBrowser.prototype.GetWindowList = cBrowser_GetWindowList;
cBrowser.prototype.HideLoading = cBrowser_HideLoading;
cBrowser.prototype.HideDirectMessage = cBrowser_HideDirectMessage;
cBrowser.prototype.HideLogin = cBrowser_HideLogin;
cBrowser.prototype.HideLostPassword = cBrowser_HideLostPassword;
cBrowser.prototype.HideLostUsername = cBrowser_HideLostUsername;
cBrowser.prototype.HidePasswordReset = cBrowser_HidePasswordReset;
cBrowser.prototype.HideRegistration = cBrowser_HideRegistration;
cBrowser.prototype.KeyDown = cBrowser_KeyDown;
cBrowser.prototype.KeyUp = cBrowser_KeyUp;
cBrowser.prototype.Load = cBrowser_Load;
cBrowser.prototype.LoadScript = cBrowser_LoadScript;
cBrowser.prototype.LoadStyle = cBrowser_LoadStyle;
cBrowser.prototype.Login = cBrowser_Login;
cBrowser.prototype.Logout = cBrowser_Logout;
cBrowser.prototype.MouseDown = cBrowser_MouseDown;
cBrowser.prototype.MouseMove = cBrowser_MouseMove;
cBrowser.prototype.MouseUp = cBrowser_MouseUp;
cBrowser.prototype.PreCache = cBrowser_PreCache;
cBrowser.prototype.RawButtonClick = cBrowser_RawButtonClick;
cBrowser.prototype.RawButtonMouseDown = cBrowser_RawButtonMouseDown;
cBrowser.prototype.RawButtonMouseOver = cBrowser_RawButtonMouseOver;
cBrowser.prototype.RawButtonMouseOut = cBrowser_RawButtonMouseOut;
cBrowser.prototype.RawButtonMouseUp = cBrowser_RawButtonMouseUp;
cBrowser.prototype.RawInputChangeConfirm = cBrowser_RawInputChangeConfirm;
cBrowser.prototype.RawInputFocus = cBrowser_RawInputFocus;
cBrowser.prototype.RawInputMouseDown = cBrowser_RawInputMouseDown;
cBrowser.prototype.RawInputMouseOver = cBrowser_RawInputMouseOver;
cBrowser.prototype.RawInputMouseOut = cBrowser_RawInputMouseOut;
cBrowser.prototype.RawInputBlur = cBrowser_RawInputBlur;
cBrowser.prototype.RawInputPasswordBlur = cBrowser_RawInputPasswordBlur;
cBrowser.prototype.RawInputUsernameBlur = cBrowser_RawInputUsernameBlur;
cBrowser.prototype.Register = cBrowser_Register;
cBrowser.prototype.RemoveAjax = cBrowser_RemoveAjax;
cBrowser.prototype.RemoveMenu = cBrowser_RemoveMenu;
cBrowser.prototype.RemoveMenuPopper = cBrowser_RemoveMenuPopper;
cBrowser.prototype.RemoveScript = cBrowser_RemoveScript;
cBrowser.prototype.RemoveSession = cBrowser_RemoveSession;
cBrowser.prototype.RemoveStyle = cBrowser_RemoveStyle;
cBrowser.prototype.RemoveWindowList = cBrowser_RemoveWindowList;
cBrowser.prototype.RequestLostPassword = cBrowser_RequestLostPassword;
cBrowser.prototype.RequestLostUsername = cBrowser_RequestLostUsername;
cBrowser.prototype.ResetPassword = cBrowser_ResetPassword;
cBrowser.prototype.SetFocusControl = cBrowser_SetFocusControl;
cBrowser.prototype.ShowLoading = cBrowser_ShowLoading;
cBrowser.prototype.ShowDirectMessage = cBrowser_ShowDirectMessage;
cBrowser.prototype.ShowLogin = cBrowser_ShowLogin;
cBrowser.prototype.ShowLostPassword = cBrowser_ShowLostPassword;
cBrowser.prototype.ShowLostUsername = cBrowser_ShowLostUsername;
cBrowser.prototype.ShowPasswordReset = cBrowser_ShowPasswordReset;
cBrowser.prototype.ShowRegistration = cBrowser_ShowRegistration;
cBrowser.prototype.Size = cBrowser_Size;
cBrowser.prototype.SystemCommand = cBrowser_SystemCommand;
cBrowser.prototype.TickSize = cBrowser_TickSize;
cBrowser.prototype.UnLoadScript = cBrowser_UnLoadScript;
cBrowser.prototype.UnLoadStyle = cBrowser_UnLoadStyle;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cCodeInterface(parent) {
    this.TypeOf = "CodeInterface";
    this.BaseType = "CodeInterface";
    this.Parent = null;
    this.Events = null;
    if(arguments.length) { this.InterfaceInitialize(parent); }
}
function cCodeInterface_InterfaceDispose() {
    if((this.Loaded == true) && (this.LoadChange != true)) { this.UnLoad(); }
    this.Parent = null;
    if(this.Events != null) {
        this.ClearEvents();
        this.Events = null;
    }
    this.Loaded = false;
    this.LoadChange = false;
}
function cCodeInterface_InterfaceInitialize(parent) {
    this.TypeOf = "CodeInterface";
    this.BaseType = "CodeInterface";
    this.Parent = parent;
    this.EventID = 0;
    this.Loaded = false;
    this.LoadChange = false;
    this.Events = new Array();
}
function cCodeInterface_Load() {
    if((this.Loaded != true) && (this.LoadChange != true)) {
        this.LoadChange = true;
        this.CodeLoad();
        this.Loaded = true;
        this.LoadChange = false;
    }
}
function cCodeInterface_UnLoad(force) {
    var ret = false;
    if((this.Loaded == true) && (this.LoadChange != true)) {
        this.LoadChange = true;
        ret = this.CodeUnLoad(force);
        if(ret != true) {
            this.Loaded = false;
        }
        this.LoadChange = false;
    }
    return(ret);
}
function cCodeInterface_ClearEvents() {
    if(this.Events.length > 0) {
        for(var i = this.Events.length - 1; i >= 0; i--) {
            if(this.Events[i] != null) {
                this.Events[i].Dispose();
                delete this.Events[i];
                this.Events[i] = null;
            }
        }
    }
    this.Events = [];
}
function cCodeInterface_FireEvent(obj, id, fromchild, args) {
    if(this.Events.length > 0) {
        for(var i = this.Events.length - 1; i >= 0; i--) {
            if((this.Events[i].ID == id) && (this.Events[i].Obj.Equals(obj))) { return(this.Events[i].Fire(this.Parent, fromchild, args)); }
        }
    }
    return(false);
}
function cCodeInterface_FireEventByName(obj, name, fromchild, args) {
    if(this.Events.length > 0) {
        name = name.toLowerCase();
        for(var i = this.Events.length - 1; i >= 0; i--) {
            if((this.Events[i].Name == name) && (this.Events[i].Obj.Equals(obj))) {
                return(this.Events[i].Fire(this.Parent, fromchild, args));
            }
        }
    }
    return(false);
}
function cCodeInterface_GetEvent(obj, id) {
    if(this.Events.length > 0) {
        for(var i = this.Events.length - 1; i >= 0; i--) {
            if((this.Events[i].ID == id) && (this.Events[i].Obj.Equals(obj))) { return(this.Events[i]); }
        }
    }
    return(null);
}
function cCodeInterface_GetEventByName(obj, name) {
    if(this.Events.length > 0) {
        name = name.toLowerCase();
        for(var i = this.Events.length - 1; i >= 0; i--) {
            if((this.Events[i].Name == name) && (this.Events[i].Obj.Equals(obj))) {
                return(this.Events[i]);
            }
        }
    }
    return(null);
}
function cCodeInterface_GetFreeEventID() {
    var Evt = this.EventID;
    this.EventID++;
    return(Evt);
}
function cCodeInterface_GetReference(objname) {
    var obj = null;
    if((objname == "") || (objname == null)) {
        obj = this.Parent;
    } else {
        if(this.Parent.BaseType == "Window") {
            obj = this.Parent.Controls.GetByName(objname);
        }
    }
    if(obj != null) { obj = ObjectReference(obj); }
    return(obj);
}
function cCodeInterface_PushEvent(obj, e, cbcallback, informationlevel) {
    e = e.toLowerCase();
    var ev = this.GetEventByName(obj, e);
    if(ev != null) {
        ev.CreateCallback(cbcallback, informationlevel);
        delete obj;
    } else {
        ev = this.GetFreeEventID();
        ev = new cEvent(this, ev, obj, e);
        ev.CreateCallback(cbcallback, informationlevel);
        this.Events.push(ev);
    }
}
function cCodeInterface_PopEvent(obj, e, cbcallback, informationlevel) {
    var bHit = false;
    if(this.Events.length > 0) {
        for(var i = this.Events.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.Events[i] = this.Events[i - 1];
            } else {
                if((this.Events[i].Name == e) && (this.Events[i].Obj.Equals(obj))) {
                    if(this.Events[i].RemoveCallback(cbcallback, informationlevel) < 1) {
                        this.Events[i].Dispose();
                        delete this.Events[i];
                        this.Events[i] = null;
                        bHit = true;
                    }
                }
            }
        }
        if(bHit == false) {
            if((this.Events[0].Name == e) && (this.Events[0].Obj.Equals(obj))) {
                if(this.Events[0].RemoveCallback(cbcallback, informationlevel) < 1) {
                    this.Events[0].Dispose();
                    delete this.Events[0];
                    this.Events[0] = null;
                    bHit = true;
                }
            }
        }
        if(bHit == true) {
            this.Events.shift();
        }
    }
}
function cCodeInterface_WireEvent(objname, e, cbcallback, informationlevel) {
    this.PushEvent(this.GetReference(objname), e, cbcallback, informationlevel);
}
function cCodeInterface_UnWireEvent(objname, e, cbcallback, informationlevel) {
    var o = this.GetReference(objname);
    this.PopEvent(o, e, cbcallback, informationlevel);
    delete o;
}
function cCodeInterface_WireTo(parent) {
    this.InterfaceInitialize(parent);
    this.Load();
}
function cCodeInterface_CodeLoad() {
    if((this.Parent != "undefined") && (this.Parent != null)) {
        if(this.Parent.BaseType == "Window") {
            alert('OVERRIDE Session['+this.Parent.Parent.ID+'].Window['+this.Parent.ID+'].CodeInterface.CodeLoad<'+this.TypeOf+'>();');
        } else if(this.Parent.BaseType == "Control") {
            alert('OVERRIDE Session['+this.Parent.ParentWindow.Parent.ID+'].Window['+this.Parent.ParentWindow.ID+'].Control['+this.Parent.ID+'].CodeInterface.CodeLoad<'+this.TypeOf+'>();');
        } else {
            alert('OVERRIDE cCodeInterface.CodeLoad<'+this.TypeOf+'>();');
        }
    } else {
        alert('OVERRIDE cCodeInterface.CodeLoad<'+this.TypeOf+'>();');
    }
}
function cCodeInterface_CodeUnLoad() {
    if((this.Parent != "undefined") && (this.Parent != null)) {
        if(this.Parent.BaseType == "Window") {
            alert('OVERRIDE Session['+this.Parent.Parent.ID+'].Window['+this.Parent.ID+'].CodeInterface.CodeUnLoad<'+this.TypeOf+'>(force);');
        } else if(this.Parent.BaseType == "Control") {
            alert('OVERRIDE Session['+this.Parent.ParentWindow.Parent.ID+'].Window['+this.Parent.ParentWindow.ID+'].Control['+this.Parent.ID+'].CodeInterface.CodeUnLoad<'+this.TypeOf+'>(force);');
        } else {
            alert('OVERRIDE cCodeInterface.CodeUnLoad<'+this.TypeOf+'>(force);');
        }
    } else {
        alert('OVERRIDE cCodeInterface.CodeUnLoad<'+this.TypeOf+'>(force);');
    }
}
cCodeInterface.prototype.InterfaceDispose = cCodeInterface_InterfaceDispose;
cCodeInterface.prototype.InterfaceInitialize = cCodeInterface_InterfaceInitialize;
cCodeInterface.prototype.Load = cCodeInterface_Load;
cCodeInterface.prototype.UnLoad = cCodeInterface_UnLoad;
cCodeInterface.prototype.ClearEvents = cCodeInterface_ClearEvents;
cCodeInterface.prototype.FireEvent = cCodeInterface_FireEvent;
cCodeInterface.prototype.FireEventByName = cCodeInterface_FireEventByName;
cCodeInterface.prototype.GetEvent = cCodeInterface_GetEvent;
cCodeInterface.prototype.GetEventByName = cCodeInterface_GetEventByName;
cCodeInterface.prototype.GetFreeEventID = cCodeInterface_GetFreeEventID;
cCodeInterface.prototype.GetReference = cCodeInterface_GetReference;
cCodeInterface.prototype.PushEvent = cCodeInterface_PushEvent;
cCodeInterface.prototype.PopEvent = cCodeInterface_PopEvent;
cCodeInterface.prototype.WireEvent = cCodeInterface_WireEvent;
cCodeInterface.prototype.UnWireEvent = cCodeInterface_UnWireEvent;
cCodeInterface.prototype.WireTo = cCodeInterface_WireTo;
cCodeInterface.prototype.CodeLoad = cCodeInterface_CodeLoad;
cCodeInterface.prototype.CodeUnLoad = cCodeInterface_CodeUnLoad;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
    //          cColorPalette, string, int, int, int, eCColorShade
function cColor(parent, name, red, green, blue, shades) {
    this.Parent = parent;
    this.Name = name;
    this.LCName = name.toLowerCase();
    this.Red = red;
    this.Green = green;
    this.Blue = blue;
    this.Shades = shades;
    var r = red.toString(16);
    var g = green.toString(16);
    var b = blue.toString(16);
    this.Hex = ((r.length < 2 ? '0' + r : r) + (g.length < 2 ? '0' + g : g) + (b.length < 2 ? '0' + b : b)).toUpperCase();
    var lh = this.CalculateLowHigh(15, red, green, blue);
    this.HexLow = lh.HexLow;
    this.RedLow = lh.RedLow; this.GreenLow = lh.GreenLow; this.BlueLow = lh.BlueLow;
    this.HexHigh = lh.HexHigh;
    this.RedHigh = lh.RedHigh; this.GreenHigh = lh.GreenHigh; this.BlueHigh = lh.BlueHigh;
    delete lh;
    lh = this.CalculateLowHigh(5, this.RedLow, this.GreenLow, this.BlueLow);
    this.HexLowLow = lh.HexLow;
    this.RedLowLow = lh.RedLow; this.GreenLowLow = lh.GreenLow; this.BlueLowLow = lh.BlueLow;
    this.HexLowHigh = lh.HexHigh;
    this.RedLowHigh = lh.RedHigh; this.GreenLowHigh = lh.GreenHigh; this.BlueLowHigh = lh.BlueHigh;
    delete lh;
    lh = this.CalculateLowHigh(5, this.RedHigh, this.GreenHigh, this.BlueHigh);
    this.HexHighLow = lh.HexLow;
    this.RedHighLow = lh.RedLow; this.GreenHighLow = lh.GreenLow; this.BlueHighLow = lh.BlueLow;
    this.HexHighHigh = lh.HexHigh;
    this.RedHighHigh = lh.RedHigh; this.GreenHighHigh = lh.GreenHigh; this.BlueHighHigh = lh.BlueHigh;
    delete lh;
}
function cColor_CalculateLowHigh(offset, red, green, blue) {
    var ret = new Object();
    var r ;var g ;var b ;
    var rO = 0;
    var gO = 0;
    var bO = 0;
    if(red < offset) { gO = gO + ((offset - red) / 2); bO = bO + ((offset - red) / 2); }
    if(green < offset) { rO = rO + ((offset - green) / 2); bO = bO + ((offset - green) / 2); }
    if(blue < offset) { rO = rO + ((offset - blue) / 2); gO = gO + ((offset - blue) / 2); }
    if(red > (255 - offset)) { gO = gO - ((255 - red) / 2); bO = bO - ((255 - red) / 2); }
    if(green > (255 - offset)) { rO = rO - ((255 - green) / 2); bO = bO - ((255 - green) / 2); }
    if(blue > (255 - offset)) { rO = rO - ((255 - blue) / 2); gO = gO - ((255 - blue) / 2); }
    if(red < 0) { red = 0; } if(red > 255) { red = 255; }
    if(green < 0) { green = 0; } if(green > 255) { green = 255; }
    if(blue < 0) { blue = 0; } if(blue > 255) { blue = 255; }
    ret.RedLow = red - 10 - rO;
    ret.GreenLow = green - 10 - gO;
    ret.BlueLow = blue - 10 - bO;
    if(ret.RedLow < 0) { ret.RedLow = 0; } if(ret.RedLow > 255) { ret.RedLow = 255; }
    if(ret.GreenLow < 0) { ret.GreenLow = 0; } if(ret.GreenLow > 255) { ret.GreenLow = 255; }
    if(ret.BlueLow < 0) { ret.BlueLow = 0; } if(ret.BlueLow > 255) { ret.BlueLow = 255; }
    ret.RedHigh = red + 10 + rO;
    ret.GreenHigh = green + 10 + gO;
    ret.BlueHigh = blue + 10 + bO;
    if(ret.RedHigh < 0) { ret.RedHigh = 0; } if(ret.RedHigh > 255) { ret.RedHigh = 255; }
    if(ret.GreenHigh < 0) { ret.GreenHigh = 0; } if(ret.GreenHigh > 255) { ret.GreenHigh = 255; }
    if(ret.BlueHigh < 0) { ret.BlueHigh = 0; } if(ret.BlueHigh > 255) { ret.BlueHigh = 255; }
    r = ret.RedLow.toString(16);
    g = ret.GreenLow.toString(16);
    b = ret.BlueLow.toString(16);
    ret.HexLow = ((r.length < 2 ? '0' + r : r) + (g.length < 2 ? '0' + g : g) + (b.length < 2 ? '0' + b : b)).toUpperCase();
    r = ret.RedHigh.toString(16);
    g = ret.GreenHigh.toString(16);
    b = ret.BlueHigh.toString(16);
    ret.HexHigh = ((r.length < 2 ? '0' + r : r) + (g.length < 2 ? '0' + g : g) + (b.length < 2 ? '0' + b : b)).toUpperCase();
    return(ret);
}
cColor.prototype.CalculateLowHigh = cColor_CalculateLowHigh;/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cColorPalette() {
    this.Colors = new Array();
    this.LoadSystemColors();
}
function cColorPalette_GetColor(name) {
    name = name.toLowerCase();
    if(name == 'default') { return(null); }
    if(this.Colors.length > 0) {
        for(var i = 0; i < this.Colors.length; i++) {
            if(this.Colors[i].LCName == name) { return(this.Colors[i]); }
        }
    }
    var rgb = this.GetRGBFromString(name);
    var c = new cColor(this, name, rgb.R, rgb.G, rgb.B, eCColorShade.Unknown);
    delete rgb;
    this.Colors.push(c);
    return(c);
}
function cColorPalette_GetColorHexHigh(name) {
    name = name.toLowerCase();
    if(this.Colors.length > 0) {
        for(var i = 0; i < this.Colors.length; i++) {
            if(this.Colors[i].LCName == name) { return(this.Colors[i].HexHigh); }
        }
    }
}
function cColorPalette_GetColorHexHighHigh(name) {
    name = name.toLowerCase();
    if(this.Colors.length > 0) {
        for(var i = 0; i < this.Colors.length; i++) {
            if(this.Colors[i].LCName == name) { return(this.Colors[i].HexHighHigh); }
        }
    }
}
function cColorPalette_GetColorHexHighLow(name) {
    name = name.toLowerCase();
    if(this.Colors.length > 0) {
        for(var i = 0; i < this.Colors.length; i++) {
            if(this.Colors[i].LCName == name) { return(this.Colors[i].HexHighLow); }
        }
    }
}
function cColorPalette_GetColorHexLow(name) {
    name = name.toLowerCase();
    if(this.Colors.length > 0) {
        for(var i = 0; i < this.Colors.length; i++) {
            if(this.Colors[i].LCName == name) { return(this.Colors[i].HexLow); }
        }
    }
}
function cColorPalette_GetColorHexLowHigh(name) {
    name = name.toLowerCase();
    if(this.Colors.length > 0) {
        for(var i = 0; i < this.Colors.length; i++) {
            if(this.Colors[i].LCName == name) { return(this.Colors[i].HexLowHigh); }
        }
    }
}
function cColorPalette_GetColorHexLowLow(name) {
    name = name.toLowerCase();
    if(this.Colors.length > 0) {
        for(var i = 0; i < this.Colors.length; i++) {
            if(this.Colors[i].LCName == name) { return(this.Colors[i].HexLowLow); }
        }
    }
}
function cColorPalette_GetColorHexNormal(name) {
    name = name.toLowerCase();
    if(this.Colors.length > 0) {
        for(var i = 0; i < this.Colors.length; i++) {
            if(this.Colors[i].LCName == name) { return(this.Colors[i].Hex); }
        }
    }
}
function cColorPalette_GetRGBFromString(name) {
    var ret = new Object();
    name = name.replace('#', '');
    if(name.length == 3) {
        ret.R = parseInt(name.substr(0, 1) + name.substr(0, 1), 16);
        ret.G = parseInt(name.substr(1, 1) + name.substr(1, 1), 16);
        ret.B = parseInt(name.substr(2, 1) + name.substr(2, 1), 16);
    } else if(name.length == 6) {
        ret.R = parseInt(name.substr(0, 1) + name.substr(0, 1), 16);
        ret.G = parseInt(name.substr(1, 1) + name.substr(1, 1), 16);
        ret.B = parseInt(name.substr(2, 1) + name.substr(2, 1), 16);
    } else if(name.indexOf(',', 0) >= 0) {
        name = name.split(',');
        if(name.length > 2) {
            ret.R = parseInt('0' + name[0]);
            ret.G = parseInt('0' + name[1]);
            ret.B = parseInt('0' + name[2]);
        }
    } else {
        ret.R = 0;
        ret.G = 0;
        ret.B = 0;
    }
    return(ret);
}
function cColorPalette_LoadSystemColors() {
    this.Colors.push(new cColor(this,   'AliceBlue',                240,    248,    255,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'Amethyst',                 153,    102,    204,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'AntiqueWhite',             250,    235,    215,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'Aqua',                     0,      255,    255,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'Aquamarine',               127,    255,    212,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'Azure',                    240,    255,    255,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'Beige',                    245,    245,    220,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'Bisque',                   255,    228,    196,    eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'Black',                    0,      0,      0,      eCColorShade.Grey                       ));
    this.Colors.push(new cColor(this,   'BlanchedAlmond',           255,    235,    205,    eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'Blue',                     0,      0,      255,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'BlueViolet',               138,    43,     226,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'Brown',                    165,    42,     42,     eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'BurlyWood',                222,    184,    135,    eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'CadetBlue',                95,     158,    160,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'Chartreuse',               127,    255,    0,      eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'Chocolate',                210,    105,    30,     eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'Coral',                    255,    127,    80,     eCColorShade.Orange                     ));
    this.Colors.push(new cColor(this,   'CornflowerBlue',           100,    149,    237,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'Cornsilk',                 255,    248,    220,    eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'Crimson',                  220,    20,     60,     eCColorShade.Red                        ));
    this.Colors.push(new cColor(this,   'Cyan',                     0,      255,    255,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'DarkBlue',                 0,      0,      139,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'DarkCyan',                 0,      139,    139,    eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'DarkGoldenrod',            184,    134,    11,     eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'DarkGray',                 169,    169,    169,    eCColorShade.Grey                       ));
    this.Colors.push(new cColor(this,   'DarkGreen',                0,      100,    0,      eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'DarkKhaki',                189,    183,    107,    eCColorShade.Yellow                     ));
    this.Colors.push(new cColor(this,   'DarkMagenta',              139,    0,      139,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'DarkOliveGreen',           85,     107,    47,     eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'DarkOrange',               255,    140,    0,      eCColorShade.Orange                     ));
    this.Colors.push(new cColor(this,   'DarkOrchid',               153,    50,     204,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'DarkRed',                  139,    0,      0,      eCColorShade.Red                        ));
    this.Colors.push(new cColor(this,   'DarkSalmon',               233,    150,    122,    eCColorShade.Red                        ));
    this.Colors.push(new cColor(this,   'DarkSeaGreen',             143,    188,    140,    eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'DarkSlateBlue',            72,     61,     139,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'DarkSlateGray',            47,     79,     79,     eCColorShade.Grey                       ));
    this.Colors.push(new cColor(this,   'DarkTurquoise',            0,      206,    209,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'DarkViolet',               148,    0,      211,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'DeepPink',                 255,    20,     147,    eCColorShade.Pink                       ));
    this.Colors.push(new cColor(this,   'DeepSkyBlue',              0,      191,    255,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'DimGray',                  105,    105,    105,    eCColorShade.Grey                       ));
    this.Colors.push(new cColor(this,   'DodgerBlue',               30,     144,    255,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'FireBrick',                178,    34,     34,     eCColorShade.Red                        ));
    this.Colors.push(new cColor(this,   'FloralWhite',              255,    250,    240,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'ForestGreen',              34,     139,    34,     eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'Fuchsia',                  255,    0,      255,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'Gainsboro',                220,    220,    220,    eCColorShade.Grey                       ));
    this.Colors.push(new cColor(this,   'GhostWhite',               248,    248,    255,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'Gold',                     255,    215,    0,      eCColorShade.Yellow                     ));
    this.Colors.push(new cColor(this,   'Goldenrod',                218,    165,    32,     eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'Gray',                     128,    128,    128,    eCColorShade.Grey                       ));
    this.Colors.push(new cColor(this,   'Green',                    0,      128,    0,      eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'GreenYellow',              173,    255,    47,     eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'Honeydew',                 240,    255,    240,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'HotPink',                  255,    105,    180,    eCColorShade.Pink                       ));
    this.Colors.push(new cColor(this,   'Ivory',                    255,    255,    240,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'IndianRed',                205,    92,     92,     eCColorShade.Red                        ));
    this.Colors.push(new cColor(this,   'Indigo',                   75,     0,      130,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'Khaki',                    240,    230,    140,    eCColorShade.Yellow                     ));
    this.Colors.push(new cColor(this,   'Lavender',                 230,    230,    250,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'LavenderBlush',            255,    240,    245,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'LawnGreen',                124,    252,    0,      eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'LemonChiffon',             255,    250,    205,    eCColorShade.Yellow                     ));
    this.Colors.push(new cColor(this,   'LightBlue',                173,    216,    230,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'LightCoral',               240,    128,    128,    eCColorShade.Red                        ));
    this.Colors.push(new cColor(this,   'LightCyan',                224,    255,    255,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'LightGoldenrodYellow',     250,    250,    210,    eCColorShade.Yellow                     ));
    this.Colors.push(new cColor(this,   'LightGreen',               144,    238,    144,    eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'LightGrey',                211,    211,    211,    eCColorShade.Grey                       ));
    this.Colors.push(new cColor(this,   'LightPink',                255,    182,    193,    eCColorShade.Pink                       ));
    this.Colors.push(new cColor(this,   'LightSalmon',              255,    160,    122,    eCColorShade.Red + eCColorShade.Orange  ));
    this.Colors.push(new cColor(this,   'LightSeaGreen',            32,     178,    170,    eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'LightSkyBlue',             135,    206,    250,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'LightSlateGray',           119,    136,    153,    eCColorShade.Grey                       ));
    this.Colors.push(new cColor(this,   'LightSteelBlue',           176,    196,    222,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'LightYellow',              255,    255,    224,    eCColorShade.Yellow                     ));
    this.Colors.push(new cColor(this,   'Lime',                     0,      255,    0,      eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'LimeGreen',                50,     205,    50,     eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'Linen',                    250,    240,    230,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'Magenta',                  255,    0,      255,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'Maroon',                   128,    0,      0,      eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'MediumAquamarine',         102,    205,    170,    eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'MediumBlue',               0,      0,      205,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'MediumOrchid',             186,    85,     211,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'MediumPurple',             147,    112,    219,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'MediumSeaGreen',           60,     179,    113,    eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'MediumSlateBlue',          123,    104,    238,    eCColorShade.Blue + eCColorShade.Purple ));
    this.Colors.push(new cColor(this,   'MediumSpringGreen',        0,      250,    154,    eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'MediumTurquoise',          72,     209,    204,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'MediumVioletRed',          199,    21,     133,    eCColorShade.Pink                       ));
    this.Colors.push(new cColor(this,   'MidnightBlue',             25,     25,     112,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'MintCream',                245,    255,    250,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'MistyRose',                255,    228,    225,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'Moccasin',                 255,    228,    181,    eCColorShade.Yellow                     ));
    this.Colors.push(new cColor(this,   'NavajoWhite',              255,    222,    173,    eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'Navy',                     0,      0,      128,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'OldLace',                  253,    245,    230,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'Olive',                    128,    128,    0,      eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'OliveDrab',                107,    142,    35,     eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'Orange',                   255,    165,    0,      eCColorShade.Orange                     ));
    this.Colors.push(new cColor(this,   'OrangeRed',                255,    69,     0,      eCColorShade.Orange                     ));
    this.Colors.push(new cColor(this,   'Orchid',                   218,    112,    214,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'PaleGoldenrod',            238,    232,    170,    eCColorShade.Yellow                     ));
    this.Colors.push(new cColor(this,   'PaleGreen',                152,    251,    152,    eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'PaleTurquoise',            175,    238,    238,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'PaleVioletRed',            219,    112,    147,    eCColorShade.Pink                       ));
    this.Colors.push(new cColor(this,   'PapayaWhip',               255,    239,    213,    eCColorShade.Yellow                     ));
    this.Colors.push(new cColor(this,   'PeachPuff',                255,    218,    185,    eCColorShade.Yellow                     ));
    this.Colors.push(new cColor(this,   'Peru',                     205,    133,    63,     eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'Pink',                     255,    192,    203,    eCColorShade.Pink                       ));
    this.Colors.push(new cColor(this,   'Plum',                     221,    160,    221,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'PowderBlue',               176,    224,    230,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'Purple',                   128,    0,      128,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'Red',                      255,    0,      0,      eCColorShade.Red                        ));
    this.Colors.push(new cColor(this,   'RosyBrown',                188,    143,    143,    eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'RoyalBlue',                65,     105,    225,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'SaddleBrown',              139,    69,     19,     eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'Salmon',                   250,    128,    114,    eCColorShade.Red                        ));
    this.Colors.push(new cColor(this,   'SandyBrown',               244,    164,    96,     eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'SeaGreen',                 46,     139,    87,     eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'Seashell',                 255,    245,    238,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'Sienna',                   160,    82,     45,     eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'Silver',                   192,    192,    192,    eCColorShade.Grey                       ));
    this.Colors.push(new cColor(this,   'SkyBlue',                  135,    206,    235,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'SlateBlue',                106,    90,     205,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'SlateGray',                112,    128,    144,    eCColorShade.Grey                       ));
    this.Colors.push(new cColor(this,   'Snow',                     255,    250,    250,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'SpringGreen',              0,      255,    127,    eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'SteelBlue',                70,     130,    180,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'Tan',                      210,    180,    140,    eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'Teal',                     0,      128,    128,    eCColorShade.Green                      ));
    this.Colors.push(new cColor(this,   'Thistle',                  216,    191,    216,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'Tomato',                   255,    99,     71,     eCColorShade.Orange                     ));
    this.Colors.push(new cColor(this,   'Turquoise',                64,     224,    208,    eCColorShade.Blue                       ));
    this.Colors.push(new cColor(this,   'Violet',                   238,    130,    238,    eCColorShade.Purple                     ));
    this.Colors.push(new cColor(this,   'Wheat',                    245,    222,    179,    eCColorShade.Brown                      ));
    this.Colors.push(new cColor(this,   'White',                    255,    255,    255,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'WhiteSmoke',               245,    245,    245,    eCColorShade.White                      ));
    this.Colors.push(new cColor(this,   'Yellow',                   255,    255,    0,      eCColorShade.Yellow                     ));
    this.Colors.push(new cColor(this,   'YellowGreen',              154,    205,    50,     eCColorShade.Green                      ));
}
cColorPalette.prototype.GetColor = cColorPalette_GetColor;
cColorPalette.prototype.GetColorHexHigh = cColorPalette_GetColorHexHigh;
cColorPalette.prototype.GetColorHexHighHigh = cColorPalette_GetColorHexHighHigh;
cColorPalette.prototype.GetColorHexHighLow = cColorPalette_GetColorHexHighLow;
cColorPalette.prototype.GetColorHexLow = cColorPalette_GetColorHexLow;
cColorPalette.prototype.GetColorHexLowHigh = cColorPalette_GetColorHexLowHigh;
cColorPalette.prototype.GetColorHexLowLow = cColorPalette_GetColorHexLowLow;
cColorPalette.prototype.GetColorHexNormal = cColorPalette_GetColorHexNormal;
cColorPalette.prototype.GetRGBFromString = cColorPalette_GetRGBFromString;
cColorPalette.prototype.LoadSystemColors = cColorPalette_LoadSystemColors;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cControl(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign) {
    this.ObjectBlur = null;
    this.ObjectClick = null;
    this.ObjectFocus = null;
    this.ObjectMouseDown = null;
    this.ObjectKeyDown = null;
    this.ObjectKeyPress = null;
    this.ObjectKeyUp = null;
    this.ObjectMouseMove = null;
    this.ObjectMouseOut = null;
    this.ObjectMouseOver = null;
    this.ObjectMouseUp = null;
    this.DIVClient = null;
    this.Border = null;
    if(arguments.length) { this.ControlInitialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign); }
}
function cControl_ControlDispose() {
    if((this.Loaded == true) && (this.LoadChange != true)) { this.UnLoad(); }
    this.ParentWindow = null;
    this.Parent = null;
    this.ID = -1;
    this.Name = '';
    delete this.Position;
    delete this.Size;
    delete this.DispRect;
    delete this.AllowedRect;
    delete this.PrefSize;
    this.Loaded = false;
    this.LoadChange = false;
}
function cControl_ControlInitialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign) {
    this.BaseType = 'Control';
    this.TypeOf = 'Control';
    this.CodeInterface = null;
    this.ParentWindow = parentWindow;
    this.Parent = parent;
    this.ID = id;
    this.Name = name;
    this.DIVClient = null;
    this.Border = null;
    this.IsDown = false;
    this.IsHovering = false;
    this.IsContainer = false;
    this.DownKey = null;
    this.HasFocus = false;
    this.AllowedRect = new Object();
    this.AllowedRect.X = 0;//x;
    this.AllowedRect.Y = 0;//y;
    this.AllowedRect.Width = 0;//width;
    this.AllowedRect.Height = 0;//height;
    this.DispRect = new Object();
    this.DispRect.X = 0;//x;
    this.DispRect.Y = 0;//y;
    this.DispRect.Width = 0;//width;
    this.DispRect.Height = 0;//height;
    this.PrefSize = new Object();
    this.PrefSize.X = width;
    this.PrefSize.Y = height;
    this.StretchPreCalcWidth = 0;
    this.StretchPreCalcHeight = 0;
    this.Position = new cWCord(x, y);
    this.Size = new cWCord(width, height);
    this.MinimumSize = new cWCord(minwidth, minheight);
    this.FixedSize = fixedsize;
    this.Align = align;
    this.VAlign = valign;
    this.Loaded = false;
    this.LoadChange = false;
    this.ClientChanged();
}
function cControl_CalcRender() {
    //if((this.ParentWindow.Caption == 'Test Window') && (this.TypeOf == 'Container') && (this.ID == 0)) { alert('cc['+this.ID+'] GetAlignmentCords('+this.Align+', '+this.Parent.GetDefaultAlign()+', '+this.Position.X+', '+this.Size.X+', '+this.PrefSize.X+', '+this.AllowedRect.X+', '+this.AllowedRect.Width+') = ('+GetAlignmentCords(this.Align, this.Parent.GetDefaultAlign(), this.Position.X, this.Size.X, this.PrefSize.X, this.AllowedRect.X, this.AllowedRect.Width).X + ', '+GetAlignmentCords(this.Align, this.Parent.GetDefaultAlign(), this.Position.X, this.Size.X, this.PrefSize.X, this.AllowedRect.X, this.AllowedRect.Width).Width+')'); }
    var aX; var aY;
    if(this.IsContainer == true) {
        aX = GetAlignmentCords(this.Align, this.Parent.GetDefaultAlign(), this.FixedSize, this.Position.X, this.Size.X, this.PrefSize.X, this.Calc.MinimumSize.X, 0, this.AllowedRect.Width);
        aY = GetVerticalAlignmentCords(this.VAlign, this.Parent.GetDefaultVAlign(), this.FixedSize, this.Position.Y, this.Size.Y, this.PrefSize.Y, this.Calc.MinimumSize.Y, 0, this.AllowedRect.Height);
        if(this.FixedSize == true) {
            //aX.Width = this.PrefSize.X;
            //aY.Height = this.PrefSize.Y;
        } else {
            if(this.Align == eCCAlign.Stretch) {
                aX.X = 0;//aX.X;
                aX.Width = this.AllowedRect.Width;//this.AllowedRect.Width - this.Calc.FixedSize.X;// + this.Calc.StretchSize.X;
            } else {// if((this.ParentWindow.Caption == 'Test Window') && (this.Name != 'client')) { alert(this.PrefSize.X); }
                //aX.X = aX.X + this.AllowedRect.X;
                //aX.Width = this.PrefSize.X*2;
            }
            if(this.VAlign == eCCVAlign.Stretch) {
                aY.Y = 0;//aY.Y;
                aY.Height = this.AllowedRect.Height;//this.AllowedRect.Width - this.Calc.FixedSize.X;// + this.Calc.StretchSize.X;
            } else {
                //aY.Y = aY.Y + this.AllowedRect.Y;
                //aY.Height = this.PrefSize.Y*2;
            }
            //aY.Height = this.AllowedRect.Height;//this.AllowedRect.Height - this.Calc.FixedSize.Y;// + this.Calc.StretchSize.Y;
        }
        //aX.Width = this.AllowedRect.Width;//aX.Width;
        //aY.Height = this.AllowedRect.Height;//aY.Height;
    } else {
        aX = GetAlignmentCords(this.Align, this.Parent.GetDefaultAlign(), this.FixedSize, this.Position.X, this.Size.X, this.PrefSize.X, this.MinimumSize.X, 0, this.AllowedRect.Width);
        aY = GetVerticalAlignmentCords(this.VAlign, this.Parent.GetDefaultVAlign(), this.FixedSize, this.Position.Y, this.Size.Y, this.PrefSize.Y, this.MinimumSize.Y, 0, this.AllowedRect.Height);
        aX.X = aX.X + this.AllowedRect.X;
        aY.Y = aY.Y + this.AllowedRect.Y;
    }
    this.DispRect.X = aX.X;
    this.DispRect.Y = aY.Y;
    this.DispRect.Width = aX.Width;
    this.DispRect.Height = aY.Height;
}
function cControl_ClientChanged(delayrender) {
    this.bClientChanged = true;
    if(this.Parent != this.ParentWindow) {
        this.Parent.ClientChanged();
    }
    if((this.Loaded == true) && (delayrender != true)) { this.Render(); }
}
function cControl_FireEvent(e, fromchild, blockforward, params) {
    var bRet = false;
    switch(e) {
        case 'blur':
            this.HasFocus = false;
            if(this.ObjectBlur != null) { bRet = bRet || this.ObjectBlur(); }
            break;
        case 'click':
            if(this.ObjectClick != null) { bRet = bRet || this.ObjectClick(params[0], params[1]); }
            break;
        case 'focus':
            this.HasFocus = true;
            if(this.ObjectFocus != null) { bRet = bRet || this.ObjectFocus(); }
            break;
        case 'keydown':
            if((this.DownKey == null) || (this.DownKey[0] != params[0])) {
                if(bRet != true) {
                    this.DownKey = params;
                }
                if(this.ObjectKeyDown != null) { bRet = bRet || this.ObjectKeyDown(params[0], params[1]); }
            }
            break;
        case 'keypress':
            if(this.DownKey != null) {
                var r = 1000;
                if(this.ObjectKeyPress != null) { var r = this.ObjectKeyPress(this.DownKey[0], this.DownKey[1]); bRet = bRet || r.CancelEvent; }
                if(r != 1000) { if(r.KeyPressInterval >= 0) { r = r.KeyPressInterval; } else { r = 1000; } }
                setTimeout('Browser.FocusControl.FireEvent(\'keypress\', \''+(fromchild ? '1' : '0')+'\' == \'1\', \''+(blockforward ? '1' : '0')+'\' == \'1\', null);', r);
            }
            break;
        case 'keyup':
            this.DownKey = null;
            if(this.ObjectKeyUp != null) { bRet = bRet || this.ObjectKeyUp(params[0], params[1]); }
            break;
        case 'mousedown':
            if(fromchild == false) {
                this.IsDown = true;
                Browser.DownControl = this;
                if(this.ObjectMouseDown != null) { bRet = bRet || this.ObjectMouseDown(params[0], params[1]); }
            }
            if(this.Border != null) {
                if(this.Border.Clickable == true) {
                    if(this.Border.Style.Style & eCCBorderStyle.Raised) {
                        this.Border.Style.Style = this.Border.Style.Style - eCCBorderStyle.Raised + eCCBorderStyle.Lowered;
                        this.Border.ChangeStyle(this.Border.Style, true, false);
                    }
                }
            }
            break;
        case 'mousemove':
            if(this.ObjectMouseMove != null) { bRet = bRet || this.ObjectMouseMove(params[0], params[1]); }
            break;
        case 'mouseout':
            this.IsHovering = false;
            if(this.Border != null) {
                if(this.IsDown == true) {
                    if(this.Border.Clickable == true) {
                        if(this.Border.Style.Style & eCCBorderStyle.Lowered) {
                            this.Border.Style.Style = this.Border.Style.Style - eCCBorderStyle.Lowered + eCCBorderStyle.Raised;
                            this.Border.ChangeStyle(this.Border.Style, true, false);
                        }
                    }
                }
                this.Border.ChangeHover(false, false, false);
                if(this.ObjectMouseOut != null) { bRet = bRet || this.ObjectMouseOut(params[0], params[1]); }
            }
            break;
        case 'mouseover':
            this.IsHovering = true;
            if(this.Border != null) {
                if(this.IsDown == true) {
                    if(this.Border.Clickable == true) {
                        if(this.Border.Style.Style & eCCBorderStyle.Raised) {
                            this.Border.Style.Style = this.Border.Style.Style - eCCBorderStyle.Raised + eCCBorderStyle.Lowered;
                            this.Border.ChangeStyle(this.Border.Style, true, false);
                        }
                    }
                }
                this.Border.ChangeHover(true, true, false);
                if(this.ObjectMouseOver != null) { bRet = bRet || this.ObjectMouseOver(params[0], params[1]); }
            }
            break;
        case 'mouseup':
            if(fromchild == false) {
                if(this.ObjectMouseUp != null) { bRet = bRet || this.ObjectMouseUp(params[0], params[1]); }
                if(this.IsDown == true) {
                    this.IsDown = false;
                    if(Browser.DownControl == this) { Browser.DownControl = null; }
                    if(this.IsHovering == true) {
                        this.FireEvent('click', false, blockforward, params);
                    }
                }
            }
            if(this.Border != null) {
                if(this.Border.Clickable == true) {
                    if(this.Border.Style.Style & eCCBorderStyle.Lowered) {
                        this.Border.Style.Style = this.Border.Style.Style - eCCBorderStyle.Lowered + eCCBorderStyle.Raised;
                        this.Border.ChangeStyle(this.Border.Style, true, false);
                    }
                }
                if(this.Border.Sizeable == true) {
                    if(this.Border.Down == true) {
                        this.Border.ChangeDown(false, true, false);
                    }
                }
            }
            break;
    }
    if(this.ParentWindow.CodeInterface != null) {
        var b = this.ParentWindow.CodeInterface.FireEventByName(ObjectReference(this), e, fromchild, params);
        bRet = bRet || b;
    }
    if(bRet == false) {
        if(this.Parent != this.ParentWindow) { bRet = bRet || this.Parent.FireEvent(e, true, blockforward); }
    }
    return(bRet);
}
function cControl_Get(id) {
    if(this.ID == id) { return(this); }
    return(null);
}
function cControl_GetBGColor() {
    if(typeof(this.BGColor) != "undefined") { return(this.BGColor); }
    else { if(this.Parent != this.ParentWindow) { return(this.Parent.GetBGColor()); }  else { return(this.ParentWindow.StyleSet.Client.BGColor); } }
    return('');
}
function cControl_GetByName(name) {
    if(this.Name == name) { return(this); }
    return(null);
}
function cControl_Load(delayrender) {
    if((this.Loaded != true) && (this.LoadChange != true)) {
        this.LoadChange = true;
        this.ObjectLoad();
        if(this.DIVClient != null) {
            eventPush(this.DIVClient, 'mousedown', this.onMouseDown);
            eventPush(this.DIVClient, 'mousemove', this.onMouseMove);
            eventPush(this.DIVClient, 'mouseout', this.onMouseOut);
            eventPush(this.DIVClient, 'mouseover', this.onMouseOver);
            eventPush(this.DIVClient, 'mouseup', this.onMouseUp);
        }
        this.Loaded = true;
        this.LoadChange = false;
        if(delayrender != true) { this.Render(); }
    }
}
function cControl_onMouseDown(e) {
    try {
        var obj = EventObj(e);
        if (obj.nodeType == 3) obj = obj.parentNode;
        var aID = obj.id.split('_');
        var SessionID = parseInt(aID[aID.length - 3]);
        var WindowID = parseInt(aID[aID.length - 2]);
        var ControlID = parseInt(aID[aID.length - 1]);
        var Ses = Browser.GetSession(SessionID);
        if(Ses != null) {
            var Win = Ses.GetWindow(WindowID);
            if(Win != null) {
                var Ctl = Win.Controls.Get(ControlID);
                if(Ctl != null) {
                    var p = Browser.GetMouseCords(e);
                    Browser.SetFocusControl(Ctl);
                    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseDown(e); }
                    return(Ctl.FireEvent('mousedown', false, false, p));
                }
            }
        }
    } catch (e){}
    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseDown(e); }
}
function cControl_onMouseMove(e) {
    try {
        var obj = EventObj(e);
        if (obj.nodeType == 3) obj = obj.parentNode;
        var aID = obj.id.split('_');
        var SessionID = parseInt(aID[aID.length - 3]);
        var WindowID = parseInt(aID[aID.length - 2]);
        var ControlID = parseInt(aID[aID.length - 1]);
        var Ses = Browser.GetSession(SessionID);
        if(Ses != null) {
            var Win = Ses.GetWindow(WindowID);
            if(Win != null) {
                var Ctl = Win.Controls.Get(ControlID);
                if(Ctl != null) {
                    var p = Browser.GetMouseCords(e);
                    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseMove(e); }
                    return(Ctl.FireEvent('mousemove', false, false, p));
                }
            }
        }
    } catch (e){}
    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseMove(e); }
}
function cControl_onMouseOut(e) {
    try {
        var obj = EventObj(e);
        if (obj.nodeType == 3) obj = obj.parentNode;
        var aID = obj.id.split('_');
        var SessionID = parseInt(aID[aID.length - 3]);
        var WindowID = parseInt(aID[aID.length - 2]);
        var ControlID = parseInt(aID[aID.length - 1]);
        var Ses = Browser.GetSession(SessionID);
        if(Ses != null) {
            var Win = Ses.GetWindow(WindowID);
            if(Win != null) {
                var Ctl = Win.Controls.Get(ControlID);
                if(Ctl != null) {
                    var p = Browser.GetMouseCords(e);
                    return(Ctl.FireEvent('mouseout', false, false, p));
                }
            }
        }
    } catch (e){}
}
function cControl_onMouseOver(e) {
    try {
        var obj = EventObj(e);
        if (obj.nodeType == 3) obj = obj.parentNode;
        var aID = obj.id.split('_');
        var SessionID = parseInt(aID[aID.length - 3]);
        var WindowID = parseInt(aID[aID.length - 2]);
        var ControlID = parseInt(aID[aID.length - 1]);
        var Ses = Browser.GetSession(SessionID);
        if(Ses != null) {
            var Win = Ses.GetWindow(WindowID);
            if(Win != null) {
                var Ctl = Win.Controls.Get(ControlID);
                if(Ctl != null) {
                    var p = Browser.GetMouseCords(e);
                    return(Ctl.FireEvent('mouseover', false, false, p));
                }
            }
        }
    } catch (e){}
}
function cControl_onMouseUp(e) {
    try {
        var obj = EventObj(e);
        if (obj.nodeType == 3) obj = obj.parentNode;
        var aID = obj.id.split('_');
        var SessionID = parseInt(aID[aID.length - 3]);
        var WindowID = parseInt(aID[aID.length - 2]);
        var ControlID = parseInt(aID[aID.length - 1]);
        var Ses = Browser.GetSession(SessionID);
        if(Ses != null) {
            var Win = Ses.GetWindow(WindowID);
            if(Win != null) {
                var Ctl = Win.Controls.Get(ControlID);
                if(Ctl != null) {
                    var p = Browser.GetMouseCords(e);
                    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseUp(e); }
                    return(Ctl.FireEvent('mouseup', false, false, p));
                }
            }
        }
    } catch (e){}
    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseUp(e); }
}
function cControl_PositionX(pos, force, delayrender) {
    if((this.X != pos) || (force == true)) {
        this.X = pos;
        if(delayrender != true) { this.RenderPosition(false); }
    }
}
function cControl_PositionY(pos, force, delayrender) {
    if((this.Y != pos) || (force == true)) {
        this.Y = pos;
        if(delayrender != true) { this.RenderPosition(false); }
    }
}
function cControl_Render() {
    //alert('('+this.AllowedRect.X+', '+this.AllowedRect.Y+')-('+this.AllowedRect.Width+', '+this.AllowedRect.Height+')-('+this.AllowedRect.X2+', '+this.AllowedRect.Y2+')');
    this.CalcClient(true);
    this.CalcRender();
    this.Resized(true);
    this.RenderPosition(true);
}
function cControl_SizeX(size, force, delayrender) {
    this.PrefSize.X = size;
    if((this.Width != size) || (force == true)) {
        this.Width = size;
        if(delayrender != true) { this.Resized(false); }
    }
}
function cControl_SizeY(size, force, delayrender) {
    this.PrefSize.Y = size;
    if((this.Height != size) || (force == true)) {
        this.Height = size;
        if(delayrender != true) { this.Resized(false); }
    }
}
function cControl_UnLoad() {
    if((this.Loaded == true) && (this.LoadChange != true)) {
        this.LoadChange = true;
        if(this.DIVClient != null) {
            eventPop(this.DIVClient, 'mousedown', this.onMouseDown);
            eventPop(this.DIVClient, 'mousemove', this.onMouseMove);
            eventPop(this.DIVClient, 'mouseout', this.onMouseOut);
            eventPop(this.DIVClient, 'mouseover', this.onMouseOver);
            eventPop(this.DIVClient, 'mouseup', this.onMouseUp);
        }
        this.ObjectUnLoad();
        this.Loaded = false;
        this.LoadChange = false;
    }
}
function cControl_AjaxProcess() { alert('OVERRIDE Session['+this.ParentWindow.Parent.ID+'].Window['+this.ParentWindow.ID+'].Control['+this.ID+'].AjaxProcess<'+this.TypeOf+'>();'); }
function cControl_CalcClient(precalc) { alert('OVERRIDE Session['+this.ParentWindow.Parent.ID+'].Window['+this.ParentWindow.ID+'].Control['+this.ID+'].CalcSize<'+this.TypeOf+'>(precalc);'); }
function cControl_ObjectLoad() { alert('OVERRIDE Session['+this.ParentWindow.Parent.ID+'].Window['+this.ParentWindow.ID+'].Control['+this.ID+'].ObjectLoad<'+this.TypeOf+'>();'); }
function cControl_ObjectUnLoad() { alert('OVERRIDE Session['+this.ParentWindow.Parent.ID+'].Window['+this.ParentWindow.ID+'].Control['+this.ID+'].ObjectUnLoad<'+this.TypeOf+'>();'); }
function cControl_RenderPosition(precalc) { alert('OVERRIDE Session['+this.ParentWindow.Parent.ID+'].Window['+this.ParentWindow.ID+'].Control['+this.ID+'].RenderPosition<'+this.TypeOf+'>(precalc);'); }
function cControl_Resized(precalc) { alert('OVERRIDE Session['+this.ParentWindow.Parent.ID+'].Window['+this.ParentWindow.ID+'].Control['+this.ID+'].Resized<'+this.TypeOf+'>(precalc);'); }
cControl.prototype.ControlDispose = cControl_ControlDispose;
cControl.prototype.AjaxProcess = cControl_AjaxProcess;
cControl.prototype.CalcClient = cControl_CalcClient;
cControl.prototype.CalcRender = cControl_CalcRender;
cControl.prototype.ClientChanged = cControl_ClientChanged;
cControl.prototype.ControlInitialize = cControl_ControlInitialize;
cControl.prototype.FireEvent = cControl_FireEvent;
cControl.prototype.Get = cControl_Get;
cControl.prototype.GetBGColor = cControl_GetBGColor;
cControl.prototype.GetByName = cControl_GetByName;
cControl.prototype.Load = cControl_Load;
cControl.prototype.onMouseDown = cControl_onMouseDown;
cControl.prototype.onMouseMove = cControl_onMouseMove;
cControl.prototype.onMouseOut = cControl_onMouseOut;
cControl.prototype.onMouseOver = cControl_onMouseOver;
cControl.prototype.onMouseUp = cControl_onMouseUp;
cControl.prototype.ObjectLoad = cControl_ObjectLoad;
cControl.prototype.ObjectUnLoad = cControl_ObjectUnLoad;
cControl.prototype.PositionX = cControl_PositionX;
cControl.prototype.PositionY = cControl_PositionY;
cControl.prototype.Render = cControl_Render;
cControl.prototype.RenderPosition = cControl_RenderPosition;
cControl.prototype.Resized = cControl_Resized;
cControl.prototype.SizeX = cControl_SizeX;
cControl.prototype.SizeY = cControl_SizeY;
cControl.prototype.UnLoad = cControl_UnLoad;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cControlBorder(parentWindow, parent, style, clickable, sizeable) {
    this.TypeOf = 'Border';
    this.ParentWindow = parentWindow;
    this.Parent = parent;
    this.Clickable = clickable;
    this.Sizeable = sizeable;
    this.Loading = false;
    this.Loaded = false;
    this.ActiveSides = eCDPosition.All;
    this.Hovering = false;
    this.Down = false;
    this.Disabled = false;
    this.DIVBT = null;
    this.DIVBR = null;
    this.DIVBB = null;
    this.DIVBL = null;
    this.DIVCTL = null;
    this.DIVCTR = null;
    this.DIVCBL = null;
    this.DIVCBR = null;
    this.Size = new Object();
    this.Size.Top = 0;
    this.Size.Right = 0;
    this.Size.Bottom = 0;
    this.Size.Left = 0;
    this.ChangeStyle(style, true);
}
function cControlBorder_Dispose() {
    if(this.Loaded == true) { this.UnLoad(); }
    delete this.Size;
}

function cControlBorder_Load() {
    if((this.Loaded == false) && (this.Loading == false)) {
        this.Loading = true;
        
        this.DIVBT = document.createElement('span');
        this.DIVBT.setAttribute('id', 'divCtlClientB_T_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.Parent.ID);
        this.DIVBR = document.createElement('span');
        this.DIVBR.setAttribute('id', 'divCtlClientB_R_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.Parent.ID);
        this.DIVBB = document.createElement('span');
        this.DIVBB.setAttribute('id', 'divCtlClientB_B_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.Parent.ID);
        this.DIVBL = document.createElement('span');
        this.DIVBL.setAttribute('id', 'divCtlClientB_L_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.Parent.ID);
        
        this.DIVCTL = document.createElement('span');
        this.DIVCTL.setAttribute('id', 'divCtlClientC_TL_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.Parent.ID);
        this.DIVCTR = document.createElement('span');
        this.DIVCTR.setAttribute('id', 'divCtlClientC_TR_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.Parent.ID);
        this.DIVCBL = document.createElement('span');
        this.DIVCBL.setAttribute('id', 'divCtlClientC_BL_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.Parent.ID);
        this.DIVCBR = document.createElement('span');
        this.DIVCBR.setAttribute('id', 'divCtlClientC_BR_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.Parent.ID);
        
        this.Parent.DIVClient.appendChild(this.DIVBT);
        this.Parent.DIVClient.appendChild(this.DIVBR);
        this.Parent.DIVClient.appendChild(this.DIVBB);
        this.Parent.DIVClient.appendChild(this.DIVBL);
        
        this.Parent.DIVClient.appendChild(this.DIVCTL);
        this.Parent.DIVClient.appendChild(this.DIVCTR);
        this.Parent.DIVClient.appendChild(this.DIVCBL);
        this.Parent.DIVClient.appendChild(this.DIVCBR);
        
        eventPush(this.DIVBT, 'mousedown', this.onMouseDown);
        eventPush(this.DIVBR, 'mousedown', this.onMouseDown);
        eventPush(this.DIVBB, 'mousedown', this.onMouseDown);
        eventPush(this.DIVBL, 'mousedown', this.onMouseDown);
        eventPush(this.DIVCTL, 'mousedown', this.onMouseDown);
        eventPush(this.DIVCTR, 'mousedown', this.onMouseDown);
        eventPush(this.DIVCBL, 'mousedown', this.onMouseDown);
        eventPush(this.DIVCBR, 'mousedown', this.onMouseDown);
        eventPush(this.DIVBT, 'mouseout', this.onMouseOut);
        eventPush(this.DIVBR, 'mouseout', this.onMouseOut);
        eventPush(this.DIVBB, 'mouseout', this.onMouseOut);
        eventPush(this.DIVBL, 'mouseout', this.onMouseOut);
        eventPush(this.DIVCTL, 'mouseout', this.onMouseOut);
        eventPush(this.DIVCTR, 'mouseout', this.onMouseOut);
        eventPush(this.DIVCBL, 'mouseout', this.onMouseOut);
        eventPush(this.DIVCBR, 'mouseout', this.onMouseOut);
        eventPush(this.DIVBT, 'mouseover', this.onMouseOver);
        eventPush(this.DIVBR, 'mouseover', this.onMouseOver);
        eventPush(this.DIVBB, 'mouseover', this.onMouseOver);
        eventPush(this.DIVBL, 'mouseover', this.onMouseOver);
        eventPush(this.DIVCTL, 'mouseover', this.onMouseOver);
        eventPush(this.DIVCTR, 'mouseover', this.onMouseOver);
        eventPush(this.DIVCBL, 'mouseover', this.onMouseOver);
        eventPush(this.DIVCBR, 'mouseover', this.onMouseOver);
        
        this.DIVBT.style.top = '0px';
        this.DIVBR.style.right = '0px';
        this.DIVBB.style.bottom = '0px';
        this.DIVBL.style.left = '0px';
        
        this.DIVCTL.style.left = '0px';
        this.DIVCTL.style.top = '0px';
        this.DIVCTR.style.right = '0px';
        this.DIVCTR.style.top = '0px';
        this.DIVCBL.style.left = '0px';
        this.DIVCBL.style.bottom = '0px';
        this.DIVCBR.style.right = '0px';
        this.DIVCBR.style.bottom = '0px';
        
        this.DIVBT.style.zIndex = '998';
        this.DIVBR.style.zIndex = '998';
        this.DIVBB.style.zIndex = '998';
        this.DIVBL.style.zIndex = '998';
        
        this.DIVCTL.style.zIndex = '999';
        this.DIVCTR.style.zIndex = '999';
        this.DIVCBL.style.zIndex = '999';
        this.DIVCBR.style.zIndex = '999';
        
        this.Loaded = true;
        this.Loading = false;
    }
}
function cControlBorder_UnLoad() {
    if((this.Loaded == true) && (this.Loading == false)) {
        this.Loading = true;
        this.Loaded = false;
        
        eventPop(this.DIVBT, 'mousedown', this.onMouseDown);
        eventPop(this.DIVBR, 'mousedown', this.onMouseDown);
        eventPop(this.DIVBB, 'mousedown', this.onMouseDown);
        eventPop(this.DIVBL, 'mousedown', this.onMouseDown);
        eventPop(this.DIVCTL, 'mousedown', this.onMouseDown);
        eventPop(this.DIVCTR, 'mousedown', this.onMouseDown);
        eventPop(this.DIVCBL, 'mousedown', this.onMouseDown);
        eventPop(this.DIVCBR, 'mousedown', this.onMouseDown);
        eventPop(this.DIVBT, 'mouseout', this.onMouseOut);
        eventPop(this.DIVBR, 'mouseout', this.onMouseOut);
        eventPop(this.DIVBB, 'mouseout', this.onMouseOut);
        eventPop(this.DIVBL, 'mouseout', this.onMouseOut);
        eventPop(this.DIVCTL, 'mouseout', this.onMouseOut);
        eventPop(this.DIVCTR, 'mouseout', this.onMouseOut);
        eventPop(this.DIVCBL, 'mouseout', this.onMouseOut);
        eventPop(this.DIVCBR, 'mouseout', this.onMouseOut);
        eventPop(this.DIVBT, 'mouseover', this.onMouseOver);
        eventPop(this.DIVBR, 'mouseover', this.onMouseOver);
        eventPop(this.DIVBB, 'mouseover', this.onMouseOver);
        eventPop(this.DIVBL, 'mouseover', this.onMouseOver);
        eventPop(this.DIVCTL, 'mouseover', this.onMouseOver);
        eventPop(this.DIVCTR, 'mouseover', this.onMouseOver);
        eventPop(this.DIVCBL, 'mouseover', this.onMouseOver);
        eventPop(this.DIVCBR, 'mouseover', this.onMouseOver);
        
        this.Parent.DIVClient.removeChild(this.DIVBT);
        this.Parent.DIVClient.removeChild(this.DIVBR);
        this.Parent.DIVClient.removeChild(this.DIVBB);
        this.Parent.DIVClient.removeChild(this.DIVBL);
        this.Parent.DIVClient.removeChild(this.DIVCTL);
        this.Parent.DIVClient.removeChild(this.DIVCTR);
        this.Parent.DIVClient.removeChild(this.DIVCBL);
        this.Parent.DIVClient.removeChild(this.DIVCBR);
        
        this.Loading = false;
    }
}
function cControlBorder_CalcSize() {
    if(this.Style.Style == eCCBorderStyle.Solid) {
        this.Size.Top = this.Style.Size;
        this.Size.Right = this.Style.Size;
        this.Size.Bottom = this.Style.Size;
        this.Size.Left = this.Style.Size;
    } else {
        if(this.Clickable == true) {
            this.Size.Top = this.StyleSet.Click.BT;
            this.Size.Right = this.StyleSet.Click.BR;
            this.Size.Bottom = this.StyleSet.Click.BB;
            this.Size.Left = this.StyleSet.Click.BL;
        } else {
            this.Size.Top = this.StyleSet.NoClick.BT;
            this.Size.Right = this.StyleSet.NoClick.BR;
            this.Size.Bottom = this.StyleSet.NoClick.BB;
            this.Size.Left = this.StyleSet.NoClick.BL;
        }
    }
}
function cControlBorder_ChangeActiveSides(sides, force, delayrender) {
    if((this.ActiveSides != sides) || (force == true)) {
        this.ActiveSides = sides;
        if(!delayrender) {
            this.RenderClasses();
        }
    }
}
function cControlBorder_ChangeDisabled(disabled, force, delayrender) {
    if((this.Disabled != disabled) || (force == true)) {
        this.Disabled = disabled;
        if(!delayrender) {
            this.RenderClasses();
        }
    }
}
function cControlBorder_ChangeDown(down, force, delayrender) {
    if((this.Down != down) || (force == true)) {
        this.Down = down;
        if(!delayrender) {
            this.RenderClasses();
        }
    }
}
function cControlBorder_ChangeHover(hover, force, delayrender) {
    if((this.Hovering != hover) || (force == true)) {
        this.Hovering = hover;
        if(!delayrender) {
            this.RenderClasses();
        }
    }
}
function cControlBorder_ChangeStyle(style, force, delayrender) {
    if((this.Style != style) || (force == true)) {
        this.Style = style;
        this.StyleSet = Browser.Style.GetBorderStyleSet(this.Style.Style);
        this.CalcSize();
        if(!delayrender) {
            this.RenderClasses();
            if(this.Parent.Loaded == true) { this.Parent.Resized(); }
        }
    }
}
function cControlBorder_DragStart(e, sides) {
    this.ChangeActiveSides(sides, false, false);
    Browser.DragStart(e, this.Parent.DIVClient.id, sides, false);
}
function cControlBorder_onMouseDown(e) {
    try {
        var Sides = eCDPosition.Float;
        var obj = EventObj(e);
        if (obj.nodeType == 3) obj = obj.parentNode;
        var aID = obj.id.split('_');
        var strSides = aID[aID.length - 4].toUpperCase();
        var SessionID = parseInt(aID[aID.length - 3]);
        var WindowID = parseInt(aID[aID.length - 2]);
        var ControlID = parseInt(aID[aID.length - 1]);
        var Ses = Browser.GetSession(SessionID);
        if(strSides.indexOf('T') >= 0) { Sides = Sides + eCDPosition.Top; }
        if(strSides.indexOf('R') >= 0) { Sides = Sides + eCDPosition.Right; }
        if(strSides.indexOf('B') >= 0) { Sides = Sides + eCDPosition.Bottom; }
        if(strSides.indexOf('L') >= 0) { Sides = Sides + eCDPosition.Left; }
        if(Ses != null) {
            var Win = Ses.GetWindow(WindowID);
            if(Win != null) {
                var Ctl = Win.Controls.Get(ControlID);
                if(Ctl != null) {
                    Browser.SetFocusControl(Ctl);
                    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseDown(e); }
                    if(Ctl.Border != null) { return(Ctl.Border.DragStart(e, Sides)); }
                }
            }
        }
    } catch (e){}
    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseDown(e); }
}
function cControlBorder_onMouseOut(e) {
    try {
        var Sides = eCDPosition.Float;
        var obj = EventObj(e);
        if (obj.nodeType == 3) obj = obj.parentNode;
        var aID = obj.id.split('_');
        var strSides = aID[aID.length - 4].toUpperCase();
        var SessionID = parseInt(aID[aID.length - 3]);
        var WindowID = parseInt(aID[aID.length - 2]);
        var ControlID = parseInt(aID[aID.length - 1]);
        var Ses = Browser.GetSession(SessionID);
        if(strSides.indexOf('T') >= 0) { Sides = Sides + eCDPosition.Top; }
        if(strSides.indexOf('R') >= 0) { Sides = Sides + eCDPosition.Right; }
        if(strSides.indexOf('B') >= 0) { Sides = Sides + eCDPosition.Bottom; }
        if(strSides.indexOf('L') >= 0) { Sides = Sides + eCDPosition.Left; }
        if(Ses != null) {
            var Win = Ses.GetWindow(WindowID);
            if(Win != null) {
                var Ctl = Win.Controls.Get(ControlID);
                if(Ctl != null) {
                    if(Ctl.Border != null) {
                        Ctl.Border.ChangeActiveSides(eCDPosition.All, true, true);
                        Ctl.Border.ChangeHover(false, true, false);
                    }
                }
            }
        }
    } catch (e){}
}
function cControlBorder_onMouseOver(e) {
    try {
        var Sides = eCDPosition.Float;
        var obj = EventObj(e);
        if (obj.nodeType == 3) obj = obj.parentNode;
        var aID = obj.id.split('_');
        var strSides = aID[aID.length - 4].toUpperCase();
        var SessionID = parseInt(aID[aID.length - 3]);
        var WindowID = parseInt(aID[aID.length - 2]);
        var ControlID = parseInt(aID[aID.length - 1]);
        var Ses = Browser.GetSession(SessionID);
        if(strSides.indexOf('T') >= 0) { Sides = Sides + eCDPosition.Top; }
        if(strSides.indexOf('R') >= 0) { Sides = Sides + eCDPosition.Right; }
        if(strSides.indexOf('B') >= 0) { Sides = Sides + eCDPosition.Bottom; }
        if(strSides.indexOf('L') >= 0) { Sides = Sides + eCDPosition.Left; }
        if(Ses != null) {
            var Win = Ses.GetWindow(WindowID);
            if(Win != null) {
                var Ctl = Win.Controls.Get(ControlID);
                if(Ctl != null) {
                    if(Ctl.Border != null) {
                        Ctl.Border.ChangeActiveSides(Sides, true, true);
                        Ctl.Border.ChangeHover(true, true, false);
                    }
                }
            }
        }
    } catch (e){}
}
function cControlBorder_Render() {
    if(this.Loaded == true) {
        if(this.Style.Style == eCCBorderStyle.Solid) {
            this.DIVCTL.style.display = 'none'; this.DIVCTL.style.visibility = 'hidden';
            this.DIVCTR.style.display = 'none'; this.DIVCTR.style.visibility = 'hidden';
            this.DIVCBL.style.display = 'none'; this.DIVCBL.style.visibility = 'hidden';
            this.DIVCBR.style.display = 'none'; this.DIVCBR.style.visibility = 'hidden';
            this.DIVBT.style.height = this.Size.Top + 'px';
            this.DIVBR.style.width = this.Size.Right + 'px';
            this.DIVBB.style.height = this.Size.Bottom + 'px';
            this.DIVBL.style.width = this.Size.Left + 'px';
            this.DIVBT.style.backgroundColor = this.Style.Color;
            this.DIVBR.style.backgroundColor = this.Style.Color;
            this.DIVBB.style.backgroundColor = this.Style.Color;
            this.DIVBL.style.backgroundColor = this.Style.Color;
        } else {
            this.DIVCTL.style.display = 'block'; this.DIVCTL.style.visibility = 'visible';
            this.DIVCTR.style.display = 'block'; this.DIVCTR.style.visibility = 'visible';
            this.DIVCBL.style.display = 'block'; this.DIVCBL.style.visibility = 'visible';
            this.DIVCBR.style.display = 'block'; this.DIVCBR.style.visibility = 'visible';
            this.DIVBT.style.backgroundColor = this.Parent.GetBGColor();
            this.DIVBR.style.backgroundColor = this.Parent.GetBGColor();
            this.DIVBB.style.backgroundColor = this.Parent.GetBGColor();
            this.DIVBL.style.backgroundColor = this.Parent.GetBGColor();
            this.DIVCTL.style.backgroundColor = this.Parent.GetBGColor();
            this.DIVCTR.style.backgroundColor = this.Parent.GetBGColor();
            this.DIVCBL.style.backgroundColor = this.Parent.GetBGColor();
            this.DIVCBR.style.backgroundColor = this.Parent.GetBGColor();
        }
        this.RenderClasses();
        
        this.DIVBT.style.left = this.StyleSet.CTL.X + 'px';
        this.DIVBT.style.width = (this.Parent.DispRect.Width - (this.StyleSet.CTL.X + this.StyleSet.CTR.X) + 1) + 'px';
        this.DIVBR.style.top = this.StyleSet.CTR.Y + 'px';
        this.DIVBR.style.height = (this.Parent.DispRect.Height - (this.StyleSet.CTR.Y + this.StyleSet.CBR.Y) + 1) + 'px';
        this.DIVBB.style.left = this.StyleSet.CBL.X + 'px';
        this.DIVBB.style.width = (this.Parent.DispRect.Width - (this.StyleSet.CBL.X + this.StyleSet.CBR.X) + 1) + 'px';
        this.DIVBL.style.top = this.StyleSet.CTL.Y + 'px';;
        this.DIVBL.style.height = (this.Parent.DispRect.Height - (this.StyleSet.CTL.Y + this.StyleSet.CBL.Y) + 1) + 'px';
    }
}
function cControlBorder_RenderClasses() {
    if(this.Loaded == true) {
        var nonhover = ''; var hover = '';
        if(this.Hovering == true) { hover = '_H'; }
        if(this.Down == true) { hover = '_D'; }
        if(this.Disabled == true) { nonhover = '_X'; hover = '_X'; }
        this.DIVCTL.className = 'ControlBorder_' + this.Style.Style + '_CTL' + (((this.ActiveSides & eCDPosition.Top) && (this.ActiveSides & eCDPosition.Left)) ? hover : nonhover);
        this.DIVCTR.className = 'ControlBorder_' + this.Style.Style + '_CTR' + (((this.ActiveSides & eCDPosition.Top) && (this.ActiveSides & eCDPosition.Right)) ? hover : nonhover);
        this.DIVCBL.className = 'ControlBorder_' + this.Style.Style + '_CBL' + (((this.ActiveSides & eCDPosition.Bottom) && (this.ActiveSides & eCDPosition.Left)) ? hover : nonhover);
        this.DIVCBR.className = 'ControlBorder_' + this.Style.Style + '_CBR' + (((this.ActiveSides & eCDPosition.Bottom) && (this.ActiveSides & eCDPosition.Right)) ? hover : nonhover);
        this.DIVBT.className = 'ControlBorder_' + this.Style.Style + '_BT' + ((this.ActiveSides & eCDPosition.Top) ? hover : nonhover);
        this.DIVBR.className = 'ControlBorder_' + this.Style.Style + '_BR' + ((this.ActiveSides & eCDPosition.Right) ? hover : nonhover);
        this.DIVBB.className = 'ControlBorder_' + this.Style.Style + '_BB' + ((this.ActiveSides & eCDPosition.Bottom) ? hover : nonhover);
        this.DIVBL.className = 'ControlBorder_' + this.Style.Style + '_BL' + ((this.ActiveSides & eCDPosition.Left) ? hover : nonhover);
    }
}

cControlBorder.prototype.constructor = cControlBorder;

cControlBorder.prototype.Dispose = cControlBorder_Dispose;
cControlBorder.prototype.Load = cControlBorder_Load;
cControlBorder.prototype.UnLoad = cControlBorder_UnLoad;
cControlBorder.prototype.CalcSize = cControlBorder_CalcSize;
cControlBorder.prototype.ChangeActiveSides = cControlBorder_ChangeActiveSides;
cControlBorder.prototype.ChangeDisabled = cControlBorder_ChangeDisabled;
cControlBorder.prototype.ChangeDown = cControlBorder_ChangeDown;
cControlBorder.prototype.ChangeHover = cControlBorder_ChangeHover;
cControlBorder.prototype.ChangeStyle = cControlBorder_ChangeStyle;
cControlBorder.prototype.DragStart = cControlBorder_DragStart;
cControlBorder.prototype.onMouseDown = cControlBorder_onMouseDown;
cControlBorder.prototype.onMouseOut = cControlBorder_onMouseOut;
cControlBorder.prototype.onMouseOver = cControlBorder_onMouseOver;
cControlBorder.prototype.Render = cControlBorder_Render;
cControlBorder.prototype.RenderClasses = cControlBorder_RenderClasses;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cControlButton(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, bgcolor, orientation, invert, caption, spacing, padding, font, image) {
    this.TypeOf = 'Button';
    this.Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, bgcolor, orientation, invert, caption, spacing, padding, font, image);
}
function cControlButton_Dispose() {
    if(this.Font) { this.Font.Dispose(); delete this.Font; this.Font = null; }
    if(this.Image) { this.Image.Dispose(); delete this.Image; this.Image = null; }
    this.Border.Dispose();
    delete this.Border;
    this.ControlDispose();
}
function cControlButton_Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, bgcolor, orientation, invert, caption, spacing, padding, font, image) {
    this.ControlInitialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign);
    this.TypeOf = 'Button';
    this.BGColor = bgcolor;
    this.Orientation = orientation;
    this.Invert = invert;
    this.Border = new cControlBorder(this.ParentWindow, this, GetBorderStyleFromString('rn'), true);
    if(isNaN(spacing)) { this.Spacing = 0; } else { this.Spacing = spacing - 0; }
    if(isNaN(padding)) { this.Padding = 0; } else { this.Padding = padding - 0; }
    this.Caption = caption;
    this.Font = font;
    this.Image = image;
}

function cControlButton_ObjectLoad() {
    this.DIVClient = document.createElement('span');
    this.DIVClient.setAttribute('id', 'divCtlClient_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.ID);
    this.DIVImage = document.createElement('span');
    this.DIVImage.setAttribute('id', 'divCtlImage_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.ID);
    this.DIVCaption = document.createElement('span');
    this.DIVCaption.setAttribute('id', 'divCtlCaption_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.ID);
        this.DIVClient.appendChild(this.DIVImage);
        this.DIVClient.appendChild(this.DIVCaption);
    this.Parent.DIVClient.appendChild(this.DIVClient);
    
    this.DIVClient.style.position = 'absolute';
    this.DIVClient.style.overflow = 'hidden';
    this.DIVClient.style.border = '0px';
    this.DIVClient.style.margin = '0px';
    this.DIVClient.style.padding = '0px';
    this.DIVClient.style.backgroundColor = this.BGColor;
    this.DIVClient.style.cursor = 'default';
    
    this.DIVImage.style.position = 'absolute';
    this.DIVImage.style.overflow = 'hidden';
    this.DIVImage.style.border = '0px';
    this.DIVImage.style.margin = '0px';
    this.DIVImage.style.padding = '0px';
    this.DIVImage.style.backgroundColor = this.Image.BGColor;
    if((this.Image.Source.length < 1) || (this.Image.Source.toLowerCase() == 'none')) {
        this.DIVImage.style.backgroundImage = 'none';
    } else { this.DIVImage.style.backgroundImage = 'url('+this.Image.Source+')'; }
    this.DIVImage.style.backgroundPosition = this.Image.Position.X + 'px ' + this.Image.Position.Y + 'px';
    this.DIVImage.style.backgroundRepeat = this.Image.Repeat;
    if(this.Image.IsValid() == true) {
        this.DIVImage.style.display = 'block';
        this.DIVImage.style.visibility = 'visible';
    } else {
        this.DIVImage.style.display = 'none';
        this.DIVImage.style.visibility = 'hidden';
    }
    
    this.DIVCaption.style.position = 'absolute';
    this.DIVCaption.style.overflow = 'hidden';
    this.DIVCaption.style.border = '0px';
    this.DIVCaption.style.margin = '0px';
    this.DIVCaption.style.padding = '0px';
    this.DIVCaption.innerHTML = this.Caption;
    this.DIVCaption.style.backgroundColor = this.Font.BGColor;
    this.DIVCaption.style.color = this.Font.Color;
    this.DIVCaption.style.fontFamily = this.Font.Family;
    this.DIVCaption.style.fontSize = this.Font.Size;
    this.DIVCaption.style.fontWeight = this.Font.Weight;
    this.DIVCaption.style.textDecoration = this.Font.Decoration;
    this.DIVCaption.style.fontStyle = this.Font.Style;
    if(this.Caption.length > 0) {
        this.DIVCaption.style.display = 'block';
        this.DIVCaption.style.visibility = 'visible';
    } else {
        this.DIVCaption.style.display = 'none';
        this.DIVCaption.style.visibility = 'hidden';
    }
    
    this.Border.Load();
    /*
    eventPush(this.DIVClient, 'mousedown', this.onMouseDown);
    eventPush(this.DIVClient, 'mouseout', this.onMouseOut);
    eventPush(this.DIVClient, 'mouseover', this.onMouseOver);
    eventPush(this.DIVClient, 'mouseup', this.onMouseUp);*/
}
function cControlButton_ObjectUnLoad() {/*
    eventPop(this.DIVClient, 'mousedown', this.onMouseDown);
    eventPop(this.DIVClient, 'mouseout', this.onMouseOut);
    eventPop(this.DIVClient, 'mouseover', this.onMouseOver);
    eventPop(this.DIVClient, 'mouseup', this.onMouseUp);*/
    
    this.Border.UnLoad();
    
        this.Parent.DIVClient.removeChild(this.DIVCaption);
        this.Parent.DIVClient.removeChild(this.DIVImage);
    this.Parent.DIVClient.removeChild(this.DIVClient);
}
function cControlButton_CalcClient(precalc) {
    var szLab; var szImg = new Object();
    if(this.Caption.length > 0) {
        szLab = Browser.GetTextSize(this.Caption, this.Font.Family, this.Font.Size, this.Font.Weight, this.Font.Decoration, this.Font.Style);
    } else { szLab = new Object(); szLab.Width = 0; szLab.Height = 0; }
    if(this.Image.IsValid() == true) {
        szImg.Width = this.Image.Size.X;
        szImg.Height = this.Image.Size.Y;
    } else { szImg.Width = 0; szImg.Height = 0; }
    
    switch(this.Orientation) {
        case eCCOrientation.Horizontal:
            this.PrefSize.X = szImg.Width + szLab.Width;
            if(szImg.Height > szLab.Height) { this.PrefSize.Y = szImg.Width; }
            else { this.PrefSize.Y = szLab.Height; }
            if((szImg.Width > 0) && (szLab.Width > 0)) { this.PrefSize.X = this.PrefSize.X + this.Spacing; }
            break;
        case eCCOrientation.Vertical:
            if(szImg.Width > szLab.Width) { this.PrefSize.X = szImg.Width; }
            else { this.PrefSize.X = szLab.Width; }
            this.PrefSize.Y = szImg.Height + szLab.Height;
            if((szImg.Height > 0) && (szLab.Height > 0)) { this.PrefSize.Y = this.PrefSize.Y + this.Spacing; }
            break;
        default:
            if(szImg.Width> szLab.Width) { this.PrefSize.X = szImg.Width; }
            else { this.PrefSize.X = szLab.Width; }
            if(szImg.Height > szLab.Height) { this.PrefSize.Y = szImg.Height; }
            else { this.PrefSize.Y = szLab.Height; }
            break;
    }
    if(this.Padding > 0) {
        this.PrefSize.X = this.PrefSize.X + (this.Padding * 2);
        this.PrefSize.Y = this.PrefSize.Y + (this.Padding * 2);
    }
    this.StretchPreCalcWidth = this.PrefSize.X;
    this.StretchPreCalcHeight = this.PrefSize.Y;
    this.bClientChanged = false;
    if(precalc != true) { this.CalcRender(); }
}
function cControlButton_RenderPosition(precalc) {
    if(precalc != true) { this.CalcRender(); }
    this.DIVClient.style.left = this.DispRect.X + 'px';
    this.DIVClient.style.top = this.DispRect.Y + 'px';
}
function cControlButton_Resized(precalc) {
    if(precalc != true) { this.CalcRender(); }
    this.DIVClient.style.width = this.DispRect.Width + 'px';
    this.DIVClient.style.height = this.DispRect.Height + 'px';
    if(this.Align == eCCAlign.Default) { this.Align = this.Parent.DefaultAlign; }
    if(this.VAlign == eCCVAlign.Default) { this.VAlign = this.Parent.DefaultVAlign; }
    var szLab; var szImg = new Object();
    if(this.Caption.length > 0) {
        szLab = Browser.GetTextSize(this.Caption, this.Font.Family, this.Font.Size, this.Font.Weight, this.Font.Decoration, this.Font.Style);
    } else { szLab = new Object(); szLab.Width = 0; szLab.Height = 0; }
    if(this.Image.IsValid() == true) {
        szImg.Width = this.Image.Size.X;
        szImg.Height = this.Image.Size.Y;
    } else { szImg.Width = 0; szImg.Height = 0; }
    
    this.DIVImage.style.width = szImg.Width + 'px';
    this.DIVImage.style.height = szImg.Height + 'px';
    this.DIVCaption.style.width = szLab.Width + 'px';
    this.DIVCaption.style.height = szLab.Height + 'px';
    this.DIVCaption.style.display = 'block';
    this.DIVCaption.style.visibility = 'visible';
    
    var oX = this.Border.Size.Left + ((this.DispRect.Width - (this.Border.Size.Left + this.Border.Size.Right)) / 2);
    var oY = this.Border.Size.Top + ((this.DispRect.Height - (this.Border.Size.Top + this.Border.Size.Bottom)) / 2);
    
    switch(this.Orientation) {
        case eCCOrientation.Horizontal:
            var xP = (this.DispRect.Width - ((this.Border.Size.Left + this.Border.Size.Right) + szImg.Width + this.Spacing + szLab.Width + (this.Padding * 2))) / 2;
            if(this.Invert == true) {
                this.DIVCaption.style.left = (this.Border.Size.Left + this.Padding + xP) + 'px';
                this.DIVImage.style.left = (this.Border.Size.Left + this.Padding + xP + szLab.Width + this.Spacing) + 'px';
            } else {
                this.DIVImage.style.left = (this.Border.Size.Left + this.Padding + xP) + 'px';
                this.DIVCaption.style.left = (this.Border.Size.Left + this.Padding + xP + szImg.Width + this.Spacing) + 'px';
            }
            this.DIVCaption.style.top = (oY - (szLab.Height / 2)) + 'px';
            this.DIVImage.style.top = (oY - (szImg.Height / 2)) + 'px';
            break;
        case eCCOrientation.Vertical:
            var yP = (this.DispRect.Height - ((this.Border.Size.Top + this.Border.Size.Bottom) + szImg.Height + this.Spacing + szLab.Height + (this.Padding * 2))) / 2;
            this.DIVCaption.style.left = (oX - (szLab.Width / 2)) + 'px';
            this.DIVImage.style.left = (oX - (szImg.Width / 2)) + 'px';
            if(this.Invert == true) {
                this.DIVCaption.style.top = (this.Border.Size.Top + this.Padding + yP) + 'px';
                this.DIVImage.style.top = (this.Border.Size.Top + this.Padding + yP + szLab.Height + this.Spacing) + 'px';
            } else {
                this.DIVImage.style.top = (this.Border.Size.Top + this.Padding + yP) + 'px';
                this.DIVCaption.style.top = (this.Border.Size.Top + this.Padding + yP + szImg.Height + this.Spacing) + 'px';
            }
            break;
        default:
            this.DIVCaption.style.left = (oX - (szLab.Width / 2)) + 'px';
            this.DIVCaption.style.top = (oY - (szLab.Height / 2)) + 'px';
            this.DIVImage.style.left = (oX - (szImg.Width / 2)) + 'px';
            this.DIVImage.style.top = (oY - (szImg.Height / 2)) + 'px';
            /*this.DIVImage.style.left = ((this.DispRect.Width / 2) - (szImg.Width / 2)) + 'px';
            this.DIVImage.style.top = ((this.DispRect.Height / 2) - (szImg.Height / 2)) + 'px';
            this.DIVCaption.style.left = ((this.DispRect.Width / 2) - (szLab.Width / 2)) + 'px';
            this.DIVCaption.style.top = ((this.DispRect.Height / 2) - (szLab.Height / 2)) + 'px';*/
            break;
    }
    
    this.Border.Render();
}

cControlButton.prototype = new cControl;
cControlButton.prototype.constructor = cControlButton;

cControlButton.prototype.Dispose = cControlButton_Dispose;
cControlButton.prototype.Initialize = cControlButton_Initialize;
cControlButton.prototype.ObjectLoad = cControlButton_ObjectLoad;
cControlButton.prototype.ObjectUnLoad = cControlButton_ObjectUnLoad;
cControlButton.prototype.CalcClient = cControlButton_CalcClient;
cControlButton.prototype.RenderPosition = cControlButton_RenderPosition;
cControlButton.prototype.Resized = cControlButton_Resized;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cControlContainer(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, orientation, xscrolling, yscrolling, defaultalign, defaultvalign) {
    this.TypeOf = 'Container';
    this.Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, orientation, xscrolling, yscrolling, defaultalign, defaultvalign);
}
function cControlContainer_Dispose() {
    this.Clear();
    delete this.Calc.Size;
    delete this.Calc.MinimumSize;
    delete this.Calc.FixedSize;
    delete this.Calc.StretchSize;
    delete this.Calc.StretchPreCalcSize;
    delete this.Calc;
    delete this.Scrolling;
    this.ControlDispose();
    delete this.Controls;
    this.Controls = null;
}
function cControlContainer_Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, orientation, xscrolling, yscrolling, defaultalign, defaultvalign) {
    this.ControlInitialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign);
    this.TypeOf = 'Container';
    this.IsContainer = true;
    this.LocalClient = false;
    this.Orientation = orientation;
    this.DefaultAlign = defaultalign;
    this.DefaultVAlign = defaultvalign;
    this.Calc = new Object();
    this.Calc.Size = new cWCord(0, 0);
    this.Calc.MinimumSize = new cWCord(0, 0);
    this.Calc.FixedSize = new cWCord(0, 0);
    this.Calc.StretchSize = new cWCord(0, 0);
    this.Calc.StretchPreCalcSize = new cWCord(0, 0);
    this.Calc.Offset = 0;
    this.Scrolling = new Object();
    this.Scrolling.X = xscrolling;
    this.Scrolling.Y = yscrolling;
    this.Controls = new Array();    //cControl
}
function cControlContainer_ObjectLoad() {
    this.DIVClient = document.createElement('div');
    this.DIVClient.setAttribute('id', 'divCtlClient_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.ID);
    this.DIVClient.style.display = 'block';
    this.DIVClient.style.position = 'absolute';
    this.DIVClient.style.overflow = 'hidden';
    this.DIVClient.style.border = '0px';
    this.DIVClient.style.margin = '0px';
    this.DIVClient.style.padding = '0px';
    this.DIVScroller = document.createElement('div');
    this.DIVScroller.setAttribute('id', 'divCtlScroller_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.ID);
    this.DIVScroller.style.display = 'block';
    this.DIVScroller.style.position = 'absolute';
    this.DIVScroller.style.overflow = 'hidden';
    this.DIVScroller.style.border = '0px';
    this.DIVScroller.style.margin = '0px';
    this.DIVScroller.style.padding = '0px';
        this.DIVScroller.appendChild(this.DIVClient);
    this.Parent.DIVClient.appendChild(this.DIVScroller);
    
    if(this.Controls.length > 0) {
        for(var i = 0; i < this.Controls.length; i++) {
            this.Controls[i].Load();
        }
    }
}
function cControlContainer_ObjectUnLoad() {
    if(this.Controls.length > 0) {
        for(var i = 0; i < this.Controls.length; i++) {
            this.Controls[i].UnLoad();
        }
    }
        this.DIVScroller.removeChild(this.DIVClient);
    this.Parent.DIVClient.removeChild(this.DIVScroller);
}
function cControlContainer_Add(configArray, delayrender) {
    if(configArray.length > 0) {
        var c = null;
        switch(configArray[0].toLowerCase()) {
            case 'button':
                if(configArray.length > 15) {
                    c = new cControlButton(this.ParentWindow, this, this.GetFreeControlID(), configArray[1], configArray[2][0], configArray[2][1], configArray[3][0], configArray[3][1], configArray[4][0], configArray[4][1], (configArray[5] == '1'), GetAlignmentFromString(configArray[6]), GetVerticalAlignmentFromString(configArray[7]), configArray[8], GetOrientationFromString(configArray[9]), (configArray[10] == '1'), configArray[11], configArray[12], configArray[13], new cFont(configArray[14]), new cImage(configArray[15]));
                    this.Controls.push(c);
                    if(this.Loaded == true) { c.Load(delayrender); }
                }
                break;
            case 'container':
                if(configArray.length > 11) {
                    c = new cControlContainer(this.ParentWindow, this, this.GetFreeControlID(), configArray[1], configArray[2][0], configArray[2][1], configArray[3][0], configArray[3][1], configArray[4][0], configArray[4][1], (configArray[5] == '1'), GetAlignmentFromString(configArray[6]), GetVerticalAlignmentFromString(configArray[7]), GetOrientationFromString(configArray[8]), (configArray[9][0] == '1'), (configArray[9][1] == '1'), GetAlignmentFromString(configArray[10]), GetVerticalAlignmentFromString(configArray[11]));
                    this.Controls.push(c);
                    if(this.Loaded == true) { c.Load(delayrender); }
                    if(configArray.length > 12) { c.AddIn(configArray[12], delayrender); }
                }
                break;
            case 'image':
                if(configArray.length > 10) {
                    c = new cControlImage(this.ParentWindow, this, this.GetFreeControlID(), configArray[1], configArray[2][0], configArray[2][1], configArray[3][0], configArray[3][1], configArray[4][0], configArray[4][1], (configArray[5] == '1'), GetAlignmentFromString(configArray[6]), GetVerticalAlignmentFromString(configArray[7]), configArray[8], configArray[9], configArray[10]);
                    this.Controls.push(c);
                    if(this.Loaded == true) { c.Load(delayrender); }
                }
                break;
            case 'label':
                if(configArray.length > 9) {
                    c = new cControlLabel(this.ParentWindow, this, this.GetFreeControlID(), configArray[1], configArray[2][0], configArray[2][1], configArray[3][0], configArray[3][1], configArray[4][0], configArray[4][1], (configArray[5] == '1'), GetAlignmentFromString(configArray[6]), GetVerticalAlignmentFromString(configArray[7]), configArray[8], new cFont(configArray[9]));
                    this.Controls.push(c);
                    if(this.Loaded == true) { c.Load(delayrender); }
                }
                break;
            case 'datagrid':
                if(configArray.length > 7) {
                    c = new cControlDataGrid(this.ParentWindow, this, this.GetFreeControlID(), configArray[1], configArray[2][0], configArray[2][1], configArray[3][0], configArray[3][1], configArray[4][0], configArray[4][1], (configArray[5] == '1'), GetAlignmentFromString(configArray[6]), GetVerticalAlignmentFromString(configArray[7]));
                    this.Controls.push(c);
                    if(this.Loaded == true) { c.Load(delayrender); }
                }
                break;
            default:
                if(configArray[0].length > 6) {
                    if(configArray[0].toLowerCase().substring(0, 4) == 'app_') {
                        setTimeout('var s = Browser.GetSession('+this.ParentWindow.Parent.ID+'); var w = s.GetWindow('+this.ParentWindow.ID+'); var cc = w.Controls.Get('+this.ID+'); var c = new '+configArray[0]+'(w, cc, cc.GetFreeControlID(), \''+configArray[1].replace('\'', '\\\'')+'\', \''+configArray[2][0].replace('\'', '\\\'')+'\', \''+configArray[2][1].replace('\'', '\\\'')+'\', \''+configArray[3][0].replace('\'', '\\\'')+'\', \''+configArray[3][1].replace('\'', '\\\'')+'\', \''+configArray[4][0].replace('\'', '\\\'')+'\', \''+configArray[4][1].replace('\'', '\\\'')+'\', (\''+configArray[5].replace('\'', '\\\'')+'\' == \'1\'), GetAlignmentFromString(\''+configArray[6].replace('\'', '\\\'')+'\'), GetVerticalAlignmentFromString(\''+configArray[7].replace('\'', '\\\'')+'\')); cc.Controls.push(c); if(cc.Loaded == true) { c.Load(\''+(delayrender ? '1' : '0')+'\' == \'1\'); } cc.ClientChanged(); if(\''+(delayrender ? '1' : '0')+'\' != \'1\') { cc.Render(); }', 1);
                    }
                }
        }
    }
    this.ClientChanged();
    if(!delayrender) { this.Render(); }
}
function cControlContainer_AddIn(configArray, delayrender) {
    if(configArray.length > 0) {
        for(var i = 0; i < configArray.length; i++) {
            this.Add(configArray[i], true);
        }
    }
    this.ClientChanged();
    if(delayrender != true) { this.Render(); }
}
function cControlContainer_GetDefaultAlign() {
    if(this.DefaultAlign != eCCAlign.Default) {
        return(this.DefaultAlign);
    } else {
        return(this.Parent.GetDefaultAlign());
    }
}
function cControlContainer_GetDefaultVAlign() {
    if(this.DefaultVAlign != eCCVAlign.Default) {
        return(this.DefaultVAlign);
    } else {
        return(this.Parent.GetDefaultVAlign());
    }
}
function cControlContainer_CalcClient(precalc) {
    var c = new Object();
    var x = 0; var y = 0;
    c.Size = new cWCord(0, 0);
    c.MinimumSize = new cWCord(0, 0);
    c.FixedSize = new cWCord(0, 0);
    c.StretchSize = new cWCord(0, 0);
    c.StretchPreCalcSize = new cWCord(0, 0);
    c.PrefSize = new cWCord(0, 0);
    if(this.Controls.length > 0) {
        switch(this.Orientation) {
            case eCCOrientation.Horizontal:
                for(var i = 0; i < this.Controls.length; i++) {
                    if(this.Controls[i].bClientChanged == true) { this.Controls[i].CalcClient(true); }
                    if(this.Controls[i].IsContainer == true) {
                        x = GetAlignmentCords(this.Controls[i].Align, this.GetDefaultAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.X, this.Controls[i].Size.X, this.Controls[i].PrefSize.X, this.Controls[i].MinimumSize.X, 0, this.AllowedRect.Width);
                        y = GetVerticalAlignmentCords(this.Controls[i].VAlign, this.GetDefaultVAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.Y, this.Controls[i].Size.Y, this.Controls[i].PrefSize.Y, this.Controls[i].MinimumSize.Y, 0, this.AllowedRect.Height);
                    } else {
                        x = GetAlignmentCords(this.Controls[i].Align, this.GetDefaultAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.X, this.Controls[i].Size.X, this.Controls[i].PrefSize.X, this.Controls[i].MinimumSize.X, 0, this.AllowedRect.Width);
                        y = GetVerticalAlignmentCords(this.Controls[i].VAlign, this.GetDefaultVAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.Y, this.Controls[i].Size.Y, this.Controls[i].PrefSize.Y, this.Controls[i].MinimumSize.Y, 0, this.AllowedRect.Height);
                    }
                    c.Size.X = c.Size.X + x.FixedWidth + x.StretchWidth;
                    c.FixedSize.X = c.FixedSize.X + x.FixedWidth;
                    c.StretchSize.X = c.StretchSize.X + x.StretchWidth;
                    c.StretchPreCalcSize.X = c.StretchPreCalcSize.X + x.StretchPreCalcWidth;
                    c.MinimumSize.X = c.MinimumSize.X + x.MinWidth;
                    c.PrefSize.X = c.PrefSize.X + this.Controls[i].PrefSize.X;
                    this.Controls[i].StretchPreCalcWidth = x.StretchPreCalcWidth;
                    if((i == 0) || ((y.FixedHeight + y.StretchHeight) > c.Size.Y)) { c.Size.Y = y.FixedHeight + y.StretchHeight; }
                    if((i == 0) || (y.FixedHeight > c.FixedSize.Y)) { c.FixedSize.Y = y.FixedHeight; }
                    if((i == 0) || (y.StretchHeight > c.StretchSize.Y)) { c.StretchSize.Y = y.StretchHeight; }
                    if((i == 0) || (y.StretchPreCalcHeight > c.StretchPreCalcSize.Y)) { c.StretchPreCalcSize.Y = y.StretchPreCalcHeight; }
                    if((i == 0) || (y.MinHeight > c.MinimumSize.Y)) { c.MinimumSize.Y = y.MinHeight; }
                    if((i == 0) || (this.Controls[i].PrefSize.Y > c.PrefSize.Y)) { c.PrefSize.Y = this.Controls[i].PrefSize.Y; }
                    delete x; delete y;
                }
                break;
            case eCCOrientation.Vertical:
                for(var i = 0; i < this.Controls.length; i++) {
                    if(this.Controls[i].bClientChanged == true) { this.Controls[i].CalcClient(true); }
                    if(this.Controls[i].IsContainer == true) {
                        x = GetAlignmentCords(this.Controls[i].Align, this.GetDefaultAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.X, this.Controls[i].Size.X, this.Controls[i].PrefSize.X, this.Controls[i].MinimumSize.X, 0, this.AllowedRect.Width);
                        y = GetVerticalAlignmentCords(this.Controls[i].VAlign, this.GetDefaultVAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.Y, this.Controls[i].Size.Y, this.Controls[i].PrefSize.Y, this.Controls[i].MinimumSize.Y, 0, this.AllowedRect.Height);
                    } else {
                        x = GetAlignmentCords(this.Controls[i].Align, this.GetDefaultAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.X, this.Controls[i].Size.X, this.Controls[i].PrefSize.X, this.Controls[i].MinimumSize.X, 0, this.AllowedRect.Width);
                        y = GetVerticalAlignmentCords(this.Controls[i].VAlign, this.GetDefaultVAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.Y, this.Controls[i].Size.Y, this.Controls[i].PrefSize.Y, this.Controls[i].MinimumSize.Y, 0, this.AllowedRect.Height);
                    }
                    if((i == 0) || ((x.FixedWidth + x.StretchWidth) > c.Size.X)) { c.Size.X = x.FixedWidth + x.StretchWidth; }
                    if((i == 0) || (x.FixedWidth > c.FixedSize.X)) { c.FixedSize.X = x.FixedWidth; }
                    if((i == 0) || (x.StretchWidth > c.StretchSize.X)) { c.StretchSize.X = x.StretchWidth; }
                    if((i == 0) || (x.StretchPreCalcWidth > c.StretchPreCalcSize.X)) { c.StretchPreCalcSize.X = x.StretchPreCalcWidth; }
                    if((i == 0) || (x.MinWidth > c.MinimumSize.X)) { c.MinimumSize.X = x.MinWidth; }
                    if((i == 0) || (this.Controls[i].PrefSize.X > c.PrefSize.X)) { c.PrefSize.X = this.Controls[i].PrefSize.X; }
                    c.Size.Y = c.Size.Y + y.FixedHeight + y.StretchHeight;
                    c.FixedSize.Y = c.FixedSize.Y + y.FixedHeight;
                    c.StretchSize.Y = c.StretchSize.Y + y.StretchHeight;
                    c.StretchPreCalcSize.Y = c.StretchPreCalcSize.Y + y.StretchPreCalcHeight;
                    c.MinimumSize.Y = c.MinimumSize.Y + y.MinHeight;
                    c.PrefSize.Y = c.PrefSize.Y + this.Controls[i].PrefSize.Y;
                    this.Controls[i].StretchPreCalcHeight = y.StretchPreCalcHeight;
                    delete x; delete y;
                }
                break;
            default:
                for(var i = 0; i < this.Controls.length; i++) {
                    if(this.Controls[i].bClientChanged == true) { this.Controls[i].CalcClient(true); }
                    if(this.Controls[i].IsContainer == true) {
                        x = GetAlignmentCords(this.Controls[i].Align, this.GetDefaultAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.X, this.Controls[i].Size.X, this.Controls[i].PrefSize.X, this.Controls[i].MinimumSize.X, 0, this.AllowedRect.Width);
                        y = GetVerticalAlignmentCords(this.Controls[i].VAlign, this.GetDefaultVAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.Y, this.Controls[i].Size.Y, this.Controls[i].PrefSize.Y, this.Controls[i].MinimumSize.Y, 0, this.AllowedRect.Height);
                    } else {
                        x = GetAlignmentCords(this.Controls[i].Align, this.GetDefaultAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.X, this.Controls[i].Size.X, this.Controls[i].PrefSize.X, this.Controls[i].MinimumSize.X, 0, this.AllowedRect.Width);
                        y = GetVerticalAlignmentCords(this.Controls[i].VAlign, this.GetDefaultVAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.Y, this.Controls[i].Size.Y, this.Controls[i].PrefSize.Y, this.Controls[i].MinimumSize.Y, 0, this.AllowedRect.Height);
                    }
                    if((i == 0) || ((x.FixedWidth + x.StretchWidth) > c.Size.X)) { c.Size.X = x.FixedWidth + x.StretchWidth; }
                    if((i == 0) || (x.FixedWidth > c.FixedSize.X)) { c.FixedSize.X = x.FixedWidth; }
                    if((i == 0) || (x.StretchWidth > c.StretchSize.X)) { c.StretchSize.X = x.StretchWidth; }
                    if((i == 0) || (x.StretchPreCalcWidth > c.StretchPreCalcSize.X)) { c.StretchPreCalcSize.X = x.StretchPreCalcWidth; }
                    if((i == 0) || (x.MinWidth > c.MinimumSize.X)) { c.MinimumSize.X = x.MinWidth; }
                    this.Controls[i].StretchPreCalcWidth = x.StretchPreCalcWidth;
                    if((i == 0) || ((x.X + this.Controls[i].PrefSize.X) > c.PrefSize.X)) { c.PrefSize.X = (x.X + this.Controls[i].PrefSize.X); }
                    if((i == 0) || ((y.FixedHeight + y.StretchHeight)) > c.Size.Y) { c.Size.Y = y.FixedHeight + y.StretchHeight; }
                    if((i == 0) || (y.FixedHeight > c.FixedSize.Y)) { c.FixedSize.Y = y.FixedHeight; }
                    if((i == 0) || (y.StretchHeight > c.StretchSize.Y)) { c.StretchSize.Y = y.StretchHeight; }
                    if((i == 0) || (y.StretchPreCalcHeight > c.StretchPreCalcSize.Y)) { c.StretchPreCalcSize.Y = y.StretchPreCalcHeight; }
                    if((i == 0) || (y.MinHeight > c.MinimumSize.Y)) { c.MinimumSize.Y = y.MinHeight; }
                    this.Controls[i].StretchPreCalcHeight = y.StretchPreCalcHeight;
                    if((i == 0) || ((y.Y + this.Controls[i].PrefSize.Y) > c.PrefSize.Y)) { c.PrefSize.Y = (y.Y + this.Controls[i].PrefSize.Y); }
                    delete x; delete y;
                }
                break;
        }
    }
    this.Calc.MinimumSize.X = c.MinimumSize.X;
    this.Calc.MinimumSize.Y = c.MinimumSize.Y;
    this.Calc.FixedSize.X = c.FixedSize.X;
    this.Calc.FixedSize.Y = c.FixedSize.Y;
    //if(this.Align = eCCAlign.Stretch) { this.Calc.StretchSize.X = this.AllowedRect.Width - c.FixedSize.X; }
    //else { 
    this.Calc.StretchSize.X = c.StretchSize.X;// }
    //if(this.VAlign = eCCVAlign.Stretch) { this.Calc.StretchSize.Y = this.AllowedRect.Height - c.FixedSize.Y; }
    //else { 
    this.Calc.StretchSize.Y = c.StretchSize.Y;// }
    this.Calc.StretchPreCalcSize.X = c.StretchPreCalcSize.X;
    this.Calc.StretchPreCalcSize.Y = c.StretchPreCalcSize.Y;
    this.Calc.Size.X = c.FixedSize.X + this.Calc.StretchSize.X;
    this.Calc.Size.Y = c.FixedSize.Y + this.Calc.StretchSize.Y;
    this.PrefSize.X = c.PrefSize.X;
    this.PrefSize.Y = c.PrefSize.Y;
    delete c.Size;
    delete c.MinimumSize;
    delete c.FixedSize;
    delete c.StretchSize;
    delete c.StretchPreCalcSize;
    delete c.PrefSize;
    delete c;
    //if(this.ParentWindow.Caption == 'Test Window') { alert('{'+this.ID+'} ||||| ('+this.AllowedRect.X+', '+this.AllowedRect.Y+')-('+this.AllowedRect.Width+', '+this.AllowedRect.Height+')=('+this.DispRect.X+', '+this.DispRect.Y+')-('+this.DispRect.Width+', '+this.DispRect.Height+')=('+this.Calc.Size.X+', '+this.Calc.Size.Y+')-('+this.Calc.MinimumSize.X+', '+this.Calc.MinimumSize.Y+')-('+this.Calc.FixedSize.X+', '+this.Calc.FixedSize.Y+')=('+this.PrefSize.X+', '+this.PrefSize.Y+')'); }
    this.bClientChanged = false;
    if(precalc != true) { this.CalcRender(); }
    //this.Parent.CalcClient();
}
function cControlContainer_Clear() {
    if(this.Controls.length > 0) {
        for(var i = this.Controls.length - 1; i > 0; i--) {
            this.Controls[i].Dispose();
            delete this.Controls[i];
        }
        this.Controls = [];
        this.ClientChanged();
    }
}
function cControlContainer_Get(id) {
    if(id < 0) { return(null); }
    if(this.ID == id) { return(this); }
    if(this.Controls.length > 0) {
        var vO = null;
        for(var i = this.Controls.length - 1; i >= 0; i--) {
            vO = this.Controls[i].Get(id);
            if(vO != null) {
                return(vO);
            }
        }
    }
    return(null);
}
function cControlContainer_GetByName(name) {
    if(name.length < 1) { return(null); }
    if(this.Name == name) { return(this); }
    if(this.Controls.length > 0) {
        var vO = null;
        for(var i = this.Controls.length - 1; i >= 0; i--) {
            vO = this.Controls[i].GetByName(name);
            if(vO != null) {
                return(vO);
            }
        }
    }
    return(null);
}
function cControlContainer_GetFreeControlID() {
    return(this.ParentWindow.GetFreeControlID());
}
function cControlContainer_Remove(id) {
    if(id < 0) { return(null); }
    var bHit = false;
    if(this.Controls.length > 0) {
        for(var i = this.Controls.length - 1; i > 0; i--) {
            if(this.Controls[i].IsContainer == true) { this.Controls[i].Remove(id); }
            if(bHit == true) {
                this.Controls[i] = this.Controls[i - 1];
            } else {
                if(this.Controls[i].ID == id) {
                    this.Controls[i].Dispose();
                    this.Controls[i] = this.Controls[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.Controls[0].ID == id) {
                this.Controls[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.Controls.shift();
            this.ClientChanged();
        }
    }
}
function cControlContainer_RemoveByName(name) {
    if(name.length < 1) { return(null); }
    var bHit = false;
    if(this.Controls.length > 0) {
        for(var i = this.Controls.length - 1; i > 0; i--) {
            if(this.Controls[i].IsContainer == true) { this.Controls[i].RemoveByName(name); }
            if(bHit == true) {
                this.Controls[i] = this.Controls[i - 1];
            } else {
                if(this.Controls[i].Name == name) {
                    this.Controls[i].Dispose();
                    this.Controls[i] = this.Controls[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.Controls[0].Name == name) {
                this.Controls[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.Controls.shift();
            this.ClientChanged();
        }
    }
}
function cControlContainer_RenderPosition(precalc) {
    if(precalc != true) { this.CalcRender(); }
    this.DIVScroller.style.left = this.AllowedRect.X + 'px';
    this.DIVScroller.style.top = this.AllowedRect.Y + 'px';
    this.DIVClient.style.left = this.DispRect.X + 'px';
    this.DIVClient.style.top = this.DispRect.Y + 'px';
}
function cControlContainer_Resized(precalc) {
    if(precalc != true) { this.CalcRender(); }
    this.DIVScroller.style.width = this.AllowedRect.Width + 'px';
    this.DIVScroller.style.height = this.AllowedRect.Height + 'px';
    this.DIVClient.style.width = this.DispRect.Width + 'px';
    this.DIVClient.style.height = this.DispRect.Height + 'px';
    this.Calc.Offset = 0;
    if(this.Align == eCCAlign.Default) { this.Align = this.Parent.DefaultAlign; }
    if(this.VAlign == eCCVAlign.Default) { this.VAlign = this.Parent.DefaultVAlign; }
    if(this.Controls.length > 0) {
        switch(this.Orientation) {
            case eCCOrientation.Horizontal:
                for(var i = 0; i < this.Controls.length; i++) {
                    if(this.Controls[i].bClientChanged == true) { this.Controls[i].CalcClient(true); }
                    if(this.Controls[i].Align == eCCAlign.Default) { this.Controls[i].Align = this.GetDefaultAlign(); }
                    if(this.Controls[i].VAlign == eCCVAlign.Default) { this.Controls[i].VAlign = this.GetDefaultVAlign(); }
                    if(this.Controls[i].IsContainer == true) {
                        x = GetAlignmentCords(this.Controls[i].Align, this.GetDefaultAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.X, this.Controls[i].Calc.Size.X, this.Controls[i].PrefSize.X, this.Controls[i].MinimumSize.X, this.DispRect.X, this.DispRect.Width);
                        y = GetVerticalAlignmentCords(this.Controls[i].VAlign, this.GetDefaultVAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.Y, this.Controls[i].Calc.Size.Y, this.Controls[i].PrefSize.Y, this.Controls[i].MinimumSize.Y, this.DispRect.Y, this.DispRect.Height);
                    } else {
                        x = GetAlignmentCords(this.Controls[i].Align, this.GetDefaultAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.X, this.Controls[i].Size.X, this.Controls[i].PrefSize.X, this.Controls[i].MinimumSize.X, this.DispRect.X, this.DispRect.Width);
                        y = GetVerticalAlignmentCords(this.Controls[i].VAlign, this.GetDefaultVAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.Y, this.Controls[i].Size.Y, this.Controls[i].PrefSize.Y, this.Controls[i].MinimumSize.Y, this.DispRect.Y, this.DispRect.Height);
                    }
                    if(i == 0) {
                        this.Controls[i].AllowedRect.X = 0;
                    } else {
                        this.Controls[i].AllowedRect.X = parseInt(this.Calc.Offset) - 0;
                    }
                    this.Controls[i].AllowedRect.Y = 0;
                    this.Controls[i].AllowedRect.Height = this.DispRect.Height - 0;
                    if(this.Controls[i].FixedSize == true) {
                        this.Controls[i].AllowedRect.Width = x.FixedWidth - 0;
                    } else {
                        if(this.Align = eCCAlign.Stretch) {
                            this.Controls[i].AllowedRect.Width = (this.DispRect.Width - this.Calc.FixedSize.X) * (this.Controls[i].StretchPreCalcWidth / this.Calc.StretchPreCalcSize.X);
                        } else {
                            this.Controls[i].AllowedRect.Width = this.Controls[i].PrefSize.X - 0;
                        }
                    }
                    if(isNaN(this.Controls[i].AllowedRect.Width)) { this.Controls[i].AllowedRect.Width = this.DispRect.Width; }
                    delete x; delete y;
                    this.Calc.Offset = this.Calc.Offset + this.Controls[i].AllowedRect.Width;
                }
                break;
            case eCCOrientation.Vertical:
                for(var i = 0; i < this.Controls.length; i++) {
                    if(this.Controls[i].bClientChanged == true) { this.Controls[i].CalcClient(true); }
                    if(this.Controls[i].Align == eCCAlign.Default) { this.Controls[i].Align = this.GetDefaultAlign(); }
                    if(this.Controls[i].VAlign == eCCVAlign.Default) { this.Controls[i].VAlign = this.GetDefaultVAlign(); }
                    if(this.Controls[i].IsContainer == true) {
                        x = GetAlignmentCords(this.Controls[i].Align, this.GetDefaultAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.X, this.Controls[i].Calc.Size.X, this.Controls[i].PrefSize.X, this.Controls[i].MinimumSize.X, this.DispRect.X, this.DispRect.Width);
                        y = GetVerticalAlignmentCords(this.Controls[i].VAlign, this.GetDefaultVAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.Y, this.Controls[i].Calc.Size.Y, this.Controls[i].PrefSize.Y, this.Controls[i].MinimumSize.Y, this.DispRect.Y, this.DispRect.Height);
                    } else {
                        x = GetAlignmentCords(this.Controls[i].Align, this.GetDefaultAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.X, this.Controls[i].Size.X, this.Controls[i].PrefSize.X, this.Controls[i].MinimumSize.X, this.DispRect.X, this.DispRect.Width);
                        y = GetVerticalAlignmentCords(this.Controls[i].VAlign, this.GetDefaultVAlign(), this.Controls[i].FixedSize, this.Controls[i].Position.Y, this.Controls[i].Size.Y, this.Controls[i].PrefSize.Y, this.Controls[i].MinimumSize.Y, this.DispRect.Y, this.DispRect.Height);
                    }
                    this.Controls[i].AllowedRect.X = 0;
                    if(i == 0) {
                        this.Controls[i].AllowedRect.Y = 0;
                    } else {
                        this.Controls[i].AllowedRect.Y = parseInt(this.Calc.Offset) - 0;
                    }
                    this.Controls[i].AllowedRect.Width = this.DispRect.Width - 0;
                    if(this.Controls[i].FixedSize == true) {
                        this.Controls[i].AllowedRect.Height = y.FixedHeight - 0;
                    } else {
                        if(this.VAlign = eCCVAlign.Stretch) {
                            this.Controls[i].AllowedRect.Height = (this.DispRect.Height - this.Calc.FixedSize.Y) * (this.Controls[i].StretchPreCalcHeight / this.Calc.StretchPreCalcSize.Y);
                        } else {
                            this.Controls[i].AllowedRect.Height = this.Controls[i].PrefSize.Y - 0;
                        }
                    }
                    if(isNaN(this.Controls[i].AllowedRect.Height)) { this.Controls[i].AllowedRect.Height = this.DispRect.Height; }
                    delete x; delete y;
                    this.Calc.Offset = this.Calc.Offset + this.Controls[i].AllowedRect.Height;
                }
                break;
            default:
                for(var i = 0; i < this.Controls.length; i++) {
                    if(this.Controls[i].bClientChanged == true) { this.Controls[i].CalcClient(true); }
                    if(this.Controls[i].Align == eCCAlign.Default) { this.Controls[i].Align = this.GetDefaultAlign(); }
                    if(this.Controls[i].VAlign == eCCVAlign.Default) { this.Controls[i].VAlign = this.GetDefaultVAlign(); }
                    this.Controls[i].AllowedRect.X = 0;
                    this.Controls[i].AllowedRect.Y = 0;
                    this.Controls[i].AllowedRect.Width = this.DispRect.Width - 0;
                    this.Controls[i].AllowedRect.Height = this.DispRect.Height - 0;
                }
                break;
        }
    }
    for(var i = 0; i < this.Controls.length; i++) {
        this.Controls[i].Render();
    }
}

cControlContainer.prototype = new cControl;
cControlContainer.prototype.constructor = cControlContainer;

cControlContainer.prototype.Dispose = cControlContainer_Dispose;
cControlContainer.prototype.Initialize = cControlContainer_Initialize;
cControlContainer.prototype.ObjectLoad = cControlContainer_ObjectLoad;
cControlContainer.prototype.ObjectUnLoad = cControlContainer_ObjectUnLoad;
cControlContainer.prototype.Add = cControlContainer_Add;
cControlContainer.prototype.AddIn = cControlContainer_AddIn;
cControlContainer.prototype.CalcClient = cControlContainer_CalcClient;
cControlContainer.prototype.Clear = cControlContainer_Clear;
cControlContainer.prototype.Get = cControlContainer_Get;
cControlContainer.prototype.GetByName = cControlContainer_GetByName;
cControlContainer.prototype.GetDefaultAlign = cControlContainer_GetDefaultAlign;
cControlContainer.prototype.GetDefaultVAlign = cControlContainer_GetDefaultVAlign;
cControlContainer.prototype.GetFreeControlID = cControlContainer_GetFreeControlID;
cControlContainer.prototype.Remove = cControlContainer_Remove;
cControlContainer.prototype.RemoveByName = cControlContainer_RemoveByName;
cControlContainer.prototype.RenderPosition = cControlContainer_RenderPosition;
cControlContainer.prototype.Resized = cControlContainer_Resized;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cControlDataGrid(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign) {
    this.TypeOf = 'DataGrid';
    this.Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign);
}
function cControlDataGrid_Dispose() {
    this.ControlDispose();
}
function cControlDataGrid_CalcClient(precalc) {
    this.PrefSize.X = -1;
    this.PrefSize.Y = -1;
    this.bClientChanged = false;
    if(precalc != true) { this.CalcRender(); }
}
function cControlDataGrid_Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign) {
    this.ControlInitialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign);
    this.TypeOf = 'DataGrid';
    this.Border = new cControlBorder(this.ParentWindow, this, GetBorderStyleFromString('sz'), false);
}
function cControlDataGrid_ObjectLoad() {
    this.DIVClient = document.createElement('div');
    this.DIVClient.setAttribute('id', 'divCtlClient_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.ID);
    
    this.Parent.DIVClient.appendChild(this.DIVClient);
    this.DIVClient.style.display = 'block';
    this.DIVClient.style.position = 'absolute';
    this.DIVClient.style.overflow = 'hidden';
    this.DIVClient.style.border = '0px';
    this.DIVClient.style.margin = '0px';
    this.DIVClient.style.padding = '0px';
    
    this.Border.Load();
    
    //this.DataBinding = new cDataBinding
}
function cControlDataGrid_ObjectUnLoad() {
    this.Parent.DIVClient.removeChild(this.DIVClient);
}
function cControlDataGrid_RenderPosition(precalc) {
    if(precalc != true) { this.CalcRender(); }
    this.DIVClient.style.left = this.DispRect.X + 'px';
    this.DIVClient.style.top = this.DispRect.Y + 'px';
}
function cControlDataGrid_Resized(precalc) {
    if(precalc != true) { this.CalcRender(); }
    this.DIVClient.style.width = this.DispRect.Width+ 'px';
    this.DIVClient.style.height = this.DispRect.Height + 'px';
    this.Border.Render();
}

cControlDataGrid.prototype = new cControl();
cControlDataGrid.prototype.constructor = cControlDataGrid;

cControlDataGrid.prototype.Dispose = cControlDataGrid_Dispose;
cControlDataGrid.prototype.CalcClient = cControlDataGrid_CalcClient;
cControlDataGrid.prototype.Initialize = cControlDataGrid_Initialize;
cControlDataGrid.prototype.ObjectLoad = cControlDataGrid_ObjectLoad;
cControlDataGrid.prototype.ObjectUnLoad = cControlDataGrid_ObjectUnLoad;
cControlDataGrid.prototype.RenderPosition = cControlDataGrid_RenderPosition;
cControlDataGrid.prototype.Resized = cControlDataGrid_Resized;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cControlDataGridRow(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize) {
    this.TypeOf = 'DataGridRow';
    this.Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize);
}
function cControlDataGridRow_Dispose() {
    this.ControlDispose();
}
function cControlDataGridRow_CalcClient(precalc) {
    this.PrefSize.X = -1;
    this.PrefSize.Y = -1;
    this.bClientChanged = false;
    if(precalc != true) { this.CalcRender(); }
}
function cControlDataGridRow_Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize) {
    this.ControlInitialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize);
    this.TypeOf = 'DataGridRow';
}

function cControlDataGridRow_ObjectLoad() {
    this.DIVClient = document.createElement('div');
    this.DIVClient.setAttribute('id', 'divCtlClient_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.ID);
    this.Parent.DIVClient.appendChild(this.DIVClient);
    this.DIVClient.style.position = 'absolute';
}
function cControlDataGridRow_ObjectUnLoad() {
    this.Parent.DIVClient.removeChild(this.DIVClient);
}
function cControlDataGridRow_RenderPosition(precalc) {
    if(precalc != true) { this.CalcRender(); }
    this.DIVClient.style.left = this.DispRect.X + 'px';
    this.DIVClient.style.top = this.DispRect.Y + 'px';
}
function cControlDataGridRow_Resized(precalc) {
    if(precalc != true) { this.CalcRender(); }
    this.DIVClient.style.width = this.DispRect.Width + 'px';
    this.DIVClient.style.height = this.DispRect.Height + 'px';
}

cControlDataGridRow.prototype = new cControl();
cControlDataGridRow.prototype.constructor = cControlDataGridRow;

cControlDataGridRow.prototype.Dispose = cControlDataGridRow_Dispose;
cControlDataGridRow.prototype.CalcClient = cControlDataGridRow_CalcClient;
cControlDataGridRow.prototype.Initialize = cControlDataGridRow_Initialize;
cControlDataGridRow.prototype.ObjectLoad = cControlDataGridRow_ObjectLoad;
cControlDataGridRow.prototype.ObjectUnLoad = cControlDataGridRow_ObjectUnLoad;
cControlDataGridRow.prototype.RenderPosition = cControlDataGridRow_RenderPosition;
cControlDataGridRow.prototype.Resized = cControlDataGridRow_Resized;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cControlHScroll(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, scrollmin, scrollmax, scrollvalue, smallstep, largestep) {
    this.TypeOf = 'HScroll';
    this.Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, scrollmin, scrollmax, scrollvalue, smallstep, largestep);
}
function cControlHScroll_Dispose() {
    this.ControlDispose();
    this.Caption = '';
    if(this.Font) { delete this.Font; }
}
function cControlHScroll_CalcClient(precalc) {
    var sz = Browser.GetTextSize(this.Caption, this.Font.Family, this.Font.Size, this.Font.Weight, this.Font.Decoration, this.Font.Style);
    this.PrefSize.X = sz.Width;
    this.PrefSize.Y = sz.Height;
    this.StretchPreCalcWidth = sz.Width;
    this.StretchPreCalcHeight = sz.Height;
    this.bClientChanged = false;
    if(precalc != true) { this.CalcRender(); }
}
function cControlHScroll_Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, scrollmin, scrollmax, scrollvalue, smallstep, largestep) {
    this.ControlInitialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign);
    this.TypeOf = 'HScroll';
    this.Minimum = scrollmin;
    this.Maximum = scrollmax;
    this.Value = scrollvalue;
    this.SmallStep = smallstep;
    this.LargeStep = largestep;
}

function cControlHScroll_ObjectLoad() {
    this.DIVClient = document.createElement('div');
    this.DIVClient.setAttribute('id', 'divCtlClient_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.ID);
    this.Parent.DIVClient.appendChild(this.DIVClient);
    this.DIVClient.style.position = 'absolute';
    this.DIVClient.style.overflow = 'hidden';
    this.DIVClient.style.border = '0px';
    this.DIVClient.style.margin = '0px';
    this.DIVClient.style.padding = '0px';
    this.DIVClient.innerHTML = this.Caption;
    this.DIVClient.style.backgroundColor = this.Font.BGColor;
    this.DIVClient.style.color = this.Font.Color;
    this.DIVClient.style.fontFamily = this.Font.Family;
    this.DIVClient.style.fontSize = this.Font.Size;
    this.DIVClient.style.fontWeight = this.Font.Weight;
    this.DIVClient.style.textDecoration = this.Font.Decoration;
    this.DIVClient.style.fontStyle = this.Font.Style;
}
function cControlHScroll_ObjectUnLoad() {
    this.Parent.DIVClient.removeChild(this.DIVClient);
}
function cControlHScroll_RenderPosition(precalc) {
    if(precalc != true) { this.CalcRender(); }
    this.DIVClient.style.left = this.DispRect.X + 'px';
    this.DIVClient.style.top = this.DispRect.Y + 'px';
}
function cControlHScroll_Resized(precalc) {
    if(precalc != true) { this.CalcRender(); }
    var sX = this.Size.X + ''; var sY = this.Size.Y + '';
    //alert('Label['+this.Caption+'].GetAlignmentCords('+this.Align+', '+this.Parent.GetDefaultAlign()+', '+this.Position.X+', '+this.Size.X+', '+this.PrefSize.X+', '+this.AllowedRect.X+', '+this.AllowedRect.Width+')-GetVerticalAlignmentCords('+this.VAlign+', '+this.Parent.GetDefaultVAlign()+', '+this.Position.Y+', '+this.Size.Y+', '+this.PrefSize.Y+', '+this.AllowedRect.Y+', '+this.AllowedRect.Height+')');
    this.DIVClient.style.width = this.DispRect.Width + 'px';
    this.DIVClient.style.height = this.DispRect.Height + 'px';
    //alert('Label['+this.Caption+'].('+this.AllowedRect.X+', '+this.AllowedRect.Y+')-('+this.AllowedRect.Width+', '+this.AllowedRect.Height+') = ('+this.DispRect.X+', '+this.DispRect.Y+')-('+this.DispRect.Width+', '+this.DispRect.Height+')');
    //alert('('+sX+', '+sY+')');
    //alert('('+sz.Width+', '+sz.Height+')');
    /*if(sX.indexOf('%') >= 0) {if(this.ParentWindow.Caption == 'Test Window') {alert(this.Size.X);}
        this.DIVClient.style.width = this.Size.X;
    } else if(sX.toLowerCase() == 'auto') {if(this.ParentWindow.Caption == 'Test Window') {alert(sz.Width);}
        this.DIVClient.style.width = sz.Width + 'px';
    } else {if(this.ParentWindow.Caption == 'Test Window') {alert(this.Size.X + 'px');}
        this.DIVClient.style.width = this.Size.X + 'px';
    }
    if(sY.indexOf('%') >= 0) {if(this.ParentWindow.Caption == 'Test Window') {alert(this.Size.Y);}
        this.DIVClient.style.height = this.Size.Y;
    } else if(sY.toLowerCase() == 'auto') {if(this.ParentWindow.Caption == 'Test Window') {alert(sz.Height);}
        this.DIVClient.style.height = sz.Height + 'px';
    } else {if(this.ParentWindow.Caption == 'Test Window') {alert(this.Size.Y + 'px');}
        this.DIVClient.style.height = this.Size.Y + 'px';
    }
    var rect = Browser.GetPosition(this.DIVClient);
    alert('('+rect.X+', '+rect.Y+')-('+rect.Width+', '+rect.Height+')');*/
}

cControlHScroll.prototype = new cControl;
cControlHScroll.prototype.constructor = cControlHScroll;

cControlHScroll.prototype.Dispose = cControlHScroll_Dispose;
cControlHScroll.prototype.CalcClient = cControlHScroll_CalcClient;
cControlHScroll.prototype.Initialize = cControlHScroll_Initialize;
cControlHScroll.prototype.ObjectLoad = cControlHScroll_ObjectLoad;
cControlHScroll.prototype.ObjectUnLoad = cControlHScroll_ObjectUnLoad;
cControlHScroll.prototype.RenderPosition = cControlHScroll_RenderPosition;
cControlHScroll.prototype.Resized = cControlHScroll_Resized;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cControlImage(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, bgcolor, src, repeat) {
    this.TypeOf = 'Image';
    this.Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, bgcolor, src, repeat);
}
function cControlImage_Dispose() {
    this.ControlDispose();
}
function cControlImage_CalcClient(precalc) {
    this.PrefSize.X = GetSizeOfMax(this.Size.X, this.AllowedRect.Width);
    this.PrefSize.Y = GetSizeOfMax(this.Size.Y, this.AllowedRect.Height);
    this.StretchPreCalcWidth = this.PrefSize.X;
    this.StretchPreCalcHeight = this.PrefSize.Y;
    this.bClientChanged = false;
    if(precalc != true) { this.CalcRender(); }
}
function cControlImage_Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, bgcolor, src, repeat) {
    this.ControlInitialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign);
    this.TypeOf = 'Image';
    this.BGColor = bgcolor;
    this.Source = src;
    this.Repeat = repeat;
}

function cControlImage_ObjectLoad() {
    this.DIVClient = document.createElement('span');
    this.DIVClient.setAttribute('id', 'divCtlClient_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.ID);
    this.Parent.DIVClient.appendChild(this.DIVClient);
    this.DIVClient.style.position = 'absolute';
    this.DIVClient.style.overflow = 'hidden';
    this.DIVClient.style.border = '0px';
    this.DIVClient.style.margin = '0px';
    this.DIVClient.style.padding = '0px';
    this.DIVClient.style.backgroundColor = this.BGColor;
    if(this.Source.length > 0) {
        this.DIVClient.style.backgroundImage = 'url('+this.Source+')';
    } else { this.DIVClient.style.backgroundImage = 'none'; }
    this.DIVClient.style.backgroundRepeat = this.Repeat;
}
function cControlImage_ObjectUnLoad() {
    this.Parent.DIVClient.removeChild(this.DIVClient);
}
function cControlImage_RenderPosition(precalc) {
    if(precalc != true) { this.CalcRender(); }
    this.DIVClient.style.left = this.DispRect.X + 'px';
    this.DIVClient.style.top = this.DispRect.Y + 'px';
}
function cControlImage_Resized(precalc) {
    if(precalc != true) { this.CalcRender(); }
    this.DIVClient.style.width = this.DispRect.Width + 'px';
    this.DIVClient.style.height = this.DispRect.Height + 'px';
}
function cControlImage_setSource(src) {
    this.Source = src + '';
    if(this.Source.length > 0) {
        this.DIVClient.style.backgroundImage = 'url('+this.Source+')';
    } else { this.DIVClient.style.backgroundImage = 'none'; }
}

cControlImage.prototype = new cControl;
cControlImage.prototype.constructor = cControlImage;

cControlImage.prototype.Dispose = cControlImage_Dispose;
cControlImage.prototype.CalcClient = cControlImage_CalcClient;
cControlImage.prototype.Initialize = cControlImage_Initialize;
cControlImage.prototype.ObjectLoad = cControlImage_ObjectLoad;
cControlImage.prototype.ObjectUnLoad = cControlImage_ObjectUnLoad;
cControlImage.prototype.RenderPosition = cControlImage_RenderPosition;
cControlImage.prototype.Resized = cControlImage_Resized;
cControlImage.prototype.setSource = cControlImage_setSource;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cControlLabel(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, caption, font) {
    this.TypeOf = 'Label';
    this.Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, caption, font);
}
function cControlLabel_Dispose() {
    this.ControlDispose();
    this.Caption = '';
    if(this.Font) { delete this.Font; }
}
function cControlLabel_CalcClient(precalc) {
    var sz = Browser.GetTextSize(this.Caption, this.Font.Family, this.Font.Size, this.Font.Weight, this.Font.Decoration, this.Font.Style);
    this.PrefSize.X = sz.Width;
    this.PrefSize.Y = sz.Height;
    this.StretchPreCalcWidth = sz.Width;
    this.StretchPreCalcHeight = sz.Height;
    this.bClientChanged = false;
    if(precalc != true) { this.CalcRender(); }
}
function cControlLabel_Initialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign, caption, font) {
    this.ControlInitialize(parentWindow, parent, id, name, x, y, width, height, minwidth, minheight, fixedsize, align, valign);
    this.TypeOf = 'Label';
    this.Caption = caption;
    this.Font = font;
}

function cControlLabel_ObjectLoad() {
    this.DIVClient = document.createElement('span');
    this.DIVClient.setAttribute('id', 'divCtlClient_' + this.ParentWindow.Parent.ID + '_' + this.ParentWindow.ID + '_' + this.ID);
    this.Parent.DIVClient.appendChild(this.DIVClient);
    this.DIVClient.style.position = 'absolute';
    this.DIVClient.style.overflow = 'hidden';
    this.DIVClient.style.border = '0px';
    this.DIVClient.style.margin = '0px';
    this.DIVClient.style.padding = '0px';
    this.DIVClient.innerHTML = this.Caption;
    this.DIVClient.style.backgroundColor = this.Font.BGColor;
    this.DIVClient.style.color = this.Font.Color;
    this.DIVClient.style.fontFamily = this.Font.Family;
    this.DIVClient.style.fontSize = this.Font.Size;
    this.DIVClient.style.fontWeight = this.Font.Weight;
    this.DIVClient.style.textDecoration = this.Font.Decoration;
    this.DIVClient.style.fontStyle = this.Font.Style;
}
function cControlLabel_ObjectUnLoad() {
    this.Parent.DIVClient.removeChild(this.DIVClient);
}
function cControlLabel_RenderPosition(precalc) {
    if(precalc != true) { this.CalcRender(); }
    this.DIVClient.style.left = this.DispRect.X + 'px';
    this.DIVClient.style.top = this.DispRect.Y + 'px';
}
function cControlLabel_Resized(precalc) {
    if(precalc != true) { this.CalcRender(); }
    var sX = this.Size.X + ''; var sY = this.Size.Y + '';
    //alert('Label['+this.Caption+'].GetAlignmentCords('+this.Align+', '+this.Parent.GetDefaultAlign()+', '+this.Position.X+', '+this.Size.X+', '+this.PrefSize.X+', '+this.AllowedRect.X+', '+this.AllowedRect.Width+')-GetVerticalAlignmentCords('+this.VAlign+', '+this.Parent.GetDefaultVAlign()+', '+this.Position.Y+', '+this.Size.Y+', '+this.PrefSize.Y+', '+this.AllowedRect.Y+', '+this.AllowedRect.Height+')');
    this.DIVClient.style.width = this.DispRect.Width + 'px';
    this.DIVClient.style.height = this.DispRect.Height + 'px';
    //alert('Label['+this.Caption+'].('+this.AllowedRect.X+', '+this.AllowedRect.Y+')-('+this.AllowedRect.Width+', '+this.AllowedRect.Height+') = ('+this.DispRect.X+', '+this.DispRect.Y+')-('+this.DispRect.Width+', '+this.DispRect.Height+')');
    //alert('('+sX+', '+sY+')');
    //alert('('+sz.Width+', '+sz.Height+')');
    /*if(sX.indexOf('%') >= 0) {if(this.ParentWindow.Caption == 'Test Window') {alert(this.Size.X);}
        this.DIVClient.style.width = this.Size.X;
    } else if(sX.toLowerCase() == 'auto') {if(this.ParentWindow.Caption == 'Test Window') {alert(sz.Width);}
        this.DIVClient.style.width = sz.Width + 'px';
    } else {if(this.ParentWindow.Caption == 'Test Window') {alert(this.Size.X + 'px');}
        this.DIVClient.style.width = this.Size.X + 'px';
    }
    if(sY.indexOf('%') >= 0) {if(this.ParentWindow.Caption == 'Test Window') {alert(this.Size.Y);}
        this.DIVClient.style.height = this.Size.Y;
    } else if(sY.toLowerCase() == 'auto') {if(this.ParentWindow.Caption == 'Test Window') {alert(sz.Height);}
        this.DIVClient.style.height = sz.Height + 'px';
    } else {if(this.ParentWindow.Caption == 'Test Window') {alert(this.Size.Y + 'px');}
        this.DIVClient.style.height = this.Size.Y + 'px';
    }
    var rect = Browser.GetPosition(this.DIVClient);
    alert('('+rect.X+', '+rect.Y+')-('+rect.Width+', '+rect.Height+')');*/
}

cControlLabel.prototype = new cControl;
cControlLabel.prototype.constructor = cControlLabel;

cControlLabel.prototype.Dispose = cControlLabel_Dispose;
cControlLabel.prototype.CalcClient = cControlLabel_CalcClient;
cControlLabel.prototype.Initialize = cControlLabel_Initialize;
cControlLabel.prototype.ObjectLoad = cControlLabel_ObjectLoad;
cControlLabel.prototype.ObjectUnLoad = cControlLabel_ObjectUnLoad;
cControlLabel.prototype.RenderPosition = cControlLabel_RenderPosition;
cControlLabel.prototype.Resized = cControlLabel_Resized;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cCooldownOverlay(size) {
    this.Size = size;
    this.Active = false;
    this.StartTime = 0;
    this.Cooldown = 0;
    this.OverObject = null;
    
    //X:0, Y:0, Width: 18, Height: 18, Icon:'img/icons/odd/18cooldown_76.png', Count:76
    this.Style = Browser.Style.GetCooldownOverlaySet(size);
    
    this.DIVButton = document.createElement('div');
    this.DIVButton.setAttribute('id', 'divCooldownOverlay_' + size);
    this.DIVButton.style.border = '0px';
    this.DIVButton.style.margin = '0px';
    this.DIVButton.style.padding = '0px';
    this.DIVButton.style.position = 'absolute';
    this.DIVButton.style.display = 'none';
    this.DIVButton.style.visibility = 'hidden';
    this.SPANIcon = document.createElement('span');
    this.SPANIcon.setAttribute('id', 'spnCooldownOverlayIcon_' + size);
    this.SPANIcon.style.border = '0px';
    this.SPANIcon.style.margin = '0px';
    this.SPANIcon.style.padding = '0px';
    this.SPANIcon.style.marginLeft = this.Style.X + 'px';
    this.SPANIcon.style.marginTop = this.Style.Y + 'px';
    this.SPANIcon.style.left = '0px';
    this.SPANIcon.style.top = '0px';
    this.SPANIcon.style.width = this.Style.Width + 'px';
    this.SPANIcon.style.height = this.Style.Height + 'px';
    this.SPANIcon.style.backgroundImage = 'url('+this.Style.Image+')';
    this.SPANIcon.style.display = 'block';
    this.SPANIcon.style.visibility = 'visible';
    this.SPANIcon.style.overflow = 'hidden';

        this.DIVButton.appendChild(this.SPANIcon);
    document.body.appendChild(this.DIVButton);
    
}
function cCooldownOverlay_Dispose() {
        this.DIVButton.removeChild(this.SPANIcon);
    document.body.removeChild(this.DIVButton);
}
function cCooldownOverlay_Hide() {
    this.Active = false;
    this.OverObject = null;
    this.DIVButton.style.display = 'none';
    this.DIVButton.style.visibility = 'hidden';
}
function cCooldownOverlay_Position() {
    if(this.OverObject == null) { return; }
    var p = Browser.GetPosition(this.OverObject);
    if(p == null) { return; }
    this.DIVButton.style.left = (p.X + this.Style.X) + 'px';
    this.DIVButton.style.top = (p.Y + this.Style.Y) + 'px';
    this.DIVButton.style.width = this.Style.Width + 'px';
    this.DIVButton.style.height = this.Style.Height + 'px';
}
function cCooldownOverlay_RenderSize() {
    this.SPANIcon.style.marginLeft = this.Style.X + 'px';
    this.SPANIcon.style.marginTop = this.Style.Y + 'px';
    this.SPANIcon.style.width = this.Style.Width + 'px';
    this.SPANIcon.style.height = this.Style.Height + 'px';
}
function cCooldownOverlay_Show(obj, cooldown) {
    this.TimeoutItr = 0;
    this.OverObject = obj;
    this.RenderSize();
    this.Position();
    this.SPANIcon.style.backgroundPosition = '0px 0px';
    this.SPANIcon.style.visibility = 'visible';
    this.SPANIcon.style.display = 'block';
    this.DIVButton.style.visibility = 'visible';
    this.DIVButton.style.display = 'block';
    this.DIVButton.style.zIndex = 999999;
    var dt = new Date();
    this.StartTime = dt.getTime();
    delete dt;
    this.Cooldown = cooldown;
    this.DIVButton.title = this.OverObject.title + ' - Cooldown in ' + parseInt(this.Cooldown / 1000) + ' seconds'
    setTimeout('Browser.GetCooldownOverlay(' + this.Size + ').Timeout();', parseInt(this.Cooldown / this.Style.Count));
    this.Active = true;
}
function cCooldownOverlay_Timeout() {
    var dt = new Date();
    var CurrentTime = dt.getTime();
    delete dt;
    dt = (CurrentTime - this.StartTime);
    CurrentTime = ((dt / this.Cooldown) * this.Style.Count);
    if(CurrentTime >= (this.Style.Count - 1)) {
        this.Hide();
    } else {
        this.Position();
        this.SPANIcon.style.backgroundPosition = (parseInt(this.Style.Count - CurrentTime) * this.Size) + 'px 0px';
        this.DIVButton.title = this.OverObject.title + ' - Cooldown in ' + parseInt((this.Cooldown - dt) / 1000) + ' seconds'
        setTimeout('Browser.GetCooldownOverlay(' + this.Size + ').Timeout();', parseInt(this.Cooldown / this.Style.Count));
    }
}
cCooldownOverlay.prototype.Dispose = cCooldownOverlay_Dispose;
cCooldownOverlay.prototype.Hide = cCooldownOverlay_Hide;
cCooldownOverlay.prototype.Position = cCooldownOverlay_Position;
cCooldownOverlay.prototype.RenderSize = cCooldownOverlay_RenderSize;
cCooldownOverlay.prototype.Show = cCooldownOverlay_Show;
cCooldownOverlay.prototype.Timeout = cCooldownOverlay_Timeout;/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
    //            
function cDataLink() {
    this.KeyFields = new Array();   //  string
    this.OutFields = new Array();   //  string
    this.Color = "FFFFFF";
    this.Windows = new Array();     //  int
}
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
    //              number, string, eCDCType
function cDataColumn(id, name, type) {
    this.ID = id;
    this.Name = name;
    this.Type = type;
}
    //           number
function cDataRow(id) {
    this.ID = id;
    this.Cells = new Array();
}
    //           
function cDataSet() {
    this.Columns = new Array();     //  cDataColumn
    this.Items = new Array()        //  cDataRow
}

/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
    //        cSession, int, eCDPosition
function cDock(parent, id, position) {
    this.Parent = parent;
    this.ID = id;
    this.Position = position;       //eCDPosition
    this.Docklets = new Array();
    this.DockletID = 0;
    this.Size = 0;
    this.MinSize = 0;
    this.Magnetism = 10;
    this.Rect = null;
    this.CalcPosition(Browser.GetPosition(this.Parent.DIV));
}
function cDock_Dispose() {
    if(this.Docklets.length > 0) {
        for(var i = this.Docklets.length - 1; i >= 0; i--) {
                this.Docklets[i].Dispose();
        }
    }
    this.Docklets = [];
}
function cDock_AutoSize(minonly) {
    var minsize = 0;
    var size = this.Size;
    var bFirst = true;
    if(this.Docklets.length > 0) {
        if((this.Position & eCDPosition.Left) || (this.Position & eCDPosition.Right)) {
            for(var i = this.Docklets.length - 1; i >= 0; i--) {
                    if((this.Docklets[i].Window.Size.X < size) || (bFirst == true)) {
                        size = this.Docklets[i].Window.Size.X;
                    }
                    if((this.Docklets[i].Window.DockMinimumSize.X > minsize) || (bFirst == true)) {
                        minsize = this.Docklets[i].Window.DockMinimumSize.X;
                    }
                    bFirst = false;
            }
        } else if ((this.Position & eCDPosition.Top) || (this.Position & eCDPosition.Bottom)) {
            for(var i = this.Docklets.length - 1; i >= 0; i--) {
                    if((this.Docklets[i].Window.Size.Y < size) || (bFirst == true)) {
                        size = this.Docklets[i].Window.Size.Y;
                    }
                    if((this.Docklets[i].Window.DockMinimumSize.Y > minsize) || (bFirst == true)) {
                        minsize = this.Docklets[i].Window.DockMinimumSize.Y;
                    }
                    bFirst = false;
            }
        }
        this.MinSize = minsize;
        if(!minonly) { this.Resize(size); }
    } else {
        size = 0;
        this.MinSize = minsize;
        this.Resize(size);
    }
}
function cDock_CalcPosition(rect) {
    if(this.Rect == null) { this.Rect = new Object(); }
    if(this.PRect == null) { this.PRect = new Object(); }
    this.PRect.X = rect.X;
    this.PRect.Y  = rect.Y;
    this.PRect.Width = rect.Width;
    this.PRect.Height = rect.Height;
    if(this.Position & eCDPosition.Top) {
        this.Rect.X = rect.X;
        this.Rect.Y  = rect.Y;
        this.Rect.Width = rect.Width;
        this.Rect.Height = this.Size;
    } else if(this.Position & eCDPosition.Right) {
        this.Rect.X = rect.X + rect.Width - this.Size;
        this.Rect.Y  = rect.Y;
        this.Rect.Width = this.Size;
        this.Rect.Height = rect.Height;
    } else if(this.Position & eCDPosition.Bottom) {
        this.Rect.X = rect.X;
        this.Rect.Y = rect.Y + rect.Height - this.Size - 1;
        this.Rect.Width = rect.Width;
        this.Rect.Height = this.Size;
    } else if(this.Position & eCDPosition.Left) {
        this.Rect.X = rect.X;
        this.Rect.Y  = rect.Y;
        this.Rect.Width = this.Size;
        this.Rect.Height = rect.Height;
    }
}
function cDock_CheckDock(rect, sides, forWindow) {
    var ret = new Object();
    ret.Hit = false;
    ret.Position = this.Position;
    if(!(sides & this.Position)) { return(ret); }
    if(!(forWindow.DocksAllowed & this.Position)) { return(ret); }
    if(this.Docklets.length < 1) {
        switch(this.Position) {
            case eCDPosition.Top:
                if(this.Magnetism > (rect.Y - this.Rect.Y)) {
                    ret.Hit = true;
                    ret.Weight = rect.Y - this.Rect.Y;
                    ret.Rect = new Object();
                    ret.Rect.X = this.Rect.X;
                    ret.Rect.Y = this.Rect.Y;
                    ret.Rect.Width = this.Rect.Width;
                    ret.Rect.Height = forWindow.DockSize.Y;    //rect.Height;
                    ret.InsertIndex = -1;
                }
                break;
            case eCDPosition.Right:
                if(this.Magnetism > (this.Rect.X - (rect.X + rect.Width))) {
                    ret.Hit = true;
                    ret.Weight = this.Rect.X - (rect.X + rect.Width);
                    ret.Rect = new Object();
                    ret.Rect.X = this.Rect.X + this.Rect.Width - forWindow.DockSize.X;    //rect.Width;
                    ret.Rect.Y = this.Rect.Y;
                    ret.Rect.Width = forWindow.DockSize.X;    //rect.Width;
                    ret.Rect.Height = this.Rect.Height;
                    ret.InsertIndex = -1;
                }
                break;
            case eCDPosition.Bottom:
                if(this.Magnetism > (this.Rect.Y - (rect.Y + rect.Height))) {
                    ret.Hit = true;
                    ret.Weight = this.Rect.Y - (rect.Y + rect.Height);
                    ret.Rect = new Object();
                    ret.Rect.X = this.Rect.X;
                    ret.Rect.Y = (this.Rect.Y + this.Rect.Height) - forWindow.DockSize.Y;    //rect.Height;
                    ret.Rect.Width = this.Rect.Width;
                    ret.Rect.Height = forWindow.DockSize.Y;    //rect.Height;
                    ret.InsertIndex = -1;
                }
                break;
            case eCDPosition.Left:
                if(this.Magnetism > (rect.X - this.Rect.X)) {
                    ret.Hit = true;
                    ret.Weight = this.Rect.X;
                    ret.Rect = new Object();
                    ret.Rect.X = this.Rect.X;
                    ret.Rect.Y = this.Rect.Y;
                    ret.Rect.Width = forWindow.DockSize.X;    //rect.Width;
                    ret.Rect.Height = this.Rect.Height;
                    ret.InsertIndex = -1;
                }
                break;
        }
    } else {
        var aPos = new Object(); var vTemp;
        aPos.X = 0; aPos.Y = 0; aPos.Width = 0; aPos.Height = 0;
        for(var i = 0; i < this.Docklets.length; i++) {
            aPos.X += this.Docklets[i].Window.Position.X;
            aPos.Y += this.Docklets[i].Window.Position.Y;
            aPos.Width += this.Docklets[i].Window.NormalSize.X;
            aPos.Height += this.Docklets[i].Window.NormalSize.Y;
        }
        switch(this.Position) {
            case eCDPosition.Top:
                if(-(this.Size / 2) > (rect.Y - (this.Rect.Y + this.Size))) {
                    ret.Hit = true;
                    ret.Weight = rect.Y - this.Rect.Y;
                    ret.Rect = new Object();
                    ret.Rect.X = this.Rect.X;
                    ret.Rect.Y = this.Rect.Y;
                    ret.Rect.Width = this.GetDockletByWindow(forWindow);
                    if(ret.Rect.Width != null) { ret.Rect.Width = ret.Rect.Width.Window.Size.X; } else {
                        ret.Rect.Width = this.Rect.Width * (rect.Width / (aPos.Width + rect.Width));
                    }
                    ret.Rect.Height = this.Size;    //rect.Height;
                    if(forWindow.Dock != this.Position) { ret.InsertIndex = this.HitTestInsertX(rect, forWindow); }
                    else { ret.InsertIndex = this.HitTestMoveX(rect, forWindow); ret.Weight = -9999; }
                    vTemp = this.GetSizeOfSpan(0, ret.InsertIndex - 1);
                    if(ret.InsertIndex == 0) {
                        ret.Rect.X = this.Rect.X;
                    } else {
                        if(vTemp < 0) {
                            ret.Rect.X = this.Rect.X + this.Rect.Width - ret.Rect.Width;
                        } else {
                            ret.Rect.X += vTemp;
                            if(forWindow.Dock != this.Position) { ret.Rect.X -= (ret.Rect.Width / 2); }
                        }
                    }
                }
                break;
            case eCDPosition.Right:
                if(-(this.Size / 2) > (this.Rect.X - (rect.X + rect.Width))) {
                    ret.Hit = true;
                    ret.Weight = this.Rect.X - (rect.X + rect.Width);
                    ret.Rect = new Object();
                    ret.Rect.X = this.Rect.X;// + this.Rect.Width - forWindow.Size.X;    //rect.Width;
                    ret.Rect.Y = this.Rect.Y;
                    ret.Rect.Width = this.Size;    //rect.Width;
                    //ret.Rect.Height = this.Rect.Height * (rect.Height / (aPos.Height + rect.Height));
                    ret.Rect.Height = this.GetDockletByWindow(forWindow);
                    if(ret.Rect.Height != null) { ret.Rect.Height = ret.Rect.Height.Window.Size.Y; } else {
                        ret.Rect.Height = this.Rect.Height * (rect.Height / (aPos.Height + rect.Height));
                    }
                    if(forWindow.Dock != this.Position) { ret.InsertIndex = this.HitTestInsertY(rect, forWindow); }
                    else { ret.InsertIndex = this.HitTestMoveY(rect, forWindow); ret.Weight = -9999; }
                    vTemp = this.GetSizeOfSpan(0, ret.InsertIndex - 1);
                    if(ret.InsertIndex == 0) {
                        ret.Rect.Y = this.Rect.Y;
                    } else {
                        if(vTemp < 0) {
                            ret.Rect.Y = this.Rect.Y + this.Rect.Height - ret.Rect.Height;
                        } else {
                            ret.Rect.Y += vTemp;
                            if(forWindow.Dock != this.Position) { ret.Rect.Y -= (ret.Rect.Height / 2); }
                        }
                    }
                }
                break;
            case eCDPosition.Bottom:
                if(-(this.Size / 2) > (this.Rect.Y - (rect.Y + rect.Height))) {
                    ret.Hit = true;
                    ret.Weight = this.Rect.Y - (rect.Y + rect.Height);
                    ret.Rect = new Object();
                    ret.Rect.X = this.Rect.X;
                    ret.Rect.Y = this.Rect.Y;//(this.Rect.Y + this.Rect.Height) - forWindow.Size.Y;    //rect.Height;
                    ret.Rect.Width = this.GetDockletByWindow(forWindow);
                    if(ret.Rect.Width != null) { ret.Rect.Width = ret.Rect.Width.Window.Size.X; } else {
                        ret.Rect.Width = this.Rect.Width * (rect.Width / (aPos.Width + rect.Width));
                    }
                    ret.Rect.Height = this.Size;    //rect.Height;
                    if(forWindow.Dock != this.Position) { ret.InsertIndex = this.HitTestInsertX(rect, forWindow); }
                    else { ret.InsertIndex = this.HitTestMoveX(rect, forWindow); ret.Weight = -9999; }
                    vTemp = this.GetSizeOfSpan(0, ret.InsertIndex - 1);
                    if(ret.InsertIndex == 0) {
                        ret.Rect.X = this.Rect.X;
                    } else {
                        if(vTemp < 0) {
                            ret.Rect.X = this.Rect.X + this.Rect.Width - ret.Rect.Width;
                        } else {
                            ret.Rect.X += vTemp;
                            if(forWindow.Dock != this.Position) { ret.Rect.X -= (ret.Rect.Width / 2); }
                        }
                    }
                }
                break;
            case eCDPosition.Left:
                if(-(this.Size / 2) > (rect.X - (this.Rect.X + this.Size))) {
                    ret.Hit = true;
                    ret.Weight = this.Rect.X;
                    ret.Rect = new Object();
                    ret.Rect.X = this.Rect.X;
                    ret.Rect.Y = this.Rect.Y;
                    ret.Rect.Width = this.Size;    //rect.Width;
                    ret.Rect.Height = this.GetDockletByWindow(forWindow);
                    if(ret.Rect.Height != null) { ret.Rect.Height = ret.Rect.Height.Window.Size.Y; } else {
                        ret.Rect.Height = this.Rect.Height * (rect.Height / (aPos.Height + rect.Height));
                    }
                    if(forWindow.Dock != this.Position) { ret.InsertIndex = this.HitTestInsertY(rect, forWindow); }
                    else { ret.InsertIndex = this.HitTestMoveY(rect, forWindow); ret.Weight = -9999; }
                    vTemp = this.GetSizeOfSpan(0, ret.InsertIndex - 1);
                    if(ret.InsertIndex == 0) {
                        ret.Rect.Y = this.Rect.Y;
                    } else {
                        if(vTemp < 0) {
                            ret.Rect.Y = this.Rect.Y + this.Rect.Height - ret.Rect.Height;
                        } else {
                            ret.Rect.Y += vTemp;
                            if(forWindow.Dock != this.Position) { ret.Rect.Y -= (ret.Rect.Height / 2); }
                        }
                    }
                }
                break;
        }
    }
    return(ret);
}
        //                  cWindow
function cDock_CreateDocklet(window, insertIndex) {
    var d = this.GetFreeDockletID();
    var bFirst = (this.Docklets.length < 1);
    if((insertIndex < 0) || (insertIndex >= this.Docklets.length) || (this.Docklets.length < 1)) {
        this.Docklets.push(new cDocklet(this, d, window));
    } else {
        if(insertIndex == 0) {
            this.Docklets.unshift(new cDocklet(this, d, window));
        } else {
            var aTemp = new Array();
            var aTH = null;
            for(var i = 0; i < insertIndex; i++) {
                aTemp.push(this.Docklets.shift());
            }
            aTemp.push(new cDocklet(this, d, window));
            aTH = aTemp.concat(this.Docklets);
            aTemp = [];
            this.Docklets = aTH;
        }
    }
    if(bFirst == true) {
        switch(this.Position) {
            case eCDPosition.Top:
                if(window.DockMinimumSize.Y > this.MinSize) { this.MinSize = window.DockMinimumSize.Y; }
                this.Resize(window.DockSize.Y);
                break;
            case eCDPosition.Right:
                if(window.DockMinimumSize.X > this.MinSize) { this.MinSize = window.DockMinimumSize.X; }
                this.Resize(window.DockSize.X);
                break;
            case eCDPosition.Bottom:
                if(window.DockMinimumSize.Y > this.MinSize) { this.MinSize = window.DockMinimumSize.Y; }
                this.Resize(window.DockSize.Y);
                break;
            case eCDPosition.Left:
                if(window.DockMinimumSize.X > this.MinSize) { this.MinSize = window.DockMinimumSize.X; }
                this.Resize(window.DockSize.X);
                break;
        }
    } else {
        switch(this.Position) {
            case eCDPosition.Top:
                if(window.DockMinimumSize.Y > this.MinSize) { this.MinSize = window.DockMinimumSize.Y; }
                if(this.Size < window.DockMinimumSize.Y) { this.Resize(window.DockMinimumSize.Y); }
                this.ItemSizeAddX(window);
                break;
            case eCDPosition.Right:
                if(window.DockMinimumSize.X > this.MinSize) { this.MinSize = window.DockMinimumSize.X; }
                if(this.Size < window.DockMinimumSize.X) { this.Resize(window.DockMinimumSize.X); }
                this.ItemSizeAddY(window);
                break;
            case eCDPosition.Bottom:
                if(window.DockMinimumSize.Y > this.MinSize) { this.MinSize = window.DockMinimumSize.Y; }
                if(this.Size < window.DockMinimumSize.Y) { this.Resize(window.DockMinimumSize.Y); }
                this.ItemSizeAddX(window);
                break;
            case eCDPosition.Left:
                if(window.DockMinimumSize.X > this.MinSize) { this.MinSize = window.DockMinimumSize.X; }
                if(this.Size < window.DockMinimumSize.X) { this.Resize(window.DockMinimumSize.X); }
                this.ItemSizeAddY(window);
                break;
        }
    }
    this.Render();
    return(d);
}
function cDock_GetFreeDockletID() {
    var Dck = this.DockletID;
    this.DockletID++;
    return(Dck);
}
function cDock_GetDocklet(id) {
    if(id < 0) { return(null); }
    if(this.Docklets.length > 0) {
        for(var i = this.Docklets.length - 1; i >= 0; i--) {
            if(this.Docklets[i].ID == id) {
                return(this.Docklets[i]);
            }
        }
    }
    return(null);
}
function cDock_GetDockletByWindow(window) {
    if(window == null) { return(null); }
    if(this.Docklets.length > 0) {
        for(var i = this.Docklets.length - 1; i >= 0; i--) {
            if(this.Docklets[i].Window.ID == window.ID) {
                return(this.Docklets[i]);
            }
        }
    }
    return(null);
}
function cDock_GetSizeOfSpan(iStart, iEnd) {
    var ret = 0;
    if(iStart < 0) { iStart = 0; }
    if(iEnd > (this.Docklets.length - 1)) { iEnd = this.Docklets.length - 1; }
    if(iStart > iEnd) { return(-1); }
    if((this.Position & eCDPosition.Left) || (this.Position & eCDPosition.Right)) {
        for(var i = iStart; i <= iEnd; i++) {
            ret += this.Docklets[i].Window.Size.Y;
        }
    } else if((this.Position & eCDPosition.Top) || (this.Position & eCDPosition.Bottom)) {
        for(var i = iStart; i <= iEnd; i++) {
            ret += this.Docklets[i].Window.Size.X;
        }
    }
    return(ret);
}
function cDock_HitTestInsertX(rect, forWindow) {
    if(this.Docklets.length > 0) {
        var rX = this.Rect.X;
        var cX = rect.X + (forWindow.Size.X / 2);
        cX = rect.X + ((cX / this.Rect.Width) * forWindow.Size.X) - this.Rect.X;
        for(var i = 0; i < this.Docklets.length; i++) {
            if((rX + (this.Docklets[i].Window.Size.X / 2)) > cX) {
                if((this.Docklets.length == (i + 1)) && (this.Docklets.length > 1)) {
                    if((rX) < (cX)) {// - (forWindow.Size.X / 2))) {
                        return(-1);
                    }
                }
                return(i);
            }
            rX += this.Docklets[i].Window.Size.X;
        }
    }
    return(-1);
}
function cDock_HitTestInsertY(rect, forWindow) {
    if(this.Docklets.length > 0) {
        var rY = this.Rect.Y;
        var cY = rect.Y + (forWindow.Size.Y / 2) - this.Rect.Y;
        cY = rect.Y + ((cY / this.Rect.Height) * forWindow.Size.Y);
        for(var i = 0; i < this.Docklets.length; i++) {
            rY += this.Docklets[i].Window.Size.Y;
            if(rY > cY) {
                if((this.Docklets.length == (i + 1)) && (this.Docklets.length > 1)) {
                    if((rY) < cY) {// - (forWindow.Size.Y / 2))) {
                        return(-1);
                    }
                }
                return(i);
            }
        }
    }
    return(-1);
}
function cDock_HitTestMoveX(rect, forWindow) {
    if(this.Docklets.length > 0) {
        var rX = this.Rect.X;
        var cX = rect.X + (forWindow.Size.X / 2) - this.Rect.X;
        cX = rect.X + (((cX) / this.Rect.Width) * forWindow.Size.X);
        var lastSize = 0;
        for(var i = 0; i < this.Docklets.length; i++) {
            rX += this.Docklets[i].Window.Size.X;
            if((((rX - (lastSize / 2)) < cX) || (i == 0)) && (cX < (rX + (this.Docklets[i].Window.Size.X / 2)))) {
                if(i > 0) {
                    return(i);
                } else {
                    return(0);
                }
            }
            lastSize = this.Docklets[i].Window.Size.X;
        }
    }
    return(-1);
}
function cDock_HitTestMoveY(rect, forWindow) {
    if(this.Docklets.length > 0) {
        var rY = this.Rect.Y;
        var cY = rect.Y + (forWindow.Size.Y / 2) - this.Rect.Y;
        cY = rect.Y + (((cY) / this.Rect.Height) * forWindow.Size.Y);
        var lastSize = 0;
        for(var i = 0; i < this.Docklets.length; i++) {
            rY += this.Docklets[i].Window.Size.Y;
            if((((rY - (lastSize / 2)) < cY) || (i == 0)) && (cY < (rY + (this.Docklets[i].Window.Size.Y / 2)))) {
                if(i > 0) {
                    return(i);
                } else {
                    return(0);
                }
            }
            lastSize = this.Docklets[i].Window.Size.Y;
        }
    }
    return(-1);
}
function cDock_ItemSizeAddX(window) {
    if(window != null) {
        if(this.Docklets.length > 0) {
            var oX = 0;
            for(var i = this.Docklets.length - 1; i >= 0; i--) {
                if((this.Docklets[i].Window.ID != window.ID) && (this.Docklets[i].Window.State == eCWState.Docked)) {
                    oX += this.Docklets[i].Window.NormalSize.X;
                }
            }
            var nX = oX + window.Size.X;
            var bHit = false;
            for(var i = this.Docklets.length - 1; i >= 0; i--) {
                if(this.Docklets[i].Window.State == eCWState.Docked) {
                    this.Docklets[i].Window.SizeX((this.Docklets[i].Window.NormalSize.X / oX) * nX);
                    if(this.Docklets[i].Window.ID == window.ID) { bHit = true; }
                }
            }
            if(bHit == false) {
                window.SizeX((window.NormalSize.X / oX) * nX);
            }
        }
    }
}
function cDock_ItemSizeAddY(window) {
    if(window != null) {
        if(this.Docklets.length > 0) {
            var oY = 0;
            for(var i = this.Docklets.length - 1; i >= 0; i--) {
                if((this.Docklets[i].Window.ID != window.ID) && (this.Docklets[i].Window.State == eCWState.Docked)) {
                    oY += this.Docklets[i].Window.NormalSize.Y;
                }
            }
            var nY = oY + window.Size.Y;
            var bHit = false;
            for(var i = this.Docklets.length - 1; i >= 0; i--) {
                if(this.Docklets[i].Window.State == eCWState.Docked) {
                    this.Docklets[i].Window.SizeY((this.Docklets[i].Window.NormalSize.Y / oY) * nY);
                    if(this.Docklets[i].Window.ID == window.ID) { bHit = true; }
                }
            }
            if(bHit == false) {
                window.SizeY((window.NormalSize.Y / oY) * nY);
            }
        }
    }
}
function cDock_ItemSizeRemoveX(window) {
    if(window != null) {
        if(this.Docklets.length > 0) {
            var oX = 0;
            for(var i = this.Docklets.length - 1; i >= 0; i--) {
                if((this.Docklets[i].Window.ID != window.ID) && (this.Docklets[i].Window.State == eCWState.Docked)) {
                    oX += this.Docklets[i].Window.NormalSize.X;
                }
            }
            var nX = oX - window.Size.X;
            var bHit = false;
            for(var i = this.Docklets.length - 1; i >= 0; i--) {
                if(this.Docklets[i].Window.State == eCWState.Docked) {
                    this.Docklets[i].Window.SizeX((this.Docklets[i].Window.NormalSize.X / oX) * nX);
                    if(this.Docklets[i].Window.ID == window.ID) { bHit = true; }
                }
            }
            if(bHit == false) {
                window.SizeX((window.NormalSize.X / oX) * nX);
            }
        }
    }
}
function cDock_ItemSizeRemoveY(window) {
    if(window != null) {
        if(this.Docklets.length > 0) {
            var oY = 0;
            for(var i = this.Docklets.length - 1; i >= 0; i--) {
                if((this.Docklets[i].Window.ID != window.ID) && (this.Docklets[i].Window.State == eCWState.Docked)) {
                    oY += this.Docklets[i].Window.NormalSize.Y;
                }
            }
            var nY = oY - window.Size.Y;
            var bHit = false;
            for(var i = this.Docklets.length - 1; i >= 0; i--) {
                if(this.Docklets[i].Window.State == eCWState.Docked) {
                    this.Docklets[i].Window.SizeY((this.Docklets[i].Window.NormalSize.Y / oY) * nY);
                    if(this.Docklets[i].Window.ID == window.ID) { bHit = true; }
                }
            }
            if(bHit == false) {
                window.SizeY((window.NormalSize.Y / oY) * nY);
            }
        }
    }
}
function cDock_MoveDocklet(window, index) {
    if(this.Docklets.length > 0) {
        var bHit = false;
        var aTemp = new Array();
        var aTemp2 = new Array();
        var aTH = null;
        var dTemp = null;
        var count;
        for(var i = this.Docklets.length - 1; i >= 0; i--) {
            if((bHit == false) && (this.Docklets[0].Window.ID == window.ID)) {
                dTemp = this.Docklets.shift();
                bHit = true;
            } else {
                aTemp.push(this.Docklets.shift());
            }
        }
        if(bHit == true) {
            if(dTemp != null) {
                count = aTemp.length;
                if(count > 0) {
                    for(var i = 0; i < count; i++) {
                        if(i == index) { break; }
                        aTemp2.push(aTemp.shift());
                    }
                    aTemp2.push(dTemp);
                    if(aTemp.length > 0) { aTH = aTemp2.concat(aTemp); aTemp2 = []; aTemp2 = aTH; }
                    aTemp = [];
                    this.Docklets = aTemp2;
                } else {
                    aTemp2.push(dTemp);
                    aTemp = [];
                    this.Docklets = [];
                    this.Docklets = aTemp2;
                }
            } else {
                this.Docklets = [];
                this.Docklets = aTemp;
            }
        } else {
            this.Docklets = [];
            this.Docklets = aTemp;
        }
        this.Render();
    }
}
function cDock_RemoveDocklet(id) {
    if(id < 0) { return; }
    var bHit = false;
    var Win = null;
    if(this.Docklets.length > 0) {
        for(var i = this.Docklets.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.Docklets[i] = this.Docklets[i - 1];
            } else {
                if(this.Docklets[i].ID == id) {
                    Win = this.Docklets[i].Window;
                    this.Docklets[i].Dispose();
                    this.Docklets[i] = this.Docklets[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.Docklets[0].ID == id) {
                Win = this.Docklets[0].Window;
                this.Docklets[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.Docklets.shift();
            if((this.Position & eCDPosition.Left) || (this.Position & eCDPosition.Right)) { this.ItemSizeRemoveX(Win); }
            if((this.Position & eCDPosition.Top) || (this.Position & eCDPosition.Bottom)) { this.ItemSizeRemoveY(Win); }
            this.AutoSize(true);
            this.Render();
        }
    }
}
function cDock_RemoveDockletByWindow(window) {
    if(window == null) { return; }
    var bHit = false;
    if(this.Docklets.length > 0) {
        for(var i = this.Docklets.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.Docklets[i] = this.Docklets[i - 1];
            } else {
                if(this.Docklets[i].Window.ID == window.ID) {
                    this.Docklets[i].Dispose();
                    this.Docklets[i] = this.Docklets[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.Docklets[0].Window.ID == window.ID) {
                this.Docklets[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.Docklets.shift();
            if((this.Position & eCDPosition.Left) || (this.Position & eCDPosition.Right)) { this.ItemSizeRemoveX(window); }
            if((this.Position & eCDPosition.Top) || (this.Position & eCDPosition.Bottom)) { this.ItemSizeRemoveY(window); }
            this.AutoSize(true);
            this.Render();
        }
    }
}
function cDock_Render(forceDZ) {
    if(this.Docklets.length > 0) {
        var oS = 0;
        var fZ = 0;
        var fS = 0;
        var nS = 0;
        var pos = 0;
        var sz;
        var bHit = false;
        if((this.Position & eCDPosition.Left) || (this.Position & eCDPosition.Right)) {
            pos = this.Rect.Y;
            for(var i = 0; i < this.Docklets.length; i++) {
                if(this.Docklets[i].Window.State == eCWState.Docked) {
                    if(this.Docklets[i].Window.DockCollapsed == true) {
                        fZ += (this.Docklets[i].Window.StyleSet.BorderTop.Height + this.Docklets[i].Window.StyleSet.BorderBottom.Height + this.Docklets[i].Window.StyleSet.Title.Height);
                    } else {
                        if(forceDZ == true) {
                            oS += this.Docklets[i].Window.DockSize.Y;
                        } else {
                            if(this.Docklets[i].Window.DockRendered == false) {
                                this.Docklets[i].Window.Size.Y = this.Docklets[i].Window.DockSize.Y;
                                bHit = true;
                                //fS += this.Docklets[i].Window.Size.Y;
                            } else {
                                oS += this.Docklets[i].Window.Size.Y;
                            }
                        }
                    }
                }
            }
            if(bHit == true) {
                this.Render(true);
                return;
            }
            nS = (this.Rect.Height - fZ) - fS;
            //alert(nS+' = ('+this.Rect.Height+' - '+fZ+') - '+fS+'    oS = '+oS);
            for(var i = 0; i < this.Docklets.length; i++) {
                if(this.Docklets[i].Window.State == eCWState.Docked) {
                    if(this.Docklets[i].Window.DockCollapsed == true) {
                        sz = (this.Docklets[i].Window.StyleSet.BorderTop.Height + this.Docklets[i].Window.StyleSet.BorderBottom.Height + this.Docklets[i].Window.StyleSet.Title.Height);
                    } else {
                        if(forceDZ == true) {
                            sz = (this.Docklets[i].Window.DockSize.Y / oS) * nS;
                        } else {
                            if(this.Docklets[i].Window.DockRendered == false) {
                                sz = this.Docklets[i].Window.Size.Y;
                            } else {
                                sz = (this.Docklets[i].Window.Size.Y / oS) * nS;
                            }
                        }
                        this.Docklets[i].Window.DockRendered = true;
                    }
                    this.Docklets[i].Window.SizeX(1, true, true, true);
                    this.Docklets[i].Window.SizeY(1, true, true, true);
                    this.Docklets[i].Window.PositionX(this.Rect.X, true, true, true);
                    this.Docklets[i].Window.PositionY(pos, true, true, true);
                    this.Docklets[i].Window.SizeX(this.Size, true, true, true);
                    this.Docklets[i].Window.SizeY(sz, true, false, true);
                    pos += sz;
                }
            }
        } else if((this.Position & eCDPosition.Top) || (this.Position & eCDPosition.Bottom)) {
            pos = this.Rect.X;
            for(var i = 0; i < this.Docklets.length; i++) {
                if(this.Docklets[i].Window.State == eCWState.Docked) {
                    if(this.Docklets[i].Window.DockCollapsed == true) {
                        fZ += (this.Docklets[i].Window.StyleSet.BorderLeft.Width + this.Docklets[i].Window.StyleSet.BorderRight.Width + this.Docklets[i].Window.StyleSet.Title.Height);
                    } else {
                        if(forceDZ == true) {
                            oS += this.Docklets[i].Window.DockSize.X;
                        } else {
                            if(this.Docklets[i].Window.DockRendered == false) {
                                this.Docklets[i].Window.Size.X = this.Docklets[i].Window.DockSize.X;
                                bHit = true;
                                //fS += this.Docklets[i].Window.Size.X;
                            } else {
                                oS += this.Docklets[i].Window.Size.X;
                            }
                        }
                    }
                }
            }
            if(bHit == true) {
                this.Render(true);
                return;
            }
            nS = (this.Rect.Width - fZ) - fS;
            for(var i = 0; i < this.Docklets.length; i++) {
                if(this.Docklets[i].Window.State == eCWState.Docked) {
                    if(this.Docklets[i].Window.DockCollapsed == true) {
                        sz = (this.Docklets[i].Window.StyleSet.BorderLeft.Width + this.Docklets[i].Window.StyleSet.BorderRight.Width + this.Docklets[i].Window.StyleSet.Title.Height);
                    } else {
                        if(forceDZ == true) {
                            sz = (this.Docklets[i].Window.DockSize.X / oS) * nS;
                        } else {
                            if(this.Docklets[i].Window.DockRendered == false) {
                                sz = this.Docklets[i].Window.Size.X;
                            } else {
                                sz = (this.Docklets[i].Window.Size.X / oS) * nS;
                            }
                        }
                        this.Docklets[i].Window.DockRendered = true;
                    }
                    this.Docklets[i].Window.SizeX(1, true, true, true);
                    this.Docklets[i].Window.SizeY(1, true, true, true);
                    this.Docklets[i].Window.PositionX(pos, true, true, true);
                    this.Docklets[i].Window.PositionY(this.Rect.Y, true, true, true);
                    this.Docklets[i].Window.SizeX(sz, true, true, true);
                    this.Docklets[i].Window.SizeY(this.Size, true, false, true);
                    pos += sz;
                }
            }
        }
    }
}
function cDock_Resize(size, force) {
    if((size != this.Size) || (force == true)) {
        var minsize = 0;
        var tD = null;
        var tO = null;
        
        switch(this.Position) {
            case eCDPosition.Top:
                tO = this.Parent.GetDockByPosition(eCDPosition.Bottom);
                if(tO != null) { if((this.PRect.Height - (this.Parent.MinSize.Y + this.Size)) < tO.MinSize) { size = this.PRect.Height - (this.Parent.MinSize.Y + tO.MinSize); } }
                break;
            case eCDPosition.Right:
                tO = this.Parent.GetDockByPosition(eCDPosition.Left);
                if(tO != null) { if((this.PRect.Width - (this.Parent.MinSize.X + this.Size)) < tO.MinSize) { size = this.PRect.Width - (this.Parent.MinSize.X + tO.MinSize); } }
                break;
            case eCDPosition.Bottom:
                tO = this.Parent.GetDockByPosition(eCDPosition.Top);
                if(tO != null) { if((this.PRect.Height - (this.Parent.MinSize.Y + this.Size)) < tO.MinSize) { size = this.PRect.Height - (this.Parent.MinSize.Y + tO.MinSize); } }
                break;
            case eCDPosition.Left:
                tO = this.Parent.GetDockByPosition(eCDPosition.Right);
                if(tO != null) { if((this.PRect.Width - (this.Parent.MinSize.X + this.Size)) < tO.MinSize) { size = this.PRect.Width - (this.Parent.MinSize.X + tO.MinSize); } }
                break;
        }
        
        if(this.Docklets.length > 0) {
            if((this.Position & eCDPosition.Left) || (this.Position & eCDPosition.Right)) {
                for(var i = this.Docklets.length - 1; i >= 0; i--) {
                    if(this.Docklets[i].Window.DockMinimumSize.X > minsize) { minsize = this.Docklets[i].Window.DockMinimumSize.X; }
                }
            } else if((this.Position & eCDPosition.Top) || (this.Position & eCDPosition.Bottom)) {
                for(var i = this.Docklets.length - 1; i >= 0; i--) {
                    if(this.Docklets[i].Window.DockMinimumSize.Y > minsize) { minsize = this.Docklets[i].Window.DockMinimumSize.Y; }
                }
            }
        }
        if(size < minsize) { size = minsize; }
        this.MinSize = minsize;
        this.Size = size;
        
        this.Parent.UpdateDockSize(this);
        var r = Browser.GetPosition(this.Parent.DIV); r.X = 0; r.Y = 0;
        if((this.Position & eCDPosition.Left) || (this.Position & eCDPosition.Right)) {
            tD = this.Parent.GetDockByPosition(eCDPosition.Top);
            if(tD != null) { r.Y += tD.Size; r.Height -= tD.Size; }
            tD = this.Parent.GetDockByPosition(eCDPosition.Bottom);
            if(tD != null) { r.Height -= tD.Size; }
            this.CalcPosition(r);
            if(tO.Size > (this.PRect.Width - (this.Parent.MinSize.X + size))) { tO.Resize(this.PRect.Width - (this.Parent.MinSize.X + size), true); }
        } else {
            this.CalcPosition(r);
            if(tO.Size > (this.PRect.Height - (this.Parent.MinSize.Y + size))) { tO.Resize(this.PRect.Height - (this.Parent.MinSize.Y + size), true); }
            if(this.Position & eCDPosition.Top) {
                r.Y += this.Size;
                r.Height -= this.Size;
                tD = this.Parent.GetDockByPosition(eCDPosition.Bottom);
                if(tD != null) { r.Height -= tD.Size; }
                
                tD = this.Parent.GetDockByPosition(eCDPosition.Left);
                if(tD != null) { tD.CalcPosition(r); tD.Render(); }
                tD = this.Parent.GetDockByPosition(eCDPosition.Right);
                if(tD != null) { tD.CalcPosition(r); tD.Render(); }
            } else if(this.Position & eCDPosition.Bottom) {
                r.Height -= this.Size;
                tD = this.Parent.GetDockByPosition(eCDPosition.Top);
                if(tD != null) { r.Y += tD.Size; r.Height -= tD.Size; }
                
                tD = this.Parent.GetDockByPosition(eCDPosition.Left);
                if(tD != null) { tD.CalcPosition(r); tD.Render(); }
                tD = this.Parent.GetDockByPosition(eCDPosition.Right);
                if(tD != null) { tD.CalcPosition(r); tD.Render(); }
            }
        }
        this.Render();
    }
}
function cDock_ResizeByWindow(window, size) {
    var fZ = size;
    var oS = 0;
    var oD = 0;
    var mS = 0;
    var pos = 0;
    if((this.Position & eCDPosition.Left) || (this.Position & eCDPosition.Right)) {
        for(var i = 0; i < this.Docklets.length; i++) {
            if(this.Docklets[i].Window.State == eCWState.Docked) {
                if(this.Docklets[i].Window.ID != window.ID) {
                    if(this.Docklets[i].Window.DockCollapsed == true) {
                        fZ += (this.Docklets[i].Window.StyleSet.BorderTop.Height + this.Docklets[i].Window.StyleSet.BorderBottom.Height + this.Docklets[i].Window.StyleSet.Title.Height);
                    } else {
                        oS += this.Docklets[i].Window.Size.Y;
                        oD += this.Docklets[i].Window.DockSize.Y;
                    }
                }
            }
        }
        nS = this.Rect.Height - fZ;
        window.DockSize.Y = (size / nS) * oD;
    } else if((this.Position & eCDPosition.Top) || (this.Position & eCDPosition.Bottom)) {
        for(var i = 0; i < this.Docklets.length; i++) {
            if(this.Docklets[i].Window.State == eCWState.Docked) {
                if(this.Docklets[i].Window.ID != window.ID) {
                    if(this.Docklets[i].Window.DockCollapsed == true) {
                        fZ += (this.Docklets[i].Window.StyleSet.BorderTop.Height + this.Docklets[i].Window.StyleSet.BorderBottom.Height + this.Docklets[i].Window.StyleSet.Title.Height);
                    } else {
                        oS += this.Docklets[i].Window.Size.X;
                        oD += this.Docklets[i].Window.DockSize.X;
                    }
                }
            }
        }
        nS = this.Rect.Width - fZ;
        window.DockSize.X = (size / nS) * oD;
    }
    window.DockRendered = false;
    this.Render();
}
cDock.prototype.Dispose = cDock_Dispose;
cDock.prototype.AutoSize = cDock_AutoSize;
cDock.prototype.CalcPosition = cDock_CalcPosition;
cDock.prototype.CheckDock = cDock_CheckDock;
cDock.prototype.CreateDocklet = cDock_CreateDocklet;
cDock.prototype.GetFreeDockletID = cDock_GetFreeDockletID;
cDock.prototype.GetDocklet = cDock_GetDocklet;
cDock.prototype.GetDockletByWindow = cDock_GetDockletByWindow;
cDock.prototype.GetSizeOfSpan = cDock_GetSizeOfSpan;
cDock.prototype.HitTestInsertX = cDock_HitTestInsertX;
cDock.prototype.HitTestInsertY = cDock_HitTestInsertY;
cDock.prototype.HitTestMoveX = cDock_HitTestMoveX;
cDock.prototype.HitTestMoveY = cDock_HitTestMoveY;
cDock.prototype.ItemSizeAddX = cDock_ItemSizeAddX;
cDock.prototype.ItemSizeAddY = cDock_ItemSizeAddY;
cDock.prototype.ItemSizeRemoveX = cDock_ItemSizeRemoveX;
cDock.prototype.ItemSizeRemoveY = cDock_ItemSizeRemoveY;
cDock.prototype.MoveDocklet = cDock_MoveDocklet;
cDock.prototype.RemoveDocklet = cDock_RemoveDocklet;
cDock.prototype.RemoveDockletByWindow = cDock_RemoveDockletByWindow;
cDock.prototype.Render = cDock_Render;
cDock.prototype.Resize = cDock_Resize;
cDock.prototype.ResizeByWindow = cDock_ResizeByWindow;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
    //           cDock, int, cWindow
function cDocklet(parent, id, window) {
    this.Parent = parent;
    this.ID = id;
    this.Window = window;
}
function cDocklet_Dispose() {
    
}
cDocklet.prototype.Dispose = cDocklet_Dispose;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cEvent(parent, id, obj, name) {
    this.Parent = parent;
    this.ID = id;
    this.Name = name;
    this.Obj = obj;
    this.Callbacks = new Array();           //cEventCallback
    this.CallbackID = 0;
}
function cEvent_Dispose() {
    
}
function cEvent_CreateCallback(cbcallback, informationlevel) {
    var cb = new cEventCallback(this, this.GetFreeCallbackID(), cbcallback, informationlevel);
    this.Callbacks.push(cb);
}
function cEvent_Fire(me, fromchild, args) {
    var bRet = false;
    if(this.Callbacks.length > 0) {
        for(var i = 0; i < this.Callbacks.length; i++) {
            if(this.Callbacks[i] != null) {
                bRet = this.Callbacks[i].cbCallback(me, fromchild, args) || bRet;
                if(bRet != false) { return(bRet); }
            }
        }
    }
    return(bRet);
}
function cEvent_GetFreeCallbackID() {
    var Cbk = this.CallbackID;
    this.CallbackID++;
    return(Cbk);
}
function cEvent_RemoveCallback(cbcallback, informationlevel) {
    var bHit = false;
    if(this.Callbacks.length > 0) {
        for(var i = this.Callbacks.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.Callbacks[i] = this.Callbacks[i - 1];
            } else {
                if((this.Callbacks[i].cbCallback == cbcallback) && ((informationlevel == -1) || (this.Callbacks[i].InformationLevel == informationlevel))) {
                    if(this.Callbacks[i].RemoveCallback(cbcallback, informationlevel) < 1) {
                        this.Callbacks[i].Dispose();
                        delete this.Callbacks[i];
                        this.Callbacks[i] = null;
                        bHit = true;
                    }
                }
            }
        }
        if(bHit == false) {
            if((this.Callbacks[0].cbCallback == cbcallback) && ((informationlevel == -1) || (this.Callbacks[0].InformationLevel == informationlevel))) {
                this.Callbacks[0].Dispose();
                delete this.Callbacks[0];
                this.Callbacks[0] = null;
                bHit = true;
            }
        }
        if(bHit == true) {
            this.Callbacks.shift();
        }
    }
    return(this.Callbacks.length);
}
cEvent.prototype.Dispose = cEvent_Dispose;
cEvent.prototype.CreateCallback = cEvent_CreateCallback;
cEvent.prototype.Fire = cEvent_Fire;
cEvent.prototype.GetFreeCallbackID = cEvent_GetFreeCallbackID;
cEvent.prototype.RemoveCallback = cEvent_RemoveCallback;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cEventCallback(parent, id, cbcallback, informationlevel) {
    this.Parent = parent;
    this.ID = id;
    this.cbCallback = cbcallback;
    this.InformationLevel = informationlevel;
}
function cEventCallback_Dispose() {
    this.cbCallback = null;
    this.InformationLevel = -1;
}
cEventCallback.prototype.Dispose = cEventCallback_Dispose;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cFont(fontArray, color, family, size, weight, decoration, style) {
    if((typeof(fontArray) == 'object') && (fontArray instanceof Array)) {
        if(fontArray.length > 0) { this.BGColor = fontArray[0]; } else { this.BGColor = ''; }
        if(fontArray.length > 1) { this.Color = fontArray[1]; } else { this.Color = ''; }
        if(fontArray.length > 2) { this.Family = fontArray[2]; } else { this.Family = ''; }
        if(fontArray.length > 3) { this.Size = fontArray[3]; } else { this.Size = ''; }
        if(fontArray.length > 4) { this.Weight = fontArray[4]; } else { this.Weight = ''; }
        if(fontArray.length > 5) { this.Decoration = fontArray[5]; } else { this.Decoration = ''; }
        if(fontArray.length > 6) { this.Style = fontArray[6]; } else { this.Style = ''; }
    } else {
        if(arguments.length > 0) { this.BGColor = arguments[0]; } else { this.BGColor = ''; }
        if(arguments.length > 1) { this.Color = arguments[1]; } else { this.Color = ''; }
        if(arguments.length > 2) { this.Family = arguments[2]; } else { this.Family = ''; }
        if(arguments.length > 3) { this.Size = arguments[3]; } else { this.Size = ''; }
        if(arguments.length > 4) { this.Weight = arguments[4]; } else { this.Weight = ''; }
        if(arguments.length > 5) { this.Decoration = arguments[5]; } else { this.Decoration = ''; }
        if(arguments.length > 6) { this.Style = arguments[6]; } else { this.Style = ''; }
    }
}
function cFont_Dispose() {
    
}
cFont.prototype.Dispose = cFont_Dispose;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cHoverIcon(size) {
    this.Size = size;
    this.Callback = null;
    this.Active = false;
    this.Hovering = false;
    this.TimeoutItr = 0;
    
    this.Style = Browser.Style.GetHoverIconSet(size);
    this.State = eCBState.Normal;
    
    this.DIVButton = document.createElement('div');
    this.DIVButton.setAttribute('id', 'divHoverIcon_' + size);
    this.DIVButton.className = 'HoverIcon_N_' + size;
    this.DIVButton.style.position = 'absolute';
    this.DIVButton.style.display = 'none';
    this.DIVButton.style.visibility = 'hidden';
    this.SPANIcon = document.createElement('span');
    this.SPANIcon.setAttribute('id', 'spnHoverIconIcon_' + size);
    this.SPANIcon.style.border = '0px';
    this.SPANIcon.style.margin = '0px';
    this.SPANIcon.style.padding = '0px';
    this.SPANIcon.style.marginLeft = this.Style.Icon.Normal.X + 'px';
    this.SPANIcon.style.marginTop = this.Style.Icon.Normal.Y + 'px';
    this.SPANIcon.style.left = '0px';
    this.SPANIcon.style.top = '0px';
    this.SPANIcon.style.width = this.Style.Icon.Normal.Width + 'px';
    this.SPANIcon.style.height = this.Style.Icon.Normal.Height + 'px';
    this.SPANIcon.style.display = 'block';
    this.SPANIcon.style.visibility = 'visible';
    this.SPANIcon.style.overflow = 'hidden';

        this.DIVButton.appendChild(this.SPANIcon);
    document.body.appendChild(this.DIVButton);
    
    eventPush(this.DIVButton, 'mousedown', this.ButtonMouseDown);
    eventPush(this.DIVButton, 'mouseout', this.ButtonMouseOut);
    eventPush(this.DIVButton, 'mouseover', this.ButtonMouseOver);
    eventPush(this.DIVButton, 'mouseup', this.ButtonMouseUp);
}
function cHoverIcon_Dispose() {
    eventPop(this.DIVButton, 'mousedown', this.ButtonMouseDown);
    eventPop(this.DIVButton, 'mouseout', this.ButtonMouseOut);
    eventPop(this.DIVButton, 'mouseover', this.ButtonMouseOver);
    eventPop(this.DIVButton, 'mouseup', this.ButtonMouseUp);
    
        this.DIVButton.removeChild(this.SPANIcon);
    document.body.removeChild(this.DIVButton);
}
function cHoverIcon_ButtonMouseDown(e) {
    var obj = EventObj(e);
    if (obj.nodeType == 3)
        obj = obj.parentNode;
    var aID = obj.id.split('_');
    var Btn = Browser.GetHoverIcon(parseInt(aID[aID.length - 1]));
    if(Btn != null) {
        Btn.ChangeState('D');
    }
    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseDown(e); }
}
function cHoverIcon_ButtonMouseOut(e) {
    var obj = EventObj(e);
    if (obj.nodeType == 3)
        obj = obj.parentNode;
    var aID = obj.id.split('_');
    var Btn = Browser.GetHoverIcon(parseInt(aID[aID.length - 1]));
    if(Btn != null) {
        Btn.ChangeState('N');
        Btn.Hovering = false;
    }
}
function cHoverIcon_ButtonMouseOver(e) {
    var obj = EventObj(e);
    if (obj.nodeType == 3)
        obj = obj.parentNode;
    var aID = obj.id.split('_');
    var Btn = Browser.GetHoverIcon(parseInt(aID[aID.length - 1]));
    if(Btn != null) {
        Btn.Hovering = true;
        Btn.ChangeState('H');
    }
}
function cHoverIcon_ButtonMouseUp(e) {
    var obj = EventObj(e);
    if (obj.nodeType == 3)
        obj = obj.parentNode;
    var aID = obj.id.split('_');
    var Btn = Browser.GetHoverIcon(parseInt(aID[aID.length - 1]));
    if(Btn != null) {
        Btn.ChangeState('N');
        if(Btn.Hovering == true) {
            if(Btn.Callback != null) {
                Btn.Callback();
            }
        }
        //setTimeout('Browser.GetHoverIcon(' + Btn.Size + ').Hide();', 250);
    }
    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseUp(e); }
}
function cHoverIcon_ChangeState(hoverstate) {
    switch(hoverstate) {
        case 'N':
            this.State = eCBState.Normal;
            break;
        case 'H':
            this.State = eCBState.Hover;
            break;
        case 'D':
            this.State = eCBState.Down;
            break;
    }
    this.DIVButton.className = 'HoverIcon_' + hoverstate + '_' + this.Size;
    this.RenderSize();
}
function cHoverIcon_Hide() {
    this.Active = false;
    this.Callback = null;
    this.DIVButton.style.display = 'none';
    this.DIVButton.style.visibility = 'hidden';
    this.Hovering = false;
}
function cHoverIcon_Position(x, y) {
    this.Width = this.Style.Width;
    this.Height = this.Style.Height;
    this.X1 = (x + this.Style.X);
    this.Y1 = (y + this.Style.Y);
    this.X2 = this.X1 + this.Width;
    this.Y2 = this.Y1 + this.Height;
    this.DIVButton.style.left = this.X1 + 'px';
    this.DIVButton.style.top = this.Y1 + 'px';
    this.DIVButton.style.width = this.Width + 'px';
    this.DIVButton.style.height = this.Height + 'px';
}
function cHoverIcon_RenderSize() {
    switch(this.State) {
        case eCBState.Normal:
            this.SPANIcon.style.marginLeft = this.Style.Icon.Normal.X + 'px';
            this.SPANIcon.style.marginTop = this.Style.Icon.Normal.Y + 'px';
            this.SPANIcon.style.width = this.Style.Icon.Normal.Width + 'px';
            this.SPANIcon.style.height = this.Style.Icon.Normal.Height + 'px';
            break;
        case eCBState.Hover:
            this.SPANIcon.style.marginLeft = this.Style.Icon.Hover.X + 'px';
            this.SPANIcon.style.marginTop = this.Style.Icon.Hover.Y + 'px';
            this.SPANIcon.style.width = this.Style.Icon.Hover.Width + 'px';
            this.SPANIcon.style.height = this.Style.Icon.Hover.Height + 'px';
            break;
        case eCBState.Down:
            this.SPANIcon.style.marginLeft = this.Style.Icon.Down.X + 'px';
            this.SPANIcon.style.marginTop = this.Style.Icon.Down.Y + 'px';
            this.SPANIcon.style.width = this.Style.Icon.Down.Width + 'px';
            this.SPANIcon.style.height = this.Style.Icon.Down.Height + 'px';
            break;
    }
}
function cHoverIcon_Show(x, y, icon, callback, id1, id2, id3) {
    this.ChangeState('H', true);
    this.TimeoutItr = 0;
    this.Position(x, y);
    this.RenderSize();
    this.Callback = callback;
    this.Hovering = true;
    this.SPANIcon.style.backgroundImage = 'url(img/icons/' + this.Size + '/' + icon + '.png)';
    this.SPANIcon.style.backgroundPosition = '0px 0px';
    Browser.ParamID1 = id1;
    Browser.ParamID2 = id2;
    Browser.ParamID3 = id3;
    this.SPANIcon.style.visibility = 'visible';
    this.SPANIcon.style.display = 'block';
    this.DIVButton.style.visibility = 'visible';
    this.DIVButton.style.display = 'block';
    this.DIVButton.style.zIndex = 999999;
    this.TimeoutItr = 0;
    setTimeout('Browser.GetHoverIcon(' + this.Size + ').Timeout();', 250);
    this.Active = true;
}
function cHoverIcon_Timeout() {
    if((Browser.MouseX < this.X1) || (Browser.MouseY < this.Y1) || (Browser.MouseX > this.X2) || (Browser.MouseY > this.Y2)) {
        this.TimeoutItr++;
        if(this.TimeoutItr > 1) {
            this.Hide();
        } else {
            setTimeout('Browser.GetHoverIcon(' + this.Size + ').Timeout();', 250);
        }
    } else {
        this.TimeoutItr = 0;
        setTimeout('Browser.GetHoverIcon(' + this.Size + ').Timeout();', 250);
    }
}
cHoverIcon.prototype.Dispose = cHoverIcon_Dispose;
cHoverIcon.prototype.ButtonMouseDown = cHoverIcon_ButtonMouseDown;
cHoverIcon.prototype.ButtonMouseOut = cHoverIcon_ButtonMouseOut;
cHoverIcon.prototype.ButtonMouseOver = cHoverIcon_ButtonMouseOver;
cHoverIcon.prototype.ButtonMouseUp = cHoverIcon_ButtonMouseUp;
cHoverIcon.prototype.ChangeState = cHoverIcon_ChangeState;
cHoverIcon.prototype.Hide = cHoverIcon_Hide;
cHoverIcon.prototype.Position = cHoverIcon_Position;
cHoverIcon.prototype.RenderSize = cHoverIcon_RenderSize;
cHoverIcon.prototype.Show = cHoverIcon_Show;
cHoverIcon.prototype.Timeout = cHoverIcon_Timeout;/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cImage(imageArray, source, position, size, repeat) {
    if((typeof(imageArray) == 'object') && (imageArray instanceof Array)) {
        if(imageArray.length > 0) { this.BGColor = imageArray[0]; } else { this.BGColor = ''; }
        if(imageArray.length > 1) { this.Source = imageArray[1]; } else { this.Source = 'none'; }
        if(imageArray.length > 2) { this.Position = new cWCord(imageArray[2][0], imageArray[2][1]); } else { this.Position = cWCord(0, 0); }
        if(imageArray.length > 3) { this.Size = new cWCord(imageArray[3][0], imageArray[3][1]); } else { this.Size = cWCord(0, 0); }
        if(imageArray.length > 4) { this.Repeat = imageArray[4]; } else { this.Repeat = 'no-repeat'; }
    } else {
        if(arguments.length > 0) { this.BGColor = arguments[0]; } else { this.BGColor = ''; }
        if(arguments.length > 1) { this.Source = arguments[1]; } else { this.Source = 'none'; }
        if(arguments.length > 2) { this.Position = new cWCord(arguments[2][0], arguments[2][1]); } else { this.Position = cWCord(0, 0); }
        if(arguments.length > 3) { this.Size = new cWCord(arguments[2][0], arguments[2][1]); } else { this.Size = cWCord(0, 0); }
        if(arguments.length > 4) { this.Repeat = arguments[4]; } else { this.Repeat = 'no-repeat'; }
    }
}
function cImage_Dispose() {
    delete this.Position;
    delete this.Size;
}
function cImage_IsValid() {
    if(this.Source.length < 1) { return(false); }
    if(this.Source == 'none') { return(false); }
    return(true);
}
cImage.prototype.Dispose = cImage_Dispose;
cImage.prototype.IsValid = cImage_IsValid;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cMenu(parent, id, key) {
    this.isRoot = true;
    this.Parent = parent;
    this.ID = id;
    this.Key = key;
    this.Parent = null;
    this.Loaded = false;
    this.Items = new Array();       //  cMenuItem
    this.ItemID = 0;
    this.Container = null;
    this.Width = 0;
    this.Height = 0;
}
function cMenu_Dispose() {
    if(this.Items.length > 0) {
        for(var i = this.Items.length - 1; i >= 0; i--) {
            this.Items[i].Dispose();
        }
        this.Items = [];
    }
    if(this.Loaded == true) { this.UnLoad(); }
}
function cMenu_CloseUp(forceAll) {
    this.Parent.CloseUp(forceAll);
}
function cMenu_CreateMenuItem(type, tag, icon, text, collapsed, checked, disabled, totalclose, dontclose) {
    var m = this.GetFreeMenuItemID();
    this.Items.push(new cMenuItem(this, m, type, tag, icon, text, collapsed, checked, disabled, totalclose, dontclose));
    return(m);
}
function cMenu_CreateMenuItemO(type, tag, icon, text, collapsed, checked, disabled, totalclose, dontclose) {
    var m = this.GetFreeMenuItemID();
    this.Items.push(new cMenuItem(this, m, type, tag, icon, text, collapsed, checked, disabled, totalclose, dontclose));
    return(this.Items[this.Items.length - 1]);
}
function cMenu_GetMenuItem(id) {
    if(id < 0) { return(null); }
    if(this.Items.length > 0) {
        for(var i = this.Items.length - 1; i >= 0; i--) {
            if(this.Items[i].ID == id) {
                return(this.Items[i]);
            }
        }
    }
    return(null);
}
function cMenu_GetFreeMenuItemID() {
    var Itm = this.ItemID;
    this.ItemID++;
    return(Itm);
}
function cMenu_Load(parent) {
    if(this.Loaded == false) {
        this.Loaded = true;
        this.Parent = parent;
        this.Container = parent;
        
        this.DIV = document.createElement('div');
        this.DIV.setAttribute('id', 'divMenu_' + this.ID);
        this.DIV.style.visibility = 'hidden';
        this.DIV.style.display = 'none';
        this.DIVChildren = document.createElement('div');
        this.DIVChildren.setAttribute('id', 'divMenuChildren_' + this.ID);
        
            this.DIV.appendChild(this.DIVChildren);
        this.Parent.DIVChildren.appendChild(this.DIV);
        
        if(this.Items.length > 0) {
            for(var i = 0; i < this.Items.length; i++) {
                this.Items[i].Load();
            }
        }
    }
}
function cMenu_PopUp(xLeft, yTop, xRight, yBottom) {
    if(this.Container == null) {
        this.Container = Browser.GetMenuPopper(Browser.CreateMenuPopper());
        this.Container.Menus.push(this);
        this.Container.PopUp(xLeft, yTop, xRight, yBottom);
    } else {
        this.Container.PopUp(xLeft, yTop, xRight, yBottom);
    }
}
function cMenu_Render() {
    var ret = null;
    var MM;
    if(this.Items.length > 0) {
        var bEven = false;
        for(var i = 0; i < this.Items.length; i++) {
            if(this.Items[i].Type == eCMIType.Normal) {
                MM = this.Items[i].Render(bEven, -1);
                bEven = !bEven;
            } else {
                MM = this.Items[i].Render(false, -1);
            }
            //MM = Browser.GetPosition(this.Items[i].DIV);
            if(ret == null) {
                ret = MM;
            }
            else {
                if(MM.Width > ret.Width) { ret.Width = MM.Width; }
                ret.Height += MM.Height;
            }
        }
    }
    this.DIV.style.width = '100%';//ret.Width + 'px';
    this.DIV.style.height = ret.Height + 'px';
    this.DIV.style.display = 'block';
    this.DIV.style.visibility = 'visible';
    this.DIVChildren.style.width = '100%';//ret.Width + 'px';
    this.DIVChildren.style.height = ret.Height + 'px';
    this.Width = ret.Width;
    this.Height = ret.Height;
    return(ret);
}
function cMenu_RenderUp() {
    if(this.isRoot == true) { this.Render(); }
    this.Parent.RenderUp();
}
function cMenu_ResizeX(newX) {
    this.DIV.style.width = newX + 'px';
}
function cMenu_ResizeY(newY) {
    this.DIV.style.height = newY + 'px';
}
function cMenu_UnLoad() {
    if(this.Loaded == true) {
        this.DIV.style.visibility = 'hidden';
        this.DIV.style.display = 'none';
        if(this.Items.length > 0) {
            for(var i = this.Items.length - 1; i >= 0; i--) {
                this.Items[i].UnLoad();
            }
        }
        
            this.DIV.removeChild(this.DIVChildren);
        this.Parent.DIVChildren.removeChild(this.DIV);
        
        this.Container = null;
        this.Parent = null;
        this.Loaded = false;
    }
}
cMenu.prototype.Dispose = cMenu_Dispose;
cMenu.prototype.CloseUp = cMenu_CloseUp;
cMenu.prototype.CreateMenuItem = cMenu_CreateMenuItem;
cMenu.prototype.CreateMenuItemO = cMenu_CreateMenuItemO;
cMenu.prototype.GetFreeMenuItemID = cMenu_GetFreeMenuItemID;
cMenu.prototype.GetMenuItem = cMenu_GetMenuItem;
cMenu.prototype.Load = cMenu_Load;
cMenu.prototype.PopUp = cMenu_PopUp;
cMenu.prototype.Render = cMenu_Render;
cMenu.prototype.RenderUp = cMenu_RenderUp;
cMenu.prototype.ResizeX = cMenu_ResizeX;
cMenu.prototype.ResizeY = cMenu_ResizeY;
cMenu.prototype.UnLoad = cMenu_UnLoad;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cMenuItem(parent, id, type, tag, icon, text, collapsed, checked, disabled, totalclose, dontclose) {
    this.isRoot = false;
    this.Parent = parent;
    this.ID = id;
    this.Tag = tag;
    this.Checked = checked;
    this.Collapsed = collapsed;
    this.Disabled = disabled;
    this.LoadChecked = checked;
    this.LoadCollapsed = collapsed;
    this.LoadDisabled = disabled;
    this.TotalCloseOnClick = totalclose;
    this.DontCloseOnClick = dontclose;
    this.Even = false;
    this.Type = type;
    this.Icon = icon;
    this.Text = text;
    this.Loaded = false;
    this.SubMenu = null;
    this.SubItems = new Array();
    this.SubItemID = 0;
    this.SelectedSubItem = -1;
    this.StyleSet = Browser.Style.GetMenuItemSet(type);
    this.Rendered = false;
    this.Width = 0;
    this.Height = 0;
    this.IconBGColor = '';
    this.cbObject = null;
    this.cbClick = null;
    this.Y = -1;
    
    this.Hover = false;
    this.Down = false;
    
    this.Suffix = this.ID;
    var p = this;
    while(p.isRoot == false) {
        this.Suffix = p.Parent.ID + '_' + this.Suffix;
        p = p.Parent;
    }
}
function cMenuItem_Dispose() {
    if(this.SubItems.length > 0) {
        for(var i = this.SubItems.length - 1; i >= 0; i--) {
            this.SubItems[i].Dispose();
        }
        this.SubItems = [];
    }
    if(this.Loaded == true) { this.UnLoad(); }
}
function cMenuItem_CloseUp(forceAll) {
    this.Parent.CloseUp(forceAll);
}
function cMenuItem_CreateSubItem(type, tag, icon, text, collapsed, checked, disabled, totalclose, dontclose) {
    var i = this.SubItemID++;
    this.SubItems.push(new cMenuItem(this, i, type, tag, icon, text, collapsed, checked, disabled, totalclose, dontclose));
    return(i);
}
function cMenuItem_CreateSubItemO(type, tag, icon, text, collapsed, checked, disabled, totalclose, dontclose) {
    var i = this.SubItemID++;
    this.SubItems.push(new cMenuItem(this, i, type, tag, icon, text, collapsed, checked, disabled, totalclose, dontclose));
    return(this.SubItems[this.SubItems.length - 1]);
}
function cMenuItem_ChangeState(hoverstate) {
    if(this.Loaded == true) {
        switch(hoverstate) {
            case 'N':
                this.State = eCBState.Normal;
                break;
            case 'H':
                this.State = eCBState.Hover;
                break;
            case 'D':
                this.State = eCBState.Down;
                break;
        }
        var alt = '';
        if(this.Even == true) { alt = 'ALT'; }
        this.TABLE.className = 'MenuItemTable_' + this.Type + '_' + hoverstate;
        this.DIVSelf.className = 'MenuItemSelf' + alt + '_' + this.Type + '_' + hoverstate;
        this.DIVChildren.className = 'MenuItemChildren_' + this.Type + '_' + hoverstate;
        var bS = 'Off';
        if(this.Checked == true) { bS = 'On'; }
        if(this.Type == eCMIType.Radio) {
            this.SPANIcon.className = 'MenuItemGlyphRadio' + bS + '_' + this.Type + '_' + hoverstate;
            this.SPANIcon.style.backgroundColor = '';
        } else if(this.Type == eCMIType.Check) {
            this.SPANIcon.className = 'MenuItemGlyphCheck' + bS + '_' + this.Type + '_' + hoverstate;
            this.SPANIcon.style.backgroundColor = '';
        } else {
            this.SPANIcon.className = 'MenuItemIcon_' + this.Type + '_' + hoverstate;
            this.SPANIcon.style.backgroundColor = this.IconBGColor;
        }
        if(this.Disabled == true) { 
            this.SPANText.className = 'MenuItemTextDisabled_' + this.Type + '_' + hoverstate;
        } else {
            this.SPANText.className = 'MenuItemText_' + this.Type + '_' + hoverstate;
        }
        this.TDIndent.className = 'MenuItemIndentLeft' + alt + '_' + this.Type + '_' + hoverstate;
        this.TDRightIndent.className = 'MenuItemIndentRight' + alt + '_' + this.Type + '_' + hoverstate;
        if(this.Type == eCMIType.Separator) {
            this.SPANRightIcon.className = 'MenuItemGlyphEmpty_' + this.Type + '_' + hoverstate;
        } else {
            if(this.SubItems.length > 0) {
                if(this.Collapsed == true) {
                    this.SPANRightIcon.className = 'MenuItemGlyphExpand_' + this.Type + '_' + hoverstate;
                } else {
                    this.SPANRightIcon.className = 'MenuItemGlyphCollapse_' + this.Type + '_' + hoverstate;
                }
            } else {
                if(this.SubMenu != null) {
                    this.SPANRightIcon.className = 'MenuItemGlyphSubMenu_' + this.Type + '_' + hoverstate;
                } else {
                    this.SPANRightIcon.className = 'MenuItemGlyphEmpty_' + this.Type + '_' + hoverstate;
                }
            }
        }
    }
}
function cMenuItem_DetectSubItemSelection() {
    if(this.SubItems.length > 0) {
        var iNew = -1;
        for(var i = 0; i < this.SubItems.length; i++) {
            if(iNew < 0) {
                if(this.SubItems[i].Checked == true) { iNew = this.SubItems[i].ID; }
            } else {
                if(this.SubItems[i].Checked != false) { this.SubItems[i].ToggleCheck(); }
            }
        }
        this.SelectedSubItem = iNew;
    }
}
function cMenuItem_GetFreeSubItemID() {
    var SI = this.SubItemID;
    this.SubItemID++;
    return(SI);
}
function cMenuItem_GetSubItem(id) {
    if(id < 0) { return(null); }
    if(this.SubItems.length > 0) {
        for(var i = this.SubItems.length - 1; i >= 0; i--) {
            if(this.SubItems[i].ID == id) {
                return(this.SubItems[i]);
            }
        }
    }
    return(null);
}
function cMenuItem_Load() {
    if(this.Loaded == false) {
        this.Loaded = true;
        this.Rendered = false;
        this.Hover = false;
        this.Down = false;
        this.Checked = this.LoadChecked;
        this.Collapsed = this.LoadCollapsed;
        this.Disabled = this.LoadDisabled;
        this.SelectedSubItem = -1;
        
        this.DIV = document.createElement('div');
        this.DIV.setAttribute('id', 'divMenuItem_' + this.Suffix);
        this.DIV.style.display = 'block';
        this.DIV.style.overflow = 'hidden';
        //this.DIV.style.backgroundColor = '#FF0000';
        this.DIVSelf = document.createElement('div');
        this.DIVSelf.setAttribute('id', 'divMenuItemSelf_' + this.Suffix);
        this.DIVSelf.style.display = 'block';
        this.DIVSelf.style.position = 'absolute';
        this.DIVSelf.style.overflow = 'hidden';
        //this.DIVSelf.style.backgroundColor = '#00FF00';
        this.DIVChildren = document.createElement('div');
        this.DIVChildren.setAttribute('id', 'divMenuItemChildren_' + this.Suffix);
        this.DIVChildren.style.display = 'block';
        this.DIVChildren.style.position = 'absolute';
        this.DIVChildren.style.overflow = 'hidden';
        this.DIVChildren.style.bottom = '0px';
        //this.DIVChildren.style.backgroundColor = '#0000FF';
        
        this.TABLE = document.createElement('table');
        this.TABLE.setAttribute('id', 'tblMenuItem_' + this.Suffix);
        this.TABLE.setAttribute('border', '0');
        this.TABLE.setAttribute('cellpadding', '0');
        this.TABLE.setAttribute('cellspacing', '0');
        this.TABLE.className = 'zeroedmaxed';
        this.TBODY = document.createElement('tbody');
        this.TBODY.setAttribute('id', 'tbdMenuItem_' + this.Suffix);
        this.TR = document.createElement('tr');
        this.TR.setAttribute('id', 'trMenuItem_' + this.Suffix);
        this.TDIndent = document.createElement('td');
        this.TDIndent.setAttribute('id', 'tdMenuItemIndent_' + this.Suffix);
        this.TDIndent.style.overflow = 'hidden';
        this.TDIcon = document.createElement('td');
        this.TDIcon.setAttribute('id', 'tdMenuItemIcon_' + this.Suffix);
        //this.TDIcon.setAttribute('align', 'left');
        this.TDIcon.setAttribute('valign', 'middle');
        this.TDIcon.style.overflow = 'hidden';
        this.TDSpacerLeft = document.createElement('td');
        this.TDSpacerLeft.setAttribute('id', 'tdMenuItemSpacerLeft_' + this.Suffix);
        this.TDSpacerLeft.style.overflow = 'hidden';
        this.TDText = document.createElement('td');
        this.TDText.setAttribute('id', 'tdMenuItemText_' + this.Suffix);
        this.TDText.setAttribute('align', 'left');
        this.TDText.setAttribute('valign', 'middle');
        this.TDText.style.overflow = 'hidden';
        this.TDSpacerRight = document.createElement('td');
        this.TDSpacerRight.setAttribute('id', 'tdMenuItemSpacerRight_' + this.Suffix);
        this.TDSpacerRight.style.overflow = 'hidden';
        this.TDRight = document.createElement('td');
        this.TDRight.setAttribute('id', 'tdMenuItemRight_' + this.Suffix);
        this.TDRight.setAttribute('align', 'right');
        this.TDRight.setAttribute('valign', 'middle');
        this.TDRight.style.overflow = 'hidden';
        this.TDRightIndent = document.createElement('td');
        this.TDRightIndent.setAttribute('id', 'tdMenuItemRightIndent_' + this.Suffix);
        this.TDRightIndent.style.overflow = 'hidden';
        
        this.SPANIcon = document.createElement('span');
        this.SPANIcon.setAttribute('id', 'spanMenuItemIcon_' + this.Suffix);
        this.SPANIcon.style.display = 'block';
        //this.SPANIcon.style.position = 'absolute';
        this.SPANIcon.style.overflow = 'hidden';
        this.SPANText = document.createElement('span');
        this.SPANText.setAttribute('id', 'spanMenuItemText_' + this.Suffix);
        this.SPANText.style.display = 'block';
        //this.SPANText.style.position = 'absolute';
        this.SPANText.style.overflow = 'hidden';
        this.SPANRightIcon = document.createElement('span');
        this.SPANRightIcon.setAttribute('id', 'spanMenuItemRightIcon_' + this.Suffix);
        this.SPANRightIcon.style.display = 'block';
        //this.SPANRightIcon.style.position = 'absolute';
        this.SPANRightIcon.style.overflow = 'hidden';
        
                        this.TR.appendChild(this.TDIndent);
                            this.TDIcon.appendChild(this.SPANIcon);
                        this.TR.appendChild(this.TDIcon);
                        this.TR.appendChild(this.TDSpacerLeft);
                            this.TDText.appendChild(this.SPANText);
                        this.TR.appendChild(this.TDText);
                        this.TR.appendChild(this.TDSpacerRight);
                            this.TDRight.appendChild(this.SPANRightIcon);
                        this.TR.appendChild(this.TDRight);
                        this.TR.appendChild(this.TDRightIndent);
                        this.TBODY.appendChild(this.TR);
                    this.TABLE.appendChild(this.TBODY);
                this.DIVSelf.appendChild(this.TABLE);
            this.DIV.appendChild(this.DIVSelf);
            this.DIV.appendChild(this.DIVChildren);
        this.Parent.DIVChildren.appendChild(this.DIV);
        
        eventPush(this.DIV, 'mousedown', this.onMouseDown);
        eventPush(this.DIV, 'mouseout', this.onMouseOut);
        eventPush(this.DIV, 'mouseover', this.onMouseOver);
        eventPush(this.DIV, 'mouseup', this.onMouseUp);
        
        this.SPANIcon.style.display = 'block';
        
        if(this.SubItems.length > 0) {
            for(var i = 0; i < this.SubItems.length; i++) {
                this.SubItems[i].Load();
            }
        }
        
        this.DetectSubItemSelection();
    }
}
function cMenuItem_onMouseDown(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        var aID = obj.id.split('_');
        if(aID.length > 2) {
            var Mnu = Browser.GetMenu(parseInt(aID[1]));
            if(Mnu != null) {
                var Itm = Mnu.GetMenuItem(parseInt(aID[2]));
                var i = 3;
                while(aID.length > i) {
                    Itm = Itm.GetSubItem(parseInt(aID[i]));
                    i++;
                }
                if(Itm.Disabled == false) {
                    Itm.Down = true;
                    Itm.ChangeState('D');
                }
            }
        }
    }
    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseDown(e); }
}
function cMenuItem_onMouseOut(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        var aID = obj.id.split('_');
        if(aID.length > 2) {
            var Mnu = Browser.GetMenu(parseInt(aID[1]));
            if(Mnu != null) {
                var Itm = Mnu.GetMenuItem(parseInt(aID[2]));
                var i = 3;
                while(aID.length > i) {
                    Itm = Itm.GetSubItem(parseInt(aID[i]));
                    i++;
                }
                Itm.Hover = false;
                Itm.ChangeState('N');
            }
        }
    }
}
function cMenuItem_onMouseOver(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        var aID = obj.id.split('_');
        if(aID.length > 2) {
            var Mnu = Browser.GetMenu(parseInt(aID[1]));
            if(Mnu != null) {
                var Itm = Mnu.GetMenuItem(parseInt(aID[2]));
                var i = 3;
                while(aID.length > i) {
                    Itm = Itm.GetSubItem(parseInt(aID[i]));
                    i++;
                }
                Itm.Hover = true;
                Itm.ChangeState('H');
            }
        }
    }
}
function cMenuItem_onMouseUp(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        var aID = obj.id.split('_');
        if(aID.length > 2) {
            var Mnu = Browser.GetMenu(parseInt(aID[1]));
            if(Mnu != null) {
                var Itm = Mnu.GetMenuItem(parseInt(aID[2]));
                var i = 3;
                while(aID.length > i) {
                    Itm = Itm.GetSubItem(parseInt(aID[i]));
                    i++;
                }
                if(Itm.Down == true) {
                    if(Itm.Disabled == false) {
                        if(Itm.SubItems.length > 0) {
                            Itm.Toggle();
                        } else {
                            if(Itm.SubMenu != null) {
                                var MM = Browser.GetPosition(Itm.DIVSelf);
                                Itm.SubMenu.PopUp(MM.X, MM.Y + MM.Height, MM.X + MM.Width, MM.Y);
                            } else {
                                if(Itm.Type == eCMIType.Radio) {
                                    if(Itm.Checked == false) {
                                        Itm.Parent.SetSubItemSelection(e, Itm.ID);
                                    }
                                } else if(Itm.Type == eCMIType.Check) {
                                    Itm.ToggleCheck();
                                } else if(Itm.Type != eCMIType.Separator) {
                                    if(Itm.cbClick != null) { Itm.cbObject.MenuCallback(e, Itm, Itm.cbClick); }
                                    if(Itm.DontCloseOnClick == false) {
                                        Itm.Parent.CloseUp(Itm.TotalCloseOnClick);
                                    }
                                }
                            }
                        }
                    }
                }
                Itm.Down = false;
                if(Itm.Hover == true) {
                    Itm.ChangeState('H');
                } else {
                    Itm.ChangeState('N');
                }
            }
        }
    }
    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseUp(e); }
}
function cMenuItem_Render(bEven, y) {
    if(this.Loaded == false) { this.Load(); }
    this.Y = y;
    this.Even = bEven;
    var ret;
    if(this.Disabled == true) {
        this.SPANText.style.fontFamily = this.StyleSet.Disabled.Font.Family;
        this.SPANText.style.fontSize = this.StyleSet.Disabled.Font.Size;
        if(this.StyleSet.Disabled.Font.Bold == true) {
            this.SPANText.style.fontWeight = 'bold';
            ret = Browser.GetTextSize(this.Text, this.StyleSet.Disabled.Font.Family, this.StyleSet.Disabled.Font.Size, 'bold', this.StyleSet.Disabled.Font.Decoration, this.StyleSet.Disabled.Font.Style);
        } else {
            this.SPANText.style.fontWeight = 'normal';
            ret = Browser.GetTextSize(this.Text, this.StyleSet.Disabled.Font.Family, this.StyleSet.Disabled.Font.Size, 'normal', this.StyleSet.Disabled.Font.Decoration, this.StyleSet.Disabled.Font.Style);
        }
        this.SPANText.style.textDecoration = this.StyleSet.Disabled.Font.Decoration;
        this.SPANText.style.fontStyle = this.StyleSet.Disabled.Font.Style;
    } else {
        this.SPANText.style.fontFamily = this.StyleSet.Normal.Font.Family;
        this.SPANText.style.fontSize = this.StyleSet.Normal.Font.Size;
        if(this.StyleSet.Normal.Font.Bold == true) {
            this.SPANText.style.fontWeight = 'bold';
            ret = Browser.GetTextSize(this.Text, this.StyleSet.Normal.Font.Family, this.StyleSet.Normal.Font.Size, 'bold', this.StyleSet.Normal.Font.Decoration, this.StyleSet.Normal.Font.Style);
        } else {
            this.SPANText.style.fontWeight = 'normal';
            ret = Browser.GetTextSize(this.Text, this.StyleSet.Normal.Font.Family, this.StyleSet.Normal.Font.Size, 'normal', this.StyleSet.Normal.Font.Decoration, this.StyleSet.Normal.Font.Style);
        }
        this.SPANText.style.textDecoration = this.StyleSet.Normal.Font.Decoration;
        this.SPANText.style.fontStyle = this.StyleSet.Normal.Font.Style;
    }
    this.SPANText.innerHTML = this.Text;
    if(this.Down == true) {
        this.ChangeState('D');
    } else {
        if(this.Hover == true) {
            this.ChangeState('H');
        } else {
            this.ChangeState('N');
        }
    }
    ret.Width += Browser.StyleSet.MenuItem.TextSizeAdjustment.X;
    ret.Height = this.StyleSet.Height;
    this.DIV.style.width = '100%';
    this.DIV.style.height = ret.Height + 'px';
    this.DIVSelf.style.width = '100%';
    this.DIVSelf.style.height = ret.Height + 'px';
    /*
    this.TDIndent.style.backgroundColor = '#0000FF';
    this.TDSpacerLeft.style.backgroundColor = '#FF0000';
    this.SPANIcon.style.backgroundColor = '#00FF00';
    this.SPANRightIcon.style.backgroundColor = '#00FF00';
    this.TDSpacerRight.style.backgroundColor = '#FF0000';
    this.TDRightIndent.style.backgroundColor = '#0000FF';
    this.DIVSelf.style.backgroundColor = '#FFFFFF';
    this.DIV.style.backgroundColor = '#000000';
    this.TABLE.style.backgroundImage = 'none';
    this.TABLE.style.backgroundColor = '#00FF00';
    this.TDRightIndent.style.backgroundImage = 'none';
    this.TDRightIndent.style.backgroundColor = '#0000FF';
    */
    this.TDText.style.width = '100%';
    switch(this.Type) {
        case eCMIType.Header:
            this.SPANText.style.position = Browser.StyleSet.MenuItem.Header.Text.Position;
            this.TDIndent.style.position = Browser.StyleSet.MenuItem.Header.LeftIndent.Position;
            this.TDRightIndent.style.position = Browser.StyleSet.MenuItem.Header.RightIndent.Position;
            if(Browser.StyleSet.MenuItem.Header.RightIndent.Right >= 0) {
                this.TDRightIndent.style.right = Browser.StyleSet.MenuItem.Header.RightIndent.Right + 'px';
            } else { this.TDRightIndent.style.right = ''; }
            this.SPANIcon.style.marginLeft = Browser.StyleSet.MenuItem.Header.Icon.Margin.Left + 'px';
            this.SPANRightIcon.style.marginRight = Browser.StyleSet.MenuItem.Header.Glyph.Margin.Right + 'px';
            this.SPANIcon.style.marginTop = Browser.StyleSet.MenuItem.Header.Icon.Margin.Top + 'px';
            this.SPANText.style.left = Browser.StyleSet.MenuItem.Header.Text.Left + 'px';
            this.SPANText.style.marginLeft = Browser.StyleSet.MenuItem.Header.Text.Margin.Left + 'px';
            this.SPANText.style.marginTop = Browser.StyleSet.MenuItem.Header.Text.Margin.Top + 'px';
            this.SPANRightIcon.style.marginTop = Browser.StyleSet.MenuItem.Header.Glyph.Margin.Top + 'px';
            
            this.TDIndent.style.width = this.StyleSet.Indent.Left + 'px';
            if(this.Icon.length > 0) {
                this.TDIcon.style.width = this.StyleSet.Icon.Size + 'px';
                this.SPANIcon.style.width = this.StyleSet.Icon.Size + 'px';
                this.SPANIcon.style.height = this.StyleSet.Icon.Size + 'px';
                this.SPANIcon.style.backgroundImage = 'url(img/icons/' + this.StyleSet.Icon.Size + '/' + this.Icon + '.png)';
                ret.Width += this.StyleSet.Icon.Size + this.StyleSet.Glyph.Size + this.StyleSet.Indent.Left + this.StyleSet.Indent.Right + this.StyleSet.Spacing.Left + this.StyleSet.Spacing.Right;
                this.TDSpacerLeft.style.width = this.StyleSet.Spacing.Left + 'px';
            } else {
                this.TDIcon.style.width = '0px';
                this.SPANIcon.style.width = '0px';
                this.SPANIcon.style.backgroundImage = '';
                ret.Width += this.StyleSet.Glyph.Size + this.StyleSet.Indent.Left + this.StyleSet.Indent.Right + this.StyleSet.Spacing.Right;
                this.TDSpacerLeft.style.width = '0px';
            }
            this.TDSpacerRight.style.width = this.StyleSet.Spacing.Right + 'px';
            this.TDRight.style.width = this.StyleSet.Glyph.Size + 'px';
            this.SPANRightIcon.style.width = this.StyleSet.Glyph.Size + 'px';
            this.SPANRightIcon.style.height = this.StyleSet.Glyph.Size + 'px';
            this.TDRightIndent.style.width = this.StyleSet.Indent.Right + 'px';
            break;
        case eCMIType.Normal:
            this.SPANText.style.position = Browser.StyleSet.MenuItem.Normal.Text.Position;
            this.TDIndent.style.position = Browser.StyleSet.MenuItem.Normal.LeftIndent.Position;
            this.TDRightIndent.style.position = Browser.StyleSet.MenuItem.Normal.RightIndent.Position;
            if(Browser.StyleSet.MenuItem.Normal.RightIndent.Right >= 0) {
                this.TDRightIndent.style.right = Browser.StyleSet.MenuItem.Normal.RightIndent.Right + 'px';
            } else { this.TDRightIndent.style.right = ''; }
            this.SPANIcon.style.marginLeft = Browser.StyleSet.MenuItem.Normal.Icon.Margin.Left + 'px';
            this.SPANRightIcon.style.marginRight = Browser.StyleSet.MenuItem.Normal.Glyph.Margin.Right + 'px';
            this.SPANText.style.left = Browser.StyleSet.MenuItem.Normal.Text.Left + 'px';
            this.SPANText.style.marginLeft = Browser.StyleSet.MenuItem.Normal.Text.Margin.Left + 'px';
            this.SPANIcon.style.marginTop = Browser.StyleSet.MenuItem.Normal.Icon.Margin.Top + 'px';
            this.SPANText.style.marginTop = Browser.StyleSet.MenuItem.Normal.Text.Margin.Top + 'px';
            this.SPANRightIcon.style.marginTop = Browser.StyleSet.MenuItem.Normal.Glyph.Margin.Top + 'px';
            
            this.TDIndent.style.width = this.StyleSet.Indent.Left + 'px';
            this.TDSpacerLeft.style.width = this.StyleSet.Spacing.Left + 'px';
            this.TDIcon.style.width = this.StyleSet.Icon.Size + 'px';
            this.SPANIcon.style.width = this.StyleSet.Icon.Size + 'px';
            this.SPANIcon.style.height = this.StyleSet.Icon.Size + 'px';
            if(this.Icon.length > 0) {
                this.SPANIcon.style.backgroundImage = 'url(img/icons/' + this.StyleSet.Icon.Size + '/' + this.Icon + '.png)';
                ret.Width += this.StyleSet.Icon.Size + this.StyleSet.Glyph.Size + this.StyleSet.Indent.Left + this.StyleSet.Indent.Right + this.StyleSet.Spacing.Left + this.StyleSet.Spacing.Right;
            } else {
                this.SPANIcon.style.backgroundImage = '';
                ret.Width += this.StyleSet.Glyph.Size + this.StyleSet.Indent.Left + this.StyleSet.Indent.Right + this.StyleSet.Spacing.Right;
            }
            
            this.TDSpacerRight.style.width = this.StyleSet.Spacing.Right + 'px';
            this.TDRight.style.width = this.StyleSet.Glyph.Size + 'px';
            this.SPANRightIcon.style.width = this.StyleSet.Glyph.Size + 'px';
            this.SPANRightIcon.style.height = this.StyleSet.Glyph.Size + 'px';
            this.TDRightIndent.style.width = this.StyleSet.Indent.Right + 'px';
            break;
        case eCMIType.Separator:
            this.SPANText.style.position = Browser.StyleSet.MenuItem.Separator.Text.Position;
            this.TDIndent.style.position = Browser.StyleSet.MenuItem.Separator.LeftIndent.Position;
            this.TDRightIndent.style.position = Browser.StyleSet.MenuItem.Separator.RightIndent.Position;
            if(Browser.StyleSet.MenuItem.Separator.RightIndent.Right >= 0) {
                this.TDRightIndent.style.right = Browser.StyleSet.MenuItem.Separator.RightIndent.Right + 'px';
            } else { this.TDRightIndent.style.right = ''; }
            this.SPANIcon.style.marginLeft = Browser.StyleSet.MenuItem.Separator.Icon.Margin.Left + 'px';
            this.SPANRightIcon.style.marginRight = Browser.StyleSet.MenuItem.Separator.Glyph.Margin.Right + 'px';
            this.SPANText.style.left = Browser.StyleSet.MenuItem.Separator.Text.Left + 'px';
            this.SPANText.style.marginLeft = Browser.StyleSet.MenuItem.Separator.Text.Margin.Left + 'px';
            this.SPANIcon.style.marginTop = Browser.StyleSet.MenuItem.Separator.Icon.Margin.Top + 'px';
            this.SPANText.style.marginTop = Browser.StyleSet.MenuItem.Separator.Text.Margin.Top + 'px';
            this.SPANRightIcon.style.marginTop = Browser.StyleSet.MenuItem.Separator.Glyph.Margin.Top + 'px';
            
            this.TDIndent.style.width = this.StyleSet.Indent.Left + 'px';
            this.TDIcon.style.width = this.StyleSet.Icon.Size + 'px';
            this.SPANIcon.style.width = this.StyleSet.Icon.Size + 'px';
            this.SPANIcon.style.height = this.StyleSet.Icon.Size + 'px';
            this.TDSpacerLeft.style.width = this.StyleSet.Spacing.Left + 'px';
            
            this.TDRightIndent.style.backgroundImage = 'none';
            
            this.TDSpacerRight.style.width = this.StyleSet.Spacing.Right + 'px';
            this.TDRight.style.width = this.StyleSet.Glyph.Size + 'px';
            this.SPANRightIcon.style.width = this.StyleSet.Glyph.Size + 'px';
            this.SPANRightIcon.style.height = this.StyleSet.Glyph.Size + 'px';
            this.TDRightIndent.style.width = this.StyleSet.Indent.Right + 'px';
            break;
        case eCMIType.Radio:
            this.TDIndent.style.position = Browser.StyleSet.MenuItem.Radio.LeftIndent.Position;
            this.SPANIcon.style.position = Browser.StyleSet.MenuItem.Radio.Icon.Position;
            this.SPANRightIcon.style.position = Browser.StyleSet.MenuItem.Radio.Glyph.Position;
            this.TDRightIndent.style.position = Browser.StyleSet.MenuItem.Radio.RightIndent.Position;
            
            this.SPANText.style.position = Browser.StyleSet.MenuItem.Radio.Text.Position;
            this.SPANText.style.left = Browser.StyleSet.MenuItem.Radio.Text.Left + 'px';
            this.SPANText.style.marginLeft = Browser.StyleSet.MenuItem.Radio.Text.Margin.Left + 'px';
            
            this.SPANText.style.top = Browser.StyleSet.MenuItem.Radio.Text.Top + 'px';
            
            if(Browser.StyleSet.MenuItem.Radio.RightIndent.Right >= 0) {
                this.TDRightIndent.style.right = Browser.StyleSet.MenuItem.Radio.RightIndent.Right + 'px';
            } else { this.TDRightIndent.style.right = ''; }
            this.SPANIcon.style.marginLeft = Browser.StyleSet.MenuItem.Radio.Icon.Margin.Left + 'px';
            this.SPANRightIcon.style.marginRight = Browser.StyleSet.MenuItem.Radio.Glyph.Margin.Right + 'px';
            this.SPANIcon.style.marginTop = Browser.StyleSet.MenuItem.Radio.Icon.Margin.Top + 'px';
            this.SPANIcon.style.top = Browser.StyleSet.MenuItem.Radio.Icon.Top + 'px';
            this.SPANRightIcon.style.marginTop = Browser.StyleSet.MenuItem.Radio.Glyph.Margin.Top + 'px';
            this.SPANRightIcon.style.top = Browser.StyleSet.MenuItem.Radio.Glyph.Top + 'px';
            
            //this.SPANText.style.position = 'relative';
            //this.SPANText.style.top = 'px';
            
            this.TDIndent.style.width = this.StyleSet.Indent.Left + 'px';
            this.TDIcon.style.width = this.StyleSet.Icon.Size + 'px';
            this.SPANIcon.style.width = this.StyleSet.Icon.Size + 'px';
            this.SPANIcon.style.height = this.StyleSet.Icon.Size + 'px';
            this.TDSpacerLeft.style.width = this.StyleSet.Spacing.Left + 'px';
            
            this.TDSpacerRight.style.width = this.StyleSet.Spacing.Right + 'px';
            this.TDRight.style.width = this.StyleSet.Glyph.Size + 'px';
            this.SPANRightIcon.style.width = this.StyleSet.Glyph.Size + 'px';
            this.SPANRightIcon.style.height = this.StyleSet.Glyph.Size + 'px';
            this.TDRightIndent.style.width = this.StyleSet.Indent.Right + 'px';
            break;
        case eCMIType.Check:
            this.SPANText.style.position = Browser.StyleSet.MenuItem.Check.Text.Position;
            this.TDIndent.style.position = Browser.StyleSet.MenuItem.Check.LeftIndent.Position;
            this.TDRightIndent.style.position = Browser.StyleSet.MenuItem.Check.RightIndent.Position;
            if(Browser.StyleSet.MenuItem.Check.RightIndent.Right >= 0) {
                this.TDRightIndent.style.right = Browser.StyleSet.MenuItem.Check.RightIndent.Right + 'px';
            } else { this.TDRightIndent.style.right = ''; }
            this.SPANIcon.style.marginLeft = Browser.StyleSet.MenuItem.Check.Icon.Margin.Left + 'px';
            this.SPANRightIcon.style.marginRight = Browser.StyleSet.MenuItem.Check.Glyph.Margin.Right + 'px';
            this.SPANIcon.style.marginTop = Browser.StyleSet.MenuItem.Check.Icon.Margin.Top + 'px';
            this.SPANText.style.left = Browser.StyleSet.MenuItem.Check.Text.Left + 'px';
            this.SPANText.style.marginLeft = Browser.StyleSet.MenuItem.Check.Text.Margin.Left + 'px';
            this.SPANText.style.marginTop = Browser.StyleSet.MenuItem.Check.Text.Margin.Top + 'px';
            this.SPANRightIcon.style.marginTop = Browser.StyleSet.MenuItem.Check.Glyph.Margin.Top + 'px';
            
            this.TDIndent.style.width = this.StyleSet.Indent.Left + 'px';
            this.TDIcon.style.width = this.StyleSet.Icon.Size + 'px';
            this.SPANIcon.style.width = this.StyleSet.Icon.Size + 'px';
            this.SPANIcon.style.height = this.StyleSet.Icon.Size + 'px';
            this.TDSpacerLeft.style.width = this.StyleSet.Spacing.Left + 'px';
            
            this.TDSpacerRight.style.width = this.StyleSet.Spacing.Right + 'px';
            this.TDRight.style.width = this.StyleSet.Glyph.Size + 'px';
            this.TDRightIndent.style.width = this.StyleSet.Indent.Right + 'px';
            break;
    }
    if(this.SubItems.length > 0) {
        var bE = false;
        var MM;
        var hC = 0;
        for(var i = 0; i < this.SubItems.length; i++) {
            if((this.SubItems[i].Type == eCMIType.Normal) || (this.SubItems[i].Type == eCMIType.Radio) || (this.SubItems[i].Type == eCMIType.Check)) {
                MM = this.SubItems[i].Render(bE, hC);
                bE = !bE;
            } else {
                MM = this.SubItems[i].Render(false, hC);
            }
            if(MM.Width > ret.Width) { ret.Width = MM.Width; }
            hC += MM.Height;
        }
        this.DIVChildren.style.width = '100%';
        this.DIVChildren.style.height = hC + 'px';
        if((this.Y >= 0) && (Browser.browser.isIE != true)) {
            this.DIVChildren.style.top = (this.Y + ret.Height + 1) + 'px';
        } else {
            this.DIVChildren.style.top = ret.Height + 'px';
        }
        if(this.Collapsed == false) {
            ret.Height += hC;
            this.DIVChildren.style.display = 'block';
            this.SPANRightIcon.style.visibility = 'visible';
        } else {
            this.SPANRightIcon.style.visibility = 'hidden';
            this.DIVChildren.style.display = 'none';
        }
        this.DIV.style.height = ret.Height + 'px';
        this.TDRight.style.width = this.StyleSet.Glyph.Size + 'px';
        this.SPANRightIcon.style.width = this.StyleSet.Glyph.Size + 'px';
        this.SPANRightIcon.style.height = this.StyleSet.Glyph.Size + 'px';
        this.SPANRightIcon.style.display = 'block';
        this.SPANRightIcon.style.visibility = 'visible';
    } else {
        this.DIVChildren.style.width = '100%';
        this.DIVChildren.style.height = '0px';
        if(this.SubMenu != null) {
            this.TDRight.style.width = this.StyleSet.Glyph.Size + 'px';
            this.SPANRightIcon.style.width = this.StyleSet.Glyph.Size + 'px';
            this.SPANRightIcon.style.height = this.StyleSet.Glyph.Size + 'px';
            this.SPANRightIcon.style.display = 'block';
            this.SPANRightIcon.style.visibility = 'visible';
        }
    }
    /*
    this.SPANText.style.backgroundColor = '#0000FF';
    this.DIVSelf.style.backgroundColor = '#FF0000';
    this.DIVSelf.style.overflow = 'auto';
    this.DIV.style.overflow = 'auto';
    */
    this.Rendered = true;
    this.Width = ret.Width;
    this.Height = ret.Height;
    return(ret);
}
function cMenuItem_RenderUp() {
    var MM = Browser.GetPosition(this.DIV);
    this.Parent.RenderUp();
    var mm = Browser.GetPosition(this.DIV);
    //if(MM.Height > mm.Height) {
    //    this.Parent.YRemove(MM.Height - mm.Height);
    //} else if(mm.Height > MM.Height) {
    //    this.Parent.YAdd(mm.Height - MM.Height);
    //}
}
function cMenuItem_SetSubItemSelection(e, subItemID) {
    if(this.SubItems.length > 0) {
        this.SelectedSubItem = subItemID;
        var iNew = -1;
        for(var i = 0; i < this.SubItems.length; i++) {
            if(this.SubItems[i].ID == subItemID) {
                iNew = i;
            } else {
                if(this.SubItems[i].Checked != false) { this.SubItems[i].ToggleCheck(); }
            }
        }
        if((iNew >= 0) && (iNew < this.SubItems.length)) {
            if(this.SubItems[iNew].Checked != true) { this.SubItems[iNew].ToggleCheck(); }
        }
        if(this.cbClick != null) { this.cbObject.MenuCallback(e, this, this.cbClick); }
    }
}
function cMenuItem_Toggle() {
    this.Collapsed = !this.Collapsed;
    if(this.Rendered == true) {
        this.Parent.RenderUp();
    }
}
function cMenuItem_ToggleCheck() {
    this.Checked = !this.Checked;
    this.Render(this.Even, this.Y);
}
function cMenuItem_UnLoad() {
    if(this.Loaded == true) {
        this.Rendered = false;
        
        eventPop(this.DIV, 'mousedown', this.onMouseDown);
        eventPop(this.DIV, 'mouseout', this.onMouseOut);
        eventPop(this.DIV, 'mouseover', this.onMouseOver);
        eventPop(this.DIV, 'mouseup', this.onMouseUp);
        
        if(this.SubItems.length > 0) {
            for(var i = this.SubItems.length - 1; i >= 0; i--) {
                this.SubItems[i].UnLoad();
            }
        }
        
            this.DIV.removeChild(this.DIVChildren);
                            this.TR.removeChild(this.TDRightIndent);
                                this.TDRight.removeChild(this.SPANRightIcon);
                            this.TR.removeChild(this.TDRight);
                            this.TR.removeChild(this.TDSpacerRight);
                                this.TDText.removeChild(this.SPANText);
                            this.TR.removeChild(this.TDText);
                            this.TR.removeChild(this.TDSpacerLeft);
                                this.TDIcon.removeChild(this.SPANIcon);
                            this.TR.removeChild(this.TDIcon);
                            this.TR.removeChild(this.TDIndent);
                        this.TBODY.removeChild(this.TR);
                    this.TABLE.removeChild(this.TBODY);
                this.DIVSelf.removeChild(this.TABLE);
            this.DIV.removeChild(this.DIVSelf);
        this.Parent.DIVChildren.removeChild(this.DIV);
        
        this.cbClick = null;
        this.Loaded = false;
    }
}
cMenuItem.prototype.Dispose = cMenuItem_Dispose;
cMenuItem.prototype.ChangeState = cMenuItem_ChangeState;
cMenuItem.prototype.CloseUp = cMenuItem_CloseUp;
cMenuItem.prototype.CreateSubItem = cMenuItem_CreateSubItem;
cMenuItem.prototype.CreateSubItemO = cMenuItem_CreateSubItemO;
cMenuItem.prototype.DetectSubItemSelection = cMenuItem_DetectSubItemSelection;
cMenuItem.prototype.GetFreeSubItemID = cMenuItem_GetFreeSubItemID;
cMenuItem.prototype.GetSubItem = cMenuItem_GetSubItem;
cMenuItem.prototype.Load = cMenuItem_Load;
cMenuItem.prototype.onMouseDown = cMenuItem_onMouseDown;
cMenuItem.prototype.onMouseOut = cMenuItem_onMouseOut;
cMenuItem.prototype.onMouseOver = cMenuItem_onMouseOver;
cMenuItem.prototype.onMouseUp = cMenuItem_onMouseUp;
cMenuItem.prototype.Render = cMenuItem_Render;
cMenuItem.prototype.RenderUp = cMenuItem_RenderUp;
cMenuItem.prototype.SetSubItemSelection = cMenuItem_SetSubItemSelection;
cMenuItem.prototype.Toggle = cMenuItem_Toggle;
cMenuItem.prototype.ToggleCheck = cMenuItem_ToggleCheck;
cMenuItem.prototype.UnLoad = cMenuItem_UnLoad;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
function cMenuPopper(parent, id) {
    this.Parent = parent;
    this.ID = id;
    this.isRoot = true;
    this.Loaded = false;
    this.Menus = new Array();       //  cMenu
    this.First = null;
    this.Prev = null;
    this.Next = null;
    this.Last = null;
    this.XLeft = 0;
    this.YTop = 0;
    this.XRight = 0;
    this.YBottom = 0;
    this.Width = 0;
    this.Height = 0;
}
function cMenuPopper_Dispose() {
    this.UnLoad();
    this.Menus = [];
}
function cMenuPopper_CloseUp(forceAll) {
    if(this.isRoot == true) {
        if(forceAll == true) {
            Browser.ClearMenuPoppers(0);
        } else {
            Browser.ClearMenuPoppers(this.ID);
        }
    } else {
        this.Parent.CloseUp();
    }
}
function cMenuPopper_Load() {
    if(this.Loaded == false) {
        this.Loaded = true;
        
        this.DIV = document.createElement('div');
        this.DIV.setAttribute('id', 'divMenuPopper_' + this.Depth);
        this.DIV.style.visibility = 'hidden';
        this.DIV.style.display = 'none';
        this.DIVChildren = document.createElement('div');
        this.DIVChildren.setAttribute('id', 'divMenuPopperChildren_' + this.Depth);
        
        this.DIVBorderTop = document.createElement('div');
        this.DIVBorderTop.setAttribute('id', 'divMenuPopperBorderTop_' + this.Depth);
        this.DIVBorderTop.style.display = 'block';
        this.DIVBorderTop.style.position = 'absolute';
        this.DIVBorderTop.style.overflow = 'hidden';
        //eventPush(this.DIVBorderTop, 'mousedown', this.SizeT);
        this.DIVBorderRight = document.createElement('div');
        this.DIVBorderRight.setAttribute('id', 'divMenuPopperBorderRight_' + this.Depth);
        this.DIVBorderRight.style.display = 'block';
        this.DIVBorderRight.style.position = 'absolute';
        this.DIVBorderRight.style.overflow = 'hidden';
        //eventPush(this.DIVBorderRight, 'mousedown', this.SizeR);
        this.DIVBorderBottom = document.createElement('div');
        this.DIVBorderBottom.setAttribute('id', 'divMenuPopperBorderBottom_' + this.Depth);
        this.DIVBorderBottom.style.display = 'block';
        this.DIVBorderBottom.style.position = 'absolute';
        this.DIVBorderBottom.style.overflow = 'hidden';
        //eventPush(this.DIVBorderBottom, 'mousedown', this.SizeB);
        this.DIVBorderLeft = document.createElement('div');
        this.DIVBorderLeft.setAttribute('id', 'divMenuPopperBorderLeft_' + this.Depth);
        this.DIVBorderLeft.style.display = 'block';
        this.DIVBorderLeft.style.position = 'absolute';
        this.DIVBorderLeft.style.overflow = 'hidden';
        //eventPush(this.DIVBorderLeft, 'mousedown', this.SizeL);
        
        this.DIVBorderTopLeft = document.createElement('div');
        this.DIVBorderTopLeft.setAttribute('id', 'divMenuPopperBorderTopLeft_' + this.Depth);
        this.DIVBorderTopLeft.style.display = 'block';
        this.DIVBorderTopLeft.style.position = 'absolute';
        this.DIVBorderTopLeft.style.overflow = 'hidden';
        //eventPush(this.DIVBorderTopLeft, 'mousedown', this.SizeTL);
        this.DIVBorderTopRight = document.createElement('div');
        this.DIVBorderTopRight.setAttribute('id', 'divMenuPopperBorderTopRight_' + this.Depth);
        this.DIVBorderTopRight.style.display = 'block';
        this.DIVBorderTopRight.style.position = 'absolute';
        this.DIVBorderTopRight.style.overflow = 'hidden';
        //eventPush(this.DIVBorderTopRight, 'mousedown', this.SizeTR);
        this.DIVBorderBottomLeft = document.createElement('div');
        this.DIVBorderBottomLeft.setAttribute('id', 'divMenuPopperBorderBottomLeft_' + this.Depth);
        this.DIVBorderBottomLeft.style.display = 'block';
        this.DIVBorderBottomLeft.style.position = 'absolute';
        this.DIVBorderBottomLeft.style.overflow = 'hidden';
        //eventPush(this.DIVBorderBottomLeft, 'mousedown', this.SizeBL);
        this.DIVBorderBottomRight = document.createElement('div');
        this.DIVBorderBottomRight.setAttribute('id', 'divMenuPopperBorderBottomRight_' + this.Depth);
        this.DIVBorderBottomRight.style.display = 'block';
        this.DIVBorderBottomRight.style.position = 'absolute';
        this.DIVBorderBottomRight.style.overflow = 'hidden';
        //eventPush(this.DIVBorderBottomRight, 'mousedown', this.SizeBR);
        
            this.DIV.appendChild(this.DIVChildren);
            this.DIV.appendChild(this.DIVBorderTop);
            this.DIV.appendChild(this.DIVBorderRight);
            this.DIV.appendChild(this.DIVBorderBottom);
            this.DIV.appendChild(this.DIVBorderLeft);
            this.DIV.appendChild(this.DIVBorderTopLeft);
            this.DIV.appendChild(this.DIVBorderTopRight);
            this.DIV.appendChild(this.DIVBorderBottomLeft);
            this.DIV.appendChild(this.DIVBorderBottomRight);
        document.body.appendChild(this.DIV);
        
        this.DIVBorderTopLeft.style.position = 'absolute';
        this.DIVBorderTopRight.style.position = 'absolute';
        this.DIVBorderBottomLeft.style.position = 'absolute';
        this.DIVBorderBottomRight.style.position = 'absolute';
        this.DIVBorderTop.style.position = 'absolute';
        this.DIVBorderRight.style.position = 'absolute';
        this.DIVBorderBottom.style.position = 'absolute';
        this.DIVBorderLeft.style.position = 'absolute';
        this.DIVChildren.style.position = 'absolute';
        
        this.DIVBorderTopLeft.className = 'Menu_CTL';
        this.DIVBorderTopRight.className = 'Menu_CTR';
        this.DIVBorderBottomLeft.className = 'Menu_CBL';
        this.DIVBorderBottomRight.className = 'Menu_CBR';
        this.DIVBorderTop.className = 'Menu_BT';
        this.DIVBorderRight.className = 'Menu_BR';
        this.DIVBorderBottom.className = 'Menu_BB';
        this.DIVBorderLeft.className = 'Menu_BL';
        this.DIVChildren.className = 'Menu_B';
        
        if(this.Menus.length > 0) {
            for(var i = 0; i < this.Menus.length; i++) {
                if(this.Menus[i].Loaded == true) { this.Menus[i].UnLoad(); }
                this.Menus[i].Load(this);
            }
        } else { this.DIVChildren.innerHTML = "Empty!"; }
    }
}
function cMenuPopper_PopUp(xLeft, yTop, xRight, yBottom) {
    if(this.Loaded != true) { this.Load(); }
    this.XLeft = xLeft;
    this.YTop = yTop;
    this.XRight = xRight;
    this.YBottom = yBottom;
    this.DIV.style.position = 'absolute';
    this.DIV.style.display = 'block';
    var MM;
    var x = 0;
    var y = 0;
    if(this.Menus.length > 0) {
        for(var i = 0; i < this.Menus.length; i++) {
            MM = this.Menus[i].Render();
            //MM = Browser.GetPosition(this.Items[i].DIV);
            if(MM.Width > x) { x = MM.Width; }
            y += MM.Height;
        }
    }
    x += 32;
    y += 8;
    this.DIV.style.width = x + 'px';
    this.DIV.style.height = y + 'px';
    this.Render();
    this.Position();
    MM = Browser.GetPosition(this.DIV);
    this.Width = MM.Width;
    this.Height = MM.Height;
    this.X1 = MM.X;
    this.Y1 = MM.Y;
    this.X2 = MM.X + MM.Width;
    this.Y2 = MM.Y + MM.Height;
}
function cMenuPopper_Position() {
    var MM = Browser.GetPosition(this.DIV);
    var mW = Browser.ScreenMetrics.X + Browser.ScreenMetrics.Width;
    var mH = Browser.ScreenMetrics.Y + Browser.ScreenMetrics.Height;
    var bW = true;
    while(bW == true) {
        bW = false;
        if((this.XRight + MM.Width) < mW) {        //pop right
            x = this.XRight;
        } else {
            if((this.XLeft - MM.Width) >= 0) {       //pop left
                x = this.XLeft - MM.Width;
            } else {
                if(MM.Width <= mW) {            //slide up
                    x = (mW / 2) - (MM.Width / 2);
                } else {                        //resize Y
                    this.ResizeX(mW);
                    MM = Browser.GetPosition(this.DIV);
                    bW = true;
                }
            }
        }
    }
    bW = true;
    while(bW == true) {
        bW = false;
        if((this.YBottom + MM.Height) < mH) {        //pop down
            y = this.YBottom;
        } else {
            if((this.YTop - MM.Height) >= 0) {       //pop up
                y = this.YTop - MM.Height;
            } else {
                if(MM.Height <= mH) {            //slide up
                    y = (mH / 2) - (MM.Height / 2);
                } else {                        //resize Y
                    this.ResizeY(mH);
                    MM = Browser.GetPosition(this.DIV);
                    bW = true;
                }
            }
        }
    }
    this.DIV.style.left = x + 'px';
    this.DIV.style.top = y + 'px';
    this.DIV.style.display = 'block';
    this.DIV.style.visibility = 'visible';
    this.DIV.style.zIndex = 99999;
}
function cMenuPopper_Render() {
    this.DIVBorderTop.style.left = '0px';
    this.DIVBorderTop.style.top = '0px';
    this.DIVBorderTop.style.width = '100%';
    this.DIVBorderRight.style.right = '0px';
    this.DIVBorderRight.style.top = '0px';
    this.DIVBorderRight.style.height = '100%';
    this.DIVBorderBottom.style.left = '0px';
    this.DIVBorderBottom.style.bottom = '0px';
    this.DIVBorderBottom.style.width = '100%';
    this.DIVBorderLeft.style.left = '0px';
    this.DIVBorderLeft.style.top = '0px';
    this.DIVBorderLeft.style.height = '100%';
    
    this.DIVBorderTopLeft.style.left = '0px';
    this.DIVBorderTopLeft.style.top = '0px';
    this.DIVBorderTopRight.style.right = '0px';
    this.DIVBorderTopRight.style.top = '0px';
    this.DIVBorderBottomLeft.style.left = '0px';
    this.DIVBorderBottomLeft.style.bottom = '0px';
    this.DIVBorderBottomRight.style.right = '0px';
    this.DIVBorderBottomRight.style.bottom = '0px';
    
    this.DIVChildren.style.left = 4 + 'px';
    this.DIVChildren.style.top = 4 + 'px';
    this.DIVChildren.style.right = 4 + 'px';
    this.DIVChildren.style.bottom = 4 + 'px';
}
function cMenuPopper_RenderUp() {
    this.Render();
    if(this.Menus.length > 0) {
        var x = 0; 
        var y = 0;
        for(var i = 0; i < this.Menus.length; i++) {
            if(this.Menus[i].Width > x) { x = this.Menus[i].Width; }
            y = y + this.Menus[i].Height;
        }
        this.DIV.style.width = (x + 32) + 'px';
        this.DIV.style.height = (y + 8) + 'px';
        this.Position();
        var MM = Browser.GetPosition(this.DIV);
        this.Width = MM.Width;
        this.Height = MM.Height;
        this.X1 = MM.X;
        this.Y1 = MM.Y;
        this.X2 = MM.X + MM.Width;
        this.Y2 = MM.Y + MM.Height;
    }
}
function cMenuPopper_ResizeX(max) {
    this.DIV.style.width = max + 'px';
}
function cMenuPopper_ResizeY(max) {
    this.DIV.style.height = max + 'px';
}
function cMenuPopper_UnLoad() {
    if(this.Loaded == true) {
        this.DIV.style.visibility = 'hidden';
        this.DIV.style.display = 'none';
        if(this.Menus.length > 0) {
            for(var i = this.Menus.length - 1; i >= 0; i--) {
                this.Menus[i].UnLoad();
            }
        }
        
            //eventPop(this.DIVBorderTop, 'mousedown', this.SizeT);
            //eventPop(this.DIVBorderRight, 'mousedown', this.SizeR);
            //eventPop(this.DIVBorderBottom, 'mousedown', this.SizeB);
            //eventPop(this.DIVBorderLeft, 'mousedown', this.SizeL);
            //eventPop(this.DIVBorderTopLeft, 'mousedown', this.SizeTL);
            //eventPop(this.DIVBorderTopRight, 'mousedown', this.SizeTR);
            //eventPop(this.DIVBorderBottomLeft, 'mousedown', this.SizeBL);
            //eventPop(this.DIVBorderBottomRight, 'mousedown', this.SizeBR);
        
            this.DIV.removeChild(this.DIVBorderTop);
            this.DIV.removeChild(this.DIVBorderRight);
            this.DIV.removeChild(this.DIVBorderBottom);
            this.DIV.removeChild(this.DIVBorderLeft);
            this.DIV.removeChild(this.DIVBorderTopLeft);
            this.DIV.removeChild(this.DIVBorderTopRight);
            this.DIV.removeChild(this.DIVBorderBottomLeft);
            this.DIV.removeChild(this.DIVBorderBottomRight);
            this.DIV.removeChild(this.DIVChildren);
        document.body.removeChild(this.DIV);
        
        this.Loaded = false;
    }
}
cMenuPopper.prototype.Dispose = cMenuPopper_Dispose;
cMenuPopper.prototype.CloseUp = cMenuPopper_CloseUp;
cMenuPopper.prototype.Load = cMenuPopper_Load;
cMenuPopper.prototype.PopUp = cMenuPopper_PopUp;
cMenuPopper.prototype.Position = cMenuPopper_Position;
cMenuPopper.prototype.Render = cMenuPopper_Render;
cMenuPopper.prototype.RenderUp = cMenuPopper_RenderUp;
cMenuPopper.prototype.ResizeX = cMenuPopper_ResizeX;
cMenuPopper.prototype.ResizeY = cMenuPopper_ResizeY;
cMenuPopper.prototype.UnLoad = cMenuPopper_UnLoad;
function cQueue(){var _1=[];var _2=0;this.size=function(){return _1.length-_2;};this.empty=function(){return (_1.length==0);};this.push=function(_3){_1.push(_3);};this.pop=function(){var _4=undefined;if(_1.length){_4=_1[_2];if(++_2*2>=_1.length){_1=_1.slice(_2);_2=0;}}return _4;};this.front=function(){var _5=undefined;if(_1.length){_5=_1[_2];}return _5;};}
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
    //        string, array<int>
function cReference(type, ids) {
    this.TypeOf = "Reference";
    this.BaseType = "Reference";
    this.Type = type;
    this.IDs = ids;
}
function cReference_Dispose() {
    this.IDs = [];
    delete this.IDs;
}
function cReference_Equals(ref) {
    if(this.Type != ref.Type) { if(this.Type != ReverseObjectType(ref.Type)) { return(false); } }
    if(this.IDs.length != ref.IDs.length) { return(false); }
    if(this.IDs.length > 0) {
        for(var i = 0; i < this.IDs.length; i++) {
            if(this.IDs[i] != ref.IDs[i]) { return(false); }
        }
    }
    return(true);
}
function cReference_GetObject() {
    switch(this.Type) {
        case "Browser":
        case eCObjectType.Browser:
            return(Browser);
            break;
        case "Session":
        case eCObjectType.Session:
            if(this.IDs.length > 0) {
                return(Browser.GetSession(this.IDs[0]));
            }
            break;
        case "Window":
        case eCObjectType.Window:
            if(this.IDs.length > 1) {
                var s = Browser.GetSession(this.IDs[0]);
                if(s != null) {
                    return(s.GetWindow(this.IDs[1]));
                }
            }
            break;
        case "Control":
        case eCObjectType.Control:
            if(this.IDs.length > 2) {
                var s = Browser.GetSession(this.IDs[0]);
                if(s != null) {
                    var w = s.GetWindow(this.IDs[1]);
                    if(w != null) {
                        return(w.GetControl(this.IDs[2]));
                    }
                }
            }
            break;
    }
    return(null);
}
cReference.prototype.Dispose = cReference_Dispose;
cReference.prototype.Equals = cReference_Equals;
cReference.prototype.GetObject = cReference_GetObject;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
    //        cBrowser, int, eCObjectType, int
function cScript(parent, id, objecttype, objectid, usingControl) {
    this.Parent = parent;
    this.ID = id;
    this.ObjectType = objecttype;
    this.ObjectID = objectid;
    this.Loaded = false;
    this.Loading = false;
    this.LoadChange = false;
    this.LoadComplete = false;
    this.SCRIPT = null;
    this.Methods = null;
    this.UsingControls = new Array();
    this.UsingControls.push(usingControl);
    this.Load();
}
function cScript_Dispose() {
    this.UnLoad();
}
function cScript_AddUsingControl(usingControl) {
    var bHit = false;
    if(this.UsingControls.length > 0) {
        for(var i = this.UsingControls.length - 1; i >= 0; i--) {
            if(this.UsingControls[i].Equals(usingControl)) {
                bHit = true;
                break;
            }
        }
    }
    if(bHit == false) {
        this.UsingControls.push(usingControl);
    } else {
        delete usingControl;
        usingControl = null;
    }
}
function cScript_FireLoadComplete(a) {
    this.LoadComplete = true;
    this.Methods = a;
    if(this.ObjectType == eCObjectType.Window) {
        if(this.UsingControls.length > 0) {
            var o;
            for(var i = 0; i < this.UsingControls.length; i++) {
                o = this.UsingControls[i].GetObject();
                if(o != null) {
                    if(o.CodeInterface != null) {
                        o.CodeInterface.Dispose();
                        o.CodeInterface = null;
                    }
                    this.WireBaseClass(i);
                }
            }
        }
    }
}
function cScript_Load() {
    if((this.Loaded == false) && (this.Loading == false) && (this.LoadChange == false)) {
        this.LoadChange = true;
        this.LoadComplete = false;
        var dt = ((new Date()).getTimezoneOffset()) / 60;
        this.SCRIPT = document.createElement('script');
        this.SCRIPT.setAttribute('id', 'srcScript_' + this.ID);
        this.SCRIPT.setAttribute('type', 'text/javascript');
        this.SCRIPT.setAttribute('src', 'inc/rawajax.php?h=' + encodeURIComponent(BufferOut(new Array(Browser.BrowserKey, dt, this.ID, 's', this.ObjectType, this.ObjectID))));
        document.getElementById('divSRCHolder').appendChild(this.SCRIPT);
        this.Loaded = true;
        this.LoadChange = false;
    }
}
function cScript_RemoveUsingControl(usingControl) {
    var bHit = false;
    if(this.UsingControls.length > 0) {
        for(var i = this.UsingControls.length - 1; i > 0; i--) {
            if(bHit == true) {
                this.UsingControls[i] = this.UsingControls[i - 1];
            } else {
                if(this.UsingControls[i].Equals(usingControl)) {
                    this.UsingControls[i].Dispose();
                    this.UsingControls[i] = this.Sessions[i - 1];
                    bHit = true;
                }
            }
        }
        if(bHit == false) {
            if(this.UsingControls[0].Equals(usingControl)) {
                this.UsingControls[0].Dispose();
                bHit = true;
            }
        }
        if(bHit == true) {
            this.UsingControls.shift();
        }
    }
    if(this.UsingControls.length < 1) { this.Parent.RemoveScript(this.ID); }
}
function cScript_UnLoad() {
    if((this.Loaded == true) && (this.Loading == false) && (this.LoadChange == false)) {
        this.LoadChange = true;
        this.LoadComplete = false;
        var p = document.getElementById('divSRCHolder');
        p.removeChild(this.SCRIPT);
        this.Loaded = false;
        this.LoadChange = false;
    }
}
function cScript_WireBaseClass(i) {
    if(this.Methods != null) {
        if(this.Methods.length > 0) {
            if(this.Methods[0].length > 0) {
                setTimeout('var s = Browser.GetScript(' + this.ID + '); if(s != null) { var o = s.UsingControls['+i+'].GetObject(); if(o != null) { o.CodeInterface = new ' + this.Methods[0] + '(); if(o.CodeInterface != null) { o.CodeInterface.WireTo(o); } } }');
            }
        }
    }
}
cScript.prototype.Dispose = cScript_Dispose;
cScript.prototype.AddUsingControl = cScript_AddUsingControl;
cScript.prototype.FireLoadComplete = cScript_FireLoadComplete;
cScript.prototype.Load = cScript_Load;
cScript.prototype.RemoveUsingControl = cScript_RemoveUsingControl;
cScript.prototype.UnLoad = cScript_UnLoad;
cScript.prototype.WireBaseClass = cScript_WireBaseClass;
/*
   Copyright 2009 Cory J. Geesaman (http://cory.geesaman.com/)
   http://www.inetgui.org/
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
    //           cBrowser, int, int
function cSession(parent, ajaxID, sessionID) {
    this.BaseType = 'Session';
    this.TypeOf = 'Session';
    this.Parent = parent;
    this.ID = sessionID;
    this.DataLinks = new Array();       //  cDataLink
    this.Windows = new Array();         //  cWindow
    this.Docks = new Array();           //  cDock
    this.AjaxID = ajaxID;
    this.DockID = 0;
    this.WindowID = 0;
    this.DockSize = new Object();
    this.DockSize.Top = 0; this.DockSize.Right = 0; this.DockSize.Bottom = 0; this.DockSize.Left = 0;
    this.MinSize = new Object(); this.MinSize.X = 0; this.MinSize.Y = 0;
    this.ButtonHovering = false;
    this.NewSpacer = new cWCord(32, 32);
    this.NewCord = new cWCord(0, 0);
    
    this.DIV = document.createElement('div');
    this.DIV.setAttribute('id', 'divSession_' + sessionID);
    document.getElementById('divSessionHolder').appendChild(this.DIV);
    if((Browser.browser.isIE == true) || (window.opera)) { this.DIV.name = 'divSession_' + sessionID; }
    this.DIVWindowList = document.createElement('div');
    this.DIVWindowList.setAttribute('id', 'divSessionWindowList_' + sessionID);
    
    this.SPANButton = document.createElement('span');
    this.SPANButton.setAttribute('id', 'spnSessionButton_' + sessionID);
    this.SPANButton.className = 'SessionButton_N';
    
        this.DIVWindowList.appendChild(this.SPANButton);
    document.getElementById('divSessionHolder').appendChild(this.DIVWindowList);
    
    eventPush(this.DIV, 'resize', this.ResizeLocal);
    
    eventPush(this.SPANButton, 'mousedown', this.ButtonMouseDown);
    eventPush(this.SPANButton, 'mouseout', this.ButtonMouseOut);
    eventPush(this.SPANButton, 'mouseover', this.ButtonMouseOver);
    eventPush(this.SPANButton, 'mouseup', this.ButtonMouseUp);
    
    var p = Browser.GetPosition(document.getElementById('divSessionHolder'));
    this.DIV.style.position = 'absolute';
    this.DIV.style.overflow = 'hidden';
    this.DIV.style.width = p.Width;
    this.DIV.style.height = p.Height - 27;
    this.DIV.style.left = '0px';
    this.DIV.style.top = '0px';
    
    this.DIVWindowList.style.position = 'absolute';
    this.DIVWindowList.style.overflow = 'hidden';
    this.DIVWindowList.style.left = '0px';
    this.DIVWindowList.style.right = '0px';
    this.DIVWindowList.style.bottom = '0px';
    this.DIVWindowList.style.height = '27px';
    
    this.WindowListID = Browser.CreateWindowList(this.DIVWindowList, 'WLB');
    this.WindowList = Browser.GetWindowList(this.WindowListID);
    
    this.CreateDock(eCDPosition.Top);
    this.CreateDock(eCDPosition.Bottom);
    this.CreateDock(eCDPosition.Left);
    this.CreateDock(eCDPosition.Right);
}
function cSession_Dispose() {
    eventPop(this.DIV, 'resize', this.ResizeLocal);
    
    eventPop(this.SPANButton, 'mousedown', this.ButtonMouseDown);
    eventPop(this.SPANButton, 'mouseout', this.ButtonMouseOut);
    eventPop(this.SPANButton, 'mouseover', this.ButtonMouseOver);
    eventPop(this.SPANButton, 'mouseup', this.ButtonMouseUp);
    
    if(this.Docks.length > 0) {
        for(var i = this.Docks.length - 1; i >= 0; i--) {
            this.Docks[i].Dispose();
        }
    }
    this.Docks = [];
    if(this.Windows.length > 0) {
        for(var i = this.Windows.length - 1; i >= 0; i--) {
            this.Windows[i].Dispose();
        }
    }
    this.Windows = [];
    this.DockSize = [];
    this.DataLinks = [];
    this.WindowList.Dispose();
    delete this.WindowList;
    var p = document.getElementById('divSessionHolder');
    p.removeChild(this.DIV);
        this.DIVWindowList.removeChild(this.SPANButton);
    p.removeChild(this.DIVWindowList);
}
function cSession_AjaxProcess(data) {
    if(data.length > 0) {
        switch(data[0]) {
            case 'session':
                this.AjaxProcessSession(data);
                break;
        }
    }
}
function cSession_AjaxProcessSession(data) {
    if(data.length > 0) {
        switch(data[1]) {
            case 'window':
                this.AjaxProcessSessionWindow(data);
                break;
        }
    }
}
function cSession_AjaxProcessSessionWindow(data) {
    if(data.length > 0) {
        switch(data[2]) {
            case 'create':
                this.CreateWindowFromPremadeConfig(data[3], data[4]);
                break;
        }
    }
}
function cSession_BringNextToFront() {
    if(this.Windows.length > 0) {
        for(var i = 0; i < this.Windows.length; i++) {
            if(this.Windows[i].ZOrder == 0) {
                this.Windows[i].ChangeZOrder(this.Windows.length - 1);
            } else {
                this.Windows[i].ChangeZOrderDown();
            }
            if(this.Windows[i].ZOrder == 0) {
                if(this.Windows[i].Dock == eCDPosition.Float) {
                    this.Windows[i].DIVHeader.style.backgroundColor = this.Windows[i].StyleSet.Header.Focus.Color;
                } else { this.Windows[i].DIVHeader.style.backgroundColor = this.Windows[i].StyleSet.Header.Unfocused.Color; }
            } else {
                this.Windows[i].DIVHeader.style.backgroundColor = this.Windows[i].StyleSet.Header.Unfocused.Color;
            }
        }
    }
}
function cSession_BringToFront(id) {
    if(this.Windows.length > 0) {
        var oZO = -1;
        for(var i = 0; i < this.Windows.length; i++) {
            if(this.Windows[i].ID == id) {
                oZO = this.Windows[i].ZOrder;
                if(oZO < 0) { oZO = this.Windows.length; }
                this.Windows[i].ChangeZOrder(0);
                if(this.Windows[i].Dock == eCDPosition.Float) {
                    this.Windows[i].DIVHeader.style.backgroundColor = this.Windows[i].StyleSet.Header.Focus.Color;
                } else { this.Windows[i].DIVHeader.style.backgroundColor = this.Windows[i].StyleSet.Header.Unfocused.Color; }
            }
        }
        if(oZO >= 0) {
            for(var i = 0; i < this.Windows.length; i++) {
                if((this.Windows[i].ZOrder < oZO) && (this.Windows[i].ZOrder >= 0)) {
                    if(this.Windows[i].ID != id) {
                        this.Windows[i].ChangeZOrderUp();
                        this.Windows[i].DIVHeader.style.backgroundColor = this.Windows[i].StyleSet.Header.Unfocused.Color;
                    }
                }
            }
        }
    }
}
function cSession_ButtonMouseDown(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        var aID = obj.id.split('_');
        var SessionID = parseInt(aID[aID.length - 1]);
        var Ses = Browser.GetSession(SessionID);
        Ses.ChangeButtonClass('D');
        Ses.ButtonHovering = true;
    }
    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseDown(e); }
}
function cSession_ButtonMouseOut(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        var aID = obj.id.split('_');
        var SessionID = parseInt(aID[aID.length - 1]);
        var Ses = Browser.GetSession(SessionID);
        Ses.ChangeButtonClass('N');
        Ses.ButtonHovering = false;
    }
}
function cSession_ButtonMouseOver(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        var aID = obj.id.split('_');
        var SessionID = parseInt(aID[aID.length - 1]);
        var Ses = Browser.GetSession(SessionID);
        Ses.ChangeButtonClass('H');
        Ses.ButtonHovering = true;
    }
}
function cSession_ButtonMouseUp(e) {
    var obj = EventObj(e);
    if(obj) {
        if (obj.nodeType == 3)
            obj = obj.parentNode;
        var aID = obj.id.split('_');
        var SessionID = parseInt(aID[aID.length - 1]);
        var Ses = Browser.GetSession(SessionID);
        if(Ses.ButtonHovering == true) {
            var o = Browser.GetPosition(Ses.SPANButton);
            var m = Browser.GetMenuByKey('sys_session');
            if(m.Items.length > 0) {
                var bLogout = true;
                for(var i = m.Items.length - 1; i >= 0; i--) {
                    switch(m.Items[i].Tag) {
                        case 'header':
                            if(m.Items[i].SubItems.length > 0) {
                                for(var j = m.Items[i].SubItems.length - 1; j >= 0; j--) {
                                    switch(m.Items[i].SubItems[j].Tag) {
                                        case 'logout':
                                            m.Items[i].SubItems[j].cbObject = Ses;
                                            m.Items[i].SubItems[j].cbClick = 'logout';
                                            m.Items[i].SubItems[j].LoadDisabled = !bLogout;
                                            break;
                                    }
                                }
                            }
                            break;
                    }
                }
            }
            m.PopUp(o.X + o.Width, o.Y, o.X, o.Y + o.Height);
            Ses.ChangeButtonClass('H');
        } else {
            
            Ses.ChangeButtonClass('N');
        }
        Ses.ButtonHovering = false;
    }
    if((Browser.browser.isIE == true) || (window.opera)) { Browser.MouseUp(e); }
}
function cSession_ChangeButtonClass(hoverstate) {
    this.SPANButton.className = 'SessionButton_' + hoverstate;
}
function cSession_CheckDock(rect, sides, forWindow) {
    var oDock = null;
    var oTemp = null;
    if(this.Docks.length > 0) {
        for(var i = this.Docks.length - 1; i >= 0; i--) {
            oTemp = this.Docks[i].CheckDock(rect, sides, forWindow);
            if(oTemp.Hit == true) {
                if(oDock == null) {
                    oDock = oTemp;
                } else {
                    if(oDock.Weight > oTemp.Weight) {
                        oDock = oTemp;
                    }
                }
            }
        }
    }
    return(oDock);
}
        //                  eCDPosition
function cSession_CreateDock(position) {
    var d = this.GetFreeDockID();
    this.Docks.push(new cDock(this, d, position));
    return(d);
}
        //                    string, string, eCWState, eCWStyle, eCDPosition, eCDPosition, cCord, cCord, cCord, cCord, cCord, bool, int, bool, bool, bool
function cSession_CreateWindow(windowServerID, name, caption, icon, state, style, dock, docksallowed, position, size, minimumsize, docksize, dockminimumsize, dockcollapsed, zorder, moveable, sizeable, datacapable, scrollx, scrolly, defaultalign, defaultvalign) {
    if(isNaN(position.X) && (position.X.toLowerCase() == 'auto')) {
        if(dock == eCDPosition.Float) { position.X = this.GetNewCordX(parseInt(size.X)); }
        else { position.X = 0; }
    }
    if(isNaN(position.Y) && (position.Y.toLowerCase() == 'auto')) {
        if(dock == eCDPosition.Float) { position.Y = this.GetNewCordY(parseInt(size.Y)); }
        else { position.Y = 0; }
    }
    var w = this.GetFreeWindowID();
    if(minimumsize.X > this.MinSize.X) { this.MinSize.X = minimumsize.X; }
    if(minimumsize.Y > this.MinSize.Y) { this.MinSize.Y = minimumsize.Y; }
    this.Windows.push(new cWindow(this, this.ID, w, windowServerID, name, caption, icon, state, style, dock, docksallowed, position, size, minimumsize, docksize, dockminimumsize, dockcollapsed, zorder, moveable, sizeable, datacapable, scrollx, scrolly, defaultalign, defaultvalign));
    this.WindowList.CreateButton(this.ID, w);
    if(!((state & eCWState.Docked) || (state & eCWState.Minimized))) { this.BringToFront(w); }
    else { this.SendToBack(w); }
    return(w);
}
function cSession_CreateWindowFromPremade(windowID, windowServerID, name, caption, icon, state, style, dock, docksallowed, position, size, minimumsize, docksize, dockminimumsize, dockcollapsed, zorder, moveable, sizeable, datacapable, scrollx, scrolly, defaultalign, defaultvalign) {
    if(isNaN(position.X) && (position.X.toLowerCase() == 'auto')) {
        if(dock == eCDPosition.Float) { position.X = this.GetNewCordX(parseInt(size.X)); }
        else { position.X = 0; }
    }
    if(isNaN(position.Y) && (position.Y.toLowerCase() == 'auto')) {
        if(dock == eCDPosition.Float) { position.Y = this.GetNewCordY(parseInt(size.Y)); }
        else { position.Y = 0; }
    }
    if(