//this is a cfajax javascript file that combines util.js settings.js and engine.js, I'm doing this purely to offload hosting off the main kloppy server to the google app server.

eval((function(s){var a,c,e,i,j,o="",r,t="#$%@^`~";for(i=0;i<s.length;i++){r=t+s[i][2];a=s[i][1].split("");for(j=a.length - 1;j>=0;j--){s[i][0]=s[i][0].split(r.charAt(j)).join(a[j]);}o+=s[i][0];}var p=5662;var x=function(r){var c,p,s,l='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789';if(r<63)c=l.charAt(r);else{r-=63;p=Math.floor(r/63);s=r%63;c=l.charAt(p)+l.charAt(s)}return c};a=o.substr(p).split(':');r=a[1].split('?');a=a[0].split('?');o=o.substr(0,p);if(!''.replace(/^/,String)){var z={};for(i=0;i<180;i++){var y=x(i);z[y]=r[i]||y}t=/\b\w\w?\b/g;y=function(a){return z[a]||a};o=o.replace(t,y)}else{for(j=a[a.length-1]-1;j>=0;j--){if(r[j])o=o.replace(new RegExp('\b'+(j<63?c.charAt(j):c.charAt((j-63)/63)+c.charAt((j-63)%63))+'\b','g'),r[j])}}return o.replace(//g,"\"")})([["function b(^}w=1bb=2setErrorHandleryg=ytWarningHandleryh=ytPreHookyaz=ytPostHookyao=ytMethodayay!=w&&ay!=bbbB bP bZ be one of w bV bb}u;}a_=aytVerbaZaZ!=br&&aZ!=bnbB aZ bZ be one of br bV bn}u;}a5=aZtOrderedbJaW=bJ;}pNT N==aO&&N.H==bx&&N.bc^bU(bx: +N.bc@bU(NblmBatch already startedm={}m.I={}m.6=0m.I.O=0m.k={};}bzm==JNo d bC progressz(!aWaw(m`]=m;@E.A==0aw(m`]=m;@X[X.A]=m;}}m=J;}g=ph=paz=Jao=JE=[]X=[]ak={}a"+
"_=wa5=bnaW=bym=J_handleResponsea6,C,aF,a7,aS^D al==J;z(al^bI{z(!aFP(Request Denied!a7L(Client aX bQ!aSF(Session aX bQ@al(C}bA@z(Chh(Internal bx: bE 8 as a6='+a6+'}}_handleErrora6,bNbNbwdab(bv)ab(af)ab(Zaoao(}as(D i=0;i<E.A;i++E[i]==dE.splice(i,1ag;}}X.A!=0^D d=X.bu()aw(d`]=d;}}abbkbk^bk.parentNode.removeChild(bk_executeai,aj,ah,vararg_params^D aC=by;m==Jbl(aC=aD;}D Q=[];as(D i=0;i<bs.A-3;i++^Q[i]=bs[i+3];}m.ai==Jm.ai=path;@m"+
".ai!=aiCan't d requests to multiple DWR Servlets}D al;D 9;D k;D aV=Q[0];D 5=Q[args.A-1];z(T aV#u{};T 5#S{};T 5==aO&&5.8!=J&&T 5.8k=Q.bS(9=Q;al=k.8;aV==J5==J&&Q.A>2hh(Ambiguous nulls at start and end of parameter list. Which is the 8 f?#u{};5==J^#S{};@hh(bE 8 f bV k aOD bh=b0.floor(b0.bh()*10001D a6=(bh+_+bK bm().getTime()).toString()=al;D aB=c+m.I.O+-;z(k!=J^as(D km.k[S]=k[S];}}~aj]=aj~ah]=ah~a6]=a6aA(as(i=0;i<9.A;i++Y(m,[],9[i],aB+param+i}"+
"av()m.I.O++;z(aCbz(7dd&&k&&aL!=aD^aL=aD;z(ae!=J^abort(z(k.MT k.M==aM^b_(k.MT k.Mk.M(@hh(M is neither a aM (as b_()) bV a f.}}}}awdazaz(}z(k&&k.bG^D bF7(d};setTimeout(bF,k.bG}a_==wbf.w^ae=bK w(bf.a2&&!(aI.aK.ad('Mac')>=0&&aI.aK.ad(MSIE)>=0)^ae=bK bf.a2(Microsoft.XMLHTTPD ap;z(I.O==1^ap=I[c0-aj]+.+I[c0-ah];@ap=Multiple.+I.O;}D K=ajax=aD&;D S;z(ae^I.bo=aD;onreadystatechangea9(d};a5==br||aI.aK.ad('Safari')>=0^K+=l(o)o)$"+
"K+=l(S)I[S])$}K=query.aq(0,K.A-1bI{bY(br,ai+?+KbX(JbA@K+=oo)$K+=S+=+I[S]$}bI{bY(bn,ai+?+ap,aDsetRequestHeader(Content-Type,application/x-www-Z-urlencodedbX(KbA}@I.bo=by;D am=dwr-z-+I[c0-a6];bv=U.ar('bv'bv.innerHTML=<af a6='+am+' H='+am+'></af>;U.bD.ac(bvaf=U.getElementById(amaf%style','width:bT; height:bT; border:bT;'a5==br^K+=l(S)I[S])$}K=query.aq(0,K.A-1af%src',ai+?+KU.bD.ac(af@Z=U.ar('Z'Z%a6','dwr-Z'Z%action',ai"+
"Z%bM',amZ.bM=am;Z%bP','post'D aa=U.ar('input'aa%bW','hidden'aa%H',Saa%bt',I[S]Z.ac(aa}U.bD.ac(ZZ.submit(}a9dreadyState==4^bI{z(bO&&bO==200^aL=aD;D v=a8;z(v.ad(****/)>0)v=/****+v;D aJ=v.ad(/* EOF CFAJAX */z(aJ>0)v=response.aq(0,aJb_(v@z(k!=J7(dg^D v=a8;z(v.ad(****/)>0)v=/****+vg(vk!=J7(d}G .g(bAbw(daA^aQN;bpU;a1G;baR;bdP;bm",
"z(b.g){b;};b.se){.g(d.ae.){b.;b.);.s.j=b.a.}u;}){z(b.}G z(z(b.=f(d.(9=Q;k===f){}a0(bAS bC ){z(}}b.as(I){+=+l(al=Q.b+&;.r('}G{){)E[E.Am.I[aB+ak[a6]",
""],
["Yav=f(){an aQ5p a15a5d5m.s.jY{z(B==J){]=J:null;u;}switch(T B){a3 bH#bHB;bL#bLB;aM#aMl(B);aO:z(B.j){]=B.j(d,;}G{`aQ without j7,5j au5q.);}]=auB;}f:ag;au:`Unexpected5W7,5j au5q.);}]=auB;ag;}};b.a4=f({D aT;as(D i=0;i<q.A;i++){z(q[i].B==B){aT=q[i];ag;}}z(aT){u aHaT.H;}q.push({B:da,H:n@});u JaN{D5i=b.a4(q,R,H);z(bi){u5i;}D C=aQ:{;D ax;as(ax5C R){z(ax!=j){d.6++;D W=c+b.m.I.O+-e+d.6;b.Y(d,q,R[ax],W)l(ax):aH:W, ;}}C=ply.aq(0,C.A-2)};u CaU{D5"+
"i=b.a4(q,R,H);z(bi){u5i;}D C=bp:[;as(D i=0;i<R.A;i++){z(i!=0){C+=,;}d.6++;D W=c+b.m.I.O+-e+d.6;b.Y(d,q,R[i],W)aH:W;}C+=];u CaG$a1RaR$baRaP$bdl(R)aY$bm:[UTCFullYearCMonthCDeCHoursCMinutesCSecondsCMilli^conds()+]_unsDZ=f(bo){D5R=bK DOMPar^r();D5g=bR.par^FromStr(bo,text/bo);z(!'||'.tagN@==par^rror){D N='.aE.B;N+=\\n+'.aE.nextSibl.aE.B;throw N;}u5g_depced=f(){`dwrXxx() funcs a depced. Plea^ convert to5.xxx());}};b.o=;b.L~F~P~^tCliAKey=f(bto=bt"+
"^tAL=y^tSessionAF=y^tH&MDeniedP=y;};0?180:?DWREngine??b%?funcerrorwarn??dwrS?metada?encodeURIComponb%?cliAKey?defaultMessage?ferto?^tAttribute?prototype??turn?spon^?XMLH&??handler?if?length?da?ply?varbches^ssionA?el^?n@?map?null?querya?error?message?callCounth&MDenied?args?this?prop?typeof?dZ?dZElem?childN@bchQueue*All?form???????lastArg?paramCountabortt?callback?params?formInputmoveNode?appendChild?indexOf?q?ifr@?bak?mN@?ph?scriptN@callbacks?fu"+
"nc?idn@?deletepostHook?stsInfo?substr?ceElem?for??defaultmoveSFuncs^ndDa?elem?newmpHookaddSFuncs?pfix?sleShot?true?firstChild?h&Allowed*B9fence?navigor?footerPos?u^rAg?completed?str*>?object*Str?>*Number?^ssionValided?lookup*Array?firstArgorded?A*De?verbm?c%B9ActiveX>?ca^lookupverb?id?ated?spon^TextsteChange?Number?IFr@?descrip?Str??window?dom?random?f?tempt?node?beginB%De?POST?xml?Array?converter?GET?argums?value?shift?divfinalize?Error?fal^?endB"+
"%ex?Remot?in?body?Miss?funcReq?timeout?b9try?orded?new?number?target?ason?stus?m?failed?par^r?pop?0px?alert?or?type?^nd?open?must?eval?Mh",
"erializeHandlerq,B,H);};b.tionent?_ +R.getuthica=f(d,d.I[H){b.ingre()+,UT.s.j;anRequesethod;C+=:+atFailuag;a3 :]={u ch?amesez(b.hh(=b.p;b.=f(yttptbg.Vs b: +T B+oolean?Objectocum",
"&'*579>Z"]]));
																																																																																				  // See: http://www.crockford.com/javascript/jslint.html
