var Lib =
{
    version: '0.1.5',
    creator: 'Jerry Middlemiss',
    email: 'jerry@richat.com',
    emptyFunction: function() {}
}
function Try()
{
    var value;
    for (var i = 0; i < arguments.length; i++)
    {
        var lambda = arguments[i];
        try
        {
            value = lambda();
            break;
        }
        catch (e) {}
    }
    return value;
}
function $R(theTargets, theFunctions)
{
}
function $G(theField)
{
    theField = $E(theField);
    if (isDom(theField) || isArray(theField))
    {
        var type = (isSet(theField.type)) ? theField.type : ((isArray(theField) && isDom(theField[0]) && isSet(theField[0].type)) ? theField[0].type : "");
        switch (type)
        {
            case "select-one" :
                if (theField.options.length > 0)
                {   return theField.options[theField.selectedIndex].value;    }
            break;
            case "select-multiple" :
                value = $A();
                for (var i = 0; i < theField.options.length; i++)
                {   if (theField.options[i].selected == true) {   value.push(theField.options[i].value);    }    }
                return (value.length > 0) ? value : null;
            break;
            case "radio" :
                var buttons = (theField.length > 0) ? theField : ((theField.form[theField.name].length > 0) ? theField.form[theField.name] : $A());
                for (var i = 0; i < buttons.length; i++)
                {   if (buttons[i].checked == true) {   return buttons[i].value;    }    }
                return theField.value;
            break;
            case "checkbox" :
                if (theField.checked == true)
                {   return theField.value;    }
            break;
            case "file" :
            case "hidden" :
            case "textarea" :
            case "password" :
            case "button" :
            case "submit" :
            case "reset" :
            case "text" :
                return theField.value;
            break;
        }
    }
    return null;
}
function $S(theField, theValue)
{
    theField = $E(theField);
    theValue = (typeof theValue != 'undefined') ? theValue : '';
    if (isDom(theField) || isArray(theField))
    {
        var type = (isSet(theField.type)) ? theField.type : ((isArray(theField) && isDom(theField[0]) && isSet(theField[0].type)) ? theField[0].type : "");
        switch (type)
        {
            case "select-one" :
            case "select-multiple" :
                for (var i = 0; i < theField.options.length; i++)
                {   if (theField.options[i].value == theValue) {   theField.selectedIndex = i;    }    }
            break;
            case "checkbox" :
                theField.checked = (theValue == theField.value);
            break;
            case "radio" :
                var buttons = (theField.length > 0) ? theField : ((theField.form[theField.name].length > 0) ? theField.form[theField.name] : $A());
                for (var i = 0; i < buttons.length; i++)
                {   buttons[i].checked = (buttons[i].value == theValue);    }
            break;
            case "textarea" :
                theField.value = theValue;
                theField.innerHTML = theValue;
            break;
            case "hidden" :
            case "password" :
            case "button" :
            case "submit" :
            case "reset" :
            case "text" : //NOTE: Safari has issues with setting textareas to DOM snippets!
                theField.value = theValue;
            break;
            case "fileupload" :
            break;
        }
        return true;
    }
    return false;
}
function $E(theId, theDoc)
{
    var doc = (isDom(theDoc)) ? theDoc : document;
    if (isArray(theId))
    {
        var arr = new Array();
        for (theId in id)
        {   arr.push((isDom(id)) ? id : doc.getElementById(id));    }
        return arr;
    }
    else if (isDom(theId))
    {   return theId;    }
    else if (isSet(theId))
    {   return doc.getElementById(theId);    }
    else
    {   return false;    }
}
function $A()
{
    var arr = new Array();
    for (var i = 0; i < arguments.length; i++)
    {   arr[i] = arguments[i];    }
    return arr;
}
function $H(theKeys, theValues)
{
    var arr = new Array();
    if (isArray(theKeys))
    {
        for (var i = 0; i < theKeys.length; i++)
        {   arr.set(theKeys[i], theValues[i]);    }
    }
    return arr;
}
function objDump(theObj, theStyle)
{
    var eol = (theStyle == "html") ? "<br />" : "\n";
    var msg = "";
    if (isObject(theObj))
    {
        msg += "Values are: " + eol;
        for (var i in theObj)
        {
            try
            {
                msg += "[" + i + "] is [" + theObj[i] + "]" + eol;
                if (isObject(theObj[i]))
                {   msg += objDump(theObj[i], theStyle);    }
                msg += eol;
            }
            catch (e)
            {       }
        }
    }
    return msg;
}
function getInt(theStr)
{
    var str = new String(theStr);
    var num = "";
    for (i = 0;  i < str.length; i++)
    {
        var ch = parseInt(str.charAt(i));
        if (ch >= 0 && ch <= 9)
        {   num += "" + str.charAt(i);    }
    }
    return num;
}
function trim(theStr)
{
    var str = (isSet(theStr)) ? new String(theStr) : '';
    return str.replace(/^\s*|\s*$/g, '');
}
function rTrim(theStr)
{
    var str = (isSet(theStr)) ? new String(theStr) : '';
    return str.replace(/\s*$/g, '');
}
function lTrim(theStr)
{
    var str = (isSet(theStr)) ? new String(theStr) : '';
    return str.replace(/^\s*/g, '');
}
function isSet(theValue)
{   return ((theValue != null) && ((typeof theValue == 'number') || (typeof theValue == 'function') || (typeof theValue == 'string' && theValue.length > 0) || (typeof theValue == 'boolean' && theValue == true) || (typeof theValue == 'object' && ((typeof theValue.getKeys == 'function' && theValue.getKeys().length > 0) || (typeof theValue.getKeys != 'function' && theValue.length == null) || (typeof theValue.getKeys != 'function' && theValue.length != null && theValue.length > 0)))));    }
function isNotSet(theValue)
{   return !isSet(theValue);    }
function isObject(theObj)
{   return (theObj && typeof theObj == "object");    }
function isNotObject(theObj)
{   return !isObject(theObj);    }
function isDom(theElem)
{   return (theElem && typeof theElem == "object" && isSet(theElem.nodeName));    }
function isNotDom(theElem)
{   return !isDom(theElem);    }
function isDefault(theField)
{
    if (isDom(theField) || isArray(theField))
    {
        var type = (isSet(theField.type)) ? theField.type : ((isArray(theField) && isDom(theField[0]) && isSet(theField[0].type)) ? theField[0].type : "");
        switch (type)
        {
            case "select-one" :
                return (theField.options[theField.selectedIndex].defaultSelected == theField.options[theField.selectedIndex].selected);
            break;
            case "select-multiple" :
                for (var i = 0; i < theField.options.length; i++)
                {
                    if (theField.options[i].defaultSelected != theField.options[i].selected)
                    {   return false;    }
                }
                return true;
            break;
            case "checkbox" :
                return (theField.defaultChecked == theField.checked);
            case "radio" :
                if (isArray(theField))
                {
                    for (var i = 0; i < theField.length; i++)
                    {
                        if (theField[i].defaultChecked != theField[i].checked)
                        {   return false;    }
                    }
                    return true;
                }
                else
                {   return (theField.defaultChecked == theField.checked);    }
            break;
            case "textarea" :
            case "hidden" :
            case "password" :
            case "button" :
            case "submit" :
            case "reset" :
            case "text" :
                return (theField.defaultValue == theField.value);
            break;
            case "fileupload" :
                return (theField.defaultValue == theField.value);
            break;
        }
    }
    return false;
}
function setDefault(theField, theValue)
{
    if (isDom(theField) || isArray(theField))
    {
        var type = (isSet(theField.type)) ? theField.type : ((isArray(theField) && isDom(theField[0]) && isSet(theField[0].type)) ? theField[0].type : "");
        var start_value = $G(theField);
        switch (type)
        {
            case "select-one" :
                theField.options[theField.selectedIndex].defaultSelected = (theValue);
            break;
            case "select-multiple" :
                for (var i = 0; i < theField.options.length; i++)
                {   theField.options[i].defaultSelected = (theValue[i]);    }
            break;
            case "checkbox" :
                theField.defaultChecked = (theValue);
            case "radio" :
                if (isArray(theField))
                {
                    for (var i = 0; i < theField.length; i++)
                    {   theField[i].defaultChecked = (theValue[i])    }
                }
                else
                {   theField.defaultChecked = (theValue);    }
            break;
            case "textarea" :
            case "hidden" :
            case "password" :
            case "button" :
            case "submit" :
            case "reset" :
            case "text" :
                theField.defaultValue = (theValue);
            break;
            case "fileupload" :
                theField.defaultValue = (theValue);
            break;
        }
        $S(theField, start_value);
        return true;
    }
    return false;
}
function getDefault(theField)
{
    if (isDom(theField) || isArray(theField))
    {
        var type = (isSet(theField.type)) ? theField.type : ((isArray(theField) && isDom(theField[0]) && isSet(theField[0].type)) ? theField[0].type : "");
        switch (type)
        {
            case "select-one" :
                return (theField.options[theField.selectedIndex].defaultSelected);
            break;
            case "select-multiple" :
                var vals = $A();
                for (var i = 0; i < theField.options.length; i++)
                {   vals[i] = (theField.options[i].defaultSelected);    }
                return vals;
            break;
            case "checkbox" :
                return (theField.defaultChecked);
            case "radio" :
                if (isArray(theField))
                {
                    var vals = $A();
                    for (var i = 0; i < theField.length; i++)
                    {   vals[i] = (theField[i].defaultChecked);    }
                    return vals;
                }
                else
                {   return (theField.defaultChecked);    }
            break;
            case "textarea" :
            case "hidden" :
            case "password" :
            case "button" :
            case "submit" :
            case "reset" :
            case "text" :
                return theField.defaultValue;
            break;
            case "fileupload" :
                return theField.defaultValue;
            break;
        }
    }
    return null;
}
function isArray(theArr)
{   return (theArr && typeof theArr == "object" && theArr.constructor == Array);    }
function isNotArray(theArr)
{   return !isArray(theArr);    }
function isFunction(theFunc)
{   return (theFunc && typeof theFunc == "function");    }
function isNotFunction(theFunc)
{   return !isFunction(theFunc);    }
function isDate(theDate)
{
    if (typeof theDate != 'object')
    {   theDate = new Date(theDate);    }
    return (theDate && typeof theDate == "object" && theDate.constructor == Date && ((theDate.getMonth() > -1) && (theDate.getDate() > -1) && (theDate.getYear() > -1)));
}
function isNotDate(theDate)
{   return !isDate(theDate);    }Object.extend = function(theDestination, theSource)
{
    for (property in theSource)
    {   theDestination[property] = theSource[property];    }
    return theDestination;
}
function objSetTimeout(theObj, theMethod, thePause, theArgs)
{
    this.id = 'timeout_' + (objSetTimeout.counter++);
    this.obj = theObj;
    this.method = theMethod;
    this.pause = thePause;
    this.timeId = 0;
    this.args = new Array();
    if (arguments.length > 3)
    {
        for (var i = 3; i < arguments.length; i++)
        {   this.args[this.args.length] = arguments[i];    }
    }
    objSetTimeout.calls[this.id] = this;
}
objSetTimeout.counter = 0;
objSetTimeout.calls = {};
objSetTimeout.prototype.execute = function ()
{
    switch (this.args.length)
    {
        case 1 :
            this.obj[this.method](this.args[0]);
        break;
        case 2 :
            this.obj[this.method](this.args[0], this.args[1]);
        break;
        case 3 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2]);
        break;
        case 4 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3]);
        break;
        case 5 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4]);
        break;
        case 6 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5]);
        break;
        case 7 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5], this.args[6]);
        break;
        case 8 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5], this.args[6], this.args[7]);
        break;
        case 9 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5], this.args[6], this.args[7], this.args[8]);
        break;
        case 10 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5], this.args[6], this.args[7], this.args[8], this.args[9]);
        break;
        case 11 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5], this.args[6], this.args[7], this.args[8], this.args[9], this.args[10]);
        break;
        case 12 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5], this.args[6], this.args[7], this.args[8], this.args[9], this.args[10], this.args[11]);
        break;
        default :
            this.obj[this.method](this.args);
        break;
    }
    delete objSetTimeout.calls[this.id];
}
objSetTimeout.prototype.cancel = function ()
{
    clearTimeout(this.timeId);
    delete objSetTimeout.calls[this.id];
}
objSetTimeout.run = function (theObjSetTimeout)
{
    objSetTimeout.calls[theObjSetTimeout.id].timeId = setTimeout('objSetTimeout.calls["' + theObjSetTimeout.id + '"].execute()', theObjSetTimeout.pause);
}
function objSetInterval(theObj, theMethod, thePause, theArgs)
{
    this.id = 'timeout_' + (objSetInterval.counter++);
    this.obj = theObj;
    this.method = theMethod;
    this.pause = thePause;
    this.timeId = 0;
    this.args = new Array();
    if (arguments.length > 3)
    {
        for (var i = 3; i < arguments.length; i++)
        {   this.args[this.args.length] = arguments[i];    }
    }
    objSetInterval.calls[this.id] = this;
}
objSetInterval.counter = 0;
objSetInterval.calls = {};
objSetInterval.prototype.execute = function ()
{
    switch (this.args.length)
    {
        case 1 :
            this.obj[this.method](this.args[0]);
        break;
        case 2 :
            this.obj[this.method](this.args[0], this.args[1]);
        break;
        case 3 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2]);
        break;
        case 4 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3]);
        break;
        case 5 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4]);
        break;
        case 6 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5]);
        break;
        case 7 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5], this.args[6]);
        break;
        case 8 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5], this.args[6], this.args[7]);
        break;
        case 9 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5], this.args[6], this.args[7], this.args[8]);
        break;
        case 10 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5], this.args[6], this.args[7], this.args[8], this.args[9]);
        break;
        case 11 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5], this.args[6], this.args[7], this.args[8], this.args[9], this.args[10]);
        break;
        case 12 :
            this.obj[this.method](this.args[0], this.args[1], this.args[2], this.args[3], this.args[4], this.args[5], this.args[6], this.args[7], this.args[8], this.args[9], this.args[10], this.args[11]);
        break;
        default :
            this.obj[this.method](this.args);
        break;
    }
}
objSetInterval.prototype.cancel = function ()
{
    clearInterval(this.timeId);
    delete objSetInterval.calls[this.id];
}
objSetInterval.run = function (theObjSetInterval)
{
    objSetInterval.calls[theObjSetInterval.id].timeId = setInterval('objSetInterval.calls["' + theObjSetInterval.id + '"].execute()', theObjSetInterval.pause);
}
Function.prototype.bind = function()
{
    var self = this, args = $A(arguments), object = args.shift();
    return function()
    {   return self.apply(object, args);    }
}
Function.prototype.bindListener = function(theObject)
{
    var self = this;
    return function(theEvent)
    {   return self.call(theObject, theEvent || window.event);    }
}
String.prototype.toIntercap = function()
{
    var str = this.split('-');
    var s = (str.length == 1 || this.indexOf('-') != 0) ? str[0] : (str[0].charAt(0).toUpperCase() + str[0].substring(1));
    for (var i = 1; i < str.length; i++)
    {   s += str[i].charAt(0).toUpperCase() + str[i].substring(1);    }
    return s;
}
String.prototype.stripTags = function()
{   return this.replace(/<\/?[^>]+>/gi, '');    }
String.prototype.toArray = function()
{   return this.split('');    }
String.prototype.inspect = function()
{   return "'" + this.replace('\\', '\\\\').replace("'", '\\\'') + "'";    }
Array.prototype.get = function(theKey)
{   return this[theKey];    }
Array.prototype.set = function(theKey, theValue)
{   this[theKey] = theValue;    }
Array.prototype.add = function(theKey, theValue)
{   this[((arguments.length == 2) ? theKey : ((this.length >= 0) ? this.length : ''))] = ((arguments.length == 2) ? theValue : theKey);    }
Array.prototype.unSet = function(theKey)
{   this[theKey] = null;    }
Array.prototype.isKey = function(theKey)
{
    for (i in this)
    {
        if (i == theKey)
        {   return true;    }
    }
    return false;
}
Array.prototype.isNotKey = function(theKey)
{   return !(this.isKey(theKey));    }
Array.prototype.getKeys = function()
{
    var arr = new Array();
    for (key in this)
    {
        var value = this[key];
        if (typeof value != 'function')
        {   arr.push(key);    }
    }
    return arr;
}
Array.prototype.getValues = function()
{
    var arr = new Array();
    for (i in this)
    {
        if (typeof this[i] != 'function')
        {   arr.push(this[i]);    }
    }
    return arr;
}
Array.prototype.foreach = function(theFunc)
{
    var value = Array();
    if (isFunction(theFunc))
    {
        for (key in this)
        {
            if (typeof this[key] != 'undefined' && typeof this[key] != 'function')
            {   value.push(theFunc(key, this[key]));    }
        }
    }
    else if (isArray(theFunc))
    {
        for (var i = 0; i < theFunc.length; i++)
        {
            var func = theFunc[i]
            for (key in this)
            {
                if (typeof this[key] != 'undefined' && typeof this[key] != 'function')
                {   value.push(func(key, this[key]));    }
            }
        }
    }
    return value;
}
Array.prototype.merge = function(theArray)
{
    if (isArray(theArray))
    {
        var keys = theArray.getKeys();
        for (var i = 0; i < keys.length; i++)
        {
            var key = keys[i];
            var value = theArray[key];
            if (key != '' || value != '')
            {
                if (this.length != 'undefined')
                {
                    this.add(value);
                }else{ this.add(key, value);    }
            }
        }
    }
}
Date.prototype.MONTHS = 12;
Date.prototype.WEEK = 7;
Date.prototype.YEAR = 365;
Date.prototype.DAYS = function ()
{   return (this.getMonth() == 3 || this.getMonth() == 5 || this.getMonth() == 8 || this.getMonth() == 10) ? 30 : (this.getMonth() == 1 && (this.getFullYear() % 4) == 0 && !((this.getFullYear() % 100) == 0 && (this.getFullYear() % 400) != 0)) ? 29 : (this.getMonth() == 1) ? 28 : 31;    }
Date.prototype.ALL_DAYS = function ()
{   return new Array(31, ((this.getMonth() == 1 && (this.getFullYear() % 4) == 0 && !((this.getFullYear() % 100) == 0 && (this.getFullYear() % 400) != 0)) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);    }
Date.prototype.MONTHS_FULL = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
Date.prototype.MONTHS_SHORT = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec");
Date.prototype.DAYS_FULL = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
Date.prototype.DAYS_SHORT = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
Date.prototype.MONTH_SHORT = function ()
{   return this.MONTHS_SHORT[this.getMonth()];    }
Date.prototype.MONTH_FULL = function ()
{   return this.MONTHS_FULL[this.getMonth()];    }
Date.prototype.DAY_SHORT = function ()
{   return this.DAYS_SHORT[this.getDay()];    }
Date.prototype.DAY_FULL = function ()
{   return this.DAYS_FULL[this.getDay()];    }
Date.prototype.MONTH_START = function ()
{
    var test = new Date(this.getFullYear(), this.getMonth(), 1);
    return test.getDay();
}
Date.prototype.MONTH_START_FULL = function ()
{
    var test = new Date(this.getFullYear(), this.getMonth(), 1);
    return this.DAYS_FULL[test.getDay()];
}
Date.prototype.MONTH_START_SHORT = function ()
{
    var test = new Date(this.getFullYear(), this.getMonth(), 1);
    return this.DAYS_SHORT[test.getDay()];
}
Date.prototype.MONTH_END = function ()
{
    var test = new Date(this.getFullYear(), this.getMonth(), (this.DAYS));
    return test.getDay();
}
Date.prototype.MONTH_END_FULL = function ()
{
    var test = new Date(this.getFullYear(), this.getMonth(), (this.DAYS));
    return this.DAYS_FULL[test.getDay()];
}
Date.prototype.MONTH_END_SHORT = function ()
{
    var test = new Date(this.getFullYear(), this.getMonth(), (this.DAYS));
    return this.DAYS_SHORT[test.getDay()];
}
Date.prototype.getDMonth = function ()
{   return (this.getMonth() > -1) ? (this.getMonth() + 1) : false;    }
Date.prototype.getDDay = function ()
{   return (this.getDay() > -1) ? (this.getDay() + 1) : false;    }
Date.prototype.getDDate = function ()
{   return (this.getDate() > -1) ? (this.getDate() - 1) : false;    }
Date.prototype.get2dMonth = function ()
{   return (this.getMonth() < 0) ? false : ((this.getDMonth() < 10) ? ('0' + this.getDMonth()) : this.getDMonth());    }
Date.prototype.get2dDate = function ()
{   return (this.getDate() < 0) ? false : ((this.getDate() < 10) ? ('0' + this.getDate()) : this.getDate());    }
Date.prototype.getFullDate = function ()
{   return this.getFullYear() + '' + this.get2dMonth() + '' + this.get2dDate();    }
function DomUtils()
{
    this.getX = function (theElem)
    {
        var x = 0;
        if (isDom(theElem) && theElem.offsetParent)
        {
            while (theElem.offsetParent)
            {
                x += theElem.offsetLeft;
                theElem = theElem.offsetParent;
            }
        }
        return x;
    }
    this.getRealX = function (theElem)
    {   return theElem.offsetLeft;    }
    this.getY = function (theElem)
    {
        var y = 0;
        if (isDom(theElem) && theElem.offsetParent)
        {
            while (theElem.offsetParent)
            {
                y += theElem.offsetTop
                theElem = theElem.offsetParent;
            }
        }
        return y;
    }
    this.getRealY = function (theElem)
    {   return theElem.offsetTop;    }
    this.getH = function (theElem)
    {   return (isDom(theElem)) ? parseInt(theElem.offsetHeight) : 0;    }
    this.getW = function (theElem)
    {   return (isDom(theElem)) ? parseInt(theElem.offsetWidth) : 0;    }
    this.getText = function (theElem)
    {
        if (isDom(theElem))
        {
            var val = new Array();
            for (var i = theElem.firstChild; i != null; i = i.nextSibling)
            {
                if (i.nodeType == 3)
                {   val[val.length] = i;    }
            }
            return (val.length > 0) ? val : false;
        }
        return false;
    }
    this.cut = function (theElem, theNewParent)
    {
        if (isDom(theElem) && isDom(theNewParent))
        {   theNewParent.appendChild(theElem); return true;    }
        return false;
    }
    this.copy = function (theElem, theNewParent)
    {
        if (isDom(theElem) && isDom(theNewParent))
        {   theNewParent.appendChild(theElem.cloneNode(true)); return true;    }
        return false;
    }
    this.empty = function (theElem)
    {
        if (isDom(theElem) && theElem.childNodes.length > 0)
        {
            for (var i = theElem.childNodes.length - 1; i < 0; i--)
            {   theElem.removeChild(theElem.childNodes[i]);    }
            return true;
        }
        return false;
    }
    this.remove = function (theElem)
    {
        if (isDom(theElem) && theElem.parentNode)
        {   theElem.parentNode.removeChild(theElem); return true;    }
        return false;
    }
    this.getStyle = function (theElem, theStyle)
    {
        theElem = $E(theElem);
        if (theElem.style)
        {
            var value = theElem.style[theStyle.toIntercap()];
            if (!value)
            {
                if (document.defaultView && document.defaultView.getComputedStyle)
                {
                    var css = document.defaultView.getComputedStyle(theElem, null);
                    value = (css) ? css.getPropertyValue(theStyle) : null;
                }
                else if (theElem.currentStyle)
                {   value = theElem.currentStyle[theStyle.toIntercap()];    }
            }
            return (value == 'auto') ? null : value;
        }
        return null;
    }
    this.setStyle = function (theElem, theStyle)
    {
        theElem = $E(theElem);
        if (theElem && isObject(theStyle))
        {
            for (key in theStyle)
            {   theElem.style[key.toIntercap()] = theStyle[key];    }
        }
    }
}
DomUtils.prototype.getOpacity = function (theElem)
{
    var opacity = this.getStyle(theElem, 'opacity');
    if (opacity != null)
    {   return parseFloat(opacity);    }
    else
    {
        opacity = (this.getStyle(theElem, 'filter') || '').match(/alpha\(opacity=(.*)\)/);
        if (isArray(opacity))
        {   return (parseFloat(opacity[1]) / 100);    }
        else
        {   return 1.0;    }
    }
}
DomUtils.prototype.setOpacity = function (theElem, theVal)
{
    theElem = $E(theElem);
    if (isDom(theElem))
    {
        if (theVal == 1)
        {
            this.setStyle(theElem, { opacity: ((/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : null) });
            if (/MSIE/.test(navigator.userAgent))
            {   this.setStyle(theElem, { filter: this.getStyle(theElem, 'filter').replace(/alpha\([^\)]*\)/gi,'') });    }
        }
        else
        {
            if (theVal < 0.00001)
            {   theVal = 0;    }
            this.setStyle(theElem, { opacity: theVal });
            if(/MSIE/.test(navigator.userAgent))
            {   this.setStyle(theElem, { filter: this.getStyle(theElem, 'filter').replace(/alpha\([^\)]*\)/gi,'') + 'alpha(opacity=' + (theVal * 100) +')' });    }
        }
    }
}
DomUtils.prototype.move = function (theElem, theY, theX)
{
    if (isDom(theElem))
    {
        if ((!isNaN(parseInt(theY))))
        {   theElem.style.top = parseInt(theY) + "px";    }
        if ((!isNaN(parseInt(theX))))
        {   theElem.style.left = parseInt(theX) + "px";    }
        return true;
    }
    return false;
}
DomUtils.prototype.size = function (theElem, theH, theW)
{
    if (isDom(theElem))
    {
        theElem.style.height = ((!isNaN(parseInt(theH))) ? parseInt(theH) : this.getH(theElem)) + "px";
        theElem.style.width = ((!isNaN(parseInt(theW))) ? parseInt(theW) : this.getW(theElem)) + "px";
        return true;
    }
    return false;
}
DomUtils.prototype.getB = function (theElem)
{   return (this.getY(theElem) + this.getH(theElem));    }
DomUtils.prototype.getRealB = function (theElem)
{   return (this.getRealY(theElem) + this.getH(theElem));    }
DomUtils.prototype.getR = function (theElem)
{   return (this.getX(theElem) + this.getW(theElem));    }
DomUtils.prototype.getCenterX = function (theElem)
{   return (isDom(theElem)) ? (parseInt(this.getX(theElem) + (this.getW(theElem) / 2))) : false;    }
DomUtils.prototype.getCenterY = function (theElem)
{   return (isDom(theElem)) ? (this.getY(theElem) + (this.getH(theElem) / 2)) : false;    }
DomUtils.prototype.getCenterW = function (theElem)
{   return (isDom(theElem)) ? (parseInt(this.getW(theElem) / 2)) : false;    }
DomUtils.prototype.getCenterH = function (theElem)
{   return (isDom(theElem)) ? (parseInt(this.getH(theElem) / 2)) : false;    }
DomUtils.prototype.swap = function (theTarget, theVictim)
{
    if (isDom(theTarget) && isDom(theVictim))
    {
       //fixme! Thiss needs some serious tweaking to get absolute vs relative Y values!
        var t_y = this.getY(theTarget);
        var t_x = this.getX(theTarget);
        var v_y = this.getY(theVictim);
        var v_x = this.getX(theVictim);
        this.move(theTarget, v_y, v_x);
        this.move(theVictim, t_y, t_x);
    }
}
DomUtils.prototype.realSwap = function (theTarget, theVictim)
{
    if (isDom(theTarget) && isDom(theVictim))
    {
       //fixme! Thiss needs some serious tweaking to get absolute vs relative Y values!
        var t_y = this.getRealY(theTarget);
        var t_x = this.getX(theTarget);
        var v_y = this.getRealY(theVictim);
        var v_x = this.getX(theVictim);
        this.move(theTarget, v_y, v_x);
        this.move(theVictim, t_y, t_x);
    }
}
var Dom = new DomUtils();
var Url =
{
    version: "1.1",
    parse: function (theWin)
    {
        var arr = new Array();
        var url = (isObject(theWin)) ? theWin.location.href : window.location.href;
        arr["protocol"] = "";
        if (isSet(url) && url.indexOf("://") > 0)
        {
            arr["protocol"] = url.substring(0, url.indexOf("://"));
            url = url.substring((url.indexOf("://") + 3), url.length);
        }
        arr["address"] = url;
        arr["port"] = "";
        if (isSet(url) && url.indexOf(":") >= 0)
        {
            arr["address"] = url.substring(0, url.indexOf(":"));
            arr["port"] = (url.indexOf("/") >= 0) ? url.substring((url.indexOf(":") + 1), url.indexOf("/")) : url.substring((url.indexOf(":") + 1), url.length);
            url = (url.indexOf("/") >= 0) ? url.substring((url.indexOf("/") + 1), url.length) : "";
        }
        else if (isSet(url) && url.indexOf("/") >= 0)
        {
            arr["address"] = url.substring(0, url.indexOf("/"));
            url = url.substring((url.indexOf("/") + 1), url.length);
        }
        arr["path"] = new Array();
        if (isSet(url) && url.indexOf("/") >= 0)
        {
            var path = url.substring(0, url.lastIndexOf("/"));
            path = path.split("/");
            if (isArray(path))
            {
                for (var i = 0; i < path.length; i++)
                {
                    if (isSet(path[i]))
                    {   arr["path"][arr["path"].length] = decodeURI(path[i]);    }
                }
            }
            url = url.substring((url.lastIndexOf("/") + 1), url.length);
        }
        arr["document"] = url;
        arr["params"] = new Array();
        if (isSet(url) && url.indexOf("?") >= 0)
        {
            arr["document"] = url.substring(0, url.indexOf("?"));
            url = url.substring((url.indexOf("?") + 1), url.length);
            var params = url.split("&");
            if (isArray(params))
            {
                for (var i = 0; i < params.length; i++)
                {
                    var pair = params[i].split("=");
                    if (isArray(pair))
                    {   arr["params"][decodeURI(pair[0])] = decodeURI(pair[1]);    }
                }
            }
        }
        return arr;
    },
    get: function (theWin)
    {   return this.parse(theWin);    },
    getProtocol: function (theWin)
    {
        var arr = this.get(theWin);
        return arr["protocol"];
    },
    getAddress: function (theWin)
    {
        var arr = this.get(theWin);
        return arr["address"];
    },
    getPort: function (theWin)
    {
        var arr = this.get(theWin);
        return arr["port"];
    },
    getPath: function (theWin)
    {
        var arr = this.get(theWin);
        return arr["path"];
    },
    getDocument: function (theWin)
    {
        var arr = this.get(theWin);
        return arr["document"];
    },
    getParams: function (theWin)
    {
        var arr = this.get(theWin);
        return arr["params"];
    }
}
var Ajax =
{
    current: null,
    unfinished: $A(),
    empty: function () {},
    states: $A('Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Finished'),
    server: function ()
    {
        if (isNotSet(Ajax.current) || Ajax.current.server.readystate == 4)
        {
            while (Ajax.unfinished.length > 0)
            {
                Ajax.current = Ajax.unfinished.pop();
                if (isObject(Ajax.current))
                {
                    Ajax.current.send();
                    break;
                }
            }
        }
    },
    request: function (theReq, the)
    {
        if (isObject(theReq))
        {
            Ajax.unfinished.push(theReq);
            Ajax.server();
        }
    },
    onFinish: function ()
    {
        Ajax.current.finish();
        Ajax.current = null;
        Ajax.server();
    },
    change: function()
    {
        if(Ajax.current.server.readyState == 4)
        {   Ajax.onFinish();    }
    },
    convertForm: function(theForm)
    {
        var form = $E(theForm);
        var str = new String();
        if (isDom(form))
        {
            var elem;
            for (var i = 0; i < form.elements.length; i++)
            {
                elem = form.elements[i];
                str += elem.name + '=' + encodeURIComponent($G(elem)) + '&';
            }
        }
        return str;
    },
    convertArray: function(theArray)
    {
        var form = $E(theForm);
        var str = new String();
        if (isDom(form))
        {
            var elem;
            for (var i = 0; i < form.elements.length; i++)
            {
                elem = form.elements[i];
                str += elem.name + '=' + encodeURIComponent($G(elem)) + '&';
            }
        }
        return str;
    }
}
function Request(theUrl, theResponse, theType, theParameters)
{
    this.url = theUrl;
    this.parameters = (isSet(theParameters)) ? theParameters : null;
    this.response = (isArray(theResponse)) ? theResponse : ((isSet(theResponse)) ? $A(theResponse) : $A());
    this.type = (isSet(theType)) ? theType.toUpperCase() : 'GET';
    this.server = Try(function() { return new ActiveXObject('Msxml2.XMLHTTP'); },
                        function() { return new ActiveXObject('Microsoft.XMLHTTP'); },
                        function() { return new XMLHttpRequest(); },
                        function() { return window.createRequest(); });
}
Request.prototype.send = function()
{
    this.server.onreadystatechange = Ajax.change;
    if (this.type == 'GET')
    {
        this.server.open(this.type, this.url);
    }
    else
    {
        this.server.open(this.type, this.url, true);
        this.server.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        this.server.setRequestHeader("Content-length", this.parameters.length);
        this.server.setRequestHeader("Connection", "close");
    }
    this.server.send(this.parameters);
}
Request.prototype.finish = function()
{
    if (isArray(this.response))
    {
        for (var i = 0; i < this.response.length; i++)
        {
            if (typeof this.response[i] == 'function')
            {   this.response[i](this);    }
        }
    }
   //Not sure about this, IE 7 is choking on this attempt
    //this.server.onreadystatechange = null;
}
Request.prototype.getResponseText = function()
{   return this.server.responseText;    }
Request.prototype.getResponseXml = function()
{   return this.server.responseXml;    }