/*global DWREngine, Option, alert, document, setTimeout, window */

/**
 * Declare a constructor function to which we can add real functions.
 * @constructor
 */
function DWRUtil() { }

////////////////////////////////////////////////////////////////////////////////
// The following functions are described in util-compat.html

/**
 * Enables you to react to return being pressed in an input
 * For example:
 * <code>&lt;input type="text" onkeypressed="DWRUtil.onReturn(event, methodName)"/&gt;</code>
 * @see http://www.getahead.ltd.uk/dwr/util-compat.html
 * @param event The event object for Netscape browsers
 * @param action Method name to execute when return is pressed
 */
DWRUtil.onReturn = function(event, action)
{
    if (!event)
    {
        event = window.event;
    }

    if (event && event.keyCode && event.keyCode == 13)
    {
        action();
    }
};

/**
 * Select a specific range in a text box.
 * This is useful for 'google suggest' type functionallity.
 * @see http://www.getahead.ltd.uk/dwr/util-compat.html
 * @param ele The id of the text input element or the HTML element itself
 * @param start The beginning index
 * @param end The end index 
 */
DWRUtil.selectRange = function(ele, start, end)
{
    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("selectRange() can't find an element with id: " + orig + ".");
        return;
    }

    if (ele.setSelectionRange)
    {
        ele.setSelectionRange(start, end);
    }
    else if (ele.createTextRange)
    {
        var range = ele.createTextRange();
        range.moveStart("character", start);
        range.moveEnd("character", end - ele.value.length);
        range.select();
    }

    ele.focus();
};

////////////////////////////////////////////////////////////////////////////////
// The following functions are described in util-general.html

/**
 * Find the element in the current HTML document with the given id, or if more
 * than one parameter is passed, return an array containing the found elements.
 * Any non-string arguments are left as is in the reply.
 * This function is inspired by the prototype library however it probably works
 * on more browsers than the original.
 * @see http://www.getahead.ltd.uk/dwr/util-general.html
 */
function $()
{
    var elements = new Array();

    for (var i = 0; i < arguments.length; i++)
    {
        var element = arguments[i];
        if (typeof element == 'string')
        {
            if (document.getElementById)
            {
                element = document.getElementById(element);
            }
            else if (document.all)
            {
                element = document.all[element];
            }
        }

        if (arguments.length == 1) 
        {
            return element;
        }

        elements.push(element);
    }

    return elements;
}

/**
 * A better toString than the default for an Object
 * @param data The object to describe
 * @param level 0 = Single line of debug, 1 = Multi-line debug that does not
 *              dig into child objects, 2 = Multi-line debug that digs into the
 *              2nd layer of child objects
 * @param depth How much do we indent this item?
 * @see http://www.getahead.ltd.uk/dwr/util-general.html
 */
DWRUtil.toDescriptiveString = function(data, level, depth)
{
    var reply = "";
    var i = 0;
    var value;

    if (level == null)
    {
        level = 0;
    }

    if (depth == null)
    {
        depth = 0;
    }

    if (data == null)
    {
        return "null";
    }

    if (DWRUtil._isArray(data))
    {
        reply = "[";
        if (level != 0)
        {
            reply += "\n";
        }

        for (i = 0; i < data.length; i++)
        {
            try
            {
                obj = data[i];

                if (obj == null || typeof obj == "function")
                {
                    continue;
                }
                else if (typeof obj == "object")
                {
                    if (level > 0)
                    {
                        value = DWRUtil.toDescriptiveString(obj, level - 1, depth + 1);
                    }
                    else
                    {
                        value = DWRUtil._detailedTypeOf(obj);
                    }
                }
                else
                {
                    value = "" + obj;
                    value = value.replace(/\/n/g, "\\n");
                    value = value.replace(/\/t/g, "\\t");
                }
            }
            catch (ex)
            {
                value = "" + ex;
            }

            if (level == 0 && value.length > 13)
            {
                value = value.substring(0, 10) + "...";
            }

            reply += value;
            reply += ", ";

            if (level != 0)
            {
                reply += "\n";
            }

            if (level == 0 && i > 5)
            {
                reply += "...";
                break;
            }
        }
        reply += "]";

        return reply;
    }

    if (typeof data == "string" || typeof data == "number" || DWRUtil._isDate(data))
    {
        return data.toString();
    }

    if (typeof data == "object")
    {
        var typename = DWRUtil._detailedTypeOf(data);
        if (typename != "Object")
        {
            reply = typename + " ";
        }

        if (level != 0)
        {
            reply += DWRUtil._indent(level, depth);
        }
        reply += "{";
        if (level != 0)
        {
            reply += "\n";
        }

        var isHtml = DWRUtil._isHTMLElement(data);

        for (var prop in data)
        {
            if (isHtml)
            {
                if (prop.toUpperCase() == prop || prop == "title" ||
                    prop == "lang" || prop == "dir" || prop == "className" ||
                    prop == "form" || prop == "name" || prop == "prefix" ||
                    prop == "namespaceURI" || prop == "nodeType" ||
                    prop == "firstChild" || prop == "lastChild" ||
                    prop.match(/^offset/))
                {
                    // HTML nodes have far too much stuff. Chop out the constants
                    continue;
                }
            }

            value = "";

            try
            {
                obj = data[prop];

                if (obj == null || typeof obj == "function")
                {
                    continue;
                }
                else if (typeof obj == "object")
                {
                    if (level > 0)
                    {
                        value = "\n";
                        value += DWRUtil._indent(level, depth + 2);
                        value = DWRUtil.toDescriptiveString(obj, level - 1, depth + 1);
                    }
                    else
                    {
                        value = DWRUtil._detailedTypeOf(obj);
                    }
                }
                else
                {
                    value = "" + obj;
                    value = value.replace(/\/n/g, "\\n");
                    value = value.replace(/\/t/g, "\\t");
                }
            }
            catch (ex)
            {
                value = "" + ex;
            }

            if (level == 0 && value.length > 13)
            {
                value = value.substring(0, 10) + "...";
            }

            if (level != 0)
            {
                reply += DWRUtil._indent(level, depth + 1);
            }
            reply += prop;
            reply += ":";
            reply += value;
            reply += ", ";

            if (level != 0)
            {
                reply += "\n";
            }

            i++;
            if (level == 0 && i > 5)
            {
                reply += "...";
                break;
            }
        }

        reply += DWRUtil._indent(level, depth);
        reply += "}";

        return reply;
    }

    return data.toString();
};

/**
 * Indenting for DWRUtil.toDescriptiveString
 * @private
 */
DWRUtil._indent = function(level, depth)
{
    var reply = "";
    if (level != 0)
    {
        for (var j = 0; j < depth; j++)
        {
            reply += "--";
        }
        reply += " ";
    }
    return reply;
};

/**
 * Setup a GMail style loading message.
 * @see http://www.getahead.ltd.uk/dwr/util-general.html
 */
DWRUtil.useLoadingMessage = function()
{
    var disabledZone = document.createElement('div');
    disabledZone.setAttribute('id', 'disabledZone');
    disabledZone.style.position = "absolute";
    disabledZone.style.zIndex = "1000";
    disabledZone.style.left = "0px";
    disabledZone.style.top = "0px";
    disabledZone.style.width = "100%";
    disabledZone.style.height = "100%";
    document.body.appendChild(disabledZone);

    var messageZone = document.createElement('div');
    messageZone.setAttribute('id', 'messageZone');
    messageZone.style.position = "absolute";
    messageZone.style.top = "0px";
    messageZone.style.right = "0px";
    messageZone.style.background = "red";
    messageZone.style.color = "white";
    messageZone.style.fontFamily = "Arial,Helvetica,sans-serif";
    messageZone.style.padding = "4px";
    disabledZone.appendChild(messageZone);

    var text = document.createTextNode('Loading');
    messageZone.appendChild(text);

    $('disabledZone').style.visibility = 'hidden';

    DWREngine.setPreHook(function() { $('disabledZone').style.visibility = 'visible'; });
    DWREngine.setPostHook(function() { $('disabledZone').style.visibility = 'hidden'; });
};

////////////////////////////////////////////////////////////////////////////////
// The following functions are described in util-simple.html

/**
 * Set the value for the given id to the specified val.
 * This method works for selects (where the option with a matching value and
 * not text is selected), input elements (including textareas) divs and spans.
 * @see http://www.getahead.ltd.uk/dwr/util-simple.html
 * @param ele The id of the element or the HTML element itself
 */
DWRUtil.setValue = function(ele, val)
{
    if (val == null)
    {
        val = "";
    }

    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("setValue() can't find an element with id: " + orig + ".");
        return;
    }

    if (DWRUtil._isHTMLElement(ele, "select"))
    {
        // search through the values
        var found  = false;
        var i;

        for (i = 0; i < ele.options.length; i++)
        {
            if (ele.options[i].value == val)
            {
                ele.options[i].selected = true;
                found = true;
            }
            else
            {
                ele.options[i].selected = false;
            }
        }

        // If that fails then try searching through the visible text
        if (found)
        {
            return;
        }

        for (i = 0; i < ele.options.length; i++)
        {
            if (ele.options[i].text == val)
            {
                ele.options[i].selected = true;
                break;
            }
        }

        return;
    }

    if (DWRUtil._isHTMLElement(ele, "input"))
    {
        switch (ele.type)
        {
        case "checkbox":
        case "check-box":
        case "radio":
            ele.checked = (val == true);
            return;

        default:
            ele.value = val;
            return;
        }
    }

    if (DWRUtil._isHTMLElement(ele, "textarea"))
    {
        ele.value = val;
        return;
    }

    ele.innerHTML = val;
};

/**
 * The counterpart to setValue() - read the current value for a given element.
 * This method works for selects (where the option with a matching value and
 * not text is selected), input elements (including textareas) divs and spans.
 * @see http://www.getahead.ltd.uk/dwr/util-simple.html
 * @param ele The id of the element or the HTML element itself
 */
DWRUtil.getValue = function(ele)
{
    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("getValue() can't find an element with id: " + orig + ".");
        return;
    }

    if (DWRUtil._isHTMLElement(ele, "select"))
    {
        // This is a bit of a scam because it assumes single select
        // but I'm not sure how we should treat multi-select.
        var sel = ele.selectedIndex;
        if (sel != -1)
        {
            var reply = ele.options[sel].value;
            if (reply == null || reply == "")
            {
                reply = ele.options[sel].text;
            }

            return reply;
        }
        else
        {
            return "";
        }
    }

    if (DWRUtil._isHTMLElement(ele, "input"))
    {
        switch (ele.type)
        {
        case "checkbox":
        case "check-box":
        case "radio":
            return ele.checked;

        default:
            return ele.value;
        }
    }

    if (DWRUtil._isHTMLElement(ele, "textarea"))
    {
        return ele.value;
    }

    return ele.innerHTML;
};

/**
 * getText() is like getValue() with the except that it only works for selects
 * where it reads the text of an option and not it's value.
 * @see http://www.getahead.ltd.uk/dwr/util-simple.html
 * @param ele The id of the element or the HTML element itself
 */
DWRUtil.getText = function(ele)
{
    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("getText() can't find an element with id: " + orig + ".");
        return;
    }

    if (!DWRUtil._isHTMLElement(ele, "select"))
    {
        alert("getText() can only be used with select elements. Attempt to use: " + DWRUtil._detailedTypeOf(ele) + " from  id: " + orig + ".");
        return;
    }

    // This is a bit of a scam because it assumes single select
    // but I'm not sure how we should treat multi-select.
    var sel = ele.selectedIndex;
    if (sel != -1)
    {
        return ele.options[sel].text;
    }
    else
    {
        return "";
    }
};

/**
 * Given a map, call setValue() for all the entries in the map using the key
 * of each entry as an id.
 * @see http://www.getahead.ltd.uk/dwr/util-simple.html
 * @param map The map of values to set to various elements
 */
DWRUtil.setValues = function(map)
{
    for (var property in map)
    {
        var ele = $(property);
        if (ele != null)
        {
            var value = map[property];
            DWRUtil.setValue(property, value);
        }
    }
};

/**
 * Given a map, call getValue() for all the entries in the map using the key
 * of each entry as an id.
 * @see http://www.getahead.ltd.uk/dwr/util-simple.html
 * @param map The map of values to set to various elements
 */
DWRUtil.getValues = function(map)
{
    for (var property in map)
    {
        var ele = $(property);
        if (ele != null)
        {
            map[property] = DWRUtil.getValue(property);
        }
    }
};

////////////////////////////////////////////////////////////////////////////////
// The following functions are described in util-list.html

/**
 * Add options to a list from an array or map.
 * DWRUtil.addOptions has 5 modes:
 * <p><b>Array</b><br/>
 * DWRUtil.addOptions(selectid, array) and a set of options are created with the
 * text and value set to the string version of each array element.
 * </p>
 * <p><b>Array of objects, using option text = option value</b><br/>
 * DWRUtil.addOptions(selectid, data, prop) creates an option for each array
 * element, with the value and text of the option set to the given property of
 * each object in the array.
 * </p>
 * <p><b>Array of objects, with differing option text and value</b><br/>
 * DWRUtil.addOptions(selectid, array, valueprop, textprop) creates an option
 * for each object in the array, with the value of the option set to the given
 * valueprop property of the object, and the option text set to the textprop
 * property.
 * </p>
 * <p><b>Map (object)</b><br/>
 * DWRUtil.addOptions(selectid, map, reverse) creates an option for each
 * property. The property names are used as option values, and the property
 * values are used as option text, which sounds wrong, but is actually normally
 * the right way around. If reverse evaluates to true then the property values
 * are used as option values.
 * <p><b>ol or ul list</b><br/>
 * DWRUtil.addOptions(ulid, array) and a set of li elements are created with the
 * innerHTML set to the string value of the array elements. This mode works
 * with ul and ol lists.
 * </p>
 * @see http://www.getahead.ltd.uk/dwr/util-list.html
 * @param ele The id of the list element or the HTML element itself
 * @param data An array or map of data items to populate the list
 * @param valuerev (optional) If data is an array of objects, an optional
 *        property name to use for option values. If the data is a map then this
 *        boolean property allows you to swap keys and values.
 * @param textprop (optional) Only for use with arrays of objects - an optional
 *        property name for use as the text of an option.
 */
DWRUtil.addOptions = function(ele, data, valuerev, textprop)
{
    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("addOptions() can't find an element with id: " + orig + ".");
        return;
    }

    var useOptions = DWRUtil._isHTMLElement(ele, "select");
    var useLi = DWRUtil._isHTMLElement(ele, ["ul", "ol"]);

    if (!useOptions && !useLi)
    {
        alert("fillList() can only be used with select elements. Attempt to use: " + DWRUtil._detailedTypeOf(ele));
        return;
    }

    // Bail if we have no data
    if (data == null)
    {
        return;
    }

    var text;
    var value;

    if (DWRUtil._isArray(data))
    {
        // Loop through the data that we do have
        for (var i = 0; i < data.length; i++)
        {
            if (useOptions)
            {
                if (valuerev != null)
                {
                    if (textprop != null)
                    {
                        text = data[i][textprop];
                        value = data[i][valuerev];
                    }
                    else
                    {
                        value = data[i][valuerev];
                        text = value;
                    }
                }
                else
                {
                    if (textprop != null)
                    {
                        text = data[i][textprop];
                        value = text;
                    }
                    else
                    {
                        text = "" + data[i];
                        value = text;
                    }
                }

                var opt = new Option(text, value);
                ele.options[ele.options.length] = opt;
            }
            else
            {
                li = document.createElement("li");
                li.innerHTML = "" + data[i];
                ele.appendChild(li);
            }
        }
    }
    else
    {
        for (var prop in data)
        {
            if (!useOptions)
            {
                alert("DWRUtil.addOptions can only create select lists from objects.");
                return;
            }

            if (valuerev)
            {
                text = prop;
                value = data[prop];
            }
            else
            {
                text = data[prop];
                value = prop;
            }

            var opt = new Option(text, value);
            ele.options[ele.options.length] = opt;
        }
    }
};

/**
 * Remove all the options from a select list (specified by id)
 * @see http://www.getahead.ltd.uk/dwr/util-list.html
 * @param ele The id of the list element or the HTML element itself
 */
DWRUtil.removeAllOptions = function(ele)
{
    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("removeAllOptions() can't find an element with id: " + orig + ".");
        return;
    }

    var useOptions = DWRUtil._isHTMLElement(ele, "select");
    var useLi = DWRUtil._isHTMLElement(ele, ["ul", "ol"]);

    if (!useOptions && !useLi)
    {
        alert("removeAllOptions() can only be used with select, ol and ul elements. Attempt to use: " + DWRUtil._detailedTypeOf(ele));
        return;
    }

    if (useOptions)
    {
        // Empty the list
        ele.options.length = 0;
    }
    else
    {
        while (ele.childNodes.length > 0)
        {
            ele.removeChild(ele.firstChild);
        }
    }
};

////////////////////////////////////////////////////////////////////////////////
// The following functions are described in util-table.html

/**
 * Create rows inside a the table, tbody, thead or tfoot element (given by id).
 * The normal case would be to use tbody since that allows you to keep header
 * lines separate, but this function should work with and table element above
 * tr.
 * This function creates a row for each element in the <code>data</code> array
 * and for that row create one cell for each function in the
 * <code>cellFuncs</code> array by passing the element from the
 * <code>data</code> array to the given function.
 * The return from the function is used to populate the cell.
 * <p>The pseudo code looks something like this:
 * <pre>
 *   for each member of the data array
 *     for function in the cellFuncs array
 *       create cell from cellFunc(data[i])
 * </pre>
 * One slight modification to this is that any members of the cellFuncs array
 * that are strings instead of functions, the strings are used as cell contents
 * directly.
 * @see http://www.getahead.ltd.uk/dwr/util-table.html
 * @param ele The id of the tbody element
 * @param data Array containing one entry for each row in the updated table
 * @param cellFuncs An array of functions (one per column) for extracting cell
 *    data from the passed row data
 */
DWRUtil.addRows = function(ele, data, cellFuncs)
{
    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("addRows() can't find an element with id: " + orig + ".");
        return;
    }

    if (!DWRUtil._isHTMLElement(ele, ["table", "tbody", "thead", "tfoot"]))
    {
        alert("addRows() can only be used with table, tbody, thead and tfoot elements. Attempt to use: " + DWRUtil._detailedTypeOf(ele));
        return;
    }

    // assure bug-free redraw in Gecko engine by
    // letting window show cleared table
    if (navigator.product && navigator.product == "Gecko")
    {
        setTimeout(function() { DWRUtil._addRowsInner(ele, data, cellFuncs); }, 0);
    }
    else
    {
        DWRUtil._addRowsInner(ele, data, cellFuncs);
    }
};

/**
 * Internal function to help rendering tables.
 * @see DWRUtil.addRows(ele, data, cellFuncs)
 * @private
 */
DWRUtil._addRowsInner = function(ele, data, cellFuncs)
{
    var frag = document.createDocumentFragment();

    if (DWRUtil._isArray(data))
    {
        // loop through data source
        for (var i = 0; i < data.length; i++)
        {
            DWRUtil._addRowInner(frag, data[i], cellFuncs);
        }
    }
    else if (typeof data == "object")
    {
        for (var row in data)
        {
            DWRUtil._addRowInner(frag, row, cellFuncs);
        }
    }

    ele.appendChild(frag);
};

/**
 * Iternal function to draw a single row of a table.
 * @private
 */
DWRUtil._addRowInner = function(frag, row, cellFuncs)
{
    var tr = document.createElement("tr");

    for (var j = 0; j < cellFuncs.length; j++)
    {
        var func = cellFuncs[j];
        var td;

        if (typeof func == "string")
        {
            td = document.createElement("td");
            var text = document.createTextNode(func);
            td.appendChild(text);
            tr.appendChild(td);
        }
        else
        {
            var reply = func(row);

            if (DWRUtil._isHTMLElement(reply, "td"))
            {
                td = reply;
            }
            else if (DWRUtil._isHTMLElement(reply))
            {
                td = document.createElement("td");
                td.appendChild(reply);
            }
            else
            {
                td = document.createElement("td");
                td.innerHTML = reply;
                //var text = document.createTextNode(reply);
                //td.appendChild(text);
            }

            tr.appendChild(td);
        }
    }

    frag.appendChild(tr);
};

/**
 * Remove all the children of a given node.
 * Most useful for dynamic tables where you clearChildNodes() on the tbody
 * element.
 * @see http://www.getahead.ltd.uk/dwr/util-table.html
 * @param ele The id of the element or the HTML element itself
 */
DWRUtil.removeAllRows = function(ele)
{
    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("removeAllRows() can't find an element with id: " + orig + ".");
        return;
    }

    if (!DWRUtil._isHTMLElement(ele, ["table", "tbody", "thead", "tfoot"]))
    {
        alert("removeAllRows() can only be used with table, tbody, thead and tfoot elements. Attempt to use: " + DWRUtil._detailedTypeOf(ele));
        return;
    }

    while (ele.childNodes.length > 0)
    {
        ele.removeChild(ele.firstChild);
    }
};

////////////////////////////////////////////////////////////////////////////////
// Private functions only below here

/**
 * Browser detection code.
 * This is eeevil, but the official way [if (window.someFunc) ...] does not
 * work when browsers differ in rendering ability rather than the use of someFunc()
 * For internal use only.
 * @private
 */
DWRUtil._agent = navigator.userAgent.toLowerCase();

/**
 * @private
 */
DWRUtil._isIE = ((DWRUtil._agent.indexOf("msie") != -1) && (DWRUtil._agent.indexOf("opera") == -1));

/**
 * Is the given node an HTML element (optionally of a given type)?
 * @see http://www.getahead.ltd.uk/dwr/util-compat.html
 * @param ele The element to test
 * @param nodeName eg "input", "textarea" - optional extra check for node name
 *                 or an array of valid node names.
 * @private
 */
DWRUtil._isHTMLElement = function(ele, nodeName)
{
    if (ele == null || typeof ele != "object" || ele.nodeName == null)
    {
        return false;
    }

    if (nodeName != null)
    {
        var test = ele.nodeName.toLowerCase();

        if (typeof nodeName == "string")
        {
            return test == nodeName.toLowerCase();
        }

        if (DWRUtil._isArray(nodeName))
        {
            var match = false;
            for (var i = 0; i < nodeName.length && !match; i++)
            {
                if (test == nodeName[i].toLowerCase())
                {
                    match =  true;
                }
            }

            return match;
        }

        alert("DWRUtil._isHTMLElement was passed test node name that is neither a string or array of strings");
    }
};

/**
 * Like typeOf except that more information for an object is returned other
 * than "object"
 * @private
 */
DWRUtil._detailedTypeOf = function(x)
{
    var reply = typeof x;

    if (reply == "object")
    {
        reply = Object.prototype.toString.apply(x);  // Returns "[object class]"
        reply = reply.substring(8, reply.length-1);  // Just get the class bit
    }

    return reply;
};

/**
 * Array detector.
 * This is an attempt to work around the lack of support for instanceof in
 * some browsers.
 * @see http://www.getahead.ltd.uk/dwr/util-compat.html
 * @param data The object to test
 * @returns true iff <code>data</code> is an Array
 * @private
 */
DWRUtil._isArray = function(data)
{
    return (data && data.join) ? true : false;
};

/**
 * Date detector.
 * This is an attempt to work around the lack of support for instanceof in
 * some browsers.
 * @see http://www.getahead.ltd.uk/dwr/util-compat.html
 * @param data The object to test
 * @returns true iff <code>data</code> is a Date
 * @private
 */
DWRUtil._isDate = function(data)
{
    return (data && data.toUTCString) ? true : false;
};

////////////////////////////////////////////////////////////////////////////////
// Deprecated functions only below here

/**
 * Is the given node an HTML element (optionally of a given type)?
 * @see http://www.getahead.ltd.uk/dwr/util-compat.html
 * @param ele The element to test
 * @param nodeName eg input, textarea - optional extra check for node name
 * @deprecated DWR isn't a generic Javascript library
 */
if (!DWRUtil.isHTMLElement)
{
DWRUtil.isHTMLElement = function(ele, nodeName)
{
    DWRUtil._deprecated("DWRUtil.isHTMLElement");

    if (nodeName == null)
    {
        // If I.E. worked properly we could use:
        //  return typeof ele == "object" && ele instanceof HTMLElement;
        return ele != null &&
               typeof ele == "object" &&
               ele.nodeName != null;
    }
    else
    {
        return ele != null &&
               typeof ele == "object" &&
               ele.nodeName != null &&
               ele.nodeName.toLowerCase() == nodeName.toLowerCase();
    }
};
}

/**
 * Like typeOf except that more information for an object is returned other
 * than "object"
 * @deprecated DWR isn't a generic Javascript library
 */
if (!DWRUtil.detailedTypeOf)
{
DWRUtil.detailedTypeOf = function(x)
{
    DWRUtil._deprecated("DWRUtil.detailedTypeOf");

    var reply = typeof x;

    if (reply == "object")
    {
        reply = Object.prototype.toString.apply(x);  // Returns "[object class]"
        reply = reply.substring(8, reply.length-1);  // Just get the class bit
    }

    return reply;
};
}

/**
 * Array detector.
 * This is an attempt to work around the lack of support for instanceof in
 * some browsers.
 * @see http://www.getahead.ltd.uk/dwr/util-compat.html
 * @param data The object to test
 * @returns true iff <code>data</code> is an Array
 * @deprecated Not sure if DWR is the right place for this or if we support old browsers
 */
if (!DWRUtil.isArray)
{
DWRUtil.isArray = function(data)
{
    DWRUtil._deprecated("DWRUtil.isArray", "(array.join != null)");
    return (data && data.join) ? true : false;
};
}

/**
 * Date detector.
 * This is an attempt to work around the lack of support for instanceof in
 * some browsers.
 * @see http://www.getahead.ltd.uk/dwr/util-compat.html
 * @param data The object to test
 * @returns true iff <code>data</code> is a Date
 * @deprecated Not sure if DWR is the right place for this or if we support old browsers
 */
if (!DWRUtil.isDate)
{
DWRUtil.isDate = function(data)
{
    return (data && data.toUTCString) ? true : false;
};
}

/**
 * Is the given node an HTML input element?
 * @see http://www.getahead.ltd.uk/dwr/util-compat.html
 * @param ele The element to test
 * @deprecated See the documentation for alternatives
 */
if (!DWRUtil.isHTMLInputElement)
{
DWRUtil.isHTMLInputElement = function(ele)
{
    DWRUtil._deprecated("DWRUtil.isHTMLInputElement");
    return DWRUtil.isHTMLElement(ele, "input");
};
}

/**
 * Is the given node an HTML textarea element?
 * @see http://www.getahead.ltd.uk/dwr/util-compat.html
 * @param ele The element to test
 * @deprecated See the documentation for alternatives
 */
if (!DWRUtil.isHTMLTextAreaElement)
{
DWRUtil.isHTMLTextAreaElement = function(ele)
{
    DWRUtil._deprecated("DWRUtil.isHTMLTextAreaElement");
    return DWRUtil.isHTMLElement(ele, "textarea");
};
}

/**
 * Is the given node an HTML select element?
 * @see http://www.getahead.ltd.uk/dwr/util-compat.html
 * @param ele The element to test
 * @deprecated See the documentation for alternatives
 */
if (!DWRUtil.isHTMLSelectElement)
{
DWRUtil.isHTMLSelectElement = function(ele)
{
    DWRUtil._deprecated("DWRUtil.isHTMLSelectElement");
    return DWRUtil.isHTMLElement(ele, "select");
};
}

/**
 * Like document.getElementById() that works in more browsers.
 * @param id The id of the element
 * @deprecated Use $()
 */
if (!DWRUtil.getElementById)
{
DWRUtil.getElementById = function(id)
{
    DWRUtil._deprecated("DWRUtil.getElementById", "$");

    if (document.getElementById)
    {
        return document.getElementById(id);
    }
    else if (document.all)
    {
        return document.all[id];
    }

    return null;
};
}

/**
 * Visually enable or diable an element.
 * @see http://www.getahead.ltd.uk/dwr/util-compat.html
 * @param ele The id of the element or the HTML element itself
 * @param state Boolean true/false to set if the element should be enabled
 * @deprecated DWR isn't a generic Javascript library
 */
if (!DWRUtil.setEnabled)
{
DWRUtil.setEnabled = function(ele, state)
{
    DWRUtil._deprecated("DWRUtil.setEnabled");

    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("setEnabled() can't find an element with id: " + orig + ".");
        return;
    }

    // If we want to get funky and disable divs and spans by changing the font
    // colour or something then we might want to check the element type before
    // we make assumptions, but in the mean time ...
    // if (DWRUtil.isHTMLElement(ele, "input")) { ... }

    ele.disabled = !state;
    ele.readonly = !state;
    if (DWRUtil._isIE)
    {
        if (state)
        {
            ele.style.backgroundColor = "White";
        }
        else
        {
            // This is WRONG but the hack will do for now.
            ele.style.backgroundColor = "Scrollbar";
        }
    }
};
}

/**
 * Set the CSS display style to 'block'
 * @param ele The id of the element or the HTML element itself
 * @deprecated DWR isn't a generic Javascript library
 */
if (!DWRUtil.showById)
{
DWRUtil.showById = function(ele)
{
    DWRUtil._deprecated("DWRUtil.showById");

    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("showById() can't find an element with id: " + orig + ".");
        return;
    }

    // Apparently this works better that display = 'block'; ???
    ele.style.display = '';
};
}

/**
 * Set the CSS display style to 'none'
 * @param ele The id of the element or the HTML element itself
 * @deprecated DWR isn't a generic Javascript library
 */
if (!DWRUtil.hideById)
{
DWRUtil.hideById = function(ele)
{
    DWRUtil._deprecated("DWRUtil.hideById");

    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("hideById() can't find an element with id: " + orig + ".");
        return;
    }

    ele.style.display = 'none';
};
}

/**
 * Toggle an elements visibility
 * @param ele The id of the element or the HTML element itself
 * @deprecated DWR isn't a generic Javascript library
 */
if (!DWRUtil.toggleDisplay)
{
DWRUtil.toggleDisplay = function(ele)
{
    DWRUtil._deprecated("DWRUtil.toggleDisplay");

    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("toggleDisplay() can't find an element with id: " + orig + ".");
        return;
    }

    if (ele.style.display == 'none')
    {
        // Apparently this works better that display = 'block'; ???
        ele.style.display = '';
    }
    else
    {
        ele.style.display = 'none';
    }
};
}

/**
 * Alter an rows in a table that have a class of zebra to have classes of either
 * oddrow or evenrow alternately.
 * This is probably not the best place for this method, but I dont want to have
 * to fight with multiple onload functions.
 * @deprecated DWR isn't a generic Javascript library
 */
if (!DWRUtil.alternateRowColors)
{
DWRUtil.alternateRowColors = function()
{
    DWRUtil._deprecated("DWRUtil.alternateRowColors");

    var tables = document.getElementsByTagName("table");
    var rowCount = 0;

    for (var i = 0; i < tables.length; i++)
    {
        var table = tables.item(i);
        var rows = table.getElementsByTagName("tr");

        for (var j = 0; j < rows.length; j++)
        {
            var row = rows.item(j);
            if (row.className == "zebra")
            {
                if (rowCount % 2)
                {
                    row.className = 'oddrow';
                }
                else
                {
                    row.className = 'evenrow';
                }

                rowCount++;
            }
        }

        rowCount = 0;
    }
};
}

/**
 * Set the CSS class for an element
 * @param ele The id of the element or the HTML element itself
 * @deprecated DWR isn't a generic Javascript library
 */
if (!DWRUtil.setCSSClass)
{
DWRUtil.setCSSClass = function(ele, cssclass)
{
    DWRUtil._deprecated("DWRUtil.setCSSClass");

    var orig = ele;
    ele = $(ele);
    if (ele == null)
    {
        alert("setCSSClass() can't find an element with id: " + orig + ".");
        return;
    }

    ele.className = cssclass;
};
}

/**
 * Ensure a function is called when the page is loaded
 * @param load The function to call when the page has been loaded
 * @deprecated DWR isn't a generic Javascript library
 */
if (!DWRUtil.callOnLoad)
{
DWRUtil.callOnLoad = function(load)
{
    DWRUtil._deprecated("DWRUtil.callOnLoad", "window.addEventListener or window.onload");

    if (window.addEventListener)
    {
        window.addEventListener("load", load, false);
    }
    else if (window.attachEvent)
    {
        window.attachEvent("onload", load);
    }
    else
    {
        window.onload = load;
    }
};
}

/**
 * Remove all the options from a select list (specified by id) and replace with
 * elements in an array of objects.
 * @deprecated Use DWRUtil.removeAllOptions(ele); DWRUtil.addOptions(ele, data, valueprop, textprop);
 */
if (!DWRUtil.fillList)
{
DWRUtil.fillList = function(ele, data, valueprop, textprop)
{
    DWRUtil._deprecated("DWRUtil.fillList", "DWRUtil.addOptions");
    DWRUtil.removeAllOptions(ele);
    DWRUtil.addOptions(ele, data, valueprop, textprop);
};
}

/**
 * Add rows to a table
 * @deprecated Use DWRUtil.addRows()
 */
if (!DWRUtil.drawTable)
{
DWRUtil.drawTable = function(ele, data, cellFuncs)
{
    DWRUtil._deprecated("DWRUtil.drawTable", "DWRUtil.addRows");
    DWRUtil.addRows(ele, data, cellFuncs);
};
}

/**
 * Remove all the children of a given node.
 * Most useful for dynamic tables where you clearChildNodes() on the tbody
 * element.
 * @param id The id of the element
 * @deprecated Use DWRUtil.removeAllRows()
 */
if (!DWRUtil.clearChildNodes)
{
DWRUtil.clearChildNodes = function(id)
{
    DWRUtil._deprecated("DWRUtil.clearChildNodes", "DWRUtil.removeAllRows");

    var ele = DWRUtil.getElementById(id);
    if (ele == null)
    {
        alert("clearChildNodes() can't find an element with id: " + id + ".");
        throw id;
    }

    while (ele.childNodes.length > 0)
    {
        ele.removeChild(ele.firstChild);
    }
};
}

/**
 * Do we alert on deprecation warnings
 * @private
 */
DWRUtil._showDeprecated = true;

/**
 * We can use this function to deprecate things.
 * @deprecated
 * @private
 */
DWRUtil._deprecated = function(fname, altfunc)
{
    if (DWRUtil._showDeprecated)
    {
        var warning;
        var alternative;

        if (fname == null)
        {
            warning = "You have used a deprecated function which could be removed in the future.";
            alternative = "";
        }
        else
        {
            warning = "Utility functions like '" + fname + "' are deprecated and could be removed in the future.";

            if (altfunc == null)
            {
                alternative = "\nSee the documentation for alternatives.";
            }
            else
            {
                alternative = "\nFor an alternative see: " + altfunc;
            }
        }

        var further = "\nImport deprecated.js to get rid of this warning.\nDo you wish to ignore further deprecation warnings on this page?";

        DWRUtil._showDeprecated = !confirm(warning + alternative + further);
    }
};



_cfscriptLocation = "/ajax/examples/functions.cfm";
_cfscriptAmazonLocation = "/ajax/app/amazon/functions.cfm";
_cfscriptVotingLocation = "/ajax/app/voting/functions.cfm";
_cfscriptYahooLocation = "/ajax/app/yahoo/functions.cfm";
_cfscriptMyLocation = "http://www.kloppy.com/Home/GetTheNews_cfajax.cfm";
_cfscriptMyLocationForVideoDivide = "/kloppyvideoParts/functions.cfm";
function errorHandler(message)
{
	$('disabledZone').style.visibility = 'hidden';
    if (typeof message == "object" && message.name == "Error" && message.description)
    {
        alert("Error: " + message.description);
    }
    else
    {
        alert(message);
    }
};