/*
 * Copyright (c) 2007 John Resig (jquery.com)
 * Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Copyright (c) 2007 cody lindley
 * Copyright (c) 2007 Jörn Zaefferer
 * Copyright 2007 Yehuda Katz, Rein Henrichs
 * Copyright (c) 2007 Christian Bach
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * 
 * Copyright (c) 2008, Yahoo! Inc. All rights reserved.
 * Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt
 *
 * Copyright: 2006 Mark Wubben.
 * This software is licensed and provided under the CC-GNU LGPL.
 * See <http://creativecommons.org/licenses/LGPL/2.1/>
 *
 * Copyright 2005 Joe Walker
 * 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
 *
 * Copyright (c)2005-2007 Matt Kruse (javascripttoolbox.com)
 * Dual licensed under the MIT and GPL licenses.
 *
 * Copyright (C) 2008 OnSurvey Inc.
 */
var G_CONTEXT_PATH = "./";
var G_LOCALE = "en_GB";
var G_BRAND = "HI";
var G_DOMAIN = ".hilton.co.uk";
var G_SAYT = "http://beta.hilton.co.uk/sayt/";

var G_SECURE = "secure.hilton.co.uk";

var dialupTestImage = "./images/tmp_image_gallery_05_DialUP.jpg";
var G_SIFR_UNIVERS = "./images/sifrFonts/universcond57.swf";
var G_SIFR_SANS = "./images/sifrFonts/fedrasans.swf";
var G_TB_LOADING_ANIMATION = "./images/loadingAnimation.gif";


var onSurveyImage = "./images/i/popup0.swf";
onSurveyImage = onSurveyImage.replace("popup0.swf","");

var error404page = "http://beta.hilton.co.uk:80/HiWayWeb/appmanager/portals/error?_nfpb=true&_pageLabel=page_not_found_error_page";                 


    

var tempDcsId = "dcskccs2c10000wk1g0h3qwgc_4e3l";
var tempSurveyFreq = "0.50";


var G_DATE_FORMAT_SHORT = "dd/MM/yyyy";
var G_CAL_ARRIVAL = "Arrival";
var G_CAL_DEPARTURE = "Departure";
var G_MONTHS = "January,February,March,April,May,June,July,August,September,October,November,December".split(",");
var G_CAL_SHORT_WEEKDAYS =  "Su,Mo,Tu,We,Th,Fr,Sa".split(",");
var G_WEEKDAYS = "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(",");
var custClaimMaxArrivalDate = '';
/*############ Begin common/js/jquery/jquery.js ############*/
(function() {
    if (typeof jQuery != "undefined") {
        var _jQuery = jQuery;
    }
    var jQuery = window.jQuery = function(selector, context) {
        return this instanceof jQuery ? this.init(selector, context) : new jQuery(selector, context);
    };
    if (typeof $ != "undefined") {
        var _$ = $;
    }
    window.$ = jQuery;
    var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;
    jQuery.fn = jQuery.prototype = {
        init: function(selector, context) {
            selector = selector || document;
            if (typeof selector == "string") {
                var m = quickExpr.exec(selector);
                if (m && (m[1] || !context)) {
                    if (m[1]) {
                        selector = jQuery.clean([m[1]], context);
                    } else {
                        var tmp = document.getElementById(m[3]);
                        if (tmp) {
                            if (tmp.id != m[3]) {
                                return jQuery().find(selector);
                            } else {
                                this[0] = tmp;
                                this.length = 1;
                                return this;
                            }
                        } else {
                            selector = [];
                        }
                    }
                } else {
                    return new jQuery(context).find(selector);
                }
            } else {
                if (jQuery.isFunction(selector)) {
                    return new jQuery(document)[jQuery.fn.ready ? "ready": "load"](selector);
                }
            }
            return this.setArray(selector.constructor == Array && selector || (selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray(selector) || [selector]);
        },
        jquery: "1.2.1",
        size: function() {
            return this.length;
        },
        length: 0,
        get: function(num) {
            return num == undefined ? jQuery.makeArray(this) : this[num];
        },
        pushStack: function(a) {
            var ret = jQuery(a);
            ret.prevObject = this;
            return ret;
        },
        setArray: function(a) {
            this.length = 0;
            Array.prototype.push.apply(this, a);
            return this;
        },
        each: function(fn, args) {
            return jQuery.each(this, fn, args);
        },
        index: function(obj) {
            var pos = -1;
            this.each(function(i) {
                if (this == obj) {
                    pos = i;
                }
            });
            return pos;
        },
        attr: function(key, value, type) {
            var obj = key;
            if (key.constructor == String) {
                if (value == undefined) {
                    return this.length && jQuery[type || "attr"](this[0], key) || undefined;
                } else {
                    obj = {};
                    obj[key] = value;
                }
            }
            return this.each(function(index) {
                for (var prop in obj) {
                    jQuery.attr(type ? this.style: this, prop, jQuery.prop(this, obj[prop], type, index, prop));
                }
            });
        },
        css: function(key, value) {
            return this.attr(key, value, "curCSS");
        },
        text: function(e) {
            if (typeof e != "object" && e != null) {
                return this.empty().append(document.createTextNode(e));
            }
            var t = "";
            jQuery.each(e || this,
            function() {
                jQuery.each(this.childNodes,
                function() {
                    if (this.nodeType != 8) {
                        t += this.nodeType != 1 ? this.nodeValue: jQuery.fn.text([this]);
                    }
                });
            });
            return t;
        },
        wrapAll: function(html) {
            if (this[0]) {
                jQuery(html, this[0].ownerDocument).clone().insertBefore(this[0]).map(function() {
                    var elem = this;
                    while (elem.firstChild) {
                        elem = elem.firstChild;
                    }
                    return elem;
                }).append(this);
            }
            return this;
        },
        wrapInner: function(html) {
            return this.each(function() {
                jQuery(this).contents().wrapAll(html);
            });
        },
        wrap: function(html) {
            return this.each(function() {
                jQuery(this).wrapAll(html);
            });
        },
        append: function() {
            return this.domManip(arguments, true, 1,
            function(a) {
                this.appendChild(a);
            });
        },
        prepend: function() {
            return this.domManip(arguments, true, -1,
            function(a) {
                this.insertBefore(a, this.firstChild);
            });
        },
        before: function() {
            return this.domManip(arguments, false, 1,
            function(a) {
                this.parentNode.insertBefore(a, this);
            });
        },
        after: function() {
            return this.domManip(arguments, false, -1,
            function(a) {
                this.parentNode.insertBefore(a, this.nextSibling);
            });
        },
        end: function() {
            return this.prevObject || jQuery([]);
        },
        find: function(t) {
            var data = jQuery.map(this,
            function(a) {
                return jQuery.find(t, a);
            });
            return this.pushStack(/[^+>] [^+>]/.test(t) || t.indexOf("..") > -1 ? jQuery.unique(data) : data);
        },
        clone: function(events) {
            var ret = this.map(function() {
                return this.outerHTML ? jQuery(this.outerHTML)[0] : this.cloneNode(true);
            });
            var clone = ret.find("*").andSelf().each(function() {
                if (this[expando] != undefined) {
                    this[expando] = null;
                }
            });
            if (events === true) {
                this.find("*").andSelf().each(function(i) {
                    var events = jQuery.data(this, "events");
                    for (var type in events) {
                        for (var handler in events[type]) {
                            jQuery.event.add(clone[i], type, events[type][handler], events[type][handler].data);
                        }
                    }
                });
            }
            return ret;
        },
        filter: function(t) {
            return this.pushStack(jQuery.isFunction(t) && jQuery.grep(this,
            function(el, index) {
                return t.apply(el, [index]);
            }) || jQuery.multiFilter(t, this));
        },
        not: function(t) {
            return this.pushStack(t.constructor == String && jQuery.multiFilter(t, this, true) || jQuery.grep(this,
            function(a) {
                return (t.constructor == Array || t.jquery) ? jQuery.inArray(a, t) < 0 : a != t;
            }));
        },
        add: function(t) {
            return this.pushStack(jQuery.merge(this.get(), t.constructor == String ? jQuery(t).get() : t.length != undefined && (!t.nodeName || jQuery.nodeName(t, "form")) ? t: [t]));
        },
        is: function(expr) {
            return expr ? jQuery.multiFilter(expr, this).length > 0 : false;
        },
        hasClass: function(expr) {
            return this.is("." + expr);
        },
        val: function(val) {
            if (val == undefined) {
                if (this.length) {
                    var elem = this[0];
                    if (jQuery.nodeName(elem, "select")) {
                        var index = elem.selectedIndex,
                        a = [],
                        options = elem.options,
                        one = elem.type == "select-one";
                        if (index < 0) {
                            return null;
                        }
                        for (var i = one ? index: 0, max = one ? index + 1 : options.length; i < max; i++) {
                            var option = options[i];
                            if (option.selected) {
                                var val = jQuery.browser.msie && !option.attributes.value.specified ? option.text: option.value;
                                if (one) {
                                    return val;
                                }
                                a.push(val);
                            }
                        }
                        return a;
                    } else {
                        return this[0].value.replace(/\r/g, "");
                    }
                }
            } else {
                return this.each(function() {
                    if (val.constructor == Array && /radio|checkbox/.test(this.type)) {
                        this.checked = (jQuery.inArray(this.value, val) >= 0 || jQuery.inArray(this.name, val) >= 0);
                    } else {
                        if (jQuery.nodeName(this, "select")) {
                            var tmp = val.constructor == Array ? val: [val];
                            jQuery("option", this).each(function() {
                                this.selected = (jQuery.inArray(this.value, tmp) >= 0 || jQuery.inArray(this.text, tmp) >= 0);
                            });
                            if (!tmp.length) {
                                this.selectedIndex = -1;
                            }
                        } else {
                            this.value = val;
                        }
                    }
                });
            }
        },
        html: function(val) {
            return val == undefined ? (this.length ? this[0].innerHTML: null) : this.empty().append(val);
        },
        replaceWith: function(val) {
            return this.after(val).remove();
        },
        eq: function(i) {
            return this.slice(i, i + 1);
        },
        slice: function() {
            return this.pushStack(Array.prototype.slice.apply(this, arguments));
        },
        map: function(fn) {
            return this.pushStack(jQuery.map(this,
            function(elem, i) {
                return fn.call(elem, i, elem);
            }));
        },
        andSelf: function() {
            return this.add(this.prevObject);
        },
        domManip: function(args, table, dir, fn) {
            var clone = this.length > 1,
            a;
            return this.each(function() {
                if (!a) {
                    a = jQuery.clean(args, this.ownerDocument);
                    if (dir < 0) {
                        a.reverse();
                    }
                }
                var obj = this;
                if (table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr")) {
                    obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));
                }
                jQuery.each(a,
                function() {
                    var elem = clone ? this.cloneNode(true) : this;
                    if (!evalScript(0, elem)) {
                        fn.call(obj, elem);
                    }
                });
            });
        }
    };
    function evalScript(i, elem) {
        var script = jQuery.nodeName(elem, "script");
        if (script) {
            if (elem.src) {
                jQuery.ajax({
                    url: elem.src,
                    async: false,
                    dataType: "script"
                });
            } else {
                jQuery.globalEval(elem.text || elem.textContent || elem.innerHTML || "");
            }
            if (elem.parentNode) {
                elem.parentNode.removeChild(elem);
            }
        } else {
            if (elem.nodeType == 1) {
                jQuery("script", elem).each(evalScript);
            }
        }
        return script;
    }
    jQuery.extend = jQuery.fn.extend = function() {
        var target = arguments[0] || {},
        a = 1,
        al = arguments.length,
        deep = false;
        if (target.constructor == Boolean) {
            deep = target;
            target = arguments[1] || {};
        }
        if (al == 1) {
            target = this;
            a = 0;
        }
        var prop;
        for (; a < al; a++) {
            if ((prop = arguments[a]) != null) {
                for (var i in prop) {
                    if (target == prop[i]) {
                        continue;
                    }
                    if (deep && typeof prop[i] == "object" && target[i]) {
                        jQuery.extend(target[i], prop[i]);
                    } else {
                        if (prop[i] != undefined) {
                            target[i] = prop[i];
                        }
                    }
                }
            }
        }
        return target;
    };
    var expando = "jQuery" + (new Date()).getTime(),
    uuid = 0,
    win = {};
    jQuery.extend({
        noConflict: function(deep) {
            window.$ = _$;
            if (deep) {
                window.jQuery = _jQuery;
            }
            return jQuery;
        },
        isFunction: function(fn) {
            return !! fn && typeof fn != "string" && !fn.nodeName && fn.constructor != Array && /function/i.test(fn + "");
        },
        isXMLDoc: function(elem) {
            return elem.documentElement && !elem.body || elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
        },
        globalEval: function(data) {
            data = jQuery.trim(data);
            if (data) {
                if (window.execScript) {
                    window.execScript(data);
                } else {
                    if (jQuery.browser.safari) {
                        window.setTimeout(data, 0);
                    } else {
                        eval.call(window, data);
                    }
                }
            }
        },
        nodeName: function(elem, name) {
            return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
        },
        cache: {},
        data: function(elem, name, data) {
            elem = elem == window ? win: elem;
            var id = elem[expando];
            if (!id) {
                id = elem[expando] = ++uuid;
            }
            if (name && !jQuery.cache[id]) {
                jQuery.cache[id] = {};
            }
            if (data != undefined) {
                jQuery.cache[id][name] = data;
            }
            return name ? jQuery.cache[id][name] : id;
        },
        removeData: function(elem, name) {
            elem = elem == window ? win: elem;
            var id = elem[expando];
            if (name) {
                if (jQuery.cache[id]) {
                    delete jQuery.cache[id][name];
                    name = "";
                    for (name in jQuery.cache[id]) {
                        break;
                    }
                    if (!name) {
                        jQuery.removeData(elem);
                    }
                }
            } else {
                try {
                    delete elem[expando];
                } catch(e) {
                    if (elem.removeAttribute) {
                        elem.removeAttribute(expando);
                    }
                }
                delete jQuery.cache[id];
            }
        },
        each: function(obj, fn, args) {
            if (args) {
                if (obj.length == undefined) {
                    for (var i in obj) {
                        fn.apply(obj[i], args);
                    }
                } else {
                    for (var i = 0,
                    ol = obj.length; i < ol; i++) {
                        if (fn.apply(obj[i], args) === false) {
                            break;
                        }
                    }
                }
            } else {
                if (obj.length == undefined) {
                    for (var i in obj) {
                        fn.call(obj[i], i, obj[i]);
                    }
                } else {
                    for (var i = 0,
                    ol = obj.length,
                    val = obj[0]; i < ol && fn.call(val, i, val) !== false; val = obj[++i]) {}
                }
            }
            return obj;
        },
        prop: function(elem, value, type, index, prop) {
            if (jQuery.isFunction(value)) {
                value = value.call(elem, [index]);
            }
            var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;
            return value && value.constructor == Number && type == "curCSS" && !exclude.test(prop) ? value + "px": value;
        },
        className: {
            add: function(elem, c) {
                jQuery.each((c || "").split(/\s+/),
                function(i, cur) {
                    if (!jQuery.className.has(elem.className, cur)) {
                        elem.className += (elem.className ? " ": "") + cur;
                    }
                });
            },
            remove: function(elem, c) {
                elem.className = c != undefined ? jQuery.grep(elem.className.split(/\s+/),
                function(cur) {
                    return ! jQuery.className.has(c, cur);
                }).join(" ") : "";
            },
            has: function(t, c) {
                return jQuery.inArray(c, (t.className || t).toString().split(/\s+/)) > -1;
            }
        },
        swap: function(e, o, f) {
            for (var i in o) {
                e.style["old" + i] = e.style[i];
                e.style[i] = o[i];
            }
            f.apply(e, []);
            for (var i in o) {
                e.style[i] = e.style["old" + i];
            }
        },
        css: function(e, p) {
            if (p == "height" || p == "width") {
                var old = {},
                oHeight, oWidth, d = ["Top", "Bottom", "Right", "Left"];
                jQuery.each(d,
                function() {
                    old["padding" + this] = 0;
                    old["border" + this + "Width"] = 0;
                });
                jQuery.swap(e, old,
                function() {
                    if (jQuery(e).is(":visible")) {
                        oHeight = e.offsetHeight;
                        oWidth = e.offsetWidth;
                    } else {
                        e = jQuery(e.cloneNode(true)).find(":radio").removeAttr("checked").end().css({
                            visibility: "hidden",
                            position: "absolute",
                            display: "block",
                            right: "0",
                            left: "0"
                        }).appendTo(e.parentNode)[0];
                        var parPos = jQuery.css(e.parentNode, "position") || "static";
                        if (parPos == "static") {
                            e.parentNode.style.position = "relative";
                        }
                        oHeight = e.clientHeight;
                        oWidth = e.clientWidth;
                        if (parPos == "static") {
                            e.parentNode.style.position = "static";
                        }
                        e.parentNode.removeChild(e);
                    }
                });
                return p == "height" ? oHeight: oWidth;
            }
            return jQuery.curCSS(e, p);
        },
        curCSS: function(elem, prop, force) {
            var ret, stack = [],
            swap = [];
            function color(a) {
                if (!jQuery.browser.safari) {
                    return false;
                }
                var ret = document.defaultView.getComputedStyle(a, null);
                return ! ret || ret.getPropertyValue("color") == "";
            }
            if (prop == "opacity" && jQuery.browser.msie) {
                ret = jQuery.attr(elem.style, "opacity");
                return ret == "" ? "1": ret;
            }
            if (prop.match(/float/i)) {
                prop = styleFloat;
            }
            if (!force && elem.style[prop]) {
                ret = elem.style[prop];
            } else {
                if (document.defaultView && document.defaultView.getComputedStyle) {
                    if (prop.match(/float/i)) {
                        prop = "float";
                    }
                    prop = prop.replace(/([A-Z])/g, "-$1").toLowerCase();
                    var cur = document.defaultView.getComputedStyle(elem, null);
                    if (cur && !color(elem)) {
                        ret = cur.getPropertyValue(prop);
                    } else {
                        for (var a = elem; a && color(a); a = a.parentNode) {
                            stack.unshift(a);
                        }
                        for (a = 0; a < stack.length; a++) {
                            if (color(stack[a])) {
                                swap[a] = stack[a].style.display;
                                stack[a].style.display = "block";
                            }
                        }
                        ret = prop == "display" && swap[stack.length - 1] != null ? "none": document.defaultView.getComputedStyle(elem, null).getPropertyValue(prop) || "";
                        for (a = 0; a < swap.length; a++) {
                            if (swap[a] != null) {
                                stack[a].style.display = swap[a];
                            }
                        }
                    }
                    if (prop == "opacity" && ret == "") {
                        ret = "1";
                    }
                } else {
                    if (elem.currentStyle) {
                        var newProp = prop.replace(/\-(\w)/g,
                        function(m, c) {
                            return c.toUpperCase();
                        });
                        ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
                        if (!/^\d+(px)?$/i.test(ret) && /^\d/.test(ret)) {
                            var style = elem.style.left;
                            var runtimeStyle = elem.runtimeStyle.left;
                            elem.runtimeStyle.left = elem.currentStyle.left;
                            elem.style.left = ret || 0;
                            ret = elem.style.pixelLeft + "px";
                            elem.style.left = style;
                            elem.runtimeStyle.left = runtimeStyle;
                        }
                    }
                }
            }
            return ret;
        },
        clean: function(a, doc) {
            var r = [];
            doc = doc || document;
            jQuery.each(a,
            function(i, arg) {
                if (!arg) {
                    return;
                }
                if (arg.constructor == Number) {
                    arg = arg.toString();
                }
                if (typeof arg == "string") {
                    arg = arg.replace(/(<(\w+)[^>]*?)\/>/g,
                    function(m, all, tag) {
                        return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area)$/i) ? m: all + "></" + tag + ">";
                    });
                    var s = jQuery.trim(arg).toLowerCase(),
                    div = doc.createElement("div"),
                    tb = [];
                    var wrap = !s.indexOf("<opt") && [1, "<select>", "</select>"] || !s.indexOf("<leg") && [1, "<fieldset>", "</fieldset>"] || s.match(/^<(thead|tbody|tfoot|colg|cap)/) && [1, "<table>", "</table>"] || !s.indexOf("<tr") && [2, "<table><tbody>", "</tbody></table>"] || (!s.indexOf("<td") || !s.indexOf("<th")) && [3, "<table><tbody><tr>", "</tr></tbody></table>"] || !s.indexOf("<col") && [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"] || jQuery.browser.msie && [1, "div<div>", "</div>"] || [0, "", ""];
                    div.innerHTML = wrap[1] + arg + wrap[2];
                    while (wrap[0]--) {
                        div = div.lastChild;
                    }
                    if (jQuery.browser.msie) {
                        if (!s.indexOf("<table") && s.indexOf("<tbody") < 0) {
                            tb = div.firstChild && div.firstChild.childNodes;
                        } else {
                            if (wrap[1] == "<table>" && s.indexOf("<tbody") < 0) {
                                tb = div.childNodes;
                            }
                        }
                        for (var n = tb.length - 1; n >= 0; --n) {
                            if (jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length) {
                                tb[n].parentNode.removeChild(tb[n]);
                            }
                        }
                        if (/^\s/.test(arg)) {
                            div.insertBefore(doc.createTextNode(arg.match(/^\s*/)[0]), div.firstChild);
                        }
                    }
                    arg = jQuery.makeArray(div.childNodes);
                }
                if (0 === arg.length && (!jQuery.nodeName(arg, "form") && !jQuery.nodeName(arg, "select"))) {
                    return;
                }
                if (arg[0] == undefined || jQuery.nodeName(arg, "form") || arg.options) {
                    r.push(arg);
                } else {
                    r = jQuery.merge(r, arg);
                }
            });
            return r;
        },
        attr: function(elem, name, value) {
            var fix = jQuery.isXMLDoc(elem) ? {}: jQuery.props;
            if (name == "selected" && jQuery.browser.safari) {
                elem.parentNode.selectedIndex;
            }
            if (fix[name]) {
                if (value != undefined) {
                    elem[fix[name]] = value;
                }
                return elem[fix[name]];
            } else {
                if (jQuery.browser.msie && name == "style") {
                    return jQuery.attr(elem.style, "cssText", value);
                } else {
                    if (value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method")) {
                        return elem.getAttributeNode(name).nodeValue;
                    } else {
                        if (elem.tagName) {
                            if (value != undefined) {
                                if (name == "type" && jQuery.nodeName(elem, "input") && elem.parentNode) {
                                    throw "type property can't be changed";
                                }
                                elem.setAttribute(name, value);
                            }
                            if (jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem)) {
                                return elem.getAttribute(name, 2);
                            }
                            return elem.getAttribute(name);
                        } else {
                            if (name == "opacity" && jQuery.browser.msie) {
                                if (value != undefined) {
                                    elem.zoom = 1;
                                    elem.filter = (elem.filter || "").replace(/alpha\([^)]*\)/, "") + (parseFloat(value).toString() == "NaN" ? "": "alpha(opacity=" + value * 100 + ")");
                                }
                                return elem.filter ? (parseFloat(elem.filter.match(/opacity=([^)]*)/)[1]) / 100).toString() : "";
                            }
                            name = name.replace(/-([a-z])/ig,
                            function(z, b) {
                                return b.toUpperCase();
                            });
                            if (value != undefined) {
                                elem[name] = value;
                            }
                            return elem[name];
                        }
                    }
                }
            }
        },
        trim: function(t) {
            return (t || "").replace(/^\s+|\s+$/g, "");
        },
        makeArray: function(a) {
            var r = [];
            if (typeof a != "array") {
                for (var i = 0,
                al = a.length; i < al; i++) {
                    r.push(a[i]);
                }
            } else {
                r = a.slice(0);
            }
            return r;
        },
        inArray: function(b, a) {
            for (var i = 0,
            al = a.length; i < al; i++) {
                if (a[i] == b) {
                    return i;
                }
            }
            return - 1;
        },
        merge: function(first, second) {
            if (jQuery.browser.msie) {
                for (var i = 0; second[i]; i++) {
                    if (second[i].nodeType != 8) {
                        first.push(second[i]);
                    }
                }
            } else {
                for (var i = 0; second[i]; i++) {
                    first.push(second[i]);
                }
            }
            return first;
        },
        unique: function(first) {
            var r = [],
            done = {};
            try {
                for (var i = 0,
                fl = first.length; i < fl; i++) {
                    var id = jQuery.data(first[i]);
                    if (!done[id]) {
                        done[id] = true;
                        r.push(first[i]);
                    }
                }
            } catch(e) {
                r = first;
            }
            return r;
        },
        grep: function(elems, fn, inv) {
            if (typeof fn == "string") {
                fn = eval("false||function(a,i){return " + fn + "}");
            }
            var result = [];
            for (var i = 0,
            el = elems.length; i < el; i++) {
                if (!inv && fn(elems[i], i) || inv && !fn(elems[i], i)) {
                    result.push(elems[i]);
                }
            }
            return result;
        },
        map: function(elems, fn) {
            if (typeof fn == "string") {
                fn = eval("false||function(a){return " + fn + "}");
            }
            var result = [];
            for (var i = 0,
            el = elems.length; i < el; i++) {
                var val = fn(elems[i], i);
                if (val !== null && val != undefined) {
                    if (val.constructor != Array) {
                        val = [val];
                    }
                    result = result.concat(val);
                }
            }
            return result;
        }
    });
    var userAgent = navigator.userAgent.toLowerCase();
    jQuery.browser = {
        version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
        safari: /webkit/.test(userAgent),
        opera: /opera/.test(userAgent),
        msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
        mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
    };
    var styleFloat = jQuery.browser.msie ? "styleFloat": "cssFloat";
    jQuery.extend({
        boxModel: !jQuery.browser.msie || document.compatMode == "CSS1Compat",
        styleFloat: jQuery.browser.msie ? "styleFloat": "cssFloat",
        props: {
            "for": "htmlFor",
            "class": "className",
            "float": styleFloat,
            cssFloat: styleFloat,
            styleFloat: styleFloat,
            innerHTML: "innerHTML",
            className: "className",
            value: "value",
            disabled: "disabled",
            checked: "checked",
            readonly: "readOnly",
            selected: "selected",
            maxlength: "maxLength"
        }
    });
    jQuery.each({
        parent: "a.parentNode",
        parents: "jQuery.dir(a,'parentNode')",
        next: "jQuery.nth(a,2,'nextSibling')",
        prev: "jQuery.nth(a,2,'previousSibling')",
        nextAll: "jQuery.dir(a,'nextSibling')",
        prevAll: "jQuery.dir(a,'previousSibling')",
        siblings: "jQuery.sibling(a.parentNode.firstChild,a)",
        children: "jQuery.sibling(a.firstChild)",
        contents: "jQuery.nodeName(a,'iframe')?a.contentDocument||a.contentWindow.document:jQuery.makeArray(a.childNodes)"
    },
    function(i, n) {
        jQuery.fn[i] = function(a) {
            var ret = jQuery.map(this, n);
            if (a && typeof a == "string") {
                ret = jQuery.multiFilter(a, ret);
            }
            return this.pushStack(jQuery.unique(ret));
        };
    });
    jQuery.each({
        appendTo: "append",
        prependTo: "prepend",
        insertBefore: "before",
        insertAfter: "after",
        replaceAll: "replaceWith"
    },
    function(i, n) {
        jQuery.fn[i] = function() {
            var a = arguments;
            return this.each(function() {
                for (var j = 0,
                al = a.length; j < al; j++) {
                    jQuery(a[j])[n](this);
                }
            });
        };
    });
    jQuery.each({
        removeAttr: function(key) {
            jQuery.attr(this, key, "");
            this.removeAttribute(key);
        },
        addClass: function(c) {
            jQuery.className.add(this, c);
        },
        removeClass: function(c) {
            jQuery.className.remove(this, c);
        },
        toggleClass: function(c) {
            jQuery.className[jQuery.className.has(this, c) ? "remove": "add"](this, c);
        },
        remove: function(a) {
            if (!a || jQuery.filter(a, [this]).r.length) {
                jQuery.removeData(this);
                this.parentNode.removeChild(this);
            }
        },
        empty: function() {
            jQuery("*", this).each(function() {
                jQuery.removeData(this);
            });
            while (this.firstChild) {
                this.removeChild(this.firstChild);
            }
        }
    },
    function(i, n) {
        jQuery.fn[i] = function() {
            return this.each(n, arguments);
        };
    });
    jQuery.each(["Height", "Width"],
    function(i, name) {
        var n = name.toLowerCase();
        jQuery.fn[n] = function(h) {
            return this[0] == window ? jQuery.browser.safari && self["inner" + name] || jQuery.boxModel && Math.max(document.documentElement["client" + name], document.body["client" + name]) || document.body["client" + name] : this[0] == document ? Math.max(document.body["scroll" + name], document.body["offset" + name]) : h == undefined ? (this.length ? jQuery.css(this[0], n) : null) : this.css(n, h.constructor == String ? h: h + "px");
        };
    });
    var chars = jQuery.browser.safari && parseInt(jQuery.browser.version) < 417 ? "(?:[\\w*_-]|\\\\.)": "(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",
    quickChild = new RegExp("^>\\s*(" + chars + "+)"),
    quickID = new RegExp("^(" + chars + "+)(#)(" + chars + "+)"),
    quickClass = new RegExp("^([#.]?)(" + chars + "*)");
    jQuery.extend({
        expr: {
            "": "m[2]=='*'||jQuery.nodeName(a,m[2])",
            "#": "a.getAttribute('id')==m[2]",
            ":": {
                lt: "i<m[3]-0",
                gt: "i>m[3]-0",
                nth: "m[3]-0==i",
                eq: "m[3]-0==i",
                first: "i==0",
                last: "i==r.length-1",
                even: "i%2==0",
                odd: "i%2",
                "first-child": "a.parentNode.getElementsByTagName('*')[0]==a",
                "last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a",
                "only-child": "!jQuery.nth(a.parentNode.lastChild,2,'previousSibling')",
                parent: "a.firstChild",
                empty: "!a.firstChild",
                contains: "(a.textContent||a.innerText||jQuery(a).text()||'').indexOf(m[3])>=0",
                visible: '"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"',
                hidden: '"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"',
                enabled: "!a.disabled",
                disabled: "a.disabled",
                checked: "a.checked",
                selected: "a.selected||jQuery.attr(a,'selected')",
                text: "'text'==a.type",
                radio: "'radio'==a.type",
                checkbox: "'checkbox'==a.type",
                file: "'file'==a.type",
                password: "'password'==a.type",
                submit: "'submit'==a.type",
                image: "'image'==a.type",
                reset: "'reset'==a.type",
                button: '"button"==a.type||jQuery.nodeName(a,"button")',
                input: "/input|select|textarea|button/i.test(a.nodeName)",
                has: "jQuery.find(m[3],a).length",
                header: "/h\\d/i.test(a.nodeName)",
                animated: "jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length"
            }
        },
        parse: [/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/, /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/, new RegExp("^([:.#]*)(" + chars + "+)")],
        multiFilter: function(expr, elems, not) {
            var old, cur = [];
            while (expr && expr != old) {
                old = expr;
                var f = jQuery.filter(expr, elems, not);
                expr = f.t.replace(/^\s*,\s*/, "");
                cur = not ? elems = f.r: jQuery.merge(cur, f.r);
            }
            return cur;
        },
        find: function(t, context) {
            if (typeof t != "string") {
                return [t];
            }
            if (context && !context.nodeType) {
                context = null;
            }
            context = context || document;
            var ret = [context],
            done = [],
            last;
            while (t && last != t) {
                var r = [];
                last = t;
                t = jQuery.trim(t);
                var foundToken = false;
                var re = quickChild;
                var m = re.exec(t);
                if (m) {
                    var nodeName = m[1].toUpperCase();
                    for (var i = 0; ret[i]; i++) {
                        for (var c = ret[i].firstChild;
                        c; c = c.nextSibling) {
                            if (c.nodeType == 1 && (nodeName == "*" || c.nodeName.toUpperCase() == nodeName.toUpperCase())) {
                                r.push(c);
                            }
                        }
                    }
                    ret = r;
                    t = t.replace(re, "");
                    if (t.indexOf(" ") == 0) {
                        continue;
                    }
                    foundToken = true;
                } else {
                    re = /^([>+~])\s*(\w*)/i;
                    if ((m = re.exec(t)) != null) {
                        r = [];
                        var nodeName = m[2],
                        merge = {};
                        m = m[1];
                        for (var j = 0,
                        rl = ret.length; j < rl; j++) {
                            var n = m == "~" || m == "+" ? ret[j].nextSibling: ret[j].firstChild;
                            for (; n; n = n.nextSibling) {
                                if (n.nodeType == 1) {
                                    var id = jQuery.data(n);
                                    if (m == "~" && merge[id]) {
                                        break;
                                    }
                                    if (!nodeName || n.nodeName.toUpperCase() == nodeName.toUpperCase()) {
                                        if (m == "~") {
                                            merge[id] = true;
                                        }
                                        r.push(n);
                                    }
                                    if (m == "+") {
                                        break;
                                    }
                                }
                            }
                        }
                        ret = r;
                        t = jQuery.trim(t.replace(re, ""));
                        foundToken = true;
                    }
                }
                if (t && !foundToken) {
                    if (!t.indexOf(",")) {
                        if (context == ret[0]) {
                            ret.shift();
                        }
                        done = jQuery.merge(done, ret);
                        r = ret = [context];
                        t = " " + t.substr(1, t.length);
                    } else {
                        var re2 = quickID;
                        var m = re2.exec(t);
                        if (m) {
                            m = [0, m[2], m[3], m[1]];
                        } else {
                            re2 = quickClass;
                            m = re2.exec(t);
                        }
                        m[2] = m[2].replace(/\\/g, "");
                        var elem = ret[ret.length - 1];
                        if (m[1] == "#" && elem && elem.getElementById && !jQuery.isXMLDoc(elem)) {
                            var oid = elem.getElementById(m[2]);
                            if ((jQuery.browser.msie || jQuery.browser.opera) && oid && typeof oid.id == "string" && oid.id != m[2]) {
                                oid = jQuery('[@id="' + m[2] + '"]', elem)[0];
                            }
                            ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
                        } else {
                            for (var i = 0; ret[i]; i++) {
                                var tag = m[1] == "#" && m[3] ? m[3] : m[1] != "" || m[0] == "" ? "*": m[2];
                                if (tag == "*" && ret[i].nodeName.toLowerCase() == "object") {
                                    tag = "param";
                                }
                                r = jQuery.merge(r, ret[i].getElementsByTagName(tag));
                            }
                            if (m[1] == ".") {
                                r = jQuery.classFilter(r, m[2]);
                            }
                            if (m[1] == "#") {
                                var tmp = [];
                                for (var i = 0; r[i]; i++) {
                                    if (r[i].getAttribute("id") == m[2]) {
                                        tmp = [r[i]];
                                        break;
                                    }
                                }
                                r = tmp;
                            }
                            ret = r;
                        }
                        t = t.replace(re2, "");
                    }
                }
                if (t) {
                    var val = jQuery.filter(t, r);
                    ret = r = val.r;
                    t = jQuery.trim(val.t);
                }
            }
            if (t) {
                ret = [];
            }
            if (ret && context == ret[0]) {
                ret.shift();
            }
            done = jQuery.merge(done, ret);
            return done;
        },
        classFilter: function(r, m, not) {
            m = " " + m + " ";
            var tmp = [];
            for (var i = 0; r[i]; i++) {
                var pass = (" " + r[i].className + " ").indexOf(m) >= 0;
                if (!not && pass || not && !pass) {
                    tmp.push(r[i]);
                }
            }
            return tmp;
        },
        filter: function(t, r, not) {
            var last;
            while (t && t != last) {
                last = t;
                var p = jQuery.parse,
                m;
                for (var i = 0; p[i]; i++) {
                    m = p[i].exec(t);
                    if (m) {
                        t = t.substring(m[0].length);
                        m[2] = m[2].replace(/\\/g, "");
                        break;
                    }
                }
                if (!m) {
                    break;
                }
                if (m[1] == ":" && m[2] == "not") {
                    r = jQuery.filter(m[3], r, true).r;
                } else {
                    if (m[1] == ".") {
                        r = jQuery.classFilter(r, m[2], not);
                    } else {
                        if (m[1] == "[") {
                            var tmp = [],
                            type = m[3];
                            for (var i = 0,
                            rl = r.length; i < rl; i++) {
                                var a = r[i],
                                z = a[jQuery.props[m[2]] || m[2]];
                                if (z == null || /href|src|selected/.test(m[2])) {
                                    z = jQuery.attr(a, m[2]) || "";
                                }
                                if ((type == "" && !!z || type == "=" && z == m[5] || type == "!=" && z != m[5] || type == "^=" && z && !z.indexOf(m[5]) || type == "$=" && z.substr(z.length - m[5].length) == m[5] || (type == "*=" || type == "~=") && z.indexOf(m[5]) >= 0) ^ not) {
                                    tmp.push(a);
                                }
                            }
                            r = tmp;
                        } else {
                            if (m[1] == ":" && m[2] == "nth-child") {
                                var merge = {},
                                tmp = [],
                                test = /(\d*)n\+?(\d*)/.exec(m[3] == "even" && "2n" || m[3] == "odd" && "2n+1" || !/\D/.test(m[3]) && "n+" + m[3] || m[3]),
                                first = (test[1] || 1) - 0,
                                last = test[2] - 0;
                                for (var i = 0,
                                rl = r.length; i < rl; i++) {
                                    var node = r[i],
                                    parentNode = node.parentNode,
                                    id = jQuery.data(parentNode);
                                    if (!merge[id]) {
                                        var c = 1;
                                        for (var n = parentNode.firstChild; n; n = n.nextSibling) {
                                            if (n.nodeType == 1) {
                                                n.nodeIndex = c++;
                                            }
                                        }
                                        merge[id] = true;
                                    }
                                    var add = false;
                                    if (first == 1) {
                                        if (last == 0 || node.nodeIndex == last) {
                                            add = true;
                                        }
                                    } else {
                                        if ((node.nodeIndex + last) % first == 0) {
                                            add = true;
                                        }
                                    }
                                    if (add ^ not) {
                                        tmp.push(node);
                                    }
                                }
                                r = tmp;
                            } else {
                                var f = jQuery.expr[m[1]];
                                if (typeof f != "string") {
                                    f = jQuery.expr[m[1]][m[2]];
                                }
                                f = eval("false||function(a,i){return " + f + "}");
                                r = jQuery.grep(r, f, not);
                            }
                        }
                    }
                }
            }
            return {
                r: r,
                t: t
            };
        },
        dir: function(elem, dir) {
            var matched = [];
            var cur = elem[dir];
            while (cur && cur != document) {
                if (cur.nodeType == 1) {
                    matched.push(cur);
                }
                cur = cur[dir];
            }
            return matched;
        },
        nth: function(cur, result, dir, elem) {
            result = result || 1;
            var num = 0;
            for (; cur; cur = cur[dir]) {
                if (cur.nodeType == 1 && ++num == result) {
                    break;
                }
            }
            return cur;
        },
        sibling: function(n, elem) {
            var r = [];
            for (; n; n = n.nextSibling) {
                if (n.nodeType == 1 && (!elem || n != elem)) {
                    r.push(n);
                }
            }
            return r;
        }
    });
    jQuery.event = {
        add: function(element, type, handler, data) {
            if (jQuery.browser.msie && element.setInterval != undefined) {
                element = window;
            }
            if (!handler.guid) {
                handler.guid = this.guid++;
            }
            if (data != undefined) {
                var fn = handler;
                handler = function() {
                    return fn.apply(this, arguments);
                };
                handler.data = data;
                handler.guid = fn.guid;
            }
            var parts = type.split(".");
            type = parts[0];
            handler.type = parts[1];
            var events = jQuery.data(element, "events") || jQuery.data(element, "events", {});
            var handle = jQuery.data(element, "handle",
            function() {
                var val;
                if (typeof jQuery == "undefined" || jQuery.event.triggered) {
                    return val;
                }
                val = jQuery.event.handle.apply(element, arguments);
                return val;
            });
            var handlers = events[type];
            if (!handlers) {
                handlers = events[type] = {};
                if (element.addEventListener) {
                    element.addEventListener(type, handle, false);
                } else {
                    element.attachEvent("on" + type, handle);
                }
            }
            handlers[handler.guid] = handler;
            this.global[type] = true;
        },
        guid: 1,
        global: {},
        remove: function(element, type, handler) {
            var events = jQuery.data(element, "events"),
            ret,
            index;
            if (typeof type == "string") {
                var parts = type.split(".");
                type = parts[0];
            }
            if (events) {
                if (type && type.type) {
                    handler = type.handler;
                    type = type.type;
                }
                if (!type) {
                    for (type in events) {
                        this.remove(element, type);
                    }
                } else {
                    if (events[type]) {
                        if (handler) {
                            delete events[type][handler.guid];
                        } else {
                            for (handler in events[type]) {
                                if (!parts[1] || events[type][handler].type == parts[1]) {
                                    delete events[type][handler];
                                }
                            }
                        }
                        for (ret in events[type]) {
                            break;
                        }
                        if (!ret) {
                            if (element.removeEventListener) {
                                element.removeEventListener(type, jQuery.data(element, "handle"), false);
                            } else {
                                element.detachEvent("on" + type, jQuery.data(element, "handle"));
                            }
                            ret = null;
                            delete events[type];
                        }
                    }
                }
                for (ret in events) {
                    break;
                }
                if (!ret) {
                    jQuery.removeData(element, "events");
                    jQuery.removeData(element, "handle");
                }
            }
        },
        trigger: function(type, data, element, donative, extra) {
            data = jQuery.makeArray(data || []);
            if (!element) {
                if (this.global[type]) {
                    jQuery("*").add([window, document]).trigger(type, data);
                }
            } else {
                var val, ret, fn = jQuery.isFunction(element[type] || null),
                evt = !data[0] || !data[0].preventDefault;
                if (evt) {
                    data.unshift(this.fix({
                        type: type,
                        target: element
                    }));
                }
                data[0].type = type;
                if (jQuery.isFunction(jQuery.data(element, "handle"))) {
                    val = jQuery.data(element, "handle").apply(element, data);
                }
                if (!fn && element["on" + type] && element["on" + type].apply(element, data) === false) {
                    val = false;
                }
                if (evt) {
                    data.shift();
                }
                if (extra && extra.apply(element, data) === false) {
                    val = false;
                }
                if (fn && donative !== false && val !== false && !(jQuery.nodeName(element, "a") && type == "click")) {
                    this.triggered = true;
                    element[type]();
                }
                this.triggered = false;
            }
            return val;
        },
        handle: function(event) {
            var val;
            event = jQuery.event.fix(event || window.event || {});
            var parts = event.type.split(".");
            event.type = parts[0];
            var c = jQuery.data(this, "events") && jQuery.data(this, "events")[event.type],
            args = Array.prototype.slice.call(arguments, 1);
            args.unshift(event);
            for (var j in c) {
                args[0].handler = c[j];
                args[0].data = c[j].data;
                if (!parts[1] || c[j].type == parts[1]) {
                    var tmp = c[j].apply(this, args);
                    if (val !== false) {
                        val = tmp;
                    }
                    if (tmp === false) {
                        event.preventDefault();
                        event.stopPropagation();
                    }
                }
            }
            if (jQuery.browser.msie) {
                event.target = event.preventDefault = event.stopPropagation = event.handler = event.data = null;
            }
            return val;
        },
        fix: function(event) {
            var originalEvent = event;
            event = jQuery.extend({},
            originalEvent);
            event.preventDefault = function() {
                if (originalEvent.preventDefault) {
                    originalEvent.preventDefault();
                }
                originalEvent.returnValue = false;
            };
            event.stopPropagation = function() {
                if (originalEvent.stopPropagation) {
                    originalEvent.stopPropagation();
                }
                originalEvent.cancelBubble = true;
            };
            if (!event.target && event.srcElement) {
                event.target = event.srcElement;
            }
            if (jQuery.browser.safari && event.target.nodeType == 3) {
                event.target = originalEvent.target.parentNode;
            }
            if (!event.relatedTarget && event.fromElement) {
                event.relatedTarget = event.fromElement == event.target ? event.toElement: event.fromElement;
            }
            if (event.pageX == null && event.clientX != null) {
                var e = document.documentElement,
                b = document.body;
                event.pageX = event.clientX + (e && e.scrollLeft || b.scrollLeft || 0);
                event.pageY = event.clientY + (e && e.scrollTop || b.scrollTop || 0);
            }
            if (!event.which && (event.charCode || event.keyCode)) {
                event.which = event.charCode || event.keyCode;
            }
            if (!event.metaKey && event.ctrlKey) {
                event.metaKey = event.ctrlKey;
            }
            if (!event.which && event.button) {
                event.which = (event.button & 1 ? 1 : (event.button & 2 ? 3 : (event.button & 4 ? 2 : 0)));
            }
            return event;
        }
    };
    jQuery.fn.extend({
        bind: function(type, data, fn) {
            return type == "unload" ? this.one(type, data, fn) : this.each(function() {
                jQuery.event.add(this, type, fn || data, fn && data);
            });
        },
        one: function(type, data, fn) {
            return this.each(function() {
                jQuery.event.add(this, type,
                function(event) {
                    jQuery(this).unbind(event);
                    return (fn || data).apply(this, arguments);
                },
                fn && data);
            });
        },
        unbind: function(type, fn) {
            return this.each(function() {
                jQuery.event.remove(this, type, fn);
            });
        },
        trigger: function(type, data, fn) {
            return this.each(function() {
                jQuery.event.trigger(type, data, this, true, fn);
            });
        },
        triggerHandler: function(type, data, fn) {
            if (this[0]) {
                return jQuery.event.trigger(type, data, this[0], false, fn);
            }
        },
        toggle: function() {
            var a = arguments;
            return this.click(function(e) {
                this.lastToggle = 0 == this.lastToggle ? 1 : 0;
                e.preventDefault();
                return a[this.lastToggle].apply(this, [e]) || false;
            });
        },
        hover: function(f, g) {
            function handleHover(e) {
                var p = e.relatedTarget;
                while (p && p != this) {
                    try {
                        p = p.parentNode;
                    } catch(e) {
                        p = this;
                    }
                }
                if (p == this) {
                    return false;
                }
                return (e.type == "mouseover" ? f: g).apply(this, [e]);
            }
            return this.mouseover(handleHover).mouseout(handleHover);
        },
        ready: function(f) {
            bindReady();
            if (jQuery.isReady) {
                f.apply(document, [jQuery]);
            } else {
                jQuery.readyList.push(function() {
                    return f.apply(this, [jQuery]);
                });
            }
            return this;
        }
    });
    jQuery.extend({
        isReady: false,
        readyList: [],
        ready: function() {
            if (!jQuery.isReady) {
                jQuery.isReady = true;
                if (jQuery.readyList) {
                    jQuery.each(jQuery.readyList,
                    function() {
                        this.apply(document);
                    });
                    jQuery.readyList = null;
                }
                if (jQuery.browser.mozilla || jQuery.browser.opera) {
                    document.removeEventListener("DOMContentLoaded", jQuery.ready, false);
                }
                if (!window.frames.length) {
                    jQuery(window).load(function() {
                        jQuery("#__ie_init").remove();
                    });
                }
            }
        }
    });
    jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,change,select,submit,keydown,keypress,keyup,error").split(","),
    function(i, o) {
        jQuery.fn[o] = function(f) {
            return f ? this.bind(o, f) : this.trigger(o);
        };
    });
    var readyBound = false;
    function bindReady() {
        if (readyBound) {
            return;
        }
        readyBound = true;
        if (jQuery.browser.mozilla || jQuery.browser.opera) {
            document.addEventListener("DOMContentLoaded", jQuery.ready, false);
        } else {
            if (jQuery.browser.msie) {
                document.write("<script id=__ie_init defer=true src=//:><\/script>");
                var script = document.getElementById("__ie_init");
                if (script) {
                    script.onreadystatechange = function() {
                        if (this.readyState != "complete") {
                            return;
                        }
                        jQuery.ready();
                    };
                }
                script = null;
            } else {
                if (jQuery.browser.safari) {
                    jQuery.safariTimer = setInterval(function() {
                        if (document.readyState == "loaded" || document.readyState == "complete") {
                            clearInterval(jQuery.safariTimer);
                            jQuery.safariTimer = null;
                            jQuery.ready();
                        }
                    },
                    10);
                }
            }
        }
        jQuery.event.add(window, "load", jQuery.ready);
    }
    jQuery.fn.extend({
        load: function(url, params, callback) {
            if (jQuery.isFunction(url)) {
                return this.bind("load", url);
            }
            var off = url.indexOf(" ");
            if (off >= 0) {
                var selector = url.slice(off, url.length);
                url = url.slice(0, off);
            }
            callback = callback ||
            function() {};
            var type = "GET";
            if (params) {
                if (jQuery.isFunction(params)) {
                    callback = params;
                    params = null;
                } else {
                    params = jQuery.param(params);
                    type = "POST";
                }
            }
            var self = this;
            jQuery.ajax({
                url: url,
                type: type,
                data: params,
                complete: function(res, status) {
                    if (status == "success" || status == "notmodified") {
                        self.html(selector ? jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g, "")).find(selector) : res.responseText);
                    }
                    setTimeout(function() {
                        self.each(callback, [res.responseText, status, res]);
                    },
                    13);
                }
            });
            return this;
        },
        serialize: function() {
            return jQuery.param(this.serializeArray());
        },
        serializeArray: function() {
            return this.map(function() {
                return jQuery.nodeName(this, "form") ? jQuery.makeArray(this.elements) : this;
            }).filter(function() {
                return this.name && !this.disabled && (this.checked || /select|textarea/i.test(this.nodeName) || /text|hidden|password/i.test(this.type));
            }).map(function(i, elem) {
                var val = jQuery(this).val();
                return val == null ? null: val.constructor == Array ? jQuery.map(val,
                function(val, i) {
                    return {
                        name: elem.name,
                        value: val
                    };
                }) : {
                    name: elem.name,
                    value: val
                };
            }).get();
        }
    });
    jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),
    function(i, o) {
        jQuery.fn[o] = function(f) {
            return this.bind(o, f);
        };
    });
    var jsc = (new Date).getTime();
    jQuery.extend({
        get: function(url, data, callback, type) {
            if (jQuery.isFunction(data)) {
                callback = data;
                data = null;
            }
            return jQuery.ajax({
                type: "GET",
                url: url,
                data: data,
                success: callback,
                dataType: type
            });
        },
        getScript: function(url, callback) {
            return jQuery.get(url, null, callback, "script");
        },
        getJSON: function(url, data, callback) {
            return jQuery.get(url, data, callback, "json");
        },
        post: function(url, data, callback, type) {
            if (jQuery.isFunction(data)) {
                callback = data;
                data = {};
            }
            return jQuery.ajax({
                type: "POST",
                url: url,
                data: data,
                success: callback,
                dataType: type
            });
        },
        ajaxSetup: function(settings) {
            jQuery.extend(jQuery.ajaxSettings, settings);
        },
        ajaxSettings: {
            global: true,
            type: "GET",
            timeout: 0,
            contentType: "application/x-www-form-urlencoded",
            processData: true,
            async: true,
            data: null
        },
        lastModified: {},
        ajax: function(s) {
            var jsonp, jsre = /=(\?|%3F)/g,
            status, data;
            s = jQuery.extend(true, s, jQuery.extend(true, {},
            jQuery.ajaxSettings, s));
            if (s.data && s.processData && typeof s.data != "string") {
                s.data = jQuery.param(s.data);
            }
            if (s.dataType == "jsonp") {
                if (s.type.toLowerCase() == "get") {
                    if (!s.url.match(jsre)) {
                        s.url += (s.url.match(/\?/) ? "&": "?") + (s.jsonp || "callback") + "=?";
                    }
                } else {
                    if (!s.data || !s.data.match(jsre)) {
                        s.data = (s.data ? s.data + "&": "") + (s.jsonp || "callback") + "=?";
                    }
                }
                s.dataType = "json";
            }
            if (s.dataType == "json" && (s.data && s.data.match(jsre) || s.url.match(jsre))) {
                jsonp = "jsonp" + jsc++;
                if (s.data) {
                    s.data = s.data.replace(jsre, "=" + jsonp);
                }
                s.url = s.url.replace(jsre, "=" + jsonp);
                s.dataType = "script";
                window[jsonp] = function(tmp) {
                    data = tmp;
                    success();
                    complete();
                    window[jsonp] = undefined;
                    try {
                        delete window[jsonp];
                    } catch(e) {}
                };
            }
            if (s.dataType == "script" && s.cache == null) {
                s.cache = false;
            }
            if (s.cache === false && s.type.toLowerCase() == "get") {
                s.url += (s.url.match(/\?/) ? "&": "?") + "_=" + (new Date()).getTime();
            }
            if (s.data && s.type.toLowerCase() == "get") {
                s.url += (s.url.match(/\?/) ? "&": "?") + s.data;
                s.data = null;
            }
            if (s.global && !jQuery.active++) {
                jQuery.event.trigger("ajaxStart");
            }
            if (!s.url.indexOf("http") && s.dataType == "script") {
                var head = document.getElementsByTagName("head")[0];
                var script = document.createElement("script");
                script.src = s.url;
                if (!jsonp && (s.success || s.complete)) {
                    var done = false;
                    script.onload = script.onreadystatechange = function() {
                        if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) {
                            done = true;
                            success();
                            complete();
                            head.removeChild(script);
                        }
                    };
                }
                head.appendChild(script);
                return;
            }
            var requestDone = false;
            var xml = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
            xml.open(s.type, s.url, s.async);
            if (s.data) {
                xml.setRequestHeader("Content-Type", s.contentType);
            }
            if (s.ifModified) {
                xml.setRequestHeader("If-Modified-Since", jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT");
            }
            xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");
            if (s.beforeSend) {
                s.beforeSend(xml);
            }
            if (s.global) {
                jQuery.event.trigger("ajaxSend", [xml, s]);
            }
            var onreadystatechange = function(isTimeout) {
                if (!requestDone && xml && (xml.readyState == 4 || isTimeout == "timeout")) {
                    requestDone = true;
                    if (ival) {
                        clearInterval(ival);
                        ival = null;
                    }
                    status = isTimeout == "timeout" && "timeout" || !jQuery.httpSuccess(xml) && "error" || s.ifModified && jQuery.httpNotModified(xml, s.url) && "notmodified" || "success";
                    if (status == "success") {
                        try {
                            data = jQuery.httpData(xml, s.dataType);
                        } catch(e) {
                            status = "parsererror";
                        }
                    }
                    if (status == "success") {
                        var modRes;
                        try {
                            modRes = xml.getResponseHeader("Last-Modified");
                        } catch(e) {}
                        if (s.ifModified && modRes) {
                            jQuery.lastModified[s.url] = modRes;
                        }
                        if (!jsonp) {
                            success();
                        }
                    } else {
                        jQuery.handleError(s, xml, status);
                    }
                    complete();
                    if (s.async) {
                        xml = null;
                    }
                }
            };
            if (s.async) {
                var ival = setInterval(onreadystatechange, 13);
                if (s.timeout > 0) {
                    setTimeout(function() {
                        if (xml) {
                            xml.abort();
                            if (!requestDone) {
                                onreadystatechange("timeout");
                            }
                        }
                    },
                    s.timeout);
                }
            }
            try {
                xml.send(s.data);
            } catch(e) {
                jQuery.handleError(s, xml, null, e);
            }
            if (!s.async) {
                onreadystatechange();
            }
            return xml;
            function success() {
                if (s.success) {
                    s.success(data, status);
                }
                if (s.global) {
                    jQuery.event.trigger("ajaxSuccess", [xml, s]);
                }
            }
            function complete() {
                if (s.complete) {
                    s.complete(xml, status);
                }
                if (s.global) {
                    jQuery.event.trigger("ajaxComplete", [xml, s]);
                }
                if (s.global && !--jQuery.active) {
                    jQuery.event.trigger("ajaxStop");
                }
            }
        },
        handleError: function(s, xml, status, e) {
            if (s.error) {
                s.error(xml, status, e);
            }
            if (s.global) {
                jQuery.event.trigger("ajaxError", [xml, s, e]);
            }
        },
        active: 0,
        httpSuccess: function(r) {
            try {
                return ! r.status && location.protocol == "file:" || (r.status >= 200 && r.status < 300) || r.status == 304 || jQuery.browser.safari && r.status == undefined;
            } catch(e) {}
            return false;
        },
        httpNotModified: function(xml, url) {
            try {
                var xmlRes = xml.getResponseHeader("Last-Modified");
                return xml.status == 304 || xmlRes == jQuery.lastModified[url] || jQuery.browser.safari && xml.status == undefined;
            } catch(e) {}
            return false;
        },
        httpData: function(r, type) {
            var ct = r.getResponseHeader("content-type");
            var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
            var data = xml ? r.responseXML: r.responseText;
            if (xml && data.documentElement.tagName == "parsererror") {
                throw "parsererror";
            }
            if (type == "script") {
                jQuery.globalEval(data);
            }
            if (type == "json") {
                data = eval("(" + data + ")");
            }
            return data;
        },
        param: function(a) {
            var s = [];
            if (a.constructor == Array || a.jquery) {
                jQuery.each(a,
                function() {
                    s.push(encodeURIComponent(this.name) + "=" + encodeURIComponent(this.value));
                });
            } else {
                for (var j in a) {
                    if (a[j] && a[j].constructor == Array) {
                        jQuery.each(a[j],
                        function() {
                            s.push(encodeURIComponent(j) + "=" + encodeURIComponent(this));
                        });
                    } else {
                        s.push(encodeURIComponent(j) + "=" + encodeURIComponent(a[j]));
                    }
                }
            }
            return s.join("&").replace(/%20/g, "+");
        }
    });
    jQuery.fn.extend({
        show: function(speed, callback) {
            return speed ? this.animate({
                height: "show",
                width: "show",
                opacity: "show"
            },
            speed, callback) : this.filter(":hidden").each(function() {
                this.style.display = this.oldblock ? this.oldblock: "";
                if (jQuery.css(this, "display") == "none") {
                    this.style.display = "block";
                }
            }).end();
        },
        hide: function(speed, callback) {
            return speed ? this.animate({
                height: "hide",
                width: "hide",
                opacity: "hide"
            },
            speed, callback) : this.filter(":visible").each(function() {
                this.oldblock = this.oldblock || jQuery.css(this, "display");
                if (this.oldblock == "none") {
                    this.oldblock = "block";
                }
                this.style.display = "none";
            }).end();
        },
        _toggle: jQuery.fn.toggle,
        toggle: function(fn, fn2) {
            return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? this._toggle(fn, fn2) : fn ? this.animate({
                height: "toggle",
                width: "toggle",
                opacity: "toggle"
            },
            fn, fn2) : this.each(function() {
                jQuery(this)[jQuery(this).is(":hidden") ? "show": "hide"]();
            });
        },
        slideDown: function(speed, callback) {
            return this.animate({
                height: "show"
            },
            speed, callback);
        },
        slideUp: function(speed, callback) {
            return this.animate({
                height: "hide"
            },
            speed, callback);
        },
        slideToggle: function(speed, callback) {
            return this.animate({
                height: "toggle"
            },
            speed, callback);
        },
        fadeIn: function(speed, callback) {
            return this.animate({
                opacity: "show"
            },
            speed, callback);
        },
        fadeOut: function(speed, callback) {
            return this.animate({
                opacity: "hide"
            },
            speed, callback);
        },
        fadeTo: function(speed, to, callback) {
            return this.animate({
                opacity: to
            },
            speed, callback);
        },
        animate: function(prop, speed, easing, callback) {
            var opt = jQuery.speed(speed, easing, callback);
            return this[opt.queue === false ? "each": "queue"](function() {
                opt = jQuery.extend({},
                opt);
                var hidden = jQuery(this).is(":hidden"),
                self = this;
                for (var p in prop) {
                    if (prop[p] == "hide" && hidden || prop[p] == "show" && !hidden) {
                        return jQuery.isFunction(opt.complete) && opt.complete.apply(this);
                    }
                    if (p == "height" || p == "width") {
                        opt.display = jQuery.css(this, "display");
                        opt.overflow = this.style.overflow;
                    }
                }
                if (opt.overflow != null) {
                    this.style.overflow = "hidden";
                }
                opt.curAnim = jQuery.extend({},
                prop);
                jQuery.each(prop,
                function(name, val) {
                    var e = new jQuery.fx(self, opt, name);
                    if (/toggle|show|hide/.test(val)) {
                        e[val == "toggle" ? hidden ? "show": "hide": val](prop);
                    } else {
                        var parts = val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),
                        start = e.cur(true) || 0;
                        if (parts) {
                            var end = parseFloat(parts[2]),
                            unit = parts[3] || "px";
                            if (unit != "px") {
                                self.style[name] = (end || 1) + unit;
                                start = ((end || 1) / e.cur(true)) * start;
                                self.style[name] = start + unit;
                            }
                            if (parts[1]) {
                                end = ((parts[1] == "-=" ? -1 : 1) * end) + start;
                            }
                            e.custom(start, end, unit);
                        } else {
                            e.custom(start, val, "");
                        }
                    }
                });
                return true;
            });
        },
        queue: function(type, fn) {
            if (jQuery.isFunction(type)) {
                fn = type;
                type = "fx";
            }
            if (!type || (typeof type == "string" && !fn)) {
                return queue(this[0], type);
            }
            return this.each(function() {
                if (fn.constructor == Array) {
                    queue(this, type, fn);
                } else {
                    queue(this, type).push(fn);
                    if (queue(this, type).length == 1) {
                        fn.apply(this);
                    }
                }
            });
        },
        stop: function() {
            var timers = jQuery.timers;
            return this.each(function() {
                for (var i = 0; i < timers.length; i++) {
                    if (timers[i].elem == this) {
                        timers.splice(i--, 1);
                    }
                }
            }).dequeue();
        }
    });
    var queue = function(elem, type, array) {
        if (!elem) {
            return;
        }
        var q = jQuery.data(elem, type + "queue");
        if (!q || array) {
            q = jQuery.data(elem, type + "queue", array ? jQuery.makeArray(array) : []);
        }
        return q;
    };
    jQuery.fn.dequeue = function(type) {
        type = type || "fx";
        return this.each(function() {
            var q = queue(this, type);
            q.shift();
            if (q.length) {
                q[0].apply(this);
            }
        });
    };
    jQuery.extend({
        speed: function(speed, easing, fn) {
            var opt = speed && speed.constructor == Object ? speed: {
                complete: fn || !fn && easing || jQuery.isFunction(speed) && speed,
                duration: speed,
                easing: fn && easing || easing && easing.constructor != Function && easing
            };
            opt.duration = (opt.duration && opt.duration.constructor == Number ? opt.duration: {
                slow: 600,
                fast: 200
            } [opt.duration]) || 400;
            opt.old = opt.complete;
            opt.complete = function() {
                jQuery(this).dequeue();
                if (jQuery.isFunction(opt.old)) {
                    opt.old.apply(this);
                }
            };
            return opt;
        },
        easing: {
            linear: function(p, n, firstNum, diff) {
                return firstNum + diff * p;
            },
            swing: function(p, n, firstNum, diff) {
                return (( - Math.cos(p * Math.PI) / 2) + 0.5) * diff + firstNum;
            }
        },
        timers: [],
        fx: function(elem, options, prop) {
            this.options = options;
            this.elem = elem;
            this.prop = prop;
            if (!options.orig) {
                options.orig = {};
            }
        }
    });
    jQuery.fx.prototype = {
        update: function() {
            if (this.options.step) {
                this.options.step.apply(this.elem, [this.now, this]);
            } (jQuery.fx.step[this.prop] || jQuery.fx.step._default)(this);
            if (this.prop == "height" || this.prop == "width") {
                this.elem.style.display = "block";
            }
        },
        cur: function(force) {
            if (this.elem[this.prop] != null && this.elem.style[this.prop] == null) {
                return this.elem[this.prop];
            }
            var r = parseFloat(jQuery.curCSS(this.elem, this.prop, force));
            return r && r > -10000 ? r: parseFloat(jQuery.css(this.elem, this.prop)) || 0;
        },
        custom: function(from, to, unit) {
            this.startTime = (new Date()).getTime();
            this.start = from;
            this.end = to;
            this.unit = unit || this.unit || "px";
            this.now = this.start;
            this.pos = this.state = 0;
            this.update();
            var self = this;
            function t() {
                return self.step();
            }
            t.elem = this.elem;
            jQuery.timers.push(t);
            if (jQuery.timers.length == 1) {
                var timer = setInterval(function() {
                    var timers = jQuery.timers;
                    for (var i = 0; i < timers.length; i++) {
                        if (!timers[i]()) {
                            timers.splice(i--, 1);
                        }
                    }
                    if (!timers.length) {
                        clearInterval(timer);
                    }
                },
                13);
            }
        },
        show: function() {
            this.options.orig[this.prop] = jQuery.attr(this.elem.style, this.prop);
            this.options.show = true;
            this.custom(0, this.cur());
            if (this.prop == "width" || this.prop == "height") {
                this.elem.style[this.prop] = "1px";
            }
            jQuery(this.elem).show();
        },
        hide: function() {
            this.options.orig[this.prop] = jQuery.attr(this.elem.style, this.prop);
            this.options.hide = true;
            this.custom(this.cur(), 0);
        },
        step: function() {
            var t = (new Date()).getTime();
            if (t > this.options.duration + this.startTime) {
                this.now = this.end;
                this.pos = this.state = 1;
                this.update();
                this.options.curAnim[this.prop] = true;
                var done = true;
                for (var i in this.options.curAnim) {
                    if (this.options.curAnim[i] !== true) {
                        done = false;
                    }
                }
                if (done) {
                    if (this.options.display != null) {
                        this.elem.style.overflow = this.options.overflow;
                        this.elem.style.display = this.options.display;
                        if (jQuery.css(this.elem, "display") == "none") {
                            this.elem.style.display = "block";
                        }
                    }
                    if (this.options.hide) {
                        this.elem.style.display = "none";
                    }
                    if (this.options.hide || this.options.show) {
                        for (var p in this.options.curAnim) {
                            jQuery.attr(this.elem.style, p, this.options.orig[p]);
                        }
                    }
                }
                if (done && jQuery.isFunction(this.options.complete)) {
                    this.options.complete.apply(this.elem);
                }
                return false;
            } else {
                var n = t - this.startTime;
                this.state = n / this.options.duration;
                this.pos = jQuery.easing[this.options.easing || (jQuery.easing.swing ? "swing": "linear")](this.state, n, 0, 1, this.options.duration);
                this.now = this.start + ((this.end - this.start) * this.pos);
                this.update();
            }
            return true;
        }
    };
    jQuery.fx.step = {
        scrollLeft: function(fx) {
            fx.elem.scrollLeft = fx.now;
        },
        scrollTop: function(fx) {
            fx.elem.scrollTop = fx.now;
        },
        opacity: function(fx) {
            jQuery.attr(fx.elem.style, "opacity", fx.now);
        },
        _default: function(fx) {
            fx.elem.style[fx.prop] = fx.now + fx.unit;
        }
    };
    jQuery.fn.offset = function() {
        var left = 0,
        top = 0,
        elem = this[0],
        results;
        if (elem) {
            with(jQuery.browser) {
                var absolute = jQuery.css(elem, "position") == "absolute",
                parent = elem.parentNode,
                offsetParent = elem.offsetParent,
                doc = elem.ownerDocument,
                safari2 = safari && parseInt(version) < 522;
                if (elem.getBoundingClientRect) {
                    box = elem.getBoundingClientRect();
                    add(box.left + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft), box.top + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop));
                    if (msie) {
                        var border = jQuery("html").css("borderWidth");
                        border = (border == "medium" || jQuery.boxModel && parseInt(version) >= 7) && 2 || border;
                        add( - border, -border);
                    }
                } else {
                    add(elem.offsetLeft, elem.offsetTop);
                    while (offsetParent) {
                        add(offsetParent.offsetLeft, offsetParent.offsetTop);
                        if (mozilla && /^t[d|h]$/i.test(parent.tagName) || !safari2) {
                            border(offsetParent);
                        }
                        if (safari2 && !absolute && jQuery.css(offsetParent, "position") == "absolute") {
                            absolute = true;
                        }
                        offsetParent = offsetParent.offsetParent;
                    }
                    while (parent.tagName && !/^body|html$/i.test(parent.tagName)) {
                        if (!/^inline|table-row.*$/i.test(jQuery.css(parent, "display"))) {
                            add( - parent.scrollLeft, -parent.scrollTop);
                        }
                        if (mozilla && jQuery.css(parent, "overflow") != "visible") {
                            border(parent);
                        }
                        parent = parent.parentNode;
                    }
                    if (safari2 && absolute) {
                        add( - doc.body.offsetLeft, -doc.body.offsetTop);
                    }
                }
                results = {
                    top: top,
                    left: left
                };
            }
        }
        return results;
        function border(elem) {
            add(jQuery.css(elem, "borderLeftWidth"), jQuery.css(elem, "borderTopWidth"));
        }
        function add(l, t) {
            left += parseInt(l) || 0;
            top += parseInt(t) || 0;
        }
    };
})();
/*############ End common/js/jquery/jquery.js ############*/
/*############ Begin common/js/jquery/jquery-ui.js ############*/
(function(jQuery) {
    jQuery.dimensions = {
        version: "@VERSION"
    };
    jQuery.each(["Height", "Width"],
    function(i, name) {
        jQuery.fn["inner" + name] = function() {
            if (!this[0]) {
                return;
            }
            var torl = name == "Height" ? "Top": "Left",
            borr = name == "Height" ? "Bottom": "Right";
            return this[name.toLowerCase()]() + num(this, "padding" + torl) + num(this, "padding" + borr);
        };
        jQuery.fn["outer" + name] = function(options) {
            if (!this[0]) {
                return;
            }
            var torl = name == "Height" ? "Top": "Left",
            borr = name == "Height" ? "Bottom": "Right";
            options = jQuery.extend({
                margin: false
            },
            options || {});
            return this[name.toLowerCase()]() + num(this, "border" + torl + "Width") + num(this, "border" + borr + "Width") + num(this, "padding" + torl) + num(this, "padding" + borr) + (options.margin ? (num(this, "margin" + torl) + num(this, "margin" + borr)) : 0);
        };
    });
    jQuery.each(["Left", "Top"],
    function(i, name) {
        jQuery.fn["scroll" + name] = function(val) {
            if (!this[0]) {
                return;
            }
            return val != undefined ? this.each(function() {
                this == window || this == document ? window.scrollTo(name == "Left" ? val: jQuery(window)["scrollLeft"](), name == "Top" ? val: jQuery(window)["scrollTop"]()) : this["scroll" + name] = val;
            }) : this[0] == window || this[0] == document ? self[(name == "Left" ? "pageXOffset": "pageYOffset")] || jQuery.boxModel && document.documentElement["scroll" + name] || document.body["scroll" + name] : this[0]["scroll" + name];
        };
    });
    jQuery.fn.extend({
        position: function() {
            var left = 0,
            top = 0,
            elem = this[0],
            offset,
            parentOffset,
            offsetParent,
            results;
            if (elem) {
                offsetParent = this.offsetParent();
                offset = this.offset();
                parentOffset = offsetParent.offset();
                offset.top -= num(elem, "marginTop");
                offset.left -= num(elem, "marginLeft");
                parentOffset.top += num(offsetParent, "borderTopWidth");
                parentOffset.left += num(offsetParent, "borderLeftWidth");
                results = {
                    top: offset.top - parentOffset.top,
                    left: offset.left - parentOffset.left
                };
            }
            return results;
        },
        offsetParent: function() {
            var offsetParent = this[0].offsetParent;
            while (offsetParent && (!/^body|htmljQuery/i.test(offsetParent.tagName) && jQuery.css(offsetParent, "position") == "static")) {
                offsetParent = offsetParent.offsetParent;
            }
            return jQuery(offsetParent);
        }
    });
    var num = function(el, prop) {
        return parseInt(jQuery.css(el.jquery ? el[0] : el, prop)) || 0;
    };
})(jQuery);
(function(jQuery) {
    jQuery.ui = jQuery.ui || {};
    jQuery.extend(jQuery.ui, {
        plugin: {
            add: function(w, c, o, p) {
                var a = jQuery.ui[w].prototype;
                if (!a.plugins[c]) {
                    a.plugins[c] = [];
                }
                a.plugins[c].push([o, p]);
            },
            call: function(instance, name, arguments) {
                var c = instance.plugins[name];
                if (!c) {
                    return;
                }
                var o = instance.interaction ? instance.interaction.options: instance.options;
                var e = instance.interaction ? instance.interaction.element: instance.element;
                for (var i = 0; i < c.length; i++) {
                    if (o[c[i][0]]) {
                        c[i][1].apply(e, arguments);
                    }
                }
            }
        }
    });
    jQuery.fn.mouseInteractionDestroy = function() {
        this.each(function() {
            if (jQuery.data(this, "ui-mouse")) {
                jQuery.data(this, "ui-mouse").destroy();
            }
        });
    };
    jQuery.ui.mouseInteraction = function(el, o) {
        if (!o) {
            var o = {};
        }
        this.element = el;
        jQuery.data(this.element, "ui-mouse", this);
        this.options = {};
        jQuery.extend(this.options, o);
        jQuery.extend(this.options, {
            handle: o.handle ? (jQuery(o.handle, el)[0] ? jQuery(o.handle, el) : jQuery(el)) : jQuery(el),
            helper: o.helper || "original",
            preventionDistance: o.preventionDistance || 0,
            dragPrevention: o.dragPrevention ? o.dragPrevention.toLowerCase().split(",") : ["input", "textarea", "button", "select", "option"],
            cursorAt: {
                top: ((o.cursorAt && o.cursorAt.top) ? o.cursorAt.top: 0),
                left: ((o.cursorAt && o.cursorAt.left) ? o.cursorAt.left: 0),
                bottom: ((o.cursorAt && o.cursorAt.bottom) ? o.cursorAt.bottom: 0),
                right: ((o.cursorAt && o.cursorAt.right) ? o.cursorAt.right: 0)
            },
            cursorAtIgnore: (!o.cursorAt) ? true: false,
            appendTo: o.appendTo || "parent"
        });
        o = this.options;
        if (!this.options.nonDestructive && (o.helper == "clone" || o.helper == "original")) {
            o.margins = {
                top: parseInt(jQuery(el).css("marginTop")) || 0,
                left: parseInt(jQuery(el).css("marginLeft")) || 0,
                bottom: parseInt(jQuery(el).css("marginBottom")) || 0,
                right: parseInt(jQuery(el).css("marginRight")) || 0
            };
            if (o.cursorAt.top != 0) {
                o.cursorAt.top = o.margins.top;
            }
            if (o.cursorAt.left != 0) {
                o.cursorAt.left += o.margins.left;
            }
            if (o.cursorAt.bottom != 0) {
                o.cursorAt.bottom += o.margins.bottom;
            }
            if (o.cursorAt.right != 0) {
                o.cursorAt.right += o.margins.right;
            }
            if (o.helper == "original") {
                o.wasPositioned = jQuery(el).css("position");
            }
        } else {
            o.margins = {
                top: 0,
                left: 0,
                right: 0,
                bottom: 0
            };
        }
        var self = this;
        this.mousedownfunc = function(e) {
            return self.click.apply(self, [e]);
        };
        o.handle.bind("mousedown", this.mousedownfunc);
        if (jQuery.browser.msie) {
            jQuery(this.element).attr("unselectable", "on");
        }
    };
    jQuery.extend(jQuery.ui.mouseInteraction.prototype, {
        plugins: {},
        currentTarget: null,
        lastTarget: null,
        timer: null,
        slowMode: false,
        init: false,
        destroy: function() {
            this.options.handle.unbind("mousedown", this.mousedownfunc);
        },
        trigger: function(e) {
            return this.click.apply(this, arguments);
        },
        click: function(e) {
            var o = this.options;
            window.focus();
            if (e.which != 1) {
                return true;
            }
            var targetName = (e.target) ? e.target.nodeName.toLowerCase() : e.srcElement.nodeName.toLowerCase();
            for (var i = 0; i < o.dragPrevention.length; i++) {
                if (targetName == o.dragPrevention[i]) {
                    return true;
                }
            }
            if (o.startCondition && !o.startCondition.apply(this, [e])) {
                return true;
            }
            var self = this;
            this.mouseup = function(e) {
                return self.stop.apply(self, [e]);
            };
            this.mousemove = function(e) {
                return self.drag.apply(self, [e]);
            };
            var initFunc = function() {
                jQuery(document).bind("mouseup", self.mouseup);
                jQuery(document).bind("mousemove", self.mousemove);
                self.opos = [e.pageX, e.pageY];
            };
            if (o.preventionTimeout) {
                if (this.timer) {
                    clearInterval(this.timer);
                }
                this.timer = setTimeout(function() {
                    initFunc();
                },
                o.preventionTimeout);
                return false;
            }
            initFunc();
            return false;
        },
        start: function(e) {
            var o = this.options;
            var a = this.element;
            o.co = jQuery(a).offset();
            this.helper = typeof o.helper == "function" ? jQuery(o.helper.apply(a, [e, this]))[0] : (o.helper == "clone" ? jQuery(a).clone()[0] : a);
            if (o.appendTo == "parent") {
                var cp = a.parentNode;
                while (cp) {
                    if (cp.style && (jQuery(cp).css("position") == "relative" || jQuery(cp).css("position") == "absolute")) {
                        o.pp = cp;
                        o.po = jQuery(cp).offset();
                        o.ppOverflow = !!(jQuery(o.pp).css("overflow") == "auto" || jQuery(o.pp).css("overflow") == "scroll");
                        break;
                    }
                    cp = cp.parentNode ? cp.parentNode: null;
                }
                if (!o.pp) {
                    o.po = {
                        top: 0,
                        left: 0
                    };
                }
            }
            this.pos = [this.opos[0], this.opos[1]];
            this.rpos = [this.pos[0], this.pos[1]];
            if (o.cursorAtIgnore) {
                o.cursorAt.left = this.pos[0] - o.co.left + o.margins.left;
                o.cursorAt.top = this.pos[1] - o.co.top + o.margins.top;
            }
            if (o.pp) {
                this.pos[0] -= o.po.left;
                this.pos[1] -= o.po.top;
            }
            this.slowMode = (o.cursorAt && (o.cursorAt.top - o.margins.top > 0 || o.cursorAt.bottom - o.margins.bottom > 0) && (o.cursorAt.left - o.margins.left > 0 || o.cursorAt.right - o.margins.right > 0)) ? true: false;
            if (!o.nonDestructive) {
                jQuery(this.helper).css("position", "absolute");
            }
            if (o.helper != "original") {
                jQuery(this.helper).appendTo((o.appendTo == "parent" ? a.parentNode: o.appendTo)).show();
            }
            if (o.cursorAt.right && !o.cursorAt.left) {
                o.cursorAt.left = this.helper.offsetWidth + o.margins.right + o.margins.left - o.cursorAt.right;
            }
            if (o.cursorAt.bottom && !o.cursorAt.top) {
                o.cursorAt.top = this.helper.offsetHeight + o.margins.top + o.margins.bottom - o.cursorAt.bottom;
            }
            this.init = true;
            if (o._start) {
                o._start.apply(a, [this.helper, this.pos, o.cursorAt, this, e]);
            }
            this.helperSize = {
                width: outerWidth(this.helper),
                height: outerHeight(this.helper)
            };
            return false;
        },
        stop: function(e) {
            var o = this.options;
            var a = this.element;
            var self = this;
            jQuery(document).unbind("mouseup", self.mouseup);
            jQuery(document).unbind("mousemove", self.mousemove);
            if (this.init == false) {
                return this.opos = this.pos = null;
            }
            if (o._beforeStop) {
                o._beforeStop.apply(a, [this.helper, this.pos, o.cursorAt, this, e]);
            }
            if (this.helper != a && !o.beQuietAtEnd) {
                jQuery(this.helper).remove();
                this.helper = null;
            }
            if (!o.beQuietAtEnd) {
                if (o._stop) {
                    o._stop.apply(a, [this.helper, this.pos, o.cursorAt, this, e]);
                }
            }
            this.init = false;
            this.opos = this.pos = null;
            return false;
        },
        drag: function(e) {
            if (!this.opos || (jQuery.browser.msie && !e.button)) {
                return this.stop.apply(this, [e]);
            }
            var o = this.options;
            this.pos = [e.pageX, e.pageY];
            if (this.rpos && this.rpos[0] == this.pos[0] && this.rpos[1] == this.pos[1]) {
                return false;
            }
            this.rpos = [this.pos[0], this.pos[1]];
            if (o.pp) {
                this.pos[0] -= o.po.left;
                this.pos[1] -= o.po.top;
            }
            if ((Math.abs(this.rpos[0] - this.opos[0]) > o.preventionDistance || Math.abs(this.rpos[1] - this.opos[1]) > o.preventionDistance) && this.init == false) {
                this.start.apply(this, [e]);
            } else {
                if (this.init == false) {
                    return false;
                }
            }
            if (o._drag) {
                o._drag.apply(this.element, [this.helper, this.pos, o.cursorAt, this, e]);
            }
            return false;
        }
    });
    var num = function(el, prop) {
        return parseInt(jQuery.css(el.jquery ? el[0] : el, prop)) || 0;
    };
    function outerWidth(el) {
        var jQueryel = jQuery(el),
        ow = jQueryel.width();
        for (var i = 0,
        props = ["borderLeftWidth", "paddingLeft", "paddingRight", "borderRightWidth"]; i < props.length; i++) {
            ow += num(jQueryel, props[i]);
        }
        return ow;
    }
    function outerHeight(el) {
        var jQueryel = jQuery(el),
        oh = jQueryel.width();
        for (var i = 0,
        props = ["borderTopWidth", "paddingTop", "paddingBottom", "borderBottomWidth"]; i < props.length; i++) {
            oh += num(jQueryel, props[i]);
        }
        return oh;
    }
})(jQuery);
(function(jQuery) {
    if (window.webforms) {
        jQuery(document).ready(function() {
            jQuery("input").each(function() {
                if (this.getAttribute("type") == "range") {
                    var cur = jQuery(this);
                    var slider = jQuery("<div class='ui-slider'></div>").css({
                        width: cur.innerWidth() + "px",
                        height: cur.innerHeight() + "px"
                    }).insertAfter(cur);
                    var handle = jQuery("<div class='ui-slider-handle'></div>").appendTo(slider);
                    slider.css({
                        position: cur.css("position") == "absolute" ? "absolute": "relative",
                        left: cur.css("left"),
                        right: cur.css("right"),
                        zIndex: cur.css("zIndex"),
                        "float": cur.css("float"),
                        clear: cur.css("clear")
                    });
                    cur.css({
                        position: "absolute",
                        opacity: 0,
                        top: "-1000px",
                        left: "-1000px"
                    });
                    slider.slider({
                        maxValue: cur.attr("max"),
                        minValue: cur.attr("min"),
                        startValue: this.getAttribute("value"),
                        stepping: cur.attr("step"),
                        change: function(e, ui) {
                            cur[0].value = ui.value;
                            cur[0].setAttribute("value", ui.value);
                        }
                    });
                    slider = slider.sliderInstance();
                    cur.bind("keydown",
                    function(e) {
                        var o = slider.interaction.options;
                        switch (e.keyCode) {
                        case 37:
                            slider.moveTo(slider.interaction.curValue + o.minValue - (o.stepping || 1));
                            break;
                        case 39:
                            slider.moveTo(slider.interaction.curValue + o.minValue + (o.stepping || 1));
                            break;
                        }
                        if (e.keyCode != 9) {
                            return false;
                        }
                    });
                }
            });
        });
    }
    jQuery.extend(jQuery.expr[":"], {
        slider: "(' '+a.className+' ').indexOf(' ui-slider ')"
    });
    jQuery.fn.slider = function(o) {
        return this.each(function() {
            new jQuery.ui.slider(this, o);
        });
    };
    var methods = "destroy,enable,disable,moveTo".split(",");
    for (var i = 0; i < methods.length; i++) {
        var cur = methods[i],
        f;
        eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-slider")) jQuery.data(this, "ui-slider")["' + cur + '"](a); }); }');
        jQuery.fn["slider" + cur.substr(0, 1).toUpperCase() + cur.substr(1)] = f;
    }
    jQuery.fn.sliderInstance = function() {
        if (jQuery(this[0]).is(".ui-slider")) {
            return jQuery.data(this[0], "ui-slider");
        }
        return false;
    };
    jQuery.ui.slider = function(el, o) {
        var options = {};
        o = o || {};
        jQuery.extend(options, o);
        jQuery.extend(options, {
            axis: o.axis || (el.offsetWidth < el.offsetHeight ? "vertical": "horizontal"),
            maxValue: parseInt(o.maxValue) || 100,
            minValue: parseInt(o.minValue) || 0,
            startValue: parseInt(o.startValue) || 0,
            _start: function(h, p, c, t, e) {
                self.start.apply(t, [self, e]);
            },
            _beforeStop: function(h, p, c, t, e) {
                self.stop.apply(t, [self, e]);
            },
            _drag: function(h, p, c, t, e) {
                self.drag.apply(t, [self, e]);
            },
            startCondition: function() {
                return ! self.disabled;
            }
        });
        var self = this;
        var o = options;
        jQuery.data(el, "ui-slider", this);
        o.stepping = parseInt(o.stepping) || (o.steps ? o.maxValue / o.steps: 0);
        o.realValue = (o.maxValue - o.minValue);
        this.handle = options.handle ? jQuery(options.handle, el) : jQuery(".ui-slider-handle", el);
        if (this.handle.length == 1) {
            this.interaction = new jQuery.ui.mouseInteraction(this.handle[0], options);
            this.multipleHandles = false;
        } else {
            this.interactions = [];
            this.handle.each(function() {
                self.interactions.push(new jQuery.ui.mouseInteraction(this, options));
            });
            this.multipleHandles = true;
        }
        this.element = el;
        jQuery(this.element).addClass("ui-slider");
        if (o.axis == "horizontal") {
            this.parentSize = jQuery(this.element).outerWidth() - this.handle.outerWidth();
            this.prop = "left";
        }
        if (o.axis == "vertical") {
            this.parentSize = jQuery(this.element).outerHeight() - this.handle.outerHeight();
            this.prop = "top";
        }
        if (!this.multipleHandles) {
            jQuery(el).bind("click",
            function(e) {
                self.click.apply(self, [e]);
            });
            if (!isNaN(o.startValue)) {
                this.moveTo(o.startValue, options.realValue, null, false);
            }
        }
    };
    jQuery.extend(jQuery.ui.slider.prototype, {
        currentTarget: null,
        lastTarget: null,
        destroy: function() {
            jQuery(this.element).removeClass("ui-slider").removeClass("ui-slider-disabled");
            this.interaction.destroy();
        },
        enable: function() {
            jQuery(this.element).removeClass("ui-slider-disabled");
            this.disabled = false;
        },
        disable: function() {
            jQuery(this.element).addClass("ui-slider-disabled");
            this.disabled = true;
        },
        nonvalidRange: function(self) {
            for (var i = 0; i < this.interactions.length; i++) {
                if (self == this.interactions[i]) {
                    if (this.interactions[i - 1]) {
                        if (this.interactions[i - 1].curValue > this.interactions[i].curValue) {
                            return this.interactions[i - 1].curValue;
                        }
                    }
                    if (this.interactions[i + 1]) {
                        if (this.interactions[i + 1].curValue < this.interactions[i].curValue) {
                            return this.interactions[i + 1].curValue;
                        }
                    }
                }
            }
            return false;
        },
        prepareCallbackObj: function(self, m) {
            var cur = this;
            var func = function() {
                var retVal = [];
                for (var i = 0; i < cur.interactions.length; i++) {
                    retVal.push((cur.interactions[i].curValue || 0) + self.options.minValue);
                }
                return retVal;
            };
            return {
                handle: self.helper,
                pixel: m,
                value: self.curValue + self.options.minValue,
                values: this.multipleHandles ? func() : self.curValue + self.options.minValue,
                slider: self
            };
        },
        click: function(e) {
            var o = this.interaction.options;
            var pointer = [e.pageX, e.pageY];
            var offset = jQuery(this.interaction.element).offsetParent().offset({
                border: false
            });
            if (this.interaction.element == e.target || this.disabled) {
                return;
            }
            this.interaction.pickValue = this.interaction.curValue;
            this.drag.apply(this.interaction, [this, e, [pointer[0] - offset.left - this.handle[0].offsetWidth / 2, pointer[1] - offset.top - this.handle[0].offsetHeight / 2]]);
            if (this.interaction.pickValue != this.interaction.curValue) {
                jQuery(this.element).triggerHandler("slidechange", [e, this.prepareCallbackObj(this.interaction)], o.change);
            }
        },
        start: function(that, e) {
            var o = this.options;
            jQuery(that.element).triggerHandler("slidestart", [e, that.prepareCallbackObj(this)], o.start);
            this.pickValue = this.curValue;
            return false;
        },
        stop: function(that, e) {
            var o = this.options;
            jQuery(that.element).triggerHandler("slidestop", [e, that.prepareCallbackObj(this)], o.stop);
            if (this.pickValue != this.curValue) {
                jQuery(that.element).triggerHandler("slidechange", [e, that.prepareCallbackObj(this)], o.change);
            }
            return false;
        },
        drag: function(that, e, pos) {
            var o = this.options;
            this.pos = pos || [this.pos[0] - this.element.offsetWidth / 2, this.pos[1] - this.element.offsetHeight / 2];
            if (o.axis == "horizontal") {
                var m = this.pos[0];
            }
            if (o.axis == "vertical") {
                var m = this.pos[1];
            }
            var p = that.parentSize;
            var prop = that.prop;
            if (m < 0) {
                m = 0;
            }
            if (m > p) {
                m = p;
            }
            this.curValue = (Math.round((m / p) * o.realValue));
            if (o.stepping) {
                this.curValue = Math.round(this.curValue / o.stepping) * o.stepping;
                m = ((this.curValue) / o.realValue) * p;
            }
            if (that.interactions) {
                nonvalidRange = that.nonvalidRange(this);
                if (nonvalidRange) {
                    this.curValue = nonvalidRange;
                    m = ((this.curValue) / o.realValue) * p;
                }
            }
            jQuery(this.element).css(prop, m + "px");
            jQuery(that.element).triggerHandler("slide", [e, that.prepareCallbackObj(this, m)], o.slide);
            return false;
        },
        moveTo: function(value, scale, changeslide, p) {
            if (this.multipleHandles) {
                return false;
            }
            var o = this.interaction.options;
            var offset = jQuery(this.interaction.element).offsetParent().offset({
                border: false
            });
            this.interaction.pickValue = this.interaction.curValue;
            value = value - o.minValue;
            var modifier = scale || o.realValue;
            if (!p) {
                var p = this.parentSize;
            }
            var prop = this.prop;
            var m = Math.round(((value) / modifier) * p);
            if (m < 0) {
                m = 0;
            }
            if (m > p) {
                m = p;
            }
            this.interaction.curValue = (Math.round((m / p) * o.realValue));
            if (o.stepping) {
                this.interaction.curValue = Math.round(this.interaction.curValue / o.stepping) * o.stepping;
                m = ((this.interaction.curValue) / o.realValue) * p;
            }
            jQuery(this.interaction.element).css(prop, m + "px");
            if (!changeslide && this.interaction.pickValue != this.interaction.curValue && !p) {
                jQuery(this.element).triggerHandler("slidechange", [null, this.prepareCallbackObj(this.interaction)], o.change);
            }
            if (changeslide) {
                jQuery(this.element).triggerHandler("slide", [null, this.prepareCallbackObj(this.interaction)], o.slide);
            }
        }
    });
})(jQuery);
/*############ End common/js/jquery/jquery-ui.js ############*/
/*############ Begin common/js/jquery/jquery-dimensions.js ############*/
(function(jQuery) {
    jQuery.dimensions = {
        version: "@VERSION"
    };
    jQuery.each(["Height", "Width"],
    function(i, name) {
        jQuery.fn["inner" + name] = function() {
            if (!this[0]) {
                return;
            }
            var torl = name == "Height" ? "Top": "Left",
            borr = name == "Height" ? "Bottom": "Right";
            return this.css("display") != "none" ? this[0]["client" + name] : num(this, name.toLowerCase()) + num(this, "padding" + torl) + num(this, "padding" + borr);
        };
        jQuery.fn["outer" + name] = function(options) {
            if (!this[0]) {
                return;
            }
            var torl = name == "Height" ? "Top": "Left",
            borr = name == "Height" ? "Bottom": "Right";
            options = jQuery.extend({
                margin: false
            },
            options || {});
            var val = this.css("display") != "none" ? this[0]["offset" + name] : num(this, name.toLowerCase()) + num(this, "border" + torl + "Width") + num(this, "border" + borr + "Width") + num(this, "padding" + torl) + num(this, "padding" + borr);
            return val + (options.margin ? (num(this, "margin" + torl) + num(this, "margin" + borr)) : 0);
        };
    });
    jQuery.each(["Left", "Top"],
    function(i, name) {
        jQuery.fn["scroll" + name] = function(val) {
            if (!this[0]) {
                return;
            }
            return val != undefined ? this.each(function() {
                this == window || this == document ? window.scrollTo(name == "Left" ? val: jQuery(window)["scrollLeft"](), name == "Top" ? val: jQuery(window)["scrollTop"]()) : this["scroll" + name] = val;
            }) : this[0] == window || this[0] == document ? self[(name == "Left" ? "pageXOffset": "pageYOffset")] || jQuery.boxModel && document.documentElement["scroll" + name] || document.body["scroll" + name] : this[0]["scroll" + name];
        };
    });
    jQuery.fn.extend({
        position: function() {
            var left = 0,
            top = 0,
            elem = this[0],
            offset,
            parentOffset,
            offsetParent,
            results;
            if (elem) {
                offsetParent = this.offsetParent();
                offset = this.offset();
                parentOffset = offsetParent.offset();
                offset.top -= num(elem, "marginTop");
                offset.left -= num(elem, "marginLeft");
                parentOffset.top += num(offsetParent, "borderTopWidth");
                parentOffset.left += num(offsetParent, "borderLeftWidth");
                results = {
                    top: offset.top - parentOffset.top,
                    left: offset.left - parentOffset.left
                };
            }
            return results;
        },
        offsetParent: function() {
            var offsetParent = this[0].offsetParent;
            while (offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && jQuery.css(offsetParent, "position") == "static")) {
                offsetParent = offsetParent.offsetParent;
            }
            return jQuery(offsetParent);
        }
    });
    function num(el, prop) {
        return parseInt(jQuery.curCSS(el.jquery ? el[0] : el, prop, true)) || 0;
    }
})(jQuery);
/*############ End common/js/jquery/jquery-dimensions.js ############*/
/*############ Begin common/js/jquery/jquery.bgiframe.js ############*/
(function($) {
    $.fn.bgIframe = $.fn.bgiframe = function(s) {
        if ($.browser.msie && parseInt($.browser.version) <= 6) {
            s = $.extend({
                top: "auto",
                left: "auto",
                width: "auto",
                height: "auto",
                opacity: true,
                src: "javascript:false;"
            },
            s || {});
            var prop = function(n) {
                return n && n.constructor == Number ? n + "px": n;
            },
            html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="' + s.src + '"style="display:block;position:absolute;z-index:-1;' + (s.opacity !== false ? "filter:Alpha(Opacity='0');": "") + "top:" + (s.top == "auto" ? "expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')": prop(s.top)) + ";left:" + (s.left == "auto" ? "expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')": prop(s.left)) + ";width:" + (s.width == "auto" ? "expression(this.parentNode.offsetWidth+'px')": prop(s.width)) + ";height:" + (s.height == "auto" ? "expression(this.parentNode.offsetHeight+'px')": prop(s.height)) + ';"/>';
            return this.each(function() {
                if ($("> iframe.bgiframe", this).length == 0) {
                    this.insertBefore(document.createElement(html), this.firstChild);
                }
            });
        }
        return this;
    };
    if (!$.browser.version) {
        $.browser.version = navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1];
    }
})(jQuery);
/*############ End common/js/jquery/jquery.bgiframe.js ############*/
/*############ Begin common/js/jquery/thickbox.js ############*/
var tb_pathToImage = G_TB_LOADING_ANIMATION;
var goToPage = "";
var goToDesktop = "";
var ctyhocnParam = "";
var portalFromParam = "";
/*!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
jQuery(document).ready(function() {
    tb_init("a.thickbox, area.thickbox, input.thickbox");
    imgLoader = new Image();
    imgLoader.src = tb_pathToImage;
});
function tb_init(domChunk) {
    jQuery(domChunk).click(function() {
        var t = this.title || this.name || null;
        var a = this.href || this.alt;
        var g = this.rel || false;
        tb_show(t, a, g);
        this.blur();
        return false;
    });
}
function tb_show(caption, url, imageGroup) {
    try {
        if (typeof document.body.style.maxHeight === "undefined") {
            jQuery("body", "html").css({
                height: "100%",
                width: "100%"
            });
            jQuery("html").css("overflow", "hidden");
            if (document.getElementById("TB_HideSelect") === null) {
                jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
                jQuery("#TB_overlay").click(tb_remove);
            }
        } else {
            if (document.getElementById("TB_overlay") === null) {
                jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
                jQuery("#TB_overlay").click(tb_remove);
            }
        }
        if (tb_detectMacXFF()) {
            jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");
        } else {
            jQuery("#TB_overlay").addClass("TB_overlayBG");
        }
        if (caption === null) {
            caption = "";
        }
        jQuery("body").append("<div id='TB_load'><img src='" + imgLoader.src + "' /></div>");
        jQuery("#TB_load").show();
        var baseURL;
        if (url.indexOf("?") !== -1) {
            baseURL = url.substr(0, url.indexOf("?"));
        } else {
            baseURL = url;
        }
        var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
        var urlType = baseURL.toLowerCase().match(urlString);
        if (urlType == ".jpg" || urlType == ".jpeg" || urlType == ".png" || urlType == ".gif" || urlType == ".bmp") {
            TB_PrevCaption = "";
            TB_PrevURL = "";
            TB_PrevHTML = "";
            TB_NextCaption = "";
            TB_NextURL = "";
            TB_NextHTML = "";
            TB_imageCount = "";
            TB_FoundURL = false;
            if (imageGroup) {
                TB_TempArray = jQuery("a[@rel=" + imageGroup + "]").get();
                for (TB_Counter = 0;
                ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
                    var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
                    if (! (TB_TempArray[TB_Counter].href == url)) {
                        if (TB_FoundURL) {
                            TB_NextCaption = TB_TempArray[TB_Counter].title;
                            TB_NextURL = TB_TempArray[TB_Counter].href;
                            TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
                        } else {
                            TB_PrevCaption = TB_TempArray[TB_Counter].title;
                            TB_PrevURL = TB_TempArray[TB_Counter].href;
                            TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
                        }
                    } else {
                        TB_FoundURL = true;
                        TB_imageCount = "Image " + (TB_Counter + 1) + " of " + (TB_TempArray.length);
                    }
                }
            }
            imgPreloader = new Image();
            imgPreloader.onload = function() {
                imgPreloader.onload = null;
                var pagesize = tb_getPageSize();
                var x = pagesize[0] - 150;
                var y = pagesize[1] - 150;
                var imageWidth = imgPreloader.width;
                var imageHeight = imgPreloader.height;
                if (imageWidth > x) {
                    imageHeight = imageHeight * (x / imageWidth);
                    imageWidth = x;
                    if (imageHeight > y) {
                        imageWidth = imageWidth * (y / imageHeight);
                        imageHeight = y;
                    }
                } else {
                    if (imageHeight > y) {
                        imageWidth = imageWidth * (y / imageHeight);
                        imageHeight = y;
                        if (imageWidth > x) {
                            imageHeight = imageHeight * (x / imageWidth);
                            imageWidth = x;
                        }
                    }
                }
                TB_WIDTH = imageWidth + 30;
                TB_HEIGHT = imageHeight + 60;
                jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='" + url + "' width='" + imageWidth + "' height='" + imageHeight + "' alt='" + caption + "'/></a><div id='TB_caption'>" + caption + "<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>");
                jQuery("#TB_closeWindowButton").click(tb_remove);
                if (! (TB_PrevHTML === "")) {
                    function goPrev() {
                        if (jQuery(document).unbind("click", goPrev)) {
                            jQuery(document).unbind("click", goPrev);
                        }
                        jQuery("#TB_window").remove();
                        jQuery("body").append("<div id='TB_window'></div>");
                        tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
                        return false;
                    }
                    jQuery("#TB_prev").click(goPrev);
                }
                if (! (TB_NextHTML === "")) {
                    function goNext() {
                        jQuery("#TB_window").remove();
                        jQuery("body").append("<div id='TB_window'></div>");
                        tb_show(TB_NextCaption, TB_NextURL, imageGroup);
                        return false;
                    }
                    jQuery("#TB_next").click(goNext);
                }
                document.onkeydown = function(e) {
                    if (e == null) {
                        keycode = event.keyCode;
                    } else {
                        keycode = e.which;
                    }
                    if (keycode == 27) {
                        tb_remove();
                    } else {
                        if (keycode == 190) {
                            if (! (TB_NextHTML == "")) {
                                document.onkeydown = "";
                                goNext();
                            }
                        } else {
                            if (keycode == 188) {
                                if (! (TB_PrevHTML == "")) {
                                    document.onkeydown = "";
                                    goPrev();
                                }
                            }
                        }
                    }
                };
                tb_position();
                jQuery("#TB_load").remove();
                jQuery("#TB_ImageOff").click(tb_remove);
                jQuery("#TB_window").css({
                    display: "block"
                });
            };
            imgPreloader.src = url;
        } else {
            var queryString = url.replace(/^[^\?]+\??/, "");
            var params = tb_parseQuery(queryString);
            TB_WIDTH = (params.width * 1) + 30 || 630;
            TB_HEIGHT = (params.height * 1) + 40 || 440;
            ajaxContentW = TB_WIDTH - 30;
            ajaxContentH = TB_HEIGHT - 45;
            if (url.indexOf("TB_iframe") != -1) {
                urlNoQuery = url.split("TB_");
                jQuery("#TB_iframeContent").remove();
                if (params.modal != "true") {
                    jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>" + caption + "</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='" + urlNoQuery[0] + "' id='TB_iframeContent' name='TB_iframeContent" + Math.round(Math.random() * 1000) + "' onload='tb_showIframe()' style='width:" + (ajaxContentW + 29) + "px;height:" + (ajaxContentH + 17) + "px;' > </iframe>");
                } else {
                    jQuery("#TB_overlay").unbind();
                    jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='" + urlNoQuery[0] + "' id='TB_iframeContent' name='TB_iframeContent" + Math.round(Math.random() * 1000) + "' onload='tb_showIframe()' style='width:" + (ajaxContentW + 29) + "px;height:" + (ajaxContentH + 17) + "px;'> </iframe>");
                }
            } else {
                if (jQuery("#TB_window").css("display") != "block") {
                    if (params.modal != "true") {
                        jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>" + caption + "</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a> or Esc Key</div></div><div id='TB_ajaxContent' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px'></div>");
                    } else {
                        jQuery("#TB_overlay").unbind();
                        jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px;'></div>");
                    }
                } else {
                    jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW + "px";
                    jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH + "px";
                    jQuery("#TB_ajaxContent")[0].scrollTop = 0;
                    jQuery("#TB_ajaxWindowTitle").html(caption);
                }
            }
            jQuery("#TB_closeWindowButton").click(tb_remove);
            if (url.indexOf("TB_inline") != -1) {
                jQuery("#TB_ajaxContent").append(jQuery("#" + params.inlineId).children());
                jQuery("#TB_window").unload(function() {
                    jQuery("#" + params.inlineId).append(jQuery("#TB_ajaxContent").children());
                });
                tb_position();
                jQuery("#TB_load").remove();
                jQuery("#TB_window").css({
                    display: "block"
                });
            } else {
                if (url.indexOf("TB_iframe") != -1) {
                    tb_position();
                    if ($.browser.safari) {
                        jQuery("#TB_load").remove();
                        jQuery("#TB_window").css({
                            display: "block"
                        });
                    }
                } else {
                    jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),
                    function() {
                        tb_position();
                        jQuery("#TB_load").remove();
                        tb_init("#TB_ajaxContent a.thickbox");
                        jQuery("#TB_window").css({
                            display: "block"
                        });
                    });
                }
            }
        }
        if (!params.modal) {
            document.onkeyup = function(e) {
                if (e == null) {
                    keycode = event.keyCode;
                } else {
                    keycode = e.which;
                }
                if (keycode == 27) {
                    tb_remove();
                }
            };
        }
        document.getElementById("_goto").value = goToPage;
        document.getElementById("_gotoDesktop").value = goToDesktop;
        document.getElementById("_ctyhocn").value = ctyhocnParam;
        document.getElementById("_portalFrom").value = portalFromParam;
    } catch(e) {}
}
function tb_showIframe() {
    jQuery("#TB_load").remove();
    jQuery("#TB_window").css({
        display: "block"
    });
}
function tb_remove() {
    jQuery("#TB_imageOff").unbind("click");
    jQuery("#TB_closeWindowButton").unbind("click");
    jQuery("#TB_window").fadeOut("fast",
    function() {
        jQuery("#TB_window,#TB_overlay,#TB_HideSelect").trigger("unload").unbind().remove();
    });
    jQuery("#TB_load").remove();
    if (typeof document.body.style.maxHeight == "undefined") {
        jQuery("body", "html").css({
            height: "auto",
            width: "auto"
        });
        jQuery("html").css("overflow", "");
    }
    document.onkeydown = "";
    document.onkeyup = "";
    return false;
}
function tb_position() {
    jQuery("#TB_window").css({
        marginLeft: "-" + parseInt((TB_WIDTH / 2), 10) + "px",
        width: TB_WIDTH + "px"
    });
    if (! (jQuery.browser.msie && jQuery.browser.version < 7)) {
        jQuery("#TB_window").css({
            marginTop: "-" + parseInt((TB_HEIGHT / 2), 10) + "px"
        });
    }
}
function tb_parseQuery(query) {
    var Params = {};
    if (!query) {
        return Params;
    }
    var Pairs = query.split(/[;&]/);
    for (var i = 0; i < Pairs.length; i++) {
        var KeyVal = Pairs[i].split("=");
        if (!KeyVal || KeyVal.length != 2) {
            continue;
        }
        var key = unescape(KeyVal[0]);
        var val = unescape(KeyVal[1]);
        val = val.replace(/\+/g, " ");
        Params[key] = val;
    }
    return Params;
}
function tb_getPageSize() {
    var de = document.documentElement;
    var w = window.innerWidth || self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
    var h = window.innerHeight || self.innerHeight || (de && de.clientHeight) || document.body.clientHeight;
    arrayPageSize = [w, h];
    return arrayPageSize;
}
function tb_detectMacXFF() {
    var userAgent = navigator.userAgent.toLowerCase();
    if (userAgent.indexOf("mac") != -1 && userAgent.indexOf("firefox") != -1) {
        return true;
    }
}
function isUserLogedIn() {
    setTimeout("jQuery('#logInUserHhonors').focus();", 500);
}
/*############ End common/js/jquery/thickbox.js ############*/
/*############ Begin common/js/jquery/jquery.treeview.js ############*/
(function(jQuery) {
    jQuery.extend(jQuery.fn, {
        swapClass: function(c1, c2) {
            var c1Elements = this.filter("." + c1);
            this.filter("." + c2).removeClass(c2).addClass(c1);
            c1Elements.removeClass(c1).addClass(c2);
            return this;
        },
        replaceClass: function(c1, c2) {
            return this.filter("." + c1).removeClass(c1).addClass(c2).end();
        },
        hoverClass: function(className) {
            className = className || "hover";
            return this.hover(function() {
                jQuery(this).addClass(className);
            },
            function() {
                jQuery(this).removeClass(className);
            });
        },
        heightToggle: function(animated, callback) {
            animated ? this.animate({
                height: "toggle"
            },
            animated, callback) : this.each(function() {
                jQuery(this)[jQuery(this).is(":hidden") ? "show": "hide"]();
                if (callback) {
                    callback.apply(this, arguments);
                }
            });
        },
        heightHide: function(animated, callback) {
            if (animated) {
                this.animate({
                    height: "hide"
                },
                animated, callback);
            } else {
                this.hide();
                if (callback) {
                    this.each(callback);
                }
            }
        },
        prepareBranches: function(settings) {
            if (!settings.prerendered) {
                this.filter(":last-child:not(ul)").addClass(CLASSES.last);
                this.filter((settings.collapsed ? "": "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide();
            }
            return this.filter(":has(>ul)");
        },
        applyClasses: function(settings, toggler) {
            this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) {
                toggler.apply(jQuery(this).next());
            }).add(jQuery("a", this)).hoverClass();
            if (!settings.prerendered) {
                this.filter(":has(>ul:hidden)").addClass(CLASSES.expandable).replaceClass(CLASSES.last, CLASSES.lastExpandable);
                this.not(":has(>ul:hidden)").addClass(CLASSES.collapsable).replaceClass(CLASSES.last, CLASSES.lastCollapsable);
                this.prepend('<div class="' + CLASSES.hitarea + '"/>').find("div." + CLASSES.hitarea).each(function() {
                    var classes = "";
                    jQuery.each(jQuery(this).parent().attr("class").split(" "),
                    function() {
                        classes += this + "-hitarea ";
                    });
                    jQuery(this).addClass(classes);
                });
            }
            this.find("div." + CLASSES.hitarea).click(toggler);
        },
        treeview: function(settings) {
            settings = jQuery.extend({
                cookieId: "treeview"
            },
            settings);
            if (settings.add) {
                return this.trigger("add", [settings.add]);
            }
            if (settings.toggle) {
                var callback = settings.toggle;
                settings.toggle = function() {
                    return callback.apply(jQuery(this).parent()[0], arguments);
                };
            }
            function treeController(tree, control) {
                function handler(filter) {
                    return function() {
                        toggler.apply(jQuery("div." + CLASSES.hitarea, tree).filter(function() {
                            return filter ? jQuery(this).parent("." + filter).length: true;
                        }));
                        return false;
                    };
                }
                jQuery("a:eq(0)", control).click(handler(CLASSES.collapsable));
                jQuery("a:eq(1)", control).click(handler(CLASSES.expandable));
                jQuery("a:eq(2)", control).click(handler());
            }
            function toggler() {
                jQuery(this).parent().find(">.hitarea").swapClass(CLASSES.collapsableHitarea, CLASSES.expandableHitarea).swapClass(CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea).end().swapClass(CLASSES.collapsable, CLASSES.expandable).swapClass(CLASSES.lastCollapsable, CLASSES.lastExpandable).find(">ul").heightToggle(settings.animated, settings.toggle);
                if (settings.unique) {
                    jQuery(this).parent().siblings().find(">.hitarea").replaceClass(CLASSES.collapsableHitarea, CLASSES.expandableHitarea).replaceClass(CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea).end().replaceClass(CLASSES.collapsable, CLASSES.expandable).replaceClass(CLASSES.lastCollapsable, CLASSES.lastExpandable).find(">ul").heightHide(settings.animated, settings.toggle);
                }
            }
            function serialize() {
                function binary(arg) {
                    return arg ? 1 : 0;
                }
                var data = [];
                branches.each(function(i, e) {
                    data[i] = jQuery(e).is(":has(>ul:visible)") ? 1 : 0;
                });
                jQuery.cookie(settings.cookieId, data.join(""));
            }
            function deserialize() {
                var stored = jQuery.cookie(settings.cookieId);
                if (stored) {
                    var data = stored.split("");
                    branches.each(function(i, e) {
                        jQuery(e).find(">ul")[parseInt(data[i]) ? "show": "hide"]();
                    });
                }
            }
            this.addClass("treeview");
            var branches = this.find("li").prepareBranches(settings);
            switch (settings.persist) {
            case "cookie":
                var toggleCallback = settings.toggle;
                settings.toggle = function() {
                    serialize();
                    if (toggleCallback) {
                        toggleCallback.apply(this, arguments);
                    }
                };
                deserialize();
                break;
            case "location":
                var current = this.find("a").filter(function() {
                    return this.href.toLowerCase() == location.href.toLowerCase();
                });
                if (current.length) {
                    current.addClass("selected").parents("ul, li").add(current.next()).show();
                }
                break;
            }
            branches.applyClasses(settings, toggler);
            if (settings.control) {
                treeController(this, settings.control);
                jQuery(settings.control).show();
            }
            return this.bind("add",
            function(event, branches) {
                jQuery(branches).prev().removeClass(CLASSES.last).removeClass(CLASSES.lastCollapsable).removeClass(CLASSES.lastExpandable).find(">.hitarea").removeClass(CLASSES.lastCollapsableHitarea).removeClass(CLASSES.lastExpandableHitarea);
                jQuery(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler);
            });
        }
    });
    var CLASSES = jQuery.fn.treeview.classes = {
        open: "open",
        closed: "closed",
        expandable: "expandable",
        expandableHitarea: "expandable-hitarea",
        lastExpandableHitarea: "lastExpandable-hitarea",
        collapsable: "collapsable",
        collapsableHitarea: "collapsable-hitarea",
        lastCollapsableHitarea: "lastCollapsable-hitarea",
        lastCollapsable: "lastCollapsable",
        lastExpandable: "lastExpandable",
        last: "last",
        hitarea: "hitarea"
    };
    jQuery.fn.Treeview = jQuery.fn.treeview;
})(jQuery);
/*############ End common/js/jquery/jquery.treeview.js ############*/
/*############ Begin common/js/jquery/jquery-autocomplete.js ############*/
(function(jQuery) {
    jQuery.ui = jQuery.ui || {};
    jQuery.ui.autocomplete = jQuery.ui.autocomplete || {};
    var active;
    jQuery.fn.autocompleteMode = function(container, input, size, opt) {
        var OFFSET = jQuery.browser.msie ? 0 : -1;
        var UNSELECTED = OFFSET;
        var original = input.val();
        var selected = OFFSET;
        var self = this;
        jQuery.data(document.body, "autocompleteMode", true);
        jQuery("body").one("cancel.autocomplete",
        function() {
            input.trigger("cancel.autocomplete");
            jQuery("body").trigger("off.autocomplete");
            input.val(original);
        });
        jQuery("body").one("doActivate.autocomplete",
        function() {
            if (active) {
                input.trigger("doActivate.autocomplete", [jQuery.data(active[0], "originalObject")]);
            }
            jQuery("body").trigger("off.autocomplete");
        });
        jQuery("body").one("off.autocomplete",
        function(e, reset) {
            jQuery.data(document.body, "autocompleteMode", false);
            input.unbind("keydown.autocomplete");
            jQuery("body").unbind("click.autocomplete").unbind("cancel.autocomplete").unbind("doActivate.autocomplete");
            jQuery(window).unbind("click.autocomplete");
            input.focus();
            container.remove();
        });
        jQuery(window).bind("click.autocomplete",
        function() {
            jQuery("body").trigger("cancel.autocomplete");
        });
        var select = function() {
            if (selected > UNSELECTED) {
                active = jQuery("> *", container).removeClass("active").slice(selected, selected + 1).addClass("active");
                input.trigger("itemSelected.autocomplete", [jQuery.data(active[0], "originalObject")]);
                input.val(opt.insertText(jQuery.data(active[0], "originalObject")));
            }
        };
        var softSelect = function() {
            active = jQuery("> *", container).removeClass("active").slice(selected, selected + 1).addClass("active");
            input.trigger("itemSelected.autocomplete", [jQuery.data(active[0], "originalObject")]);
        };
        container.mouseover(function(e) {
            if (e.target == container[0]) {
                return;
            }
            selected = jQuery("> *", container).index(jQuery(e.target).is("li") ? jQuery(e.target)[0] : jQuery(e.target).parents("li")[0]);
            softSelect();
        }).bind("click.autocomplete",
        function(e) {
            select();
            jQuery("body").trigger("doActivate.autocomplete");
            jQuery.data(document.body, "suppressKey", false);
        });
        input.bind("keydown.autocomplete",
        function(e) {
            if (e.which == 27 || e.which == 9) {
                jQuery("body").trigger("cancel.autocomplete");
            } else {
                if (e.which == 13) {
                    jQuery("body").trigger("doActivate.autocomplete");
                } else {
                    if (e.which == 40 || e.which == 38) {
                        switch (e.which) {
                        case 40:
                            selected = selected >= size + OFFSET ? 1 + OFFSET: selected + 1;
                            break;
                        case 38:
                            selected = selected <= 1 + OFFSET ? size + OFFSET: selected - 1;
                            break;
                        default:
                            break;
                        }
                        select();
                    } else {
                        return true;
                    }
                }
            }
            jQuery.data(document.body, "suppressKey", true);
            return false;
        });
    };
    jQuery.fn.autocomplete = function(opt) {
        opt = jQuery.extend({},
        {
            timeout: 300,
            getList: function(input) {
                input.trigger("updateList", [opt.list]);
            },
            template: function(str) {
                return "<li>" + opt.insertText(str) + "</li>";
            },
            insertText: function(str) {
                return str;
            },
            match: function(typed) {
                return this.match(new RegExp(typed));
            },
            wrapper: "<ul class='jq-ui-autocomplete'></ul>"
        },
        opt);
        if (jQuery.ui.autocomplete.ext) {
            for (var ext in jQuery.ui.autocomplete.ext) {
                if (opt[ext]) {
                    opt = jQuery.extend(opt, jQuery.ui.autocomplete.ext[ext](opt));
                    delete opt[ext];
                }
            }
        }
        return this.each(function() {
            var $this = jQuery(this);
            $this.keydown(function(e) {
                var typingTimeout = jQuery.data(this, "typingTimeout");
                if (typingTimeout) {
                    window.clearInterval(typingTimeout);
                }
                if (jQuery.data(document.body, "suppressKey")) {
                    return jQuery.data(document.body, "suppressKey", false);
                } else {
                    if (jQuery.data(document.body, "autocompleteMode") && e.keyCode < 32 && e.keyCode != 8 && e.keyCode != 46 || (e.keyCode >= 37 && e.keyCode <= 40)) {
                        return true;
                    } else {
                        jQuery.data(this, "typingTimeout", window.setTimeout(function() {
                            $this.trigger("autocomplete");
                        },
                        opt.timeout));
                    }
                }
            });
            $this.bind("autocomplete",
            function() {
                var self = jQuery(this);
                self.one("updateList",
                function(e, list) {
                    list = jQuery(list).filter(function() {
                        return opt.match.call(this, self.val());
                    }).map(function() {
                        var node = jQuery(opt.template(this))[0];
                        jQuery.data(node, "originalObject", this);
                        return node;
                    });
                    jQuery("body").trigger("off.autocomplete");
                    if (!list.length) {
                        return false;
                    }
                    var container = jQuery(opt.wrapper);
                    list.appendTo(container);
                    var offset = self.offset();
                    opt.container = container.css({
                        top: offset.top + self.outerHeight(),
                        left: offset.left
                    }).appendTo("body").bgiframe();
                    jQuery("body").autocompleteMode(container, self, list.length, opt);
                });
                opt.getList(self);
            });
        });
    };
})(jQuery);
/*############ End common/js/jquery/jquery-autocomplete.js ############*/
/*############ Begin common/js/jquery/jColor.js ############*/
(function(jQuery) {
    jQuery.each(["backgroundColor", "borderBottomColor", "borderLeftColor", "borderRightColor", "borderTopColor", "color", "outlineColor"],
    function(i, attr) {
        jQuery.fx.step[attr] = function(fx) {
            if (fx.state == 0) {
                fx.start = getColor(fx.elem, attr);
                fx.end = getRGB(fx.end);
            }
            fx.elem.style[attr] = "rgb(" + [Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)].join(",") + ")";
        };
    });
    function getRGB(color) {
        var result;
        if (color && color.constructor == Array && color.length == 3) {
            return color;
        }
        if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) {
            return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
        }
        if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)) {
            return [parseFloat(result[1]) * 2.55, parseFloat(result[2]) * 2.55, parseFloat(result[3]) * 2.55];
        }
        if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) {
            return [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)];
        }
        if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) {
            return [parseInt(result[1] + result[1], 16), parseInt(result[2] + result[2], 16), parseInt(result[3] + result[3], 16)];
        }
        return colors[jQuery.trim(color).toLowerCase()];
    }
    function getColor(elem, attr) {
        var color;
        do {
            color = jQuery.curCSS(elem, attr);
            if (color != "" && color != "transparent" || jQuery.nodeName(elem, "body")) {
                break;
            }
            attr = "backgroundColor";
        } while ( elem = elem . parentNode );
        return getRGB(color);
    }
    var colors = {
        aqua: [0, 255, 255],
        azure: [240, 255, 255],
        beige: [245, 245, 220],
        black: [0, 0, 0],
        blue: [0, 0, 255],
        brown: [165, 42, 42],
        cyan: [0, 255, 255],
        darkblue: [0, 0, 139],
        darkcyan: [0, 139, 139],
        darkgrey: [169, 169, 169],
        darkgreen: [0, 100, 0],
        darkkhaki: [189, 183, 107],
        darkmagenta: [139, 0, 139],
        darkolivegreen: [85, 107, 47],
        darkorange: [255, 140, 0],
        darkorchid: [153, 50, 204],
        darkred: [139, 0, 0],
        darksalmon: [233, 150, 122],
        darkviolet: [148, 0, 211],
        fuchsia: [255, 0, 255],
        gold: [255, 215, 0],
        green: [0, 128, 0],
        indigo: [75, 0, 130],
        khaki: [240, 230, 140],
        lightblue: [173, 216, 230],
        lightcyan: [224, 255, 255],
        lightgreen: [144, 238, 144],
        lightgrey: [211, 211, 211],
        lightpink: [255, 182, 193],
        lightyellow: [255, 255, 224],
        lime: [0, 255, 0],
        magenta: [255, 0, 255],
        maroon: [128, 0, 0],
        navy: [0, 0, 128],
        olive: [128, 128, 0],
        orange: [255, 165, 0],
        pink: [255, 192, 203],
        purple: [128, 0, 128],
        violet: [128, 0, 128],
        red: [255, 0, 0],
        silver: [192, 192, 192],
        white: [255, 255, 255],
        yellow: [255, 255, 0]
    };
})(jQuery);
/*############ End common/js/jquery/jColor.js ############*/
/*############ Begin common/js/jquery/jquery.tablesorter.js ############*/
(function($) {
    $.extend({
        tablesorter: new
        function() {
            var parsers = [],
            widgets = [];
            this.defaults = {
                cssHeader: "header",
                cssAsc: "headerSortUp",
                cssDesc: "headerSortDown",
                sortInitialOrder: "asc",
                sortMultiSortKey: "shiftKey",
                sortForce: null,
                textExtraction: "simple",
                parsers: {},
                widgets: [],
                widgetZebra: {
                    css: ["even", "odd"]
                },
                headers: {},
                widthFixed: false,
                cancelSelection: true,
                sortList: [],
                headerList: [],
                dateFormat: "us",
                debug: false
            };
            function benchmark(s, d) {
                log(s + "," + (new Date().getTime() - d.getTime()) + "ms");
            }
            this.benchmark = benchmark;
            function log(s) {
                if (typeof console != "undefined" && typeof console.debug != "undefined") {
                    console.log(s);
                } else {
                    alert(s);
                }
            }
            function buildParserCache(table, $headers) {
                if (table.config.debug) {
                    var parsersDebug = "";
                }
                var rows = table.tBodies[0].rows;
                if (table.tBodies[0].rows[0]) {
                    var list = [],
                    cells = rows[0].cells,
                    l = cells.length;
                    for (var i = 0; i < l; i++) {
                        var p = false;
                        if ($.meta && ($($headers[i]).data() && $($headers[i]).data().sorter)) {
                            p = getParserById($($headers[i]).data().sorter);
                        } else {
                            if ((table.config.headers[i] && table.config.headers[i].sorter)) {
                                p = getParserById(table.config.headers[i].sorter);
                            }
                        }
                        if (!p) {
                            p = detectParserForColumn(table.config, cells[i]);
                        }
                        if (table.config.debug) {
                            parsersDebug += "column:" + i + " parser:" + p.id + "\n";
                        }
                        list.push(p);
                    }
                }
                if (table.config.debug) {
                    log(parsersDebug);
                }
                return list;
            }
            function detectParserForColumn(config, node) {
                var l = parsers.length;
                for (var i = 1; i < l; i++) {
                    if (parsers[i].is($.trim(getElementText(config, node)))) {
                        return parsers[i];
                    }
                }
                return parsers[0];
            }
            function getParserById(name) {
                var l = parsers.length;
                for (var i = 0; i < l; i++) {
                    if (parsers[i].id.toLowerCase() == name.toLowerCase()) {
                        return parsers[i];
                    }
                }
                return false;
            }
            function buildCache(table) {
                if (table.config.debug) {
                    var cacheTime = new Date();
                }
                var totalRows = (table.tBodies[0] && table.tBodies[0].rows.length) || 0,
                totalCells = (table.tBodies[0].rows[0] && table.tBodies[0].rows[0].cells.length) || 0,
                parsers = table.config.parsers,
                cache = {
                    row: [],
                    normalized: []
                };
                for (var i = 0; i < totalRows; ++i) {
                    var c = table.tBodies[0].rows[i],
                    cols = [];
                    cache.row.push($(c));
                    for (var j = 0; j < totalCells; ++j) {
                        cols.push(parsers[j].format(getElementText(table.config, c.cells[j]), table, c.cells[j]));
                    }
                    cols.push(i);
                    cache.normalized.push(cols);
                    cols = null;
                }
                if (table.config.debug) {
                    benchmark("Building cache for " + totalRows + " rows:", cacheTime);
                }
                return cache;
            }
            function getElementText(config, node) {
                if (!node) {
                    return "";
                }
                var t = "";
                if (config.textExtraction == "simple") {
                    if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
                        t = node.childNodes[0].innerHTML;
                    } else {
                        t = node.innerHTML;
                    }
                } else {
                    if (typeof(config.textExtraction) == "function") {
                        t = config.textExtraction(node);
                    } else {
                        t = $(node).text();
                    }
                }
                return t;
            }
            function appendToTable(table, cache) {
                if (table.config.debug) {
                    var appendTime = new Date();
                }
                var c = cache,
                r = c.row,
                n = c.normalized,
                totalRows = n.length,
                checkCell = (n[0].length - 1),
                tableBody = $(table.tBodies[0]),
                rows = [];
                for (var i = 0; i < totalRows; i++) {
                    rows.push(r[n[i][checkCell]]);
                    if (!table.config.appender) {
                        var o = r[n[i][checkCell]];
                        var l = o.length;
                        for (var j = 0; j < l; j++) {
                            tableBody[0].appendChild(o[j]);
                        }
                    }
                }
                if (table.config.appender) {
                    table.config.appender(table, rows);
                }
                rows = null;
                if (table.config.debug) {
                    benchmark("Rebuilt table:", appendTime);
                }
                applyWidget(table);
            }
            function buildHeaders(table) {
                if (table.config.debug) {
                    var time = new Date();
                }
                var meta = ($.meta) ? true: false,
                tableHeadersRows = [];
                for (var i = 0; i < table.tHead.rows.length; i++) {
                    tableHeadersRows[i] = 0;
                }
                $tableHeaders = $("thead th", table);
                $tableHeaders.each(function(index) {
                    this.count = 0;
                    this.column = index;
                    this.order = formatSortingOrder(table.config.sortInitialOrder);
                    if (checkHeaderMetadata(this) || checkHeaderOptions(table, index)) {
                        this.sortDisabled = true;
                    }
                    if (!this.sortDisabled) {
                        $(this).addClass(table.config.cssHeader);
                    }
                    table.config.headerList[index] = this;
                });
                if (table.config.debug) {
                    benchmark("Built headers:", time);
                    log($tableHeaders);
                }
                return $tableHeaders;
            }
            function checkCellColSpan(table, rows, row) {
                var arr = [],
                r = table.tHead.rows,
                c = r[row].cells;
                for (var i = 0; i < c.length; i++) {
                    var cell = c[i];
                    if (cell.colSpan > 1) {
                        arr = arr.concat(checkCellColSpan(table, headerArr, row++));
                    } else {
                        if (table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row + 1])) {
                            arr.push(cell);
                        }
                    }
                }
                return arr;
            }
            function checkHeaderMetadata(cell) {
                if (($.meta) && ($(cell).data().sorter === false)) {
                    return true;
                }
                return false;
            }
            function checkHeaderOptions(table, i) {
                if ((table.config.headers[i]) && (table.config.headers[i].sorter === false)) {
                    return true;
                }
                return false;
            }
            function applyWidget(table) {
                var c = table.config.widgets;
                var l = c.length;
                for (var i = 0; i < l; i++) {
                    getWidgetById(c[i]).format(table);
                }
            }
            function getWidgetById(name) {
                var l = widgets.length;
                for (var i = 0; i < l; i++) {
                    if (widgets[i].id.toLowerCase() == name.toLowerCase()) {
                        return widgets[i];
                    }
                }
            }
            function formatSortingOrder(v) {
                if (typeof(v) != "Number") {
                    i = (v.toLowerCase() == "desc") ? 1 : 0;
                } else {
                    i = (v == (0 || 1)) ? v: 0;
                }
                return i;
            }
            function isValueInArray(v, a) {
                var l = a.length;
                for (var i = 0; i < l; i++) {
                    if (a[i][0] == v) {
                        return true;
                    }
                }
                return false;
            }
            function setHeadersCss(table, $headers, list, css) {
                $headers.removeClass(css[0]).removeClass(css[1]);
                var h = [];
                $headers.each(function(offset) {
                    if (!this.sortDisabled) {
                        h[this.column] = $(this);
                    }
                });
                var l = list.length;
                for (var i = 0; i < l; i++) {
                    h[list[i][0]].addClass(css[list[i][1]]);
                }
            }
            function fixColumnWidth(table, $headers) {
                var c = table.config;
                if (c.widthFixed) {
                    var colgroup = $("<colgroup>");
                    $("tr:first td", table.tBodies[0]).each(function() {
                        colgroup.append($("<col>").css("width", $(this).width()));
                    });
                    $(table).prepend(colgroup);
                }
            }
            function updateHeaderSortCount(table, sortList) {
                var c = table.config,
                l = sortList.length;
                for (var i = 0; i < l; i++) {
                    var s = sortList[i],
                    o = c.headerList[s[0]];
                    o.count = s[1];
                    o.count++;
                }
            }
            function multisort(table, sortList, cache) {
                if (table.config.debug) {
                    var sortTime = new Date();
                }
                var dynamicExp = "var sortWrapper = function(a,b) {",
                l = sortList.length;
                for (var i = 0; i < l; i++) {
                    var c = sortList[i][0];
                    var order = sortList[i][1];
                    var s = (getCachedSortType(table.config.parsers, c) == "text") ? ((order == 0) ? "sortText": "sortTextDesc") : ((order == 0) ? "sortNumeric": "sortNumericDesc");
                    var e = "e" + i;
                    dynamicExp += "var " + e + " = " + s + "(a[" + c + "],b[" + c + "]); ";
                    dynamicExp += "if(" + e + ") { return " + e + "; } ";
                    dynamicExp += "else { ";
                }
                var orgOrderCol = cache.normalized[0].length - 1;
                dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];";
                for (var i = 0; i < l; i++) {
                    dynamicExp += "}; ";
                }
                dynamicExp += "return 0; ";
                dynamicExp += "}; ";
                eval(dynamicExp);
                cache.normalized.sort(sortWrapper);
                if (table.config.debug) {
                    benchmark("Sorting on " + sortList.toString() + " and dir " + order + " time:", sortTime);
                }
                return cache;
            }
            function sortText(a, b) {
                return ((a < b) ? -1 : ((a > b) ? 1 : 0));
            }
            function sortTextDesc(a, b) {
                return ((b < a) ? -1 : ((b > a) ? 1 : 0));
            }
            function sortNumeric(a, b) {
                return a - b;
            }
            function sortNumericDesc(a, b) {
                return b - a;
            }
            function getCachedSortType(parsers, i) {
                return parsers[i].type;
            }
            this.construct = function(settings) {
                return this.each(function() {
                    if (!this.tHead || !this.tBodies) {
                        return;
                    }
                    var $this, $document, $headers, cache, config, shiftDown = 0,
                    sortOrder;
                    this.config = {};
                    config = $.extend(this.config, $.tablesorter.defaults, settings);
                    $this = $(this);
                    $headers = buildHeaders(this);
                    this.config.parsers = buildParserCache(this, $headers);
                    cache = buildCache(this);
                    var sortCSS = [config.cssDesc, config.cssAsc];
                    fixColumnWidth(this);
                    $headers.click(function(e) {
                        var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;
                        if (!this.sortDisabled && totalRows > 0) {
                            var $cell = $(this);
                            var i = this.column;
                            this.order = this.count++%2;
                            if (!e[config.sortMultiSortKey]) {
                                config.sortList = [];
                                if (config.sortForce != null) {
                                    var a = config.sortForce;
                                    for (var j = 0; j < a.length; j++) {
                                        config.sortList.push(a[j]);
                                    }
                                }
                                config.sortList.push([i, this.order]);
                            } else {
                                if (isValueInArray(i, config.sortList)) {
                                    for (var j = 0; j < config.sortList.length; j++) {
                                        var s = config.sortList[j],
                                        o = config.headerList[s[0]];
                                        if (s[0] == i) {
                                            o.count = s[1];
                                            o.count++;
                                            s[1] = o.count % 2;
                                        }
                                    }
                                } else {
                                    config.sortList.push([i, this.order]);
                                }
                            }
                            $this.trigger("sortStart");
                            setHeadersCss($this[0], $headers, config.sortList, sortCSS);
                            setTimeout(function() {
                                appendToTable($this[0], multisort($this[0], config.sortList, cache));
                                $this.trigger("sortEnd");
                            },
                            0);
                            return false;
                        }
                    }).mousedown(function() {
                        if (config.cancelSelection) {
                            this.onselectstart = function() {
                                return false;
                            };
                            return false;
                        }
                    });
                    $this.bind("update",
                    function() {
                        this.config.parsers = buildParserCache(this, $headers);
                        cache = buildCache(this);
                    }).bind("sorton",
                    function(e, list) {
                        config.sortList = list;
                        var sortList = config.sortList;
                        updateHeaderSortCount(this, sortList);
                        setHeadersCss(this, $headers, sortList, sortCSS);
                        appendToTable(this, multisort(this, sortList, cache));
                    }).bind("appendCache",
                    function() {
                        appendToTable(this, cache);
                    }).bind("applyWidgetId",
                    function(e, id) {
                        getWidgetById(id).format(this);
                    }).bind("applyWidgets",
                    function() {
                        applyWidget(this);
                    });
                    if ($.meta && ($(this).data() && $(this).data().sortlist)) {
                        config.sortList = $(this).data().sortlist;
                    }
                    if (config.sortList.length > 0) {
                        $this.trigger("sorton", [config.sortList]);
                    }
                    applyWidget(this);
                });
            };
            this.addParser = function(parser) {
                var l = parsers.length,
                a = true;
                for (var i = 0; i < l;
                i++) {
                    if (parsers[i].id.toLowerCase() == parser.id.toLowerCase()) {
                        a = false;
                    }
                }
                if (a) {
                    parsers.push(parser);
                }
            };
            this.addWidget = function(widget) {
                widgets.push(widget);
            };
            this.formatFloat = function(s) {
                var i = parseFloat(s);
                return (isNaN(i)) ? 0 : i;
            };
            this.formatInt = function(s) {
                var i = parseInt(s);
                return (isNaN(i)) ? 0 : i;
            };
            this.clearTableBody = function(table) {
                if ($.browser.msie) {
                    function empty() {
                        while (this.firstChild) {
                            this.removeChild(this.firstChild);
                        }
                    }
                    empty.apply(table.tBodies[0]);
                } else {
                    table.tBodies[0].innerHTML = "";
                }
            };
        }
    });
    $.fn.extend({
        tablesorter: $.tablesorter.construct
    });
    var ts = $.tablesorter;
    ts.addParser({
        id: "text",
        is: function(s) {
            return true;
        },
        format: function(s) {
            return $.trim(s.toLowerCase());
        },
        type: "text"
    });
    ts.addParser({
        id: "integer",
        is: function(s) {
            return /^\d+$/.test(s);
        },
        format: function(s) {
            return $.tablesorter.formatFloat(s);
        },
        type: "numeric"
    });
    ts.addParser({
        id: "currency",
        is: function(s) {
            return /^[£$€?.]/.test(s);
        },
        format: function(s) {
            return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.]/g), ""));
        },
        type: "numeric"
    });
    ts.addParser({
        id: "floating",
        is: function(s) {
            return s.match(new RegExp(/^(\+|-)?[0-9]+\.[0-9]+((E|e)(\+|-)?[0-9]+)?$/));
        },
        format: function(s) {
            return $.tablesorter.formatFloat(s.replace(new RegExp(/,/), ""));
        },
        type: "numeric"
    });
    ts.addParser({
        id: "ipAddress",
        is: function(s) {
            return /^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);
        },
        format: function(s) {
            var a = s.split("."),
            r = "",
            l = a.length;
            for (var i = 0; i < l; i++) {
                var item = a[i];
                if (item.length == 2) {
                    r += "0" + item;
                } else {
                    r += item;
                }
            }
            return $.tablesorter.formatFloat(r);
        },
        type: "numeric"
    });
    ts.addParser({
        id: "url",
        is: function(s) {
            return /^(https?|ftp|file):\/\/$/.test(s);
        },
        format: function(s) {
            return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//), ""));
        },
        type: "text"
    });
    ts.addParser({
        id: "isoDate",
        is: function(s) {
            return /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);
        },
        format: function(s) {
            return $.tablesorter.formatFloat((s != "") ? new Date(s.replace(new RegExp(/-/g), "/")).getTime() : "0");
        },
        type: "numeric"
    });
    ts.addParser({
        id: "percent",
        is: function(s) {
            return /^\d{1,3}%$/.test(s);
        },
        format: function(s) {
            return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g), ""));
        },
        type: "numeric"
    });
    ts.addParser({
        id: "usLongDate",
        is: function(s) {
            return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));
        },
        format: function(s) {
            return $.tablesorter.formatFloat(new Date(s).getTime());
        },
        type: "numeric"
    });
    ts.addParser({
        id: "shortDate",
        is: function(s) {
            return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);
        },
        format: function(s, table) {
            var c = table.config;
            s = s.replace(/\-/g, "/");
            if (c.dateFormat == "us") {
                s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2");
            } else {
                if (c.dateFormat == "uk") {
                    s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");
                } else {
                    if (c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") {
                        s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3");
                    }
                }
            }
            return $.tablesorter.formatFloat(new Date(s).getTime());
        },
        type: "numeric"
    });
    ts.addParser({
        id: "time",
        is: function(s) {
            return /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);
        },
        format: function(s) {
            return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime());
        },
        type: "numeric"
    });
    ts.addParser({
        id: "metadata",
        is: function(s) {
            return false;
        },
        format: function(s, table, cell) {
            var c = table.config,
            p = (!c.parserMetadataName) ? "sortValue": c.parserMetadataName;
            return $(cell).data()[p];
        },
        type: "numeric"
    });
    ts.addWidget({
        id: "zebra",
        format: function(table) {
            if (table.config.debug) {
                var time = new Date();
            }
            $("tr:visible", table.tBodies[0]).filter(":even").removeClass(table.config.widgetZebra.css[1]).addClass(table.config.widgetZebra.css[0]).end().filter(":odd").removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);
            if (table.config.debug) {
                $.tablesorter.benchmark("Applying Zebra widget", time);
            }
        }
    });
})(jQuery);
/*############ End common/js/jquery/jquery.tablesorter.js ############*/
/*############ Begin common/js/utils/StringUtils.js ############*/
var StringUtils = {};
StringUtils.trim = function(str) {
    return (str || "").replace(/^\s+|\s+$/g, "");
};
StringUtils.isEmpty = function(str) {
    return str == undefined || str == null || str == "";
};
StringUtils.isNotEmpty = function(str) {
    return str != undefined && str != null && str != "";
};
StringUtils.isBlank = function(str) {
    return str == undefined || str == null || StringUtils.trim(str) == "";
};
StringUtils.isNotBlank = function(str) {
    return str != undefined && str != null && StringUtils.trim(str) != "";
};
StringUtils.formatMessage = function(str, arguments) {
    var argumentArray = [];
    if (arguments.constructor.toString().indexOf("Array") == -1) {
        argumentArray.push(arguments);
    } else {
        argumentArray = arguments.slice(0);
    }
    for (index in argumentArray) {
        str = str.replace("{" + index + "}", argumentArray[index]);
    }
    return str;
}
/*############ End common/js/utils/StringUtils.js ############*/
/*############ Begin common/js/utils/CurrencyUtils.js ############*/
;
var CurrencyUtils = {};
CurrencyUtils.formatByLocale = function(num, locale) {
    this.i18nFormatPrefs = {
        "default": {
            suppressZeros: false,
            separatorSymbol: ",",
            decimalSymbol: "."
        },
        de_DE: {
            suppressZeros: false,
            separatorSymbol: ".",
            decimalSymbol: ","
        },
        ja_JP: {
            suppressZeros: true,
            separatorSymbol: ",",
            decimalSymbol: "."
        }
    };
    var localePrefs = this.i18nFormatPrefs[locale];
    if (localePrefs == null) {
        localePrefs = this.i18nFormatPrefs["default"];
    }
    var numberFormat = new NumberFormat(num);
    numberFormat.setSeparators(true, localePrefs.separatorSymbol, localePrefs.decimalSymbol);
    numberFormat.setPlaces(localePrefs.suppressZeros ? 0 : 2);
    return numberFormat.toFormatted();
};
CurrencyUtils.formatSuppressZeros = function(num) {
    var numberFormat = new NumberFormat(num);
    numberFormat.setPlaces(0);
    return numberFormat.toFormatted();
};
CurrencyUtils.formatBySymbol = function(num, locale, currencyFormat) {
    var fmtNum = CurrencyUtils.formatByLocale(num, locale);
    if (StringUtils.isNotBlank(fmtNum) && StringUtils.isNotBlank(currencyFormat)) {
        return StringUtils.formatMessage(currencyFormat, fmtNum);
    }
    return fmtNum;
};
CurrencyUtils.formatBySymbolSuppressZeros = function(num, locale, currencyFormat) {
    var fmtNum = CurrencyUtils.formatSuppressZeros(num);
    if (StringUtils.isNotBlank(fmtNum) && StringUtils.isNotBlank(currencyFormat)) {
        return StringUtils.formatMessage(currencyFormat, fmtNum);
    }
    return fmtNum;
};
CurrencyUtils.formatByCode = function(num, locale, currencyCode) {
    var fmtNum = CurrencyUtils.formatByLocale(num, locale);
    if (StringUtils.isNotBlank(fmtNum) && StringUtils.isNotBlank(currencyCode)) {
        return fmtNum + " " + currencyCode;
    }
    return fmtNum;
};
CurrencyUtils.formatByCodeSuppressZeros = function(num, locale, currencyCode) {
    var fmtNum = CurrencyUtils.formatSuppressZeros(num);
    if (StringUtils.isNotBlank(fmtNum) && StringUtils.isNotBlank(currencyCode)) {
        return fmtNum + " " + currencyCode;
    }
    return fmtNum;
};
function NumberFormat(num, inputDecimal) {
    this.VERSION = "Number Format v1.5.4";
    this.COMMA = ",";
    this.PERIOD = ".";
    this.DASH = "-";
    this.LEFT_PAREN = "(";
    this.RIGHT_PAREN = ")";
    this.LEFT_OUTSIDE = 0;
    this.LEFT_INSIDE = 1;
    this.RIGHT_INSIDE = 2;
    this.RIGHT_OUTSIDE = 3;
    this.LEFT_DASH = 0;
    this.RIGHT_DASH = 1;
    this.PARENTHESIS = 2;
    this.NO_ROUNDING = -1;
    this.num;
    this.numOriginal;
    this.hasSeparators = false;
    this.separatorValue;
    this.inputDecimalValue;
    this.decimalValue;
    this.negativeFormat;
    this.negativeRed;
    this.hasCurrency;
    this.currencyPosition;
    this.currencyValue;
    this.places;
    this.roundToPlaces;
    this.truncate;
    this.setNumber = setNumberNF;
    this.toUnformatted = toUnformattedNF;
    this.setInputDecimal = setInputDecimalNF;
    this.setSeparators = setSeparatorsNF;
    this.setCommas = setCommasNF;
    this.setNegativeFormat = setNegativeFormatNF;
    this.setNegativeRed = setNegativeRedNF;
    this.setCurrency = setCurrencyNF;
    this.setCurrencyPrefix = setCurrencyPrefixNF;
    this.setCurrencyPostfix = setCurrencyPostfixNF;
    this.setCurrencyValue = setCurrencyValueNF;
    this.setCurrencyPosition = setCurrencyPositionNF;
    this.setPlaces = setPlacesNF;
    this.toFormatted = toFormattedNF;
    this.toPercentage = toPercentageNF;
    this.getOriginal = getOriginalNF;
    this.moveDecimalRight = moveDecimalRightNF;
    this.moveDecimalLeft = moveDecimalLeftNF;
    this.getRounded = getRoundedNF;
    this.preserveZeros = preserveZerosNF;
    this.justNumber = justNumberNF;
    this.expandExponential = expandExponentialNF;
    this.getZeros = getZerosNF;
    this.moveDecimalAsString = moveDecimalAsStringNF;
    this.moveDecimal = moveDecimalNF;
    this.addSeparators = addSeparatorsNF;
    if (inputDecimal == null) {
        this.setNumber(num, this.PERIOD);
    } else {
        this.setNumber(num, inputDecimal);
    }
    this.setCommas(true);
    this.setNegativeFormat(this.LEFT_DASH);
    this.setNegativeRed(false);
    this.setCurrency(false);
    this.setCurrencyPrefix("$");
    this.setPlaces(2);
}
function setInputDecimalNF(val) {
    this.inputDecimalValue = val;
}
function setNumberNF(num, inputDecimal) {
    if (inputDecimal != null) {
        this.setInputDecimal(inputDecimal);
    }
    this.numOriginal = num;
    this.num = this.justNumber(num);
}
function toUnformattedNF() {
    return (this.num);
}
function getOriginalNF() {
    return (this.numOriginal);
}
function setNegativeFormatNF(format) {
    this.negativeFormat = format;
}
function setNegativeRedNF(isRed) {
    this.negativeRed = isRed;
}
function setSeparatorsNF(isC, separator, decimal) {
    this.hasSeparators = isC;
    if (separator == null) {
        separator = this.COMMA;
    }
    if (decimal == null) {
        decimal = this.PERIOD;
    }
    if (separator == decimal) {
        this.decimalValue = (decimal == this.PERIOD) ? this.COMMA: this.PERIOD;
    } else {
        this.decimalValue = decimal;
    }
    this.separatorValue = separator;
}
function setCommasNF(isC) {
    this.setSeparators(isC, this.COMMA, this.PERIOD);
}
function setCurrencyNF(isC) {
    this.hasCurrency = isC;
}
function setCurrencyValueNF(val) {
    this.currencyValue = val;
}
function setCurrencyPrefixNF(cp) {
    this.setCurrencyValue(cp);
    this.setCurrencyPosition(this.LEFT_OUTSIDE);
}
function setCurrencyPostfixNF(cp) {
    this.setCurrencyValue(cp);
    this.setCurrencyPosition(this.RIGHT_OUTSIDE);
}
function setCurrencyPositionNF(cp) {
    this.currencyPosition = cp;
}
function setPlacesNF(p, tr) {
    this.roundToPlaces = !(p == this.NO_ROUNDING);
    this.truncate = (tr != null && tr);
    this.places = (p < 0) ? 0 : p;
}
function addSeparatorsNF(nStr, inD, outD, sep) {
    nStr += "";
    var dpos = nStr.indexOf(inD);
    var nStrEnd = "";
    if (dpos != -1) {
        nStrEnd = outD + nStr.substring(dpos + 1, nStr.length);
        nStr = nStr.substring(0, dpos);
    }
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(nStr)) {
        nStr = nStr.replace(rgx, "$1" + sep + "$2");
    }
    return nStr + nStrEnd;
}
function toFormattedNF() {
    var pos;
    var nNum = this.num;
    var nStr;
    var splitString = new Array(2);
    if (this.roundToPlaces) {
        nNum = this.getRounded(nNum);
        nStr = this.preserveZeros(Math.abs(nNum));
    } else {
        nStr = this.expandExponential(Math.abs(nNum));
    }
    if (this.hasSeparators) {
        nStr = this.addSeparators(nStr, this.PERIOD, this.decimalValue, this.separatorValue);
    } else {
        nStr = nStr.replace(new RegExp("\\" + this.PERIOD), this.decimalValue);
    }
    var c0 = "";
    var n0 = "";
    var c1 = "";
    var n1 = "";
    var n2 = "";
    var c2 = "";
    var n3 = "";
    var c3 = "";
    var negSignL = (this.negativeFormat == this.PARENTHESIS) ? this.LEFT_PAREN: this.DASH;
    var negSignR = (this.negativeFormat == this.PARENTHESIS) ? this.RIGHT_PAREN: this.DASH;
    if (this.currencyPosition == this.LEFT_OUTSIDE) {
        if (nNum < 0) {
            if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) {
                n1 = negSignL;
            }
            if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) {
                n2 = negSignR;
            }
        }
        if (this.hasCurrency) {
            c0 = this.currencyValue;
        }
    } else {
        if (this.currencyPosition == this.LEFT_INSIDE) {
            if (nNum < 0) {
                if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) {
                    n0 = negSignL;
                }
                if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) {
                    n3 = negSignR;
                }
            }
            if (this.hasCurrency) {
                c1 = this.currencyValue;
            }
        } else {
            if (this.currencyPosition == this.RIGHT_INSIDE) {
                if (nNum < 0) {
                    if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) {
                        n0 = negSignL;
                    }
                    if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) {
                        n3 = negSignR;
                    }
                }
                if (this.hasCurrency) {
                    c2 = this.currencyValue;
                }
            } else {
                if (this.currencyPosition == this.RIGHT_OUTSIDE) {
                    if (nNum < 0) {
                        if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) {
                            n1 = negSignL;
                        }
                        if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) {
                            n2 = negSignR;
                        }
                    }
                    if (this.hasCurrency) {
                        c3 = this.currencyValue;
                    }
                }
            }
        }
    }
    nStr = c0 + n0 + c1 + n1 + nStr + n2 + c2 + n3 + c3;
    if (this.negativeRed && nNum < 0) {
        nStr = '<font color="red">' + nStr + "</font>";
    }
    return (nStr);
}
function toPercentageNF() {
    nNum = this.num * 100;
    nNum = this.getRounded(nNum);
    return nNum + "%";
}
function getZerosNF(places) {
    var extraZ = "";
    var i;
    for (i = 0; i < places; i++) {
        extraZ += "0";
    }
    return extraZ;
}
function expandExponentialNF(origVal) {
    if (isNaN(origVal)) {
        return origVal;
    }
    var newVal = parseFloat(origVal) + "";
    var eLoc = newVal.toLowerCase().indexOf("e");
    if (eLoc != -1) {
        var plusLoc = newVal.toLowerCase().indexOf("+");
        var negLoc = newVal.toLowerCase().indexOf("-", eLoc);
        var justNumber = newVal.substring(0, eLoc);
        if (negLoc != -1) {
            var places = newVal.substring(negLoc + 1, newVal.length);
            justNumber = this.moveDecimalAsString(justNumber, true, parseInt(places));
        } else {
            if (plusLoc == -1) {
                plusLoc = eLoc;
            }
            var places = newVal.substring(plusLoc + 1, newVal.length);
            justNumber = this.moveDecimalAsString(justNumber, false, parseInt(places));
        }
        newVal = justNumber;
    }
    return newVal;
}
function moveDecimalRightNF(val, places) {
    var newVal = "";
    if (places == null) {
        newVal = this.moveDecimal(val, false);
    } else {
        newVal = this.moveDecimal(val, false, places);
    }
    return newVal;
}
function moveDecimalLeftNF(val, places) {
    var newVal = "";
    if (places == null) {
        newVal = this.moveDecimal(val, true);
    } else {
        newVal = this.moveDecimal(val, true, places);
    }
    return newVal;
}
function moveDecimalAsStringNF(val, left, places) {
    var spaces = (arguments.length < 3) ? this.places: places;
    if (spaces <= 0) {
        return val;
    }
    var newVal = val + "";
    var extraZ = this.getZeros(spaces);
    var re1 = new RegExp("([0-9.]+)");
    if (left) {
        newVal = newVal.replace(re1, extraZ + "$1");
        var re2 = new RegExp("(-?)([0-9]*)([0-9]{" + spaces + "})(\\.?)");
        newVal = newVal.replace(re2, "$1$2.$3");
    } else {
        var reArray = re1.exec(newVal);
        if (reArray != null) {
            newVal = newVal.substring(0, reArray.index) + reArray[1] + extraZ + newVal.substring(reArray.index + reArray[0].length);
        }
        var re2 = new RegExp("(-?)([0-9]*)(\\.?)([0-9]{" + spaces + "})");
        newVal = newVal.replace(re2, "$1$2$4.");
    }
    newVal = newVal.replace(/\.$/, "");
    return newVal;
}
function moveDecimalNF(val, left, places) {
    var newVal = "";
    if (places == null) {
        newVal = this.moveDecimalAsString(val, left);
    } else {
        newVal = this.moveDecimalAsString(val, left, places);
    }
    return parseFloat(newVal);
}
function getRoundedNF(val) {
    val = this.moveDecimalRight(val);
    if (this.truncate) {
        val = val >= 0 ? Math.floor(val) : Math.ceil(val);
    } else {
        val = Math.round(val);
    }
    val = this.moveDecimalLeft(val);
    return val;
}
function preserveZerosNF(val) {
    var i;
    val = this.expandExponential(val);
    if (this.places <= 0) {
        return val;
    }
    var decimalPos = val.indexOf(".");
    if (decimalPos == -1) {
        val += ".";
        for (i = 0; i < this.places; i++) {
            val += "0";
        }
    } else {
        var actualDecimals = (val.length - 1) - decimalPos;
        var difference = this.places - actualDecimals;
        for (i = 0; i < difference; i++) {
            val += "0";
        }
    }
    return val;
}
function justNumberNF(val) {
    newVal = val + "";
    var isPercentage = false;
    if (newVal.indexOf("%") != -1) {
        newVal = newVal.replace(/\%/g, "");
        isPercentage = true;
    }
    var re = new RegExp("[^\\" + this.inputDecimalValue + "\\d\\-\\+\\(\\)eE]", "g");
    newVal = newVal.replace(re, "");
    var tempRe = new RegExp("[" + this.inputDecimalValue + "]", "g");
    var treArray = tempRe.exec(newVal);
    if (treArray != null) {
        var tempRight = newVal.substring(treArray.index + treArray[0].length);
        newVal = newVal.substring(0, treArray.index) + this.PERIOD + tempRight.replace(tempRe, "");
    }
    if (newVal.charAt(newVal.length - 1) == this.DASH) {
        newVal = newVal.substring(0, newVal.length - 1);
        newVal = "-" + newVal;
    } else {
        if (newVal.charAt(0) == this.LEFT_PAREN && newVal.charAt(newVal.length - 1) == this.RIGHT_PAREN) {
            newVal = newVal.substring(1, newVal.length - 1);
            newVal = "-" + newVal;
        }
    }
    newVal = parseFloat(newVal);
    if (!isFinite(newVal)) {
        newVal = 0;
    }
    if (isPercentage) {
        newVal = this.moveDecimalLeft(newVal, 2);
    }
    return newVal;
}
/*############ End common/js/utils/CurrencyUtils.js ############*/
/*############ Begin common/js/utils/date.js ############*/
Date.$VERSION = 1.02;
Date.LZ = function(x) {
    return (x < 0 || x > 9 ? "": "0") + x;
};
Date.monthNames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
Date.monthAbbreviations = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
Date.dayNames = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
Date.dayAbbreviations = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
Date.preferAmericanFormat = true;
if (!Date.prototype.getFullYear) {
    Date.prototype.getFullYear = function() {
        var yy = this.getYear();
        return (yy < 1900 ? yy + 1900 : yy);
    };
}
Date.parseString = function(val, format) {
    if (typeof(format) == "undefined" || format == null || format == "") {
        var generalFormats = new Array("y-M-d", "MMM d, y", "MMM d,y", "y-MMM-d", "d-MMM-y", "MMM d", "MMM-d", "d-MMM");
        var monthFirst = new Array("M/d/y", "M-d-y", "M.d.y", "M/d", "M-d");
        var dateFirst = new Array("d/M/y", "d-M-y", "d.M.y", "d/M", "d-M");
        var checkList = new Array(generalFormats, Date.preferAmericanFormat ? monthFirst: dateFirst, Date.preferAmericanFormat ? dateFirst: monthFirst);
        for (var i = 0; i < checkList.length; i++) {
            var l = checkList[i];
            for (var j = 0; j < l.length; j++) {
                var d = Date.parseString(val, l[j]);
                if (d != null) {
                    return d;
                }
            }
        }
        return null;
    }
    this.isInteger = function(val) {
        for (var i = 0; i < val.length; i++) {
            if ("1234567890".indexOf(val.charAt(i)) == -1) {
                return false;
            }
        }
        return true;
    };
    this.getInt = function(str, i, minlength, maxlength) {
        for (var x = maxlength; x >= minlength; x--) {
            var token = str.substring(i, i + x);
            if (token.length < minlength) {
                return null;
            }
            if (this.isInteger(token)) {
                return token;
            }
        }
        return null;
    };
    val = val + "";
    format = format + "";
    var i_val = 0;
    var i_format = 0;
    var c = "";
    var token = "";
    var token2 = "";
    var x, y;
    var year = new Date().getFullYear();
    var month = 1;
    var date = 1;
    var hh = 0;
    var mm = 0;
    var ss = 0;
    var ampm = "";
    while (i_format < format.length) {
        c = format.charAt(i_format);
        token = "";
        while ((format.charAt(i_format) == c) && (i_format < format.length)) {
            token += format.charAt(i_format++);
        }
        if (token == "yyyy" || token == "yy" || token == "y") {
            if (token == "yyyy") {
                x = 4;
                y = 4;
            }
            if (token == "yy") {
                x = 2;
                y = 2;
            }
            if (token == "y") {
                x = 2;
                y = 4;
            }
            year = this.getInt(val, i_val, x, y);
            if (year == null) {
                return null;
            }
            i_val += year.length;
            if (year.length == 2) {
                if (year > 70) {
                    year = 1900 + (year - 0);
                } else {
                    year = 2000 + (year - 0);
                }
            }
        } else {
            if (token == "MMM" || token == "NNN") {
                month = 0;
                var names = (token == "MMM" ? (Date.monthNames.concat(Date.monthAbbreviations)) : Date.monthAbbreviations);
                for (var i = 0; i < names.length; i++) {
                    var month_name = names[i];
                    if (val.substring(i_val, i_val + month_name.length).toLowerCase() == month_name.toLowerCase()) {
                        month = (i % 12) + 1;
                        i_val += month_name.length;
                        break;
                    }
                }
                if ((month < 1) || (month > 12)) {
                    return null;
                }
            } else {
                if (token == "EE" || token == "E") {
                    var names = (token == "EE" ? Date.dayNames: Date.dayAbbreviations);
                    for (var i = 0; i < names.length; i++) {
                        var day_name = names[i];
                        if (val.substring(i_val, i_val + day_name.length).toLowerCase() == day_name.toLowerCase()) {
                            i_val += day_name.length;
                            break;
                        }
                    }
                } else {
                    if (token == "MM" || token == "M") {
                        month = this.getInt(val, i_val, token.length, 2);
                        if (month == null || (month < 1) || (month > 12)) {
                            return null;
                        }
                        i_val += month.length;
                    } else {
                        if (token == "dd" || token == "d") {
                            date = this.getInt(val, i_val, token.length, 2);
                            if (date == null || (date < 1) || (date > 31)) {
                                return null;
                            }
                            i_val += date.length;
                        } else {
                            if (token == "hh" || token == "h") {
                                hh = this.getInt(val, i_val, token.length, 2);
                                if (hh == null || (hh < 1) || (hh > 12)) {
                                    return null;
                                }
                                i_val += hh.length;
                            } else {
                                if (token == "HH" || token == "H") {
                                    hh = this.getInt(val, i_val, token.length, 2);
                                    if (hh == null || (hh < 0) || (hh > 23)) {
                                        return null;
                                    }
                                    i_val += hh.length;
                                } else {
                                    if (token == "KK" || token == "K") {
                                        hh = this.getInt(val, i_val, token.length, 2);
                                        if (hh == null || (hh < 0) || (hh > 11)) {
                                            return null;
                                        }
                                        i_val += hh.length;
                                        hh++;
                                    } else {
                                        if (token == "kk" || token == "k") {
                                            hh = this.getInt(val, i_val, token.length, 2);
                                            if (hh == null || (hh < 1) || (hh > 24)) {
                                                return null;
                                            }
                                            i_val += hh.length;
                                            hh--;
                                        } else {
                                            if (token == "mm" || token == "m") {
                                                mm = this.getInt(val, i_val, token.length, 2);
                                                if (mm == null || (mm < 0) || (mm > 59)) {
                                                    return null;
                                                }
                                                i_val += mm.length;
                                            } else {
                                                if (token == "ss" || token == "s") {
                                                    ss = this.getInt(val, i_val, token.length, 2);
                                                    if (ss == null || (ss < 0) || (ss > 59)) {
                                                        return null;
                                                    }
                                                    i_val += ss.length;
                                                } else {
                                                    if (token == "a") {
                                                        if (val.substring(i_val, i_val + 2).toLowerCase() == "am") {
                                                            ampm = "AM";
                                                        } else {
                                                            if (val.substring(i_val, i_val + 2).toLowerCase() == "pm") {
                                                                ampm = "PM";
                                                            } else {
                                                                return null;
                                                            }
                                                        }
                                                        i_val += 2;
                                                    } else {
                                                        if (val.substring(i_val, i_val + token.length) != token) {
                                                            return null;
                                                        } else {
                                                            i_val += token.length;
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (i_val != val.length) {
        return null;
    }
    if (month == 2) {
        if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
            if (date > 29) {
                return null;
            }
        } else {
            if (date > 28) {
                return null;
            }
        }
    }
    if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) {
        if (date > 30) {
            return null;
        }
    }
    if (hh < 12 && ampm == "PM") {
        hh = hh - 0 + 12;
    } else {
        if (hh > 11 && ampm == "AM") {
            hh -= 12;
        }
    }
    return new Date(year, month - 1, date, hh, mm, ss);
};
Date.isValid = function(val, format) {
    return (Date.parseString(val, format) != null);
};
Date.prototype.isBefore = function(date2) {
    if (date2 == null) {
        return false;
    }
    return (this.getTime() < date2.getTime());
};
Date.prototype.isAfter = function(date2) {
    if (date2 == null) {
        return false;
    }
    return (this.getTime() > date2.getTime());
};
Date.prototype.equals = function(date2) {
    if (date2 == null) {
        return false;
    }
    return (this.getTime() == date2.getTime());
};
Date.prototype.equalsIgnoreTime = function(date2) {
    if (date2 == null) {
        return false;
    }
    var d1 = new Date(this.getTime()).clearTime();
    var d2 = new Date(date2.getTime()).clearTime();
    return (d1.getTime() == d2.getTime());
};
Date.prototype.format = function(format) {
    format = format + "";
    var result = "";
    var i_format = 0;
    var c = "";
    var token = "";
    var y = this.getYear() + "";
    var M = this.getMonth() + 1;
    var d = this.getDate();
    var E = this.getDay();
    var H = this.getHours();
    var m = this.getMinutes();
    var s = this.getSeconds();
    var yyyy, yy, MMM, MM, dd, hh, h, mm, ss, ampm, HH, H, KK, K, kk, k;
    var value = new Object();
    if (y.length < 4) {
        y = "" + ( + y + 1900);
    }
    value.y = "" + y;
    value.yyyy = y;
    value.yy = y.substring(2, 4);
    value.M = M;
    value.MM = Date.LZ(M);
    value.MMM = Date.monthNames[M - 1];
    value.NNN = Date.monthAbbreviations[M - 1];
    value.d = d;
    value.dd = Date.LZ(d);
    value.E = Date.dayAbbreviations[E];
    value.EE = Date.dayNames[E];
    value.H = H;
    value.HH = Date.LZ(H);
    if (H == 0) {
        value.h = 12;
    } else {
        if (H > 12) {
            value.h = H - 12;
        } else {
            value.h = H;
        }
    }
    value.hh = Date.LZ(value.h);
    value.K = value.h - 1;
    value.k = value.H + 1;
    value.KK = Date.LZ(value.K);
    value.kk = Date.LZ(value.k);
    if (H > 11) {
        value.a = "PM";
    } else {
        value.a = "AM";
    }
    value.m = m;
    value.mm = Date.LZ(m);
    value.s = s;
    value.ss = Date.LZ(s);
    while (i_format < format.length) {
        c = format.charAt(i_format);
        token = "";
        while ((format.charAt(i_format) == c) && (i_format < format.length)) {
            token += format.charAt(i_format++);
        }
        if (typeof(value[token]) != "undefined") {
            result = result + value[token];
        } else {
            result = result + token;
        }
    }
    return result;
};
Date.prototype.getDayName = function() {
    return Date.dayNames[this.getDay()];
};
Date.prototype.getDayAbbreviation = function() {
    return Date.dayAbbreviations[this.getDay()];
};
Date.prototype.getMonthName = function() {
    return Date.monthNames[this.getMonth()];
};
Date.prototype.getMonthAbbreviation = function() {
    return Date.monthAbbreviations[this.getMonth()];
};
Date.prototype.clearTime = function() {
    this.setHours(0);
    this.setMinutes(0);
    this.setSeconds(0);
    this.setMilliseconds(0);
    return this;
};
Date.prototype.add = function(interval, number) {
    if (typeof(interval) == "undefined" || interval == null || typeof(number) == "undefined" || number == null) {
        return this;
    }
    number = +number;
    if (interval == "y") {
        this.setFullYear(this.getFullYear() + number);
    } else {
        if (interval == "M") {
            this.setMonth(this.getMonth() + number);
        } else {
            if (interval == "d") {
                this.setDate(this.getDate() + number);
            } else {
                if (interval == "w") {
                    var step = (number > 0) ? 1 : -1;
                    while (number != 0) {
                        this.add("d", step);
                        while (this.getDay() == 0 || this.getDay() == 6) {
                            this.add("d", step);
                        }
                        number -= step;
                    }
                } else {
                    if (interval == "h") {
                        this.setHours(this.getHours() + number);
                    } else {
                        if (interval == "m") {
                            this.setMinutes(this.getMinutes() + number);
                        } else {
                            if (interval == "s") {
                                this.setSeconds(this.getSeconds() + number);
                            }
                        }
                    }
                }
            }
        }
    }
    return this;
};
/*############ End common/js/utils/date.js ############*/
/*############ Begin common/js/yahoo/yahoo-dom-event.js ############*/
if (typeof YAHOO == "undefined" || !YAHOO) {
    var YAHOO = {};
}
YAHOO.namespace = function() {
    var A = arguments,
    E = null,
    C, B, D;
    for (C = 0; C < A.length; C = C + 1) {
        D = A[C].split(".");
        E = YAHOO;
        for (B = (D[0] == "YAHOO") ? 1 : 0; B < D.length; B = B + 1) {
            E[D[B]] = E[D[B]] || {};
            E = E[D[B]];
        }
    }
    return E;
};
YAHOO.log = function(D, A, C) {
    var B = YAHOO.widget.Logger;
    if (B && B.log) {
        return B.log(D, A, C);
    } else {
        return false;
    }
};
YAHOO.register = function(A, E, D) {
    var I = YAHOO.env.modules;
    if (!I[A]) {
        I[A] = {
            versions: [],
            builds: []
        };
    }
    var B = I[A],
    H = D.version,
    G = D.build,
    F = YAHOO.env.listeners;
    B.name = A;
    B.version = H;
    B.build = G;
    B.versions.push(H);
    B.builds.push(G);
    B.mainClass = E;
    for (var C = 0; C < F.length; C = C + 1) {
        F[C](B);
    }
    if (E) {
        E.VERSION = H;
        E.BUILD = G;
    } else {
        YAHOO.log("mainClass is undefined for module " + A, "warn");
    }
};
YAHOO.env = YAHOO.env || {
    modules: [],
    listeners: []
};
YAHOO.env.getVersion = function(A) {
    return YAHOO.env.modules[A] || null;
};
YAHOO.env.ua = function() {
    var C = {
        ie: 0,
        opera: 0,
        gecko: 0,
        webkit: 0,
        mobile: null,
        air: 0
    };
    var B = navigator.userAgent,
    A;
    if ((/KHTML/).test(B)) {
        C.webkit = 1;
    }
    A = B.match(/AppleWebKit\/([^\s]*)/);
    if (A && A[1]) {
        C.webkit = parseFloat(A[1]);
        if (/ Mobile\//.test(B)) {
            C.mobile = "Apple";
        } else {
            A = B.match(/NokiaN[^\/]*/);
            if (A) {
                C.mobile = A[0];
            }
        }
        A = B.match(/AdobeAIR\/([^\s]*)/);
        if (A) {
            C.air = A[0];
        }
    }
    if (!C.webkit) {
        A = B.match(/Opera[\s\/]([^\s]*)/);
        if (A && A[1]) {
            C.opera = parseFloat(A[1]);
            A = B.match(/Opera Mini[^;]*/);
            if (A) {
                C.mobile = A[0];
            }
        } else {
            A = B.match(/MSIE\s([^;]*)/);
            if (A && A[1]) {
                C.ie = parseFloat(A[1]);
            } else {
                A = B.match(/Gecko\/([^\s]*)/);
                if (A) {
                    C.gecko = 1;
                    A = B.match(/rv:([^\s\)]*)/);
                    if (A && A[1]) {
                        C.gecko = parseFloat(A[1]);
                    }
                }
            }
        }
    }
    return C;
} ();
(function() {
    YAHOO.namespace("util", "widget", "example");
    if ("undefined" !== typeof YAHOO_config) {
        var B = YAHOO_config.listener,
        A = YAHOO.env.listeners,
        D = true,
        C;
        if (B) {
            for (C = 0; C < A.length; C = C + 1) {
                if (A[C] == B) {
                    D = false;
                    break;
                }
            }
            if (D) {
                A.push(B);
            }
        }
    }
})();
YAHOO.lang = YAHOO.lang || {};
(function() {
    var A = YAHOO.lang,
    C = ["toString", "valueOf"],
    B = {
        isArray: function(D) {
            if (D) {
                return A.isNumber(D.length) && A.isFunction(D.splice);
            }
            return false;
        },
        isBoolean: function(D) {
            return typeof D === "boolean";
        },
        isFunction: function(D) {
            return typeof D === "function";
        },
        isNull: function(D) {
            return D === null;
        },
        isNumber: function(D) {
            return typeof D === "number" && isFinite(D);
        },
        isObject: function(D) {
            return (D && (typeof D === "object" || A.isFunction(D))) || false;
        },
        isString: function(D) {
            return typeof D === "string";
        },
        isUndefined: function(D) {
            return typeof D === "undefined";
        },
        _IEEnumFix: (YAHOO.env.ua.ie) ?
        function(F, E) {
            for (var D = 0; D < C.length; D = D + 1) {
                var H = C[D],
                G = E[H];
                if (A.isFunction(G) && G != Object.prototype[H]) {
                    F[H] = G;
                }
            }
        }: function() {},
        extend: function(H, I, G) {
            if (!I || !H) {
                throw new Error("extend failed, please check that all dependencies are included.");
            }
            var E = function() {};
            E.prototype = I.prototype;
            H.prototype = new E();
            H.prototype.constructor = H;
            H.superclass = I.prototype;
            if (I.prototype.constructor == Object.prototype.constructor) {
                I.prototype.constructor = I;
            }
            if (G) {
                for (var D in G) {
                    if (A.hasOwnProperty(G, D)) {
                        H.prototype[D] = G[D];
                    }
                }
                A._IEEnumFix(H.prototype, G);
            }
        },
        augmentObject: function(H, G) {
            if (!G || !H) {
                throw new Error("Absorb failed, verify dependencies.");
            }
            var D = arguments,
            F, I, E = D[2];
            if (E && E !== true) {
                for (F = 2; F < D.length; F = F + 1) {
                    H[D[F]] = G[D[F]];
                }
            } else {
                for (I in G) {
                    if (E || !(I in H)) {
                        H[I] = G[I];
                    }
                }
                A._IEEnumFix(H, G);
            }
        },
        augmentProto: function(G, F) {
            if (!F || !G) {
                throw new Error("Augment failed, verify dependencies.");
            }
            var D = [G.prototype, F.prototype];
            for (var E = 2; E < arguments.length;
            E = E + 1) {
                D.push(arguments[E]);
            }
            A.augmentObject.apply(this, D);
        },
        dump: function(D, I) {
            var F, H, K = [],
            L = "{...}",
            E = "f(){...}",
            J = ", ",
            G = " => ";
            if (!A.isObject(D)) {
                return D + "";
            } else {
                if (D instanceof Date || ("nodeType" in D && "tagName" in D)) {
                    return D;
                } else {
                    if (A.isFunction(D)) {
                        return E;
                    }
                }
            }
            I = (A.isNumber(I)) ? I: 3;
            if (A.isArray(D)) {
                K.push("[");
                for (F = 0, H = D.length; F < H; F = F + 1) {
                    if (A.isObject(D[F])) {
                        K.push((I > 0) ? A.dump(D[F], I - 1) : L);
                    } else {
                        K.push(D[F]);
                    }
                    K.push(J);
                }
                if (K.length > 1) {
                    K.pop();
                }
                K.push("]");
            } else {
                K.push("{");
                for (F in D) {
                    if (A.hasOwnProperty(D, F)) {
                        K.push(F + G);
                        if (A.isObject(D[F])) {
                            K.push((I > 0) ? A.dump(D[F], I - 1) : L);
                        } else {
                            K.push(D[F]);
                        }
                        K.push(J);
                    }
                }
                if (K.length > 1) {
                    K.pop();
                }
                K.push("}");
            }
            return K.join("");
        },
        substitute: function(S, E, L) {
            var I, H, G, O, P, R, N = [],
            F,
            J = "dump",
            M = " ",
            D = "{",
            Q = "}";
            for (;;) {
                I = S.lastIndexOf(D);
                if (I < 0) {
                    break;
                }
                H = S.indexOf(Q, I);
                if (I + 1 >= H) {
                    break;
                }
                F = S.substring(I + 1, H);
                O = F;
                R = null;
                G = O.indexOf(M);
                if (G > -1) {
                    R = O.substring(G + 1);
                    O = O.substring(0, G);
                }
                P = E[O];
                if (L) {
                    P = L(O, P, R);
                }
                if (A.isObject(P)) {
                    if (A.isArray(P)) {
                        P = A.dump(P, parseInt(R, 10));
                    } else {
                        R = R || "";
                        var K = R.indexOf(J);
                        if (K > -1) {
                            R = R.substring(4);
                        }
                        if (P.toString === Object.prototype.toString || K > -1) {
                            P = A.dump(P, parseInt(R, 10));
                        } else {
                            P = P.toString();
                        }
                    }
                } else {
                    if (!A.isString(P) && !A.isNumber(P)) {
                        P = "~-" + N.length + "-~";
                        N[N.length] = F;
                    }
                }
                S = S.substring(0, I) + P + S.substring(H + 1);
            }
            for (I = N.length - 1; I >= 0; I = I - 1) {
                S = S.replace(new RegExp("~-" + I + "-~"), "{" + N[I] + "}", "g");
            }
            return S;
        },
        trim: function(D) {
            try {
                return D.replace(/^\s+|\s+$/g, "");
            } catch(E) {
                return D;
            }
        },
        merge: function() {
            var G = {},
            E = arguments;
            for (var F = 0,
            D = E.length; F < D; F = F + 1) {
                A.augmentObject(G, E[F], true);
            }
            return G;
        },
        later: function(K, E, L, G, H) {
            K = K || 0;
            E = E || {};
            var F = L,
            J = G,
            I, D;
            if (A.isString(L)) {
                F = E[L];
            }
            if (!F) {
                throw new TypeError("method undefined");
            }
            if (!A.isArray(J)) {
                J = [G];
            }
            I = function() {
                F.apply(E, J);
            };
            D = (H) ? setInterval(I, K) : setTimeout(I, K);
            return {
                interval: H,
                cancel: function() {
                    if (this.interval) {
                        clearInterval(D);
                    } else {
                        clearTimeout(D);
                    }
                }
            };
        },
        isValue: function(D) {
            return (A.isObject(D) || A.isString(D) || A.isNumber(D) || A.isBoolean(D));
        }
    };
    A.hasOwnProperty = (Object.prototype.hasOwnProperty) ?
    function(D, E) {
        return D && D.hasOwnProperty(E);
    }: function(D, E) {
        return ! A.isUndefined(D[E]) && D.constructor.prototype[E] !== D[E];
    };
    B.augmentObject(A, B, true);
    YAHOO.util.Lang = A;
    A.augment = A.augmentProto;
    YAHOO.augment = A.augmentProto;
    YAHOO.extend = A.extend;
})();
YAHOO.register("yahoo", YAHOO, {
    version: "2.5.2",
    build: "1076"
});
(function() {
    var B = YAHOO.util,
    K, I, J = {},
    F = {},
    M = window.document;
    YAHOO.env._id_counter = YAHOO.env._id_counter || 0;
    var C = YAHOO.env.ua.opera,
    L = YAHOO.env.ua.webkit,
    A = YAHOO.env.ua.gecko,
    G = YAHOO.env.ua.ie;
    var E = {
        HYPHEN: /(-[a-z])/i,
        ROOT_TAG: /^body|html$/i,
        OP_SCROLL: /^(?:inline|table-row)$/i
    };
    var N = function(P) {
        if (!E.HYPHEN.test(P)) {
            return P;
        }
        if (J[P]) {
            return J[P];
        }
        var Q = P;
        while (E.HYPHEN.exec(Q)) {
            Q = Q.replace(RegExp.$1, RegExp.$1.substr(1).toUpperCase());
        }
        J[P] = Q;
        return Q;
    };
    var O = function(Q) {
        var P = F[Q];
        if (!P) {
            P = new RegExp("(?:^|\\s+)" + Q + "(?:\\s+|$)");
            F[Q] = P;
        }
        return P;
    };
    if (M.defaultView && M.defaultView.getComputedStyle) {
        K = function(P, S) {
            var R = null;
            if (S == "float") {
                S = "cssFloat";
            }
            var Q = P.ownerDocument.defaultView.getComputedStyle(P, "");
            if (Q) {
                R = Q[N(S)];
            }
            return P.style[S] || R;
        };
    } else {
        if (M.documentElement.currentStyle && G) {
            K = function(P, R) {
                switch (N(R)) {
                case "opacity":
                    var T = 100;
                    try {
                        T = P.filters["DXImageTransform.Microsoft.Alpha"].opacity;
                    } catch(S) {
                        try {
                            T = P.filters("alpha").opacity;
                        } catch(S) {}
                    }
                    return T / 100;
                case "float":
                    R = "styleFloat";
                default:
                    var Q = P.currentStyle ? P.currentStyle[R] : null;
                    return (P.style[R] || Q);
                }
            };
        } else {
            K = function(P, Q) {
                return P.style[Q];
            };
        }
    }
    if (G) {
        I = function(P, Q, R) {
            switch (Q) {
            case "opacity":
                if (YAHOO.lang.isString(P.style.filter)) {
                    P.style.filter = "alpha(opacity=" + R * 100 + ")";
                    if (!P.currentStyle || !P.currentStyle.hasLayout) {
                        P.style.zoom = 1;
                    }
                }
                break;
            case "float":
                Q = "styleFloat";
            default:
                P.style[Q] = R;
            }
        };
    } else {
        I = function(P, Q, R) {
            if (Q == "float") {
                Q = "cssFloat";
            }
            P.style[Q] = R;
        };
    }
    var D = function(P, Q) {
        return P && P.nodeType == 1 && (!Q || Q(P));
    };
    YAHOO.util.Dom = {
        get: function(R) {
            if (R && (R.nodeType || R.item)) {
                return R;
            }
            if (YAHOO.lang.isString(R) || !R) {
                return M.getElementById(R);
            }
            if (R.length !== undefined) {
                var S = [];
                for (var Q = 0,
                P = R.length; Q < P; ++Q) {
                    S[S.length] = B.Dom.get(R[Q]);
                }
                return S;
            }
            return R;
        },
        getStyle: function(P, R) {
            R = N(R);
            var Q = function(S) {
                return K(S, R);
            };
            return B.Dom.batch(P, Q, B.Dom, true);
        },
        setStyle: function(P, R, S) {
            R = N(R);
            var Q = function(T) {
                I(T, R, S);
            };
            B.Dom.batch(P, Q, B.Dom, true);
        },
        getXY: function(P) {
            var Q = function(R) {
                if ((R.parentNode === null || R.offsetParent === null || this.getStyle(R, "display") == "none") && R != R.ownerDocument.body) {
                    return false;
                }
                return H(R);
            };
            return B.Dom.batch(P, Q, B.Dom, true);
        },
        getX: function(P) {
            var Q = function(R) {
                return B.Dom.getXY(R)[0];
            };
            return B.Dom.batch(P, Q, B.Dom, true);
        },
        getY: function(P) {
            var Q = function(R) {
                return B.Dom.getXY(R)[1];
            };
            return B.Dom.batch(P, Q, B.Dom, true);
        },
        setXY: function(P, S, R) {
            var Q = function(V) {
                var U = this.getStyle(V, "position");
                if (U == "static") {
                    this.setStyle(V, "position", "relative");
                    U = "relative";
                }
                var X = this.getXY(V);
                if (X === false) {
                    return false;
                }
                var W = [parseInt(this.getStyle(V, "left"), 10), parseInt(this.getStyle(V, "top"), 10)];
                if (isNaN(W[0])) {
                    W[0] = (U == "relative") ? 0 : V.offsetLeft;
                }
                if (isNaN(W[1])) {
                    W[1] = (U == "relative") ? 0 : V.offsetTop;
                }
                if (S[0] !== null) {
                    V.style.left = S[0] - X[0] + W[0] + "px";
                }
                if (S[1] !== null) {
                    V.style.top = S[1] - X[1] + W[1] + "px";
                }
                if (!R) {
                    var T = this.getXY(V);
                    if ((S[0] !== null && T[0] != S[0]) || (S[1] !== null && T[1] != S[1])) {
                        this.setXY(V, S, true);
                    }
                }
            };
            B.Dom.batch(P, Q, B.Dom, true);
        },
        setX: function(Q, P) {
            B.Dom.setXY(Q, [P, null]);
        },
        setY: function(P, Q) {
            B.Dom.setXY(P, [null, Q]);
        },
        getRegion: function(P) {
            var Q = function(R) {
                if ((R.parentNode === null || R.offsetParent === null || this.getStyle(R, "display") == "none") && R != R.ownerDocument.body) {
                    return false;
                }
                var S = B.Region.getRegion(R);
                return S;
            };
            return B.Dom.batch(P, Q, B.Dom, true);
        },
        getClientWidth: function() {
            return B.Dom.getViewportWidth();
        },
        getClientHeight: function() {
            return B.Dom.getViewportHeight();
        },
        getElementsByClassName: function(T, X, U, V) {
            X = X || "*";
            U = (U) ? B.Dom.get(U) : null || M;
            if (!U) {
                return [];
            }
            var Q = [],
            P = U.getElementsByTagName(X),
            W = O(T);
            for (var R = 0,
            S = P.length; R < S; ++R) {
                if (W.test(P[R].className)) {
                    Q[Q.length] = P[R];
                    if (V) {
                        V.call(P[R], P[R]);
                    }
                }
            }
            return Q;
        },
        hasClass: function(R, Q) {
            var P = O(Q);
            var S = function(T) {
                return P.test(T.className);
            };
            return B.Dom.batch(R, S, B.Dom, true);
        },
        addClass: function(Q, P) {
            var R = function(S) {
                if (this.hasClass(S, P)) {
                    return false;
                }
                S.className = YAHOO.lang.trim([S.className, P].join(" "));
                return true;
            };
            return B.Dom.batch(Q, R, B.Dom, true);
        },
        removeClass: function(R, Q) {
            var P = O(Q);
            var S = function(T) {
                if (!Q || !this.hasClass(T, Q)) {
                    return false;
                }
                var U = T.className;
                T.className = U.replace(P, " ");
                if (this.hasClass(T, Q)) {
                    this.removeClass(T, Q);
                }
                T.className = YAHOO.lang.trim(T.className);
                return true;
            };
            return B.Dom.batch(R, S, B.Dom, true);
        },
        replaceClass: function(S, Q, P) {
            if (!P || Q === P) {
                return false;
            }
            var R = O(Q);
            var T = function(U) {
                if (!this.hasClass(U, Q)) {
                    this.addClass(U, P);
                    return true;
                }
                U.className = U.className.replace(R, " " + P + " ");
                if (this.hasClass(U, Q)) {
                    this.replaceClass(U, Q, P);
                }
                U.className = YAHOO.lang.trim(U.className);
                return true;
            };
            return B.Dom.batch(S, T, B.Dom, true);
        },
        generateId: function(P, R) {
            R = R || "yui-gen";
            var Q = function(S) {
                if (S && S.id) {
                    return S.id;
                }
                var T = R + YAHOO.env._id_counter++;
                if (S) {
                    S.id = T;
                }
                return T;
            };
            return B.Dom.batch(P, Q, B.Dom, true) || Q.apply(B.Dom, arguments);
        },
        isAncestor: function(P, Q) {
            P = B.Dom.get(P);
            Q = B.Dom.get(Q);
            if (!P || !Q) {
                return false;
            }
            if (P.contains && Q.nodeType && !L) {
                return P.contains(Q);
            } else {
                if (P.compareDocumentPosition && Q.nodeType) {
                    return !! (P.compareDocumentPosition(Q) & 16);
                } else {
                    if (Q.nodeType) {
                        return !! this.getAncestorBy(Q,
                        function(R) {
                            return R == P;
                        });
                    }
                }
            }
            return false;
        },
        inDocument: function(P) {
            return this.isAncestor(M.documentElement, P);
        },
        getElementsBy: function(W, Q, R, T) {
            Q = Q || "*";
            R = (R) ? B.Dom.get(R) : null || M;
            if (!R) {
                return [];
            }
            var S = [],
            V = R.getElementsByTagName(Q);
            for (var U = 0,
            P = V.length; U < P; ++U) {
                if (W(V[U])) {
                    S[S.length] = V[U];
                    if (T) {
                        T(V[U]);
                    }
                }
            }
            return S;
        },
        batch: function(T, W, V, R) {
            T = (T && (T.tagName || T.item)) ? T: B.Dom.get(T);
            if (!T || !W) {
                return false;
            }
            var S = (R) ? V: window;
            if (T.tagName || T.length === undefined) {
                return W.call(S, T, V);
            }
            var U = [];
            for (var Q = 0,
            P = T.length; Q < P; ++Q) {
                U[U.length] = W.call(S, T[Q], V);
            }
            return U;
        },
        getDocumentHeight: function() {
            var Q = (M.compatMode != "CSS1Compat") ? M.body.scrollHeight: M.documentElement.scrollHeight;
            var P = Math.max(Q, B.Dom.getViewportHeight());
            return P;
        },
        getDocumentWidth: function() {
            var Q = (M.compatMode != "CSS1Compat") ? M.body.scrollWidth: M.documentElement.scrollWidth;
            var P = Math.max(Q, B.Dom.getViewportWidth());
            return P;
        },
        getViewportHeight: function() {
            var P = self.innerHeight;
            var Q = M.compatMode;
            if ((Q || G) && !C) {
                P = (Q == "CSS1Compat") ? M.documentElement.clientHeight: M.body.clientHeight;
            }
            return P;
        },
        getViewportWidth: function() {
            var P = self.innerWidth;
            var Q = M.compatMode;
            if (Q || G) {
                P = (Q == "CSS1Compat") ? M.documentElement.clientWidth: M.body.clientWidth;
            }
            return P;
        },
        getAncestorBy: function(P, Q) {
            while (P = P.parentNode) {
                if (D(P, Q)) {
                    return P;
                }
            }
            return null;
        },
        getAncestorByClassName: function(Q, P) {
            Q = B.Dom.get(Q);
            if (!Q) {
                return null;
            }
            var R = function(S) {
                return B.Dom.hasClass(S, P);
            };
            return B.Dom.getAncestorBy(Q, R);
        },
        getAncestorByTagName: function(Q, P) {
            Q = B.Dom.get(Q);
            if (!Q) {
                return null;
            }
            var R = function(S) {
                return S.tagName && S.tagName.toUpperCase() == P.toUpperCase();
            };
            return B.Dom.getAncestorBy(Q, R);
        },
        getPreviousSiblingBy: function(P, Q) {
            while (P) {
                P = P.previousSibling;
                if (D(P, Q)) {
                    return P;
                }
            }
            return null;
        },
        getPreviousSibling: function(P) {
            P = B.Dom.get(P);
            if (!P) {
                return null;
            }
            return B.Dom.getPreviousSiblingBy(P);
        },
        getNextSiblingBy: function(P, Q) {
            while (P) {
                P = P.nextSibling;
                if (D(P, Q)) {
                    return P;
                }
            }
            return null;
        },
        getNextSibling: function(P) {
            P = B.Dom.get(P);
            if (!P) {
                return null;
            }
            return B.Dom.getNextSiblingBy(P);
        },
        getFirstChildBy: function(P, R) {
            var Q = (D(P.firstChild, R)) ? P.firstChild: null;
            return Q || B.Dom.getNextSiblingBy(P.firstChild, R);
        },
        getFirstChild: function(P, Q) {
            P = B.Dom.get(P);
            if (!P) {
                return null;
            }
            return B.Dom.getFirstChildBy(P);
        },
        getLastChildBy: function(P, R) {
            if (!P) {
                return null;
            }
            var Q = (D(P.lastChild, R)) ? P.lastChild: null;
            return Q || B.Dom.getPreviousSiblingBy(P.lastChild, R);
        },
        getLastChild: function(P) {
            P = B.Dom.get(P);
            return B.Dom.getLastChildBy(P);
        },
        getChildrenBy: function(Q, S) {
            var R = B.Dom.getFirstChildBy(Q, S);
            var P = R ? [R] : [];
            B.Dom.getNextSiblingBy(R,
            function(T) {
                if (!S || S(T)) {
                    P[P.length] = T;
                }
                return false;
            });
            return P;
        },
        getChildren: function(P) {
            P = B.Dom.get(P);
            if (!P) {}
            return B.Dom.getChildrenBy(P);
        },
        getDocumentScrollLeft: function(P) {
            P = P || M;
            return Math.max(P.documentElement.scrollLeft, P.body.scrollLeft);
        },
        getDocumentScrollTop: function(P) {
            P = P || M;
            return Math.max(P.documentElement.scrollTop, P.body.scrollTop);
        },
        insertBefore: function(Q, P) {
            Q = B.Dom.get(Q);
            P = B.Dom.get(P);
            if (!Q || !P || !P.parentNode) {
                return null;
            }
            return P.parentNode.insertBefore(Q, P);
        },
        insertAfter: function(Q, P) {
            Q = B.Dom.get(Q);
            P = B.Dom.get(P);
            if (!Q || !P || !P.parentNode) {
                return null;
            }
            if (P.nextSibling) {
                return P.parentNode.insertBefore(Q, P.nextSibling);
            } else {
                return P.parentNode.appendChild(Q);
            }
        },
        getClientRegion: function() {
            var R = B.Dom.getDocumentScrollTop(),
            Q = B.Dom.getDocumentScrollLeft(),
            S = B.Dom.getViewportWidth() + Q,
            P = B.Dom.getViewportHeight() + R;
            return new B.Region(R, S, P, Q);
        }
    };
    var H = function() {
        if (M.documentElement.getBoundingClientRect) {
            return function(Q) {
                var R = Q.getBoundingClientRect();
                var P = Q.ownerDocument;
                return [R.left + B.Dom.getDocumentScrollLeft(P), R.top + B.Dom.getDocumentScrollTop(P)];
            };
        } else {
            return function(R) {
                var S = [R.offsetLeft, R.offsetTop];
                var Q = R.offsetParent;
                var P = (L && B.Dom.getStyle(R, "position") == "absolute" && R.offsetParent == R.ownerDocument.body);
                if (Q != R) {
                    while (Q) {
                        S[0] += Q.offsetLeft;
                        S[1] += Q.offsetTop;
                        if (!P && L && B.Dom.getStyle(Q, "position") == "absolute") {
                            P = true;
                        }
                        Q = Q.offsetParent;
                    }
                }
                if (P) {
                    S[0] -= R.ownerDocument.body.offsetLeft;
                    S[1] -= R.ownerDocument.body.offsetTop;
                }
                Q = R.parentNode;
                while (Q.tagName && !E.ROOT_TAG.test(Q.tagName)) {
                    if (Q.scrollTop || Q.scrollLeft) {
                        if (!E.OP_SCROLL.test(B.Dom.getStyle(Q, "display"))) {
                            if (!C || B.Dom.getStyle(Q, "overflow") !== "visible") {
                                S[0] -= Q.scrollLeft;
                                S[1] -= Q.scrollTop;
                            }
                        }
                    }
                    Q = Q.parentNode;
                }
                return S;
            };
        }
    } ();
})();
YAHOO.util.Region = function(C, D, A, B) {
    this.top = C;
    this[1] = C;
    this.right = D;
    this.bottom = A;
    this.left = B;
    this[0] = B;
};
YAHOO.util.Region.prototype.contains = function(A) {
    return (A.left >= this.left && A.right <= this.right && A.top >= this.top && A.bottom <= this.bottom);
};
YAHOO.util.Region.prototype.getArea = function() {
    return ((this.bottom - this.top) * (this.right - this.left));
};
YAHOO.util.Region.prototype.intersect = function(E) {
    var C = Math.max(this.top, E.top);
    var D = Math.min(this.right, E.right);
    var A = Math.min(this.bottom, E.bottom);
    var B = Math.max(this.left, E.left);
    if (A >= C && D >= B) {
        return new YAHOO.util.Region(C, D, A, B);
    } else {
        return null;
    }
};
YAHOO.util.Region.prototype.union = function(E) {
    var C = Math.min(this.top, E.top);
    var D = Math.max(this.right, E.right);
    var A = Math.max(this.bottom, E.bottom);
    var B = Math.min(this.left, E.left);
    return new YAHOO.util.Region(C, D, A, B);
};
YAHOO.util.Region.prototype.toString = function() {
    return ("Region {top: " + this.top + ", right: " + this.right + ", bottom: " + this.bottom + ", left: " + this.left + "}");
};
YAHOO.util.Region.getRegion = function(D) {
    var F = YAHOO.util.Dom.getXY(D);
    var C = F[1];
    var E = F[0] + D.offsetWidth;
    var A = F[1] + D.offsetHeight;
    var B = F[0];
    return new YAHOO.util.Region(C, E, A, B);
};
YAHOO.util.Point = function(A, B) {
    if (YAHOO.lang.isArray(A)) {
        B = A[1];
        A = A[0];
    }
    this.x = this.right = this.left = this[0] = A;
    this.y = this.top = this.bottom = this[1] = B;
};
YAHOO.util.Point.prototype = new YAHOO.util.Region();
YAHOO.register("dom", YAHOO.util.Dom, {
    version: "2.5.2",
    build: "1076"
});
YAHOO.util.CustomEvent = function(D, B, C, A) {
    this.type = D;
    this.scope = B || window;
    this.silent = C;
    this.signature = A || YAHOO.util.CustomEvent.LIST;
    this.subscribers = [];
    if (!this.silent) {}
    var E = "_YUICEOnSubscribe";
    if (D !== E) {
        this.subscribeEvent = new YAHOO.util.CustomEvent(E, this, true);
    }
    this.lastError = null;
};
YAHOO.util.CustomEvent.LIST = 0;
YAHOO.util.CustomEvent.FLAT = 1;
YAHOO.util.CustomEvent.prototype = {
    subscribe: function(B, C, A) {
        if (!B) {
            throw new Error("Invalid callback for subscriber to '" + this.type + "'");
        }
        if (this.subscribeEvent) {
            this.subscribeEvent.fire(B, C, A);
        }
        this.subscribers.push(new YAHOO.util.Subscriber(B, C, A));
    },
    unsubscribe: function(D, F) {
        if (!D) {
            return this.unsubscribeAll();
        }
        var E = false;
        for (var B = 0,
        A = this.subscribers.length; B < A; ++B) {
            var C = this.subscribers[B];
            if (C && C.contains(D, F)) {
                this._delete(B);
                E = true;
            }
        }
        return E;
    },
    fire: function() {
        this.lastError = null;
        var K = [],
        E = this.subscribers.length;
        if (!E && this.silent) {
            return true;
        }
        var I = [].slice.call(arguments, 0),
        G = true,
        D,
        J = false;
        if (!this.silent) {}
        var C = this.subscribers.slice(),
        A = YAHOO.util.Event.throwErrors;
        for (D = 0; D < E; ++D) {
            var M = C[D];
            if (!M) {
                J = true;
            } else {
                if (!this.silent) {}
                var L = M.getScope(this.scope);
                if (this.signature == YAHOO.util.CustomEvent.FLAT) {
                    var B = null;
                    if (I.length > 0) {
                        B = I[0];
                    }
                    try {
                        G = M.fn.call(L, B, M.obj);
                    } catch(F) {
                        this.lastError = F;
                        if (A) {
                            throw F;
                        }
                    }
                } else {
                    try {
                        G = M.fn.call(L, this.type, I, M.obj);
                    } catch(H) {
                        this.lastError = H;
                        if (A) {
                            throw H;
                        }
                    }
                }
                if (false === G) {
                    if (!this.silent) {}
                    break;
                }
            }
        }
        return (G !== false);
    },
    unsubscribeAll: function() {
        for (var A = this.subscribers.length - 1; A > -1; A--) {
            this._delete(A);
        }
        this.subscribers = [];
        return A;
    },
    _delete: function(A) {
        var B = this.subscribers[A];
        if (B) {
            delete B.fn;
            delete B.obj;
        }
        this.subscribers.splice(A, 1);
    },
    toString: function() {
        return "CustomEvent: '" + this.type + "', scope: " + this.scope;
    }
};
YAHOO.util.Subscriber = function(B, C, A) {
    this.fn = B;
    this.obj = YAHOO.lang.isUndefined(C) ? null: C;
    this.override = A;
};
YAHOO.util.Subscriber.prototype.getScope = function(A) {
    if (this.override) {
        if (this.override === true) {
            return this.obj;
        } else {
            return this.override;
        }
    }
    return A;
};
YAHOO.util.Subscriber.prototype.contains = function(A, B) {
    if (B) {
        return (this.fn == A && this.obj == B);
    } else {
        return (this.fn == A);
    }
};
YAHOO.util.Subscriber.prototype.toString = function() {
    return "Subscriber { obj: " + this.obj + ", override: " + (this.override || "no") + " }";
};
if (!YAHOO.util.Event) {
    YAHOO.util.Event = function() {
        var H = false;
        var I = [];
        var J = [];
        var G = [];
        var E = [];
        var C = 0;
        var F = [];
        var B = [];
        var A = 0;
        var D = {
            63232 : 38,
            63233 : 40,
            63234 : 37,
            63235 : 39,
            63276 : 33,
            63277 : 34,
            25 : 9
        };
        return {
            POLL_RETRYS: 2000,
            POLL_INTERVAL: 20,
            EL: 0,
            TYPE: 1,
            FN: 2,
            WFN: 3,
            UNLOAD_OBJ: 3,
            ADJ_SCOPE: 4,
            OBJ: 5,
            OVERRIDE: 6,
            lastError: null,
            isSafari: YAHOO.env.ua.webkit,
            webkit: YAHOO.env.ua.webkit,
            isIE: YAHOO.env.ua.ie,
            _interval: null,
            _dri: null,
            DOMReady: false,
            throwErrors: false,
            startInterval: function() {
                if (!this._interval) {
                    var K = this;
                    var L = function() {
                        K._tryPreloadAttach();
                    };
                    this._interval = setInterval(L, this.POLL_INTERVAL);
                }
            },
            onAvailable: function(P, M, Q, O, N) {
                var K = (YAHOO.lang.isString(P)) ? [P] : P;
                for (var L = 0; L < K.length; L = L + 1) {
                    F.push({
                        id: K[L],
                        fn: M,
                        obj: Q,
                        override: O,
                        checkReady: N
                    });
                }
                C = this.POLL_RETRYS;
                this.startInterval();
            },
            onContentReady: function(M, K, N, L) {
                this.onAvailable(M, K, N, L, true);
            },
            onDOMReady: function(K, M, L) {
                if (this.DOMReady) {
                    setTimeout(function() {
                        var N = window;
                        if (L) {
                            if (L === true) {
                                N = M;
                            } else {
                                N = L;
                            }
                        }
                        K.call(N, "DOMReady", [], M);
                    },
                    0);
                } else {
                    this.DOMReadyEvent.subscribe(K, M, L);
                }
            },
            addListener: function(M, K, V, Q, L) {
                if (!V || !V.call) {
                    return false;
                }
                if (this._isValidCollection(M)) {
                    var W = true;
                    for (var R = 0,
                    T = M.length; R < T; ++R) {
                        W = this.on(M[R], K, V, Q, L) && W;
                    }
                    return W;
                } else {
                    if (YAHOO.lang.isString(M)) {
                        var P = this.getEl(M);
                        if (P) {
                            M = P;
                        } else {
                            this.onAvailable(M,
                            function() {
                                YAHOO.util.Event.on(M, K, V, Q, L);
                            });
                            return true;
                        }
                    }
                }
                if (!M) {
                    return false;
                }
                if ("unload" == K && Q !== this) {
                    J[J.length] = [M, K, V, Q, L];
                    return true;
                }
                var Y = M;
                if (L) {
                    if (L === true) {
                        Y = Q;
                    } else {
                        Y = L;
                    }
                }
                var N = function(Z) {
                    return V.call(Y, YAHOO.util.Event.getEvent(Z, M), Q);
                };
                var X = [M, K, V, N, Y, Q, L];
                var S = I.length;
                I[S] = X;
                if (this.useLegacyEvent(M, K)) {
                    var O = this.getLegacyIndex(M, K);
                    if (O == -1 || M != G[O][0]) {
                        O = G.length;
                        B[M.id + K] = O;
                        G[O] = [M, K, M["on" + K]];
                        E[O] = [];
                        M["on" + K] = function(Z) {
                            YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(Z), O);
                        };
                    }
                    E[O].push(X);
                } else {
                    try {
                        this._simpleAdd(M, K, N, false);
                    } catch(U) {
                        this.lastError = U;
                        this.removeListener(M, K, V);
                        return false;
                    }
                }
                return true;
            },
            fireLegacyEvent: function(O, M) {
                var Q = true,
                K, S, R, T, P;
                S = E[M].slice();
                for (var L = 0,
                N = S.length; L < N; ++L) {
                    R = S[L];
                    if (R && R[this.WFN]) {
                        T = R[this.ADJ_SCOPE];
                        P = R[this.WFN].call(T, O);
                        Q = (Q && P);
                    }
                }
                K = G[M];
                if (K && K[2]) {
                    K[2](O);
                }
                return Q;
            },
            getLegacyIndex: function(L, M) {
                var K = this.generateId(L) + M;
                if (typeof B[K] == "undefined") {
                    return - 1;
                } else {
                    return B[K];
                }
            },
            useLegacyEvent: function(L, M) {
                if (this.webkit && ("click" == M || "dblclick" == M)) {
                    var K = parseInt(this.webkit, 10);
                    if (!isNaN(K) && K < 418) {
                        return true;
                    }
                }
                return false;
            },
            removeListener: function(L, K, T) {
                var O, R, V;
                if (typeof L == "string") {
                    L = this.getEl(L);
                } else {
                    if (this._isValidCollection(L)) {
                        var U = true;
                        for (O = L.length - 1; O > -1; O--) {
                            U = (this.removeListener(L[O], K, T) && U);
                        }
                        return U;
                    }
                }
                if (!T || !T.call) {
                    return this.purgeElement(L, false, K);
                }
                if ("unload" == K) {
                    for (O = J.length - 1; O > -1; O--) {
                        V = J[O];
                        if (V && V[0] == L && V[1] == K && V[2] == T) {
                            J.splice(O, 1);
                            return true;
                        }
                    }
                    return false;
                }
                var P = null;
                var Q = arguments[3];
                if ("undefined" === typeof Q) {
                    Q = this._getCacheIndex(L, K, T);
                }
                if (Q >= 0) {
                    P = I[Q];
                }
                if (!L || !P) {
                    return false;
                }
                if (this.useLegacyEvent(L, K)) {
                    var N = this.getLegacyIndex(L, K);
                    var M = E[N];
                    if (M) {
                        for (O = 0, R = M.length; O < R; ++O) {
                            V = M[O];
                            if (V && V[this.EL] == L && V[this.TYPE] == K && V[this.FN] == T) {
                                M.splice(O, 1);
                                break;
                            }
                        }
                    }
                } else {
                    try {
                        this._simpleRemove(L, K, P[this.WFN], false);
                    } catch(S) {
                        this.lastError = S;
                        return false;
                    }
                }
                delete I[Q][this.WFN];
                delete I[Q][this.FN];
                I.splice(Q, 1);
                return true;
            },
            getTarget: function(M, L) {
                var K = M.target || M.srcElement;
                return this.resolveTextNode(K);
            },
            resolveTextNode: function(L) {
                try {
                    if (L && 3 == L.nodeType) {
                        return L.parentNode;
                    }
                } catch(K) {}
                return L;
            },
            getPageX: function(L) {
                var K = L.pageX;
                if (!K && 0 !== K) {
                    K = L.clientX || 0;
                    if (this.isIE) {
                        K += this._getScrollLeft();
                    }
                }
                return K;
            },
            getPageY: function(K) {
                var L = K.pageY;
                if (!L && 0 !== L) {
                    L = K.clientY || 0;
                    if (this.isIE) {
                        L += this._getScrollTop();
                    }
                }
                return L;
            },
            getXY: function(K) {
                return [this.getPageX(K), this.getPageY(K)];
            },
            getRelatedTarget: function(L) {
                var K = L.relatedTarget;
                if (!K) {
                    if (L.type == "mouseout") {
                        K = L.toElement;
                    } else {
                        if (L.type == "mouseover") {
                            K = L.fromElement;
                        }
                    }
                }
                return this.resolveTextNode(K);
            },
            getTime: function(M) {
                if (!M.time) {
                    var L = new Date().getTime();
                    try {
                        M.time = L;
                    } catch(K) {
                        this.lastError = K;
                        return L;
                    }
                }
                return M.time;
            },
            stopEvent: function(K) {
                this.stopPropagation(K);
                this.preventDefault(K);
            },
            stopPropagation: function(K) {
                if (K.stopPropagation) {
                    K.stopPropagation();
                } else {
                    K.cancelBubble = true;
                }
            },
            preventDefault: function(K) {
                if (K.preventDefault) {
                    K.preventDefault();
                } else {
                    K.returnValue = false;
                }
            },
            getEvent: function(M, K) {
                var L = M || window.event;
                if (!L) {
                    var N = this.getEvent.caller;
                    while (N) {
                        L = N.arguments[0];
                        if (L && Event == L.constructor) {
                            break;
                        }
                        N = N.caller;
                    }
                }
                return L;
            },
            getCharCode: function(L) {
                var K = L.keyCode || L.charCode || 0;
                if (YAHOO.env.ua.webkit && (K in D)) {
                    K = D[K];
                }
                return K;
            },
            _getCacheIndex: function(O, P, N) {
                for (var M = 0,
                L = I.length;
                M < L; M = M + 1) {
                    var K = I[M];
                    if (K && K[this.FN] == N && K[this.EL] == O && K[this.TYPE] == P) {
                        return M;
                    }
                }
                return - 1;
            },
            generateId: function(K) {
                var L = K.id;
                if (!L) {
                    L = "yuievtautoid-" + A; ++A;
                    K.id = L;
                }
                return L;
            },
            _isValidCollection: function(L) {
                try {
                    return (L && typeof L !== "string" && L.length && !L.tagName && !L.alert && typeof L[0] !== "undefined");
                } catch(K) {
                    return false;
                }
            },
            elCache: {},
            getEl: function(K) {
                return (typeof K === "string") ? document.getElementById(K) : K;
            },
            clearCache: function() {},
            DOMReadyEvent: new YAHOO.util.CustomEvent("DOMReady", this),
            _load: function(L) {
                if (!H) {
                    H = true;
                    var K = YAHOO.util.Event;
                    K._ready();
                    K._tryPreloadAttach();
                }
            },
            _ready: function(L) {
                var K = YAHOO.util.Event;
                if (!K.DOMReady) {
                    K.DOMReady = true;
                    K.DOMReadyEvent.fire();
                    K._simpleRemove(document, "DOMContentLoaded", K._ready);
                }
            },
            _tryPreloadAttach: function() {
                if (F.length === 0) {
                    C = 0;
                    clearInterval(this._interval);
                    this._interval = null;
                    return;
                }
                if (this.locked) {
                    return;
                }
                if (this.isIE) {
                    if (!this.DOMReady) {
                        this.startInterval();
                        return;
                    }
                }
                this.locked = true;
                var Q = !H;
                if (!Q) {
                    Q = (C > 0 && F.length > 0);
                }
                var P = [];
                var R = function(T, U) {
                    var S = T;
                    if (U.override) {
                        if (U.override === true) {
                            S = U.obj;
                        } else {
                            S = U.override;
                        }
                    }
                    U.fn.call(S, U.obj);
                };
                var L, K, O, N, M = [];
                for (L = 0, K = F.length; L < K; L = L + 1) {
                    O = F[L];
                    if (O) {
                        N = this.getEl(O.id);
                        if (N) {
                            if (O.checkReady) {
                                if (H || N.nextSibling || !Q) {
                                    M.push(O);
                                    F[L] = null;
                                }
                            } else {
                                R(N, O);
                                F[L] = null;
                            }
                        } else {
                            P.push(O);
                        }
                    }
                }
                for (L = 0, K = M.length; L < K; L = L + 1) {
                    O = M[L];
                    R(this.getEl(O.id), O);
                }
                C--;
                if (Q) {
                    for (L = F.length - 1; L > -1; L--) {
                        O = F[L];
                        if (!O || !O.id) {
                            F.splice(L, 1);
                        }
                    }
                    this.startInterval();
                } else {
                    clearInterval(this._interval);
                    this._interval = null;
                }
                this.locked = false;
            },
            purgeElement: function(O, P, R) {
                var M = (YAHOO.lang.isString(O)) ? this.getEl(O) : O;
                var Q = this.getListeners(M, R),
                N,
                K;
                if (Q) {
                    for (N = Q.length - 1; N > -1; N--) {
                        var L = Q[N];
                        this.removeListener(M, L.type, L.fn);
                    }
                }
                if (P && M && M.childNodes) {
                    for (N = 0, K = M.childNodes.length; N < K; ++N) {
                        this.purgeElement(M.childNodes[N], P, R);
                    }
                }
            },
            getListeners: function(M, K) {
                var P = [],
                L;
                if (!K) {
                    L = [I, J];
                } else {
                    if (K === "unload") {
                        L = [J];
                    } else {
                        L = [I];
                    }
                }
                var R = (YAHOO.lang.isString(M)) ? this.getEl(M) : M;
                for (var O = 0; O < L.length; O = O + 1) {
                    var T = L[O];
                    if (T) {
                        for (var Q = 0,
                        S = T.length;
                        Q < S; ++Q) {
                            var N = T[Q];
                            if (N && N[this.EL] === R && (!K || K === N[this.TYPE])) {
                                P.push({
                                    type: N[this.TYPE],
                                    fn: N[this.FN],
                                    obj: N[this.OBJ],
                                    adjust: N[this.OVERRIDE],
                                    scope: N[this.ADJ_SCOPE],
                                    index: Q
                                });
                            }
                        }
                    }
                }
                return (P.length) ? P: null;
            },
            _unload: function(Q) {
                var K = YAHOO.util.Event,
                N, M, L, P, O, R = J.slice();
                for (N = 0, P = J.length; N < P; ++N) {
                    L = R[N];
                    if (L) {
                        var S = window;
                        if (L[K.ADJ_SCOPE]) {
                            if (L[K.ADJ_SCOPE] === true) {
                                S = L[K.UNLOAD_OBJ];
                            } else {
                                S = L[K.ADJ_SCOPE];
                            }
                        }
                        L[K.FN].call(S, K.getEvent(Q, L[K.EL]), L[K.UNLOAD_OBJ]);
                        R[N] = null;
                        L = null;
                        S = null;
                    }
                }
                J = null;
                if (I) {
                    for (M = I.length - 1; M > -1; M--) {
                        L = I[M];
                        if (L) {
                            K.removeListener(L[K.EL], L[K.TYPE], L[K.FN], M);
                        }
                    }
                    L = null;
                }
                G = null;
                K._simpleRemove(window, "unload", K._unload);
            },
            _getScrollLeft: function() {
                return this._getScroll()[1];
            },
            _getScrollTop: function() {
                return this._getScroll()[0];
            },
            _getScroll: function() {
                var K = document.documentElement,
                L = document.body;
                if (K && (K.scrollTop || K.scrollLeft)) {
                    return [K.scrollTop, K.scrollLeft];
                } else {
                    if (L) {
                        return [L.scrollTop, L.scrollLeft];
                    } else {
                        return [0, 0];
                    }
                }
            },
            regCE: function() {},
            _simpleAdd: function() {
                if (window.addEventListener) {
                    return function(M, N, L, K) {
                        M.addEventListener(N, L, (K));
                    };
                } else {
                    if (window.attachEvent) {
                        return function(M, N, L, K) {
                            M.attachEvent("on" + N, L);
                        };
                    } else {
                        return function() {};
                    }
                }
            } (),
            _simpleRemove: function() {
                if (window.removeEventListener) {
                    return function(M, N, L, K) {
                        M.removeEventListener(N, L, (K));
                    };
                } else {
                    if (window.detachEvent) {
                        return function(L, M, K) {
                            L.detachEvent("on" + M, K);
                        };
                    } else {
                        return function() {};
                    }
                }
            } ()
        };
    } ();
    (function() {
        var EU = YAHOO.util.Event;
        EU.on = EU.addListener;
        if (EU.isIE) {
            YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach, YAHOO.util.Event, true);
            var n = document.createElement("p");
            EU._dri = setInterval(function() {
                try {
                    n.doScroll("left");
                    clearInterval(EU._dri);
                    EU._dri = null;
                    EU._ready();
                    n = null;
                } catch(ex) {}
            },
            EU.POLL_INTERVAL);
        } else {
            if (EU.webkit && EU.webkit < 525) {
                EU._dri = setInterval(function() {
                    var rs = document.readyState;
                    if ("loaded" == rs || "complete" == rs) {
                        clearInterval(EU._dri);
                        EU._dri = null;
                        EU._ready();
                    }
                },
                EU.POLL_INTERVAL);
            } else {
                EU._simpleAdd(document, "DOMContentLoaded", EU._ready);
            }
        }
        EU._simpleAdd(window, "load", EU._load);
        EU._simpleAdd(window, "unload", EU._unload);
        EU._tryPreloadAttach();
    })();
}
YAHOO.util.EventProvider = function() {};
YAHOO.util.EventProvider.prototype = {
    __yui_events: null,
    __yui_subscribers: null,
    subscribe: function(A, C, F, E) {
        this.__yui_events = this.__yui_events || {};
        var D = this.__yui_events[A];
        if (D) {
            D.subscribe(C, F, E);
        } else {
            this.__yui_subscribers = this.__yui_subscribers || {};
            var B = this.__yui_subscribers;
            if (!B[A]) {
                B[A] = [];
            }
            B[A].push({
                fn: C,
                obj: F,
                override: E
            });
        }
    },
    unsubscribe: function(C, E, G) {
        this.__yui_events = this.__yui_events || {};
        var A = this.__yui_events;
        if (C) {
            var F = A[C];
            if (F) {
                return F.unsubscribe(E, G);
            }
        } else {
            var B = true;
            for (var D in A) {
                if (YAHOO.lang.hasOwnProperty(A, D)) {
                    B = B && A[D].unsubscribe(E, G);
                }
            }
            return B;
        }
        return false;
    },
    unsubscribeAll: function(A) {
        return this.unsubscribe(A);
    },
    createEvent: function(G, D) {
        this.__yui_events = this.__yui_events || {};
        var A = D || {};
        var I = this.__yui_events;
        if (I[G]) {} else {
            var H = A.scope || this;
            var E = (A.silent);
            var B = new YAHOO.util.CustomEvent(G, H, E, YAHOO.util.CustomEvent.FLAT);
            I[G] = B;
            if (A.onSubscribeCallback) {
                B.subscribeEvent.subscribe(A.onSubscribeCallback);
            }
            this.__yui_subscribers = this.__yui_subscribers || {};
            var F = this.__yui_subscribers[G];
            if (F) {
                for (var C = 0; C < F.length; ++C) {
                    B.subscribe(F[C].fn, F[C].obj, F[C].override);
                }
            }
        }
        return I[G];
    },
    fireEvent: function(E, D, A, C) {
        this.__yui_events = this.__yui_events || {};
        var G = this.__yui_events[E];
        if (!G) {
            return null;
        }
        var B = [];
        for (var F = 1; F < arguments.length; ++F) {
            B.push(arguments[F]);
        }
        return G.fire.apply(G, B);
    },
    hasEvent: function(A) {
        if (this.__yui_events) {
            if (this.__yui_events[A]) {
                return true;
            }
        }
        return false;
    }
};
YAHOO.util.KeyListener = function(A, F, B, C) {
    if (!A) {} else {
        if (!F) {} else {
            if (!B) {}
        }
    }
    if (!C) {
        C = YAHOO.util.KeyListener.KEYDOWN;
    }
    var D = new YAHOO.util.CustomEvent("keyPressed");
    this.enabledEvent = new YAHOO.util.CustomEvent("enabled");
    this.disabledEvent = new YAHOO.util.CustomEvent("disabled");
    if (typeof A == "string") {
        A = document.getElementById(A);
    }
    if (typeof B == "function") {
        D.subscribe(B);
    } else {
        D.subscribe(B.fn, B.scope, B.correctScope);
    }
    function E(J, I) {
        if (!F.shift) {
            F.shift = false;
        }
        if (!F.alt) {
            F.alt = false;
        }
        if (!F.ctrl) {
            F.ctrl = false;
        }
        if (J.shiftKey == F.shift && J.altKey == F.alt && J.ctrlKey == F.ctrl) {
            var G;
            if (F.keys instanceof Array) {
                for (var H = 0;
                H < F.keys.length; H++) {
                    G = F.keys[H];
                    if (G == J.charCode) {
                        D.fire(J.charCode, J);
                        break;
                    } else {
                        if (G == J.keyCode) {
                            D.fire(J.keyCode, J);
                            break;
                        }
                    }
                }
            } else {
                G = F.keys;
                if (G == J.charCode) {
                    D.fire(J.charCode, J);
                } else {
                    if (G == J.keyCode) {
                        D.fire(J.keyCode, J);
                    }
                }
            }
        }
    }
    this.enable = function() {
        if (!this.enabled) {
            YAHOO.util.Event.addListener(A, C, E);
            this.enabledEvent.fire(F);
        }
        this.enabled = true;
    };
    this.disable = function() {
        if (this.enabled) {
            YAHOO.util.Event.removeListener(A, C, E);
            this.disabledEvent.fire(F);
        }
        this.enabled = false;
    };
    this.toString = function() {
        return "KeyListener [" + F.keys + "] " + A.tagName + (A.id ? "[" + A.id + "]": "");
    };
};
YAHOO.util.KeyListener.KEYDOWN = "keydown";
YAHOO.util.KeyListener.KEYUP = "keyup";
YAHOO.util.KeyListener.KEY = {
    ALT: 18,
    BACK_SPACE: 8,
    CAPS_LOCK: 20,
    CONTROL: 17,
    DELETE: 46,
    DOWN: 40,
    END: 35,
    ENTER: 13,
    ESCAPE: 27,
    HOME: 36,
    LEFT: 37,
    META: 224,
    NUM_LOCK: 144,
    PAGE_DOWN: 34,
    PAGE_UP: 33,
    PAUSE: 19,
    PRINTSCREEN: 44,
    RIGHT: 39,
    SCROLL_LOCK: 145,
    SHIFT: 16,
    SPACE: 32,
    TAB: 9,
    UP: 38
};
YAHOO.register("event", YAHOO.util.Event, {
    version: "2.5.2",
    build: "1076"
});
YAHOO.register("yahoo-dom-event", YAHOO, {
    version: "2.5.2",
    build: "1076"
});
/*############ End common/js/yahoo/yahoo-dom-event.js ############*/
/*############ Begin common/js/yahoo/yui-calendar.js ############*/
(function() {
    YAHOO.util.Config = function(owner) {
        if (owner) {
            this.init(owner);
        }
    };
    var Lang = YAHOO.lang,
    CustomEvent = YAHOO.util.CustomEvent,
    Config = YAHOO.util.Config;
    Config.CONFIG_CHANGED_EVENT = "configChanged";
    Config.BOOLEAN_TYPE = "boolean";
    Config.prototype = {
        owner: null,
        queueInProgress: false,
        config: null,
        initialConfig: null,
        eventQueue: null,
        configChangedEvent: null,
        init: function(owner) {
            this.owner = owner;
            this.configChangedEvent = this.createEvent(Config.CONFIG_CHANGED_EVENT);
            this.configChangedEvent.signature = CustomEvent.LIST;
            this.queueInProgress = false;
            this.config = {};
            this.initialConfig = {};
            this.eventQueue = [];
        },
        checkBoolean: function(val) {
            return (typeof val == Config.BOOLEAN_TYPE);
        },
        checkNumber: function(val) {
            return (!isNaN(val));
        },
        fireEvent: function(key, value) {
            var property = this.config[key];
            if (property && property.event) {
                property.event.fire(value);
            }
        },
        addProperty: function(key, propertyObject) {
            key = key.toLowerCase();
            this.config[key] = propertyObject;
            propertyObject.event = this.createEvent(key, {
                scope: this.owner
            });
            propertyObject.event.signature = CustomEvent.LIST;
            propertyObject.key = key;
            if (propertyObject.handler) {
                propertyObject.event.subscribe(propertyObject.handler, this.owner);
            }
            this.setProperty(key, propertyObject.value, true);
            if (!propertyObject.suppressEvent) {
                this.queueProperty(key, propertyObject.value);
            }
        },
        getConfig: function() {
            var cfg = {},
            prop, property;
            for (prop in this.config) {
                property = this.config[prop];
                if (property && property.event) {
                    cfg[prop] = property.value;
                }
            }
            return cfg;
        },
        getProperty: function(key) {
            var property = this.config[key.toLowerCase()];
            if (property && property.event) {
                return property.value;
            } else {
                return undefined;
            }
        },
        resetProperty: function(key) {
            key = key.toLowerCase();
            var property = this.config[key];
            if (property && property.event) {
                if (this.initialConfig[key] && !Lang.isUndefined(this.initialConfig[key])) {
                    this.setProperty(key, this.initialConfig[key]);
                    return true;
                }
            } else {
                return false;
            }
        },
        setProperty: function(key, value, silent) {
            var property;
            key = key.toLowerCase();
            if (this.queueInProgress && !silent) {
                this.queueProperty(key, value);
                return true;
            } else {
                property = this.config[key];
                if (property && property.event) {
                    if (property.validator && !property.validator(value)) {
                        return false;
                    } else {
                        property.value = value;
                        if (!silent) {
                            this.fireEvent(key, value);
                            this.configChangedEvent.fire([key, value]);
                        }
                        return true;
                    }
                } else {
                    return false;
                }
            }
        },
        queueProperty: function(key, value) {
            key = key.toLowerCase();
            var property = this.config[key],
            foundDuplicate = false,
            iLen,
            queueItem,
            queueItemKey,
            queueItemValue,
            sLen,
            supercedesCheck,
            qLen,
            queueItemCheck,
            queueItemCheckKey,
            queueItemCheckValue,
            i,
            s,
            q;
            if (property && property.event) {
                if (!Lang.isUndefined(value) && property.validator && !property.validator(value)) {
                    return false;
                } else {
                    if (!Lang.isUndefined(value)) {
                        property.value = value;
                    } else {
                        value = property.value;
                    }
                    foundDuplicate = false;
                    iLen = this.eventQueue.length;
                    for (i = 0; i < iLen; i++) {
                        queueItem = this.eventQueue[i];
                        if (queueItem) {
                            queueItemKey = queueItem[0];
                            queueItemValue = queueItem[1];
                            if (queueItemKey == key) {
                                this.eventQueue[i] = null;
                                this.eventQueue.push([key, (!Lang.isUndefined(value) ? value: queueItemValue)]);
                                foundDuplicate = true;
                                break;
                            }
                        }
                    }
                    if (!foundDuplicate && !Lang.isUndefined(value)) {
                        this.eventQueue.push([key, value]);
                    }
                }
                if (property.supercedes) {
                    sLen = property.supercedes.length;
                    for (s = 0; s < sLen; s++) {
                        supercedesCheck = property.supercedes[s];
                        qLen = this.eventQueue.length;
                        for (q = 0; q < qLen; q++) {
                            queueItemCheck = this.eventQueue[q];
                            if (queueItemCheck) {
                                queueItemCheckKey = queueItemCheck[0];
                                queueItemCheckValue = queueItemCheck[1];
                                if (queueItemCheckKey == supercedesCheck.toLowerCase()) {
                                    this.eventQueue.push([queueItemCheckKey, queueItemCheckValue]);
                                    this.eventQueue[q] = null;
                                    break;
                                }
                            }
                        }
                    }
                }
                return true;
            } else {
                return false;
            }
        },
        refireEvent: function(key) {
            key = key.toLowerCase();
            var property = this.config[key];
            if (property && property.event && !Lang.isUndefined(property.value)) {
                if (this.queueInProgress) {
                    this.queueProperty(key);
                } else {
                    this.fireEvent(key, property.value);
                }
            }
        },
        applyConfig: function(userConfig, init) {
            var sKey, oConfig;
            if (init) {
                oConfig = {};
                for (sKey in userConfig) {
                    if (Lang.hasOwnProperty(userConfig, sKey)) {
                        oConfig[sKey.toLowerCase()] = userConfig[sKey];
                    }
                }
                this.initialConfig = oConfig;
            }
            for (sKey in userConfig) {
                if (Lang.hasOwnProperty(userConfig, sKey)) {
                    this.queueProperty(sKey, userConfig[sKey]);
                }
            }
        },
        refresh: function() {
            var prop;
            for (prop in this.config) {
                this.refireEvent(prop);
            }
        },
        fireQueue: function() {
            var i, queueItem, key, value, property;
            this.queueInProgress = true;
            for (i = 0; i < this.eventQueue.length; i++) {
                queueItem = this.eventQueue[i];
                if (queueItem) {
                    key = queueItem[0];
                    value = queueItem[1];
                    property = this.config[key];
                    property.value = value;
                    this.fireEvent(key, value);
                }
            }
            this.queueInProgress = false;
            this.eventQueue = [];
        },
        subscribeToConfigEvent: function(key, handler, obj, override) {
            var property = this.config[key.toLowerCase()];
            if (property && property.event) {
                if (!Config.alreadySubscribed(property.event, handler, obj)) {
                    property.event.subscribe(handler, obj, override);
                }
                return true;
            } else {
                return false;
            }
        },
        unsubscribeFromConfigEvent: function(key, handler, obj) {
            var property = this.config[key.toLowerCase()];
            if (property && property.event) {
                return property.event.unsubscribe(handler, obj);
            } else {
                return false;
            }
        },
        toString: function() {
            var output = "Config";
            if (this.owner) {
                output += " [" + this.owner.toString() + "]";
            }
            return output;
        },
        outputEventQueue: function() {
            var output = "",
            queueItem, q, nQueue = this.eventQueue.length;
            for (q = 0; q < nQueue; q++) {
                queueItem = this.eventQueue[q];
                if (queueItem) {
                    output += queueItem[0] + "=" + queueItem[1] + ", ";
                }
            }
            return output;
        },
        destroy: function() {
            var oConfig = this.config,
            sProperty, oProperty;
            for (sProperty in oConfig) {
                if (Lang.hasOwnProperty(oConfig, sProperty)) {
                    oProperty = oConfig[sProperty];
                    oProperty.event.unsubscribeAll();
                    oProperty.event = null;
                }
            }
            this.configChangedEvent.unsubscribeAll();
            this.configChangedEvent = null;
            this.owner = null;
            this.config = null;
            this.initialConfig = null;
            this.eventQueue = null;
        }
    };
    Config.alreadySubscribed = function(evt, fn, obj) {
        var nSubscribers = evt.subscribers.length,
        subsc, i;
        if (nSubscribers > 0) {
            i = nSubscribers - 1;
            do {
                subsc = evt.subscribers[i];
                if (subsc && subsc.obj == obj && subsc.fn == fn) {
                    return true;
                }
            } while ( i --);
        }
        return false;
    };
    YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider);
} ());
YAHOO.widget.DateMath = {
    DAY: "D",
    WEEK: "W",
    YEAR: "Y",
    MONTH: "M",
    ONE_DAY_MS: 1000 * 60 * 60 * 24,
    WEEK_ONE_JAN_DATE: 1,
    add: function(date, field, amount) {
        var d = new Date(date.getTime());
        switch (field) {
        case this.MONTH:
            var newMonth = date.getMonth() + amount;
            var years = 0;
            if (newMonth < 0) {
                while (newMonth < 0) {
                    newMonth += 12;
                    years -= 1;
                }
            } else {
                if (newMonth > 11) {
                    while (newMonth > 11) {
                        newMonth -= 12;
                        years += 1;
                    }
                }
            }
            d.setMonth(newMonth);
            d.setFullYear(date.getFullYear() + years);
            break;
        case this.DAY:
            this._addDays(d, amount);
            break;
        case this.YEAR:
            d.setFullYear(date.getFullYear() + amount);
            break;
        case this.WEEK:
            this._addDays(d, (amount * 7));
            break;
        }
        return d;
    },
    _addDays: function(d, nDays) {
        if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420) {
            if (nDays < 0) {
                for (var min = -128; nDays < min; nDays -= min) {
                    d.setDate(d.getDate() + min);
                }
            } else {
                for (var max = 96; nDays > max; nDays -= max) {
                    d.setDate(d.getDate() + max);
                }
            }
        }
        d.setDate(d.getDate() + nDays);
    },
    subtract: function(date, field, amount) {
        return this.add(date, field, (amount * -1));
    },
    before: function(date, compareTo) {
        var ms = compareTo.getTime();
        if (date.getTime() < ms) {
            return true;
        } else {
            return false;
        }
    },
    after: function(date, compareTo) {
        var ms = compareTo.getTime();
        if (date.getTime() > ms) {
            return true;
        } else {
            return false;
        }
    },
    between: function(date, dateBegin, dateEnd) {
        if (this.after(date, dateBegin) && this.before(date, dateEnd)) {
            return true;
        } else {
            return false;
        }
    },
    getJan1: function(calendarYear) {
        return this.getDate(calendarYear, 0, 1);
    },
    getDayOffset: function(date, calendarYear) {
        var beginYear = this.getJan1(calendarYear);
        var dayOffset = Math.ceil((date.getTime() - beginYear.getTime()) / this.ONE_DAY_MS);
        return dayOffset;
    },
    getWeekNumber: function(date, firstDayOfWeek, janDate) {
        firstDayOfWeek = firstDayOfWeek || 0;
        janDate = janDate || this.WEEK_ONE_JAN_DATE;
        var targetDate = this.clearTime(date),
        startOfWeek,
        endOfWeek;
        if (targetDate.getDay() === firstDayOfWeek) {
            startOfWeek = targetDate;
        } else {
            startOfWeek = this.getFirstDayOfWeek(targetDate, firstDayOfWeek);
        }
        var startYear = startOfWeek.getFullYear(),
        startTime = startOfWeek.getTime();
        endOfWeek = new Date(startOfWeek.getTime() + 6 * this.ONE_DAY_MS);
        var weekNum;
        if (startYear !== endOfWeek.getFullYear() && endOfWeek.getDate() >= janDate) {
            weekNum = 1;
        } else {
            var weekOne = this.clearTime(this.getDate(startYear, 0, janDate)),
            weekOneDayOne = this.getFirstDayOfWeek(weekOne, firstDayOfWeek);
            var daysDiff = Math.round((targetDate.getTime() - weekOneDayOne.getTime()) / this.ONE_DAY_MS);
            var rem = daysDiff % 7;
            var weeksDiff = (daysDiff - rem) / 7;
            weekNum = weeksDiff + 1;
        }
        return weekNum;
    },
    getFirstDayOfWeek: function(dt, startOfWeek) {
        startOfWeek = startOfWeek || 0;
        var dayOfWeekIndex = dt.getDay(),
        dayOfWeek = (dayOfWeekIndex - startOfWeek + 7) % 7;
        return this.subtract(dt, this.DAY, dayOfWeek);
    },
    isYearOverlapWeek: function(weekBeginDate) {
        var overlaps = false;
        var nextWeek = this.add(weekBeginDate, this.DAY, 6);
        if (nextWeek.getFullYear() != weekBeginDate.getFullYear()) {
            overlaps = true;
        }
        return overlaps;
    },
    isMonthOverlapWeek: function(weekBeginDate) {
        var overlaps = false;
        var nextWeek = this.add(weekBeginDate, this.DAY, 6);
        if (nextWeek.getMonth() != weekBeginDate.getMonth()) {
            overlaps = true;
        }
        return overlaps;
    },
    findMonthStart: function(date) {
        var start = this.getDate(date.getFullYear(), date.getMonth(), 1);
        return start;
    },
    findMonthEnd: function(date) {
        var start = this.findMonthStart(date);
        var nextMonth = this.add(start, this.MONTH, 1);
        var end = this.subtract(nextMonth, this.DAY, 1);
        return end;
    },
    clearTime: function(date) {
        date.setHours(12, 0, 0, 0);
        return date;
    },
    getDate: function(y, m, d) {
        var dt = null;
        if (YAHOO.lang.isUndefined(d)) {
            d = 1;
        }
        if (y >= 100) {
            dt = new Date(y, m, d);
        } else {
            dt = new Date();
            dt.setFullYear(y);
            dt.setMonth(m);
            dt.setDate(d);
            dt.setHours(0, 0, 0, 0);
        }
        return dt;
    }
};
YAHOO.widget.Calendar = function(id, containerId, config) {
    this.init.apply(this, arguments);
};
YAHOO.widget.Calendar.IMG_ROOT = null;
YAHOO.widget.Calendar.DATE = "D";
YAHOO.widget.Calendar.MONTH_DAY = "MD";
YAHOO.widget.Calendar.WEEKDAY = "WD";
YAHOO.widget.Calendar.RANGE = "R";
YAHOO.widget.Calendar.MONTH = "M";
YAHOO.widget.Calendar.DISPLAY_DAYS = 42;
YAHOO.widget.Calendar.STOP_RENDER = "S";
YAHOO.widget.Calendar.SHORT = "short";
YAHOO.widget.Calendar.LONG = "long";
YAHOO.widget.Calendar.MEDIUM = "medium";
YAHOO.widget.Calendar.ONE_CHAR = "1char";
YAHOO.widget.Calendar._DEFAULT_CONFIG = {
    PAGEDATE: {
        key: "pagedate",
        value: null
    },
    SELECTED: {
        key: "selected",
        value: null
    },
    TITLE: {
        key: "title",
        value: ""
    },
    CLOSE: {
        key: "close",
        value: false
    },
    IFRAME: {
        key: "iframe",
        value: (YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) ? true: false
    },
    MINDATE: {
        key: "mindate",
        value: null
    },
    MAXDATE: {
        key: "maxdate",
        value: null
    },
    MULTI_SELECT: {
        key: "multi_select",
        value: false
    },
    START_WEEKDAY: {
        key: "start_weekday",
        value: 0
    },
    SHOW_WEEKDAYS: {
        key: "show_weekdays",
        value: true
    },
    SHOW_WEEK_HEADER: {
        key: "show_week_header",
        value: false
    },
    SHOW_WEEK_FOOTER: {
        key: "show_week_footer",
        value: false
    },
    HIDE_BLANK_WEEKS: {
        key: "hide_blank_weeks",
        value: false
    },
    NAV_ARROW_LEFT: {
        key: "nav_arrow_left",
        value: null
    },
    NAV_ARROW_RIGHT: {
        key: "nav_arrow_right",
        value: null
    },
    MONTHS_SHORT: {
        key: "months_short",
        value: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
    },
    MONTHS_LONG: {
        key: "months_long",
        value: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
    },
    WEEKDAYS_1CHAR: {
        key: "weekdays_1char",
        value: ["S", "M", "T", "W", "T", "F", "S"]
    },
    WEEKDAYS_SHORT: {
        key: "weekdays_short",
        value: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
    },
    WEEKDAYS_MEDIUM: {
        key: "weekdays_medium",
        value: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
    },
    WEEKDAYS_LONG: {
        key: "weekdays_long",
        value: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
    },
    LOCALE_MONTHS: {
        key: "locale_months",
        value: "long"
    },
    LOCALE_WEEKDAYS: {
        key: "locale_weekdays",
        value: "short"
    },
    DATE_DELIMITER: {
        key: "date_delimiter",
        value: ","
    },
    DATE_FIELD_DELIMITER: {
        key: "date_field_delimiter",
        value: "/"
    },
    DATE_RANGE_DELIMITER: {
        key: "date_range_delimiter",
        value: "-"
    },
    MY_MONTH_POSITION: {
        key: "my_month_position",
        value: 1
    },
    MY_YEAR_POSITION: {
        key: "my_year_position",
        value: 2
    },
    MD_MONTH_POSITION: {
        key: "md_month_position",
        value: 1
    },
    MD_DAY_POSITION: {
        key: "md_day_position",
        value: 2
    },
    MDY_MONTH_POSITION: {
        key: "mdy_month_position",
        value: 1
    },
    MDY_DAY_POSITION: {
        key: "mdy_day_position",
        value: 2
    },
    MDY_YEAR_POSITION: {
        key: "mdy_year_position",
        value: 3
    },
    MY_LABEL_MONTH_POSITION: {
        key: "my_label_month_position",
        value: 1
    },
    MY_LABEL_YEAR_POSITION: {
        key: "my_label_year_position",
        value: 2
    },
    MY_LABEL_MONTH_SUFFIX: {
        key: "my_label_month_suffix",
        value: " "
    },
    MY_LABEL_YEAR_SUFFIX: {
        key: "my_label_year_suffix",
        value: ""
    },
    NAV: {
        key: "navigator",
        value: null
    }
};
YAHOO.widget.Calendar._EVENT_TYPES = {
    BEFORE_SELECT: "beforeSelect",
    SELECT: "select",
    BEFORE_DESELECT: "beforeDeselect",
    DESELECT: "deselect",
    CHANGE_PAGE: "changePage",
    BEFORE_RENDER: "beforeRender",
    RENDER: "render",
    RESET: "reset",
    CLEAR: "clear",
    BEFORE_HIDE: "beforeHide",
    HIDE: "hide",
    BEFORE_SHOW: "beforeShow",
    SHOW: "show",
    BEFORE_HIDE_NAV: "beforeHideNav",
    HIDE_NAV: "hideNav",
    BEFORE_SHOW_NAV: "beforeShowNav",
    SHOW_NAV: "showNav",
    BEFORE_RENDER_NAV: "beforeRenderNav",
    RENDER_NAV: "renderNav"
};
YAHOO.widget.Calendar._STYLES = {
    CSS_ROW_HEADER: "calrowhead",
    CSS_ROW_FOOTER: "calrowfoot",
    CSS_CELL: "calcell",
    CSS_CELL_SELECTOR: "selector",
    CSS_CELL_SELECTED: "selected",
    CSS_CELL_SELECTABLE: "selectable",
    CSS_CELL_RESTRICTED: "restricted",
    CSS_CELL_TODAY: "today",
    CSS_CELL_OOM: "oom",
    CSS_CELL_OOB: "previous",
    CSS_HEADER: "calheader",
    CSS_HEADER_TEXT: "calhead",
    CSS_BODY: "calbody",
    CSS_WEEKDAY_CELL: "calweekdaycell",
    CSS_WEEKDAY_ROW: "calweekdayrow",
    CSS_FOOTER: "calfoot",
    CSS_CALENDAR: "yui-calendar",
    CSS_SINGLE: "single",
    CSS_CONTAINER: "yui-calcontainer",
    CSS_NAV_LEFT: "calnavleft",
    CSS_NAV_RIGHT: "calnavright",
    CSS_NAV: "calnav",
    CSS_CLOSE: "calclose",
    CSS_CELL_TOP: "calcelltop",
    CSS_CELL_LEFT: "calcellleft",
    CSS_CELL_RIGHT: "calcellright",
    CSS_CELL_BOTTOM: "calcellbottom",
    CSS_CELL_HOVER: "calcellhover",
    CSS_CELL_HIGHLIGHT1: "highlight1",
    CSS_CELL_HIGHLIGHT2: "highlight2",
    CSS_CELL_HIGHLIGHT3: "highlight3",
    CSS_CELL_HIGHLIGHT4: "highlight4"
};
YAHOO.widget.Calendar.prototype = {
    Config: null,
    parent: null,
    index: -1,
    cells: null,
    cellDates: null,
    id: null,
    containerId: null,
    oDomContainer: null,
    today: null,
    renderStack: null,
    _renderStack: null,
    oNavigator: null,
    _selectedDates: null,
    domEventMap: null,
    _parseArgs: function(args) {
        var nArgs = {
            id: null,
            container: null,
            config: null
        };
        if (args && args.length && args.length > 0) {
            switch (args.length) {
            case 1:
                nArgs.id = null;
                nArgs.container = args[0];
                nArgs.config = null;
                break;
            case 2:
                if (YAHOO.lang.isObject(args[1]) && !args[1].tagName && !(args[1] instanceof String)) {
                    nArgs.id = null;
                    nArgs.container = args[0];
                    nArgs.config = args[1];
                } else {
                    nArgs.id = args[0];
                    nArgs.container = args[1];
                    nArgs.config = null;
                }
                break;
            default:
                nArgs.id = args[0];
                nArgs.container = args[1];
                nArgs.config = args[2];
                break;
            }
        } else {}
        return nArgs;
    },
    init: function(id, container, config) {
        var nArgs = this._parseArgs(arguments);
        id = nArgs.id;
        container = nArgs.container;
        config = nArgs.config;
        this.oDomContainer = YAHOO.util.Dom.get(container);
        if (!this.oDomContainer.id) {
            this.oDomContainer.id = YAHOO.util.Dom.generateId();
        }
        if (!id) {
            id = this.oDomContainer.id + "_t";
        }
        this.id = id;
        this.containerId = this.oDomContainer.id;
        this.initEvents();
        this.today = new Date();
        YAHOO.widget.DateMath.clearTime(this.today);
        this.cfg = new YAHOO.util.Config(this);
        this.Options = {};
        this.Locale = {};
        this.initStyles();
        YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);
        YAHOO.util.Dom.addClass(this.oDomContainer, this.Style.CSS_SINGLE);
        this.cellDates = [];
        this.cells = [];
        this.renderStack = [];
        this._renderStack = [];
        this.setupConfig();
        if (config) {
            this.cfg.applyConfig(config, true);
        }
        this.cfg.fireQueue();
    },
    configIframe: function(type, args, obj) {
        var useIframe = args[0];
        if (!this.parent) {
            if (YAHOO.util.Dom.inDocument(this.oDomContainer)) {
                if (useIframe) {
                    var pos = YAHOO.util.Dom.getStyle(this.oDomContainer, "position");
                    if (pos == "absolute" || pos == "relative") {
                        if (!YAHOO.util.Dom.inDocument(this.iframe)) {
                            this.iframe = document.createElement("iframe");
                            this.iframe.src = "javascript:false;";
                            YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");
                            if (YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) {
                                YAHOO.util.Dom.addClass(this.iframe, "fixedsize");
                            }
                            this.oDomContainer.insertBefore(this.iframe, this.oDomContainer.firstChild);
                        }
                    }
                } else {
                    if (this.iframe) {
                        if (this.iframe.parentNode) {
                            this.iframe.parentNode.removeChild(this.iframe);
                        }
                        this.iframe = null;
                    }
                }
            }
        }
    },
    configTitle: function(type, args, obj) {
        var title = args[0];
        if (title) {
            this.createTitleBar(title);
        } else {
            var close = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.CLOSE.key);
            if (!close) {
                this.removeTitleBar();
            } else {
                this.createTitleBar("&#160;");
            }
        }
    },
    configClose: function(type, args, obj) {
        var close = args[0],
        title = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.TITLE.key);
        if (close) {
            if (!title) {
                this.createTitleBar("&#160;");
            }
            this.createCloseButton();
        } else {
            this.removeCloseButton();
            if (!title) {
                this.removeTitleBar();
            }
        }
    },
    initEvents: function() {
        var defEvents = YAHOO.widget.Calendar._EVENT_TYPES;
        this.beforeSelectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT);
        this.selectEvent = new YAHOO.util.CustomEvent(defEvents.SELECT);
        this.beforeDeselectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT);
        this.deselectEvent = new YAHOO.util.CustomEvent(defEvents.DESELECT);
        this.changePageEvent = new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE);
        this.beforeRenderEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);
        this.renderEvent = new YAHOO.util.CustomEvent(defEvents.RENDER);
        this.resetEvent = new YAHOO.util.CustomEvent(defEvents.RESET);
        this.clearEvent = new YAHOO.util.CustomEvent(defEvents.CLEAR);
        this.beforeShowEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SHOW);
        this.showEvent = new YAHOO.util.CustomEvent(defEvents.SHOW);
        this.beforeHideEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_HIDE);
        this.hideEvent = new YAHOO.util.CustomEvent(defEvents.HIDE);
        this.beforeShowNavEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SHOW_NAV);
        this.showNavEvent = new YAHOO.util.CustomEvent(defEvents.SHOW_NAV);
        this.beforeHideNavEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_HIDE_NAV);
        this.hideNavEvent = new YAHOO.util.CustomEvent(defEvents.HIDE_NAV);
        this.beforeRenderNavEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER_NAV);
        this.renderNavEvent = new YAHOO.util.CustomEvent(defEvents.RENDER_NAV);
        this.beforeSelectEvent.subscribe(this.onBeforeSelect, this, true);
        this.selectEvent.subscribe(this.onSelect, this, true);
        this.beforeDeselectEvent.subscribe(this.onBeforeDeselect, this, true);
        this.deselectEvent.subscribe(this.onDeselect, this, true);
        this.changePageEvent.subscribe(this.onChangePage, this, true);
        this.renderEvent.subscribe(this.onRender, this, true);
        this.resetEvent.subscribe(this.onReset, this, true);
        this.clearEvent.subscribe(this.onClear, this, true);
    },
    doSelectCell: function(e, cal) {
        var cell, index, d, date;
        var target = YAHOO.util.Event.getTarget(e);
        var tagName = target.tagName.toLowerCase();
        var defSelector = false;
        while (tagName != "td" && !YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
            if (!defSelector && tagName == "a" && YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTOR)) {
                defSelector = true;
            }
            target = target.parentNode;
            tagName = target.tagName.toLowerCase();
            if (tagName == "html") {
                return;
            }
        }
        if (defSelector) {
            YAHOO.util.Event.preventDefault(e);
        }
        cell = target;
        if (YAHOO.util.Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
            index = cell.id.split("cell")[1];
            d = cal.cellDates[index];
            date = YAHOO.widget.DateMath.getDate(d[0], d[1] - 1, d[2]);
            var link;
            if (cal.Options.MULTI_SELECT) {
                link = cell.getElementsByTagName("a")[0];
                if (link) {
                    link.blur();
                }
                var cellDate = cal.cellDates[index];
                var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);
                if (cellDateIndex > -1) {
                    cal.deselectCell(index);
                } else {
                    cal.selectCell(index);
                }
            } else {
                link = cell.getElementsByTagName("a")[0];
                if (link) {
                    link.blur();
                }
                cal.selectCell(index);
            }
        }
    },
    doCellMouseOver: function(e, cal) {
        var target;
        if (e) {
            target = YAHOO.util.Event.getTarget(e);
        } else {
            target = this;
        }
        while (target.tagName && target.tagName.toLowerCase() != "td") {
            target = target.parentNode;
            if (!target.tagName || target.tagName.toLowerCase() == "html") {
                return;
            }
        }
        if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
            YAHOO.util.Dom.addClass(target, cal.Style.CSS_CELL_HOVER);
        }
    },
    doCellMouseOut: function(e, cal) {
        var target;
        if (e) {
            target = YAHOO.util.Event.getTarget(e);
        } else {
            target = this;
        }
        while (target.tagName && target.tagName.toLowerCase() != "td") {
            target = target.parentNode;
            if (!target.tagName || target.tagName.toLowerCase() == "html") {
                return;
            }
        }
        if (YAHOO.util.Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
            YAHOO.util.Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
        }
    },
    setupConfig: function() {
        var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
        this.cfg.addProperty(defCfg.PAGEDATE.key, {
            value: new Date(),
            handler: this.configPageDate
        });
        this.cfg.addProperty(defCfg.SELECTED.key, {
            value: [],
            handler: this.configSelected
        });
        this.cfg.addProperty(defCfg.TITLE.key, {
            value: defCfg.TITLE.value,
            handler: this.configTitle
        });
        this.cfg.addProperty(defCfg.CLOSE.key, {
            value: defCfg.CLOSE.value,
            handler: this.configClose
        });
        this.cfg.addProperty(defCfg.IFRAME.key, {
            value: defCfg.IFRAME.value,
            handler: this.configIframe,
            validator: this.cfg.checkBoolean
        });
        this.cfg.addProperty(defCfg.MINDATE.key, {
            value: defCfg.MINDATE.value,
            handler: this.configMinDate
        });
        this.cfg.addProperty(defCfg.MAXDATE.key, {
            value: defCfg.MAXDATE.value,
            handler: this.configMaxDate
        });
        this.cfg.addProperty(defCfg.MULTI_SELECT.key, {
            value: defCfg.MULTI_SELECT.value,
            handler: this.configOptions,
            validator: this.cfg.checkBoolean
        });
        this.cfg.addProperty(defCfg.START_WEEKDAY.key, {
            value: defCfg.START_WEEKDAY.value,
            handler: this.configOptions,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.SHOW_WEEKDAYS.key, {
            value: defCfg.SHOW_WEEKDAYS.value,
            handler: this.configOptions,
            validator: this.cfg.checkBoolean
        });
        this.cfg.addProperty(defCfg.SHOW_WEEK_HEADER.key, {
            value: defCfg.SHOW_WEEK_HEADER.value,
            handler: this.configOptions,
            validator: this.cfg.checkBoolean
        });
        this.cfg.addProperty(defCfg.SHOW_WEEK_FOOTER.key, {
            value: defCfg.SHOW_WEEK_FOOTER.value,
            handler: this.configOptions,
            validator: this.cfg.checkBoolean
        });
        this.cfg.addProperty(defCfg.HIDE_BLANK_WEEKS.key, {
            value: defCfg.HIDE_BLANK_WEEKS.value,
            handler: this.configOptions,
            validator: this.cfg.checkBoolean
        });
        this.cfg.addProperty(defCfg.NAV_ARROW_LEFT.key, {
            value: defCfg.NAV_ARROW_LEFT.value,
            handler: this.configOptions
        });
        this.cfg.addProperty(defCfg.NAV_ARROW_RIGHT.key, {
            value: defCfg.NAV_ARROW_RIGHT.value,
            handler: this.configOptions
        });
        this.cfg.addProperty(defCfg.MONTHS_SHORT.key, {
            value: defCfg.MONTHS_SHORT.value,
            handler: this.configLocale
        });
        this.cfg.addProperty(defCfg.MONTHS_LONG.key, {
            value: defCfg.MONTHS_LONG.value,
            handler: this.configLocale
        });
        this.cfg.addProperty(defCfg.WEEKDAYS_1CHAR.key, {
            value: defCfg.WEEKDAYS_1CHAR.value,
            handler: this.configLocale
        });
        this.cfg.addProperty(defCfg.WEEKDAYS_SHORT.key, {
            value: defCfg.WEEKDAYS_SHORT.value,
            handler: this.configLocale
        });
        this.cfg.addProperty(defCfg.WEEKDAYS_MEDIUM.key, {
            value: defCfg.WEEKDAYS_MEDIUM.value,
            handler: this.configLocale
        });
        this.cfg.addProperty(defCfg.WEEKDAYS_LONG.key, {
            value: defCfg.WEEKDAYS_LONG.value,
            handler: this.configLocale
        });
        var refreshLocale = function() {
            this.cfg.refireEvent(defCfg.LOCALE_MONTHS.key);
            this.cfg.refireEvent(defCfg.LOCALE_WEEKDAYS.key);
        };
        this.cfg.subscribeToConfigEvent(defCfg.START_WEEKDAY.key, refreshLocale, this, true);
        this.cfg.subscribeToConfigEvent(defCfg.MONTHS_SHORT.key, refreshLocale, this, true);
        this.cfg.subscribeToConfigEvent(defCfg.MONTHS_LONG.key, refreshLocale, this, true);
        this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_1CHAR.key, refreshLocale, this, true);
        this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_SHORT.key, refreshLocale, this, true);
        this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_MEDIUM.key, refreshLocale, this, true);
        this.cfg.subscribeToConfigEvent(defCfg.WEEKDAYS_LONG.key, refreshLocale, this, true);
        this.cfg.addProperty(defCfg.LOCALE_MONTHS.key, {
            value: defCfg.LOCALE_MONTHS.value,
            handler: this.configLocaleValues
        });
        this.cfg.addProperty(defCfg.LOCALE_WEEKDAYS.key, {
            value: defCfg.LOCALE_WEEKDAYS.value,
            handler: this.configLocaleValues
        });
        this.cfg.addProperty(defCfg.DATE_DELIMITER.key, {
            value: defCfg.DATE_DELIMITER.value,
            handler: this.configLocale
        });
        this.cfg.addProperty(defCfg.DATE_FIELD_DELIMITER.key, {
            value: defCfg.DATE_FIELD_DELIMITER.value,
            handler: this.configLocale
        });
        this.cfg.addProperty(defCfg.DATE_RANGE_DELIMITER.key, {
            value: defCfg.DATE_RANGE_DELIMITER.value,
            handler: this.configLocale
        });
        this.cfg.addProperty(defCfg.MY_MONTH_POSITION.key, {
            value: defCfg.MY_MONTH_POSITION.value,
            handler: this.configLocale,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MY_YEAR_POSITION.key, {
            value: defCfg.MY_YEAR_POSITION.value,
            handler: this.configLocale,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MD_MONTH_POSITION.key, {
            value: defCfg.MD_MONTH_POSITION.value,
            handler: this.configLocale,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MD_DAY_POSITION.key, {
            value: defCfg.MD_DAY_POSITION.value,
            handler: this.configLocale,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MDY_MONTH_POSITION.key, {
            value: defCfg.MDY_MONTH_POSITION.value,
            handler: this.configLocale,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MDY_DAY_POSITION.key, {
            value: defCfg.MDY_DAY_POSITION.value,
            handler: this.configLocale,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MDY_YEAR_POSITION.key, {
            value: defCfg.MDY_YEAR_POSITION.value,
            handler: this.configLocale,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MY_LABEL_MONTH_POSITION.key, {
            value: defCfg.MY_LABEL_MONTH_POSITION.value,
            handler: this.configLocale,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MY_LABEL_YEAR_POSITION.key, {
            value: defCfg.MY_LABEL_YEAR_POSITION.value,
            handler: this.configLocale,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MY_LABEL_MONTH_SUFFIX.key, {
            value: defCfg.MY_LABEL_MONTH_SUFFIX.value,
            handler: this.configLocale
        });
        this.cfg.addProperty(defCfg.MY_LABEL_YEAR_SUFFIX.key, {
            value: defCfg.MY_LABEL_YEAR_SUFFIX.value,
            handler: this.configLocale
        });
        this.cfg.addProperty(defCfg.NAV.key, {
            value: defCfg.NAV.value,
            handler: this.configNavigator
        });
    },
    configPageDate: function(type, args, obj) {
        this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key, this._parsePageDate(args[0]), true);
    },
    configMinDate: function(type, args, obj) {
        var val = args[0];
        if (YAHOO.lang.isString(val)) {
            val = this._parseDate(val);
            this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MINDATE.key, YAHOO.widget.DateMath.getDate(val[0], (val[1] - 1), val[2]));
        }
    },
    configMaxDate: function(type, args, obj) {
        var val = args[0];
        if (YAHOO.lang.isString(val)) {
            val = this._parseDate(val);
            this.cfg.setProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MAXDATE.key, YAHOO.widget.DateMath.getDate(val[0], (val[1] - 1), val[2]));
        }
    },
    configSelected: function(type, args, obj) {
        var selected = args[0];
        var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
        if (selected) {
            if (YAHOO.lang.isString(selected)) {
                this.cfg.setProperty(cfgSelected, this._parseDates(selected), true);
            }
        }
        if (!this._selectedDates) {
            this._selectedDates = this.cfg.getProperty(cfgSelected);
        }
    },
    configOptions: function(type, args, obj) {
        this.Options[type.toUpperCase()] = args[0];
    },
    configLocale: function(type, args, obj) {
        var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
        this.Locale[type.toUpperCase()] = args[0];
        this.cfg.refireEvent(defCfg.LOCALE_MONTHS.key);
        this.cfg.refireEvent(defCfg.LOCALE_WEEKDAYS.key);
    },
    configLocaleValues: function(type, args, obj) {
        var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
        type = type.toLowerCase();
        var val = args[0];
        switch (type) {
        case defCfg.LOCALE_MONTHS.key:
            switch (val) {
            case YAHOO.widget.Calendar.SHORT:
                this.Locale.LOCALE_MONTHS = this.cfg.getProperty(defCfg.MONTHS_SHORT.key).concat();
                break;
            case YAHOO.widget.Calendar.LONG:
                this.Locale.LOCALE_MONTHS = this.cfg.getProperty(defCfg.MONTHS_LONG.key).concat();
                break;
            }
            break;
        case defCfg.LOCALE_WEEKDAYS.key:
            switch (val) {
            case YAHOO.widget.Calendar.ONE_CHAR:
                this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_1CHAR.key).concat();
                break;
            case YAHOO.widget.Calendar.SHORT:
                this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_SHORT.key).concat();
                break;
            case YAHOO.widget.Calendar.MEDIUM:
                this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_MEDIUM.key).concat();
                break;
            case YAHOO.widget.Calendar.LONG:
                this.Locale.LOCALE_WEEKDAYS = this.cfg.getProperty(defCfg.WEEKDAYS_LONG.key).concat();
                break;
            }
            var START_WEEKDAY = this.cfg.getProperty(defCfg.START_WEEKDAY.key);
            if (START_WEEKDAY > 0) {
                for (var w = 0; w < START_WEEKDAY; ++w) {
                    this.Locale.LOCALE_WEEKDAYS.push(this.Locale.LOCALE_WEEKDAYS.shift());
                }
            }
            break;
        }
    },
    configNavigator: function(type, args, obj) {
        var val = args[0];
        if (YAHOO.widget.CalendarNavigator && (val === true || YAHOO.lang.isObject(val))) {
            if (!this.oNavigator) {
                this.oNavigator = new YAHOO.widget.CalendarNavigator(this);
                function erase() {
                    if (!this.pages) {
                        this.oNavigator.erase();
                    }
                }
                this.beforeRenderEvent.subscribe(erase, this, true);
            }
        } else {
            if (this.oNavigator) {
                this.oNavigator.destroy();
                this.oNavigator = null;
            }
        }
    },
    initStyles: function() {
        var defStyle = YAHOO.widget.Calendar._STYLES;
        this.Style = {
            CSS_ROW_HEADER: defStyle.CSS_ROW_HEADER,
            CSS_ROW_FOOTER: defStyle.CSS_ROW_FOOTER,
            CSS_CELL: defStyle.CSS_CELL,
            CSS_CELL_SELECTOR: defStyle.CSS_CELL_SELECTOR,
            CSS_CELL_SELECTED: defStyle.CSS_CELL_SELECTED,
            CSS_CELL_SELECTABLE: defStyle.CSS_CELL_SELECTABLE,
            CSS_CELL_RESTRICTED: defStyle.CSS_CELL_RESTRICTED,
            CSS_CELL_TODAY: defStyle.CSS_CELL_TODAY,
            CSS_CELL_OOM: defStyle.CSS_CELL_OOM,
            CSS_CELL_OOB: defStyle.CSS_CELL_OOB,
            CSS_HEADER: defStyle.CSS_HEADER,
            CSS_HEADER_TEXT: defStyle.CSS_HEADER_TEXT,
            CSS_BODY: defStyle.CSS_BODY,
            CSS_WEEKDAY_CELL: defStyle.CSS_WEEKDAY_CELL,
            CSS_WEEKDAY_ROW: defStyle.CSS_WEEKDAY_ROW,
            CSS_FOOTER: defStyle.CSS_FOOTER,
            CSS_CALENDAR: defStyle.CSS_CALENDAR,
            CSS_SINGLE: defStyle.CSS_SINGLE,
            CSS_CONTAINER: defStyle.CSS_CONTAINER,
            CSS_NAV_LEFT: defStyle.CSS_NAV_LEFT,
            CSS_NAV_RIGHT: defStyle.CSS_NAV_RIGHT,
            CSS_NAV: defStyle.CSS_NAV,
            CSS_CLOSE: defStyle.CSS_CLOSE,
            CSS_CELL_TOP: defStyle.CSS_CELL_TOP,
            CSS_CELL_LEFT: defStyle.CSS_CELL_LEFT,
            CSS_CELL_RIGHT: defStyle.CSS_CELL_RIGHT,
            CSS_CELL_BOTTOM: defStyle.CSS_CELL_BOTTOM,
            CSS_CELL_HOVER: defStyle.CSS_CELL_HOVER,
            CSS_CELL_HIGHLIGHT1: defStyle.CSS_CELL_HIGHLIGHT1,
            CSS_CELL_HIGHLIGHT2: defStyle.CSS_CELL_HIGHLIGHT2,
            CSS_CELL_HIGHLIGHT3: defStyle.CSS_CELL_HIGHLIGHT3,
            CSS_CELL_HIGHLIGHT4: defStyle.CSS_CELL_HIGHLIGHT4
        };
    },
    buildMonthLabel: function() {
        var pageDate = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key);
        var monthLabel = this.Locale.LOCALE_MONTHS[pageDate.getMonth()] + this.Locale.MY_LABEL_MONTH_SUFFIX;
        var yearLabel = pageDate.getFullYear() + this.Locale.MY_LABEL_YEAR_SUFFIX;
        if (this.Locale.MY_LABEL_MONTH_POSITION == 2 || this.Locale.MY_LABEL_YEAR_POSITION == 1) {
            return yearLabel + monthLabel;
        } else {
            return monthLabel + yearLabel;
        }
    },
    buildDayLabel: function(workingDate) {
        return workingDate.getDate();
    },
    createTitleBar: function(strTitle) {
        var tDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || document.createElement("div");
        tDiv.className = YAHOO.widget.CalendarGroup.CSS_2UPTITLE;
        tDiv.innerHTML = strTitle;
        this.oDomContainer.insertBefore(tDiv, this.oDomContainer.firstChild);
        YAHOO.util.Dom.addClass(this.oDomContainer, "withtitle");
        return tDiv;
    },
    removeTitleBar: function() {
        var tDiv = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
        if (tDiv) {
            YAHOO.util.Event.purgeElement(tDiv);
            this.oDomContainer.removeChild(tDiv);
        }
        YAHOO.util.Dom.removeClass(this.oDomContainer, "withtitle");
    },
    createCloseButton: function() {
        var Dom = YAHOO.util.Dom,
        Event = YAHOO.util.Event,
        cssClose = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,
        DEPR_CLOSE_PATH = "us/my/bn/x_d.gif";
        var lnk = Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0];
        if (!lnk) {
            lnk = document.createElement("a");
            Event.addListener(lnk, "click",
            function(e, cal) {
                cal.hide();
                Event.preventDefault(e);
            },
            this);
        }
        lnk.href = "#";
        lnk.className = "link-close";
        if (YAHOO.widget.Calendar.IMG_ROOT !== null) {
            var img = Dom.getElementsByClassName(cssClose, "img", lnk)[0] || document.createElement("img");
            img.src = YAHOO.widget.Calendar.IMG_ROOT + DEPR_CLOSE_PATH;
            img.className = cssClose;
            lnk.appendChild(img);
        } else {
            lnk.innerHTML = '<span class="' + cssClose + " " + this.Style.CSS_CLOSE + '"></span>';
        }
        this.oDomContainer.appendChild(lnk);
        return lnk;
    },
    removeCloseButton: function() {
        var btn = YAHOO.util.Dom.getElementsByClassName("link-close", "a", this.oDomContainer)[0] || null;
        if (btn) {
            YAHOO.util.Event.purgeElement(btn);
            this.oDomContainer.removeChild(btn);
        }
    },
    renderHeader: function(html) {
        var colSpan = 7;
        var DEPR_NAV_LEFT = "us/tr/callt.gif";
        var DEPR_NAV_RIGHT = "us/tr/calrt.gif";
        var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
        if (this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key)) {
            colSpan += 1;
        }
        if (this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key)) {
            colSpan += 1;
        }
        html[html.length] = "<thead>";
        html[html.length] = "<tr>";
        html[html.length] = '<th colspan="' + colSpan + '" class="' + this.Style.CSS_HEADER_TEXT + '">';
        html[html.length] = '<div class="' + this.Style.CSS_HEADER + '">';
        var renderLeft, renderRight = false;
        if (this.parent) {
            if (this.index === 0) {
                renderLeft = true;
            }
            if (this.index == (this.parent.cfg.getProperty("pages") - 1)) {
                renderRight = true;
            }
        } else {
            renderLeft = true;
            renderRight = true;
        }
        if (renderLeft) {
            var dateToValid = this.cfg.getProperty(defCfg.MINDATE.key);
            var sameDates = this.validateDateToShowLink(dateToValid);
            var leftArrow = this.cfg.getProperty(defCfg.NAV_ARROW_LEFT.key);
            if (leftArrow === null && YAHOO.widget.Calendar.IMG_ROOT !== null) {
                leftArrow = YAHOO.widget.Calendar.IMG_ROOT + DEPR_NAV_LEFT;
            }
            var leftStyle = (leftArrow === null) ? "": ' style="background-image:url(' + leftArrow + ')"';
            if (sameDates == "true") {} else {
                html[html.length] = '<a class="' + this.Style.CSS_NAV_LEFT + '"' + leftStyle + " >&#160;</a>";
            }
        }
        var lbl = this.buildMonthLabel();
        var cal = this.parent || this;
        if (cal.cfg.getProperty("navigator")) {
            lbl = '<a class="' + this.Style.CSS_NAV + '" href="#">' + lbl + "</a>";
        }
        html[html.length] = lbl;
        if (renderRight) {
            var dateToValid = this.cfg.getProperty(defCfg.MAXDATE.key);
            var sameDates = this.validateDateToShowLink(dateToValid);
            var rightArrow = this.cfg.getProperty(defCfg.NAV_ARROW_RIGHT.key);
            if (rightArrow === null && YAHOO.widget.Calendar.IMG_ROOT !== null) {
                rightArrow = YAHOO.widget.Calendar.IMG_ROOT + DEPR_NAV_RIGHT;
            }
            var rightStyle = (rightArrow === null) ? "": ' style="background-image:url(' + rightArrow + ')"';
            if (sameDates == "true") {} else {
                html[html.length] = '<a class="' + this.Style.CSS_NAV_RIGHT + '"' + rightStyle + " >&#160;</a>";
            }
        }
        html[html.length] = "</div>\n</th>\n</tr>";
        if (this.cfg.getProperty(defCfg.SHOW_WEEKDAYS.key)) {
            html = this.buildWeekdays(html);
        }
        html[html.length] = "</thead>";
        return html;
    },
    validateDateToShowLink: function(dateToValid) {
        var pageDate = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key);
        var dateLabel = this.Locale.LOCALE_MONTHS[pageDate.getMonth()] + this.Locale.MY_LABEL_MONTH_SUFFIX;
        dateLabel += pageDate.getFullYear() + this.Locale.MY_LABEL_YEAR_SUFFIX;
        var dateLabelM = this.Locale.LOCALE_MONTHS[dateToValid.getMonth()] + this.Locale.MY_LABEL_MONTH_SUFFIX;
        dateLabelM += dateToValid.getFullYear() + this.Locale.MY_LABEL_YEAR_SUFFIX;
        var sameDates = "false";
        if (dateLabel == dateLabelM) {
            sameDates = "true";
        }
        return sameDates;
    },
    buildWeekdays: function(html) {
        var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
        html[html.length] = '<tr class="' + this.Style.CSS_WEEKDAY_ROW + '">';
        if (this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key)) {
            html[html.length] = "<th>&#160;</th>";
        }
        for (var i = 0; i < this.Locale.LOCALE_WEEKDAYS.length; ++i) {
            html[html.length] = '<th class="calweekdaycell">' + this.Locale.LOCALE_WEEKDAYS[i] + "</th>";
        }
        if (this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key)) {
            html[html.length] = "<th>&#160;</th>";
        }
        html[html.length] = "</tr>";
        return html;
    },
    renderBody: function(workingDate, html) {
        var DM = YAHOO.widget.DateMath,
        CAL = YAHOO.widget.Calendar,
        D = YAHOO.util.Dom,
        defCfg = CAL._DEFAULT_CONFIG;
        var startDay = this.cfg.getProperty(defCfg.START_WEEKDAY.key);
        this.preMonthDays = workingDate.getDay();
        if (startDay > 0) {
            this.preMonthDays -= startDay;
        }
        if (this.preMonthDays < 0) {
            this.preMonthDays += 7;
        }
        this.monthDays = DM.findMonthEnd(workingDate).getDate();
        this.postMonthDays = CAL.DISPLAY_DAYS - this.preMonthDays - this.monthDays;
        workingDate = DM.subtract(workingDate, DM.DAY, this.preMonthDays);
        var weekNum, weekClass, weekPrefix = "w",
        cellPrefix = "_cell",
        workingDayPrefix = "wd",
        dayPrefix = "d",
        cellRenderers, renderer, todayYear = this.today.getFullYear(),
        todayMonth = this.today.getMonth(),
        todayDate = this.today.getDate(),
        useDate = this.cfg.getProperty(defCfg.PAGEDATE.key),
        hideBlankWeeks = this.cfg.getProperty(defCfg.HIDE_BLANK_WEEKS.key),
        showWeekFooter = this.cfg.getProperty(defCfg.SHOW_WEEK_FOOTER.key),
        showWeekHeader = this.cfg.getProperty(defCfg.SHOW_WEEK_HEADER.key),
        mindate = this.cfg.getProperty(defCfg.MINDATE.key),
        maxdate = this.cfg.getProperty(defCfg.MAXDATE.key);
        if (mindate) {
            mindate = DM.clearTime(mindate);
        }
        if (maxdate) {
            maxdate = DM.clearTime(maxdate);
        }
        html[html.length] = '<tbody class="m' + (useDate.getMonth() + 1) + " " + this.Style.CSS_BODY + '">';
        var i = 0,
        tempDiv = document.createElement("div"),
        cell = document.createElement("td");
        tempDiv.appendChild(cell);
        var cal = this.parent || this;
        for (var r = 0; r < 6; r++) {
            weekNum = DM.getWeekNumber(workingDate, startDay);
            weekClass = weekPrefix + weekNum;
            if (r !== 0 && hideBlankWeeks === true && workingDate.getMonth() != useDate.getMonth()) {
                break;
            } else {
                html[html.length] = '<tr class="' + weekClass + '">';
                if (showWeekHeader) {
                    html = this.renderRowHeader(weekNum, html);
                }
                for (var d = 0; d < 7; d++) {
                    cellRenderers = [];
                    this.clearElement(cell);
                    cell.className = this.Style.CSS_CELL;
                    cell.id = this.id + cellPrefix + i;
                    if (workingDate.getDate() == todayDate && workingDate.getMonth() == todayMonth && workingDate.getFullYear() == todayYear) {
                        cellRenderers[cellRenderers.length] = cal.renderCellStyleToday;
                    }
                    var workingArray = [workingDate.getFullYear(), workingDate.getMonth() + 1, workingDate.getDate()];
                    this.cellDates[this.cellDates.length] = workingArray;
                    if (workingDate.getMonth() != useDate.getMonth()) {
                        cellRenderers[cellRenderers.length] = cal.renderCellNotThisMonth;
                    } else {
                        D.addClass(cell, workingDayPrefix + workingDate.getDay());
                        D.addClass(cell, dayPrefix + workingDate.getDate());
                        for (var s = 0; s < this.renderStack.length; ++s) {
                            renderer = null;
                            var rArray = this.renderStack[s],
                            type = rArray[0],
                            month,
                            day,
                            year;
                            switch (type) {
                            case CAL.DATE:
                                month = rArray[1][1];
                                day = rArray[1][2];
                                year = rArray[1][0];
                                if (workingDate.getMonth() + 1 == month && workingDate.getDate() == day && workingDate.getFullYear() == year) {
                                    renderer = rArray[2];
                                    this.renderStack.splice(s, 1);
                                }
                                break;
                            case CAL.MONTH_DAY:
                                month = rArray[1][0];
                                day = rArray[1][1];
                                if (workingDate.getMonth() + 1 == month && workingDate.getDate() == day) {
                                    renderer = rArray[2];
                                    this.renderStack.splice(s, 1);
                                }
                                break;
                            case CAL.RANGE:
                                var date1 = rArray[1][0],
                                date2 = rArray[1][1],
                                d1month = date1[1],
                                d1day = date1[2],
                                d1year = date1[0],
                                d1 = DM.getDate(d1year, d1month - 1, d1day),
                                d2month = date2[1],
                                d2day = date2[2],
                                d2year = date2[0],
                                d2 = DM.getDate(d2year, d2month - 1, d2day);
                                if (workingDate.getTime() >= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
                                    renderer = rArray[2];
                                    if (workingDate.getTime() == d2.getTime()) {
                                        this.renderStack.splice(s, 1);
                                    }
                                }
                                break;
                            case CAL.WEEKDAY:
                                var weekday = rArray[1][0];
                                if (workingDate.getDay() + 1 == weekday) {
                                    renderer = rArray[2];
                                }
                                break;
                            case CAL.MONTH:
                                month = rArray[1][0];
                                if (workingDate.getMonth() + 1 == month) {
                                    renderer = rArray[2];
                                }
                                break;
                            }
                            if (renderer) {
                                cellRenderers[cellRenderers.length] = renderer;
                            }
                        }
                    }
                    if (this._indexOfSelectedFieldArray(workingArray) > -1) {
                        cellRenderers[cellRenderers.length] = cal.renderCellStyleSelected;
                    }
                    if ((mindate && (workingDate.getTime() < mindate.getTime())) || (maxdate && (workingDate.getTime() > maxdate.getTime()))) {
                        cellRenderers[cellRenderers.length] = cal.renderOutOfBoundsDate;
                    } else {
                        cellRenderers[cellRenderers.length] = cal.styleCellDefault;
                        cellRenderers[cellRenderers.length] = cal.renderCellDefault;
                    }
                    for (var x = 0; x < cellRenderers.length; ++x) {
                        if (cellRenderers[x].call(cal, workingDate, cell) == CAL.STOP_RENDER) {
                            break;
                        }
                    }
                    workingDate.setTime(workingDate.getTime() + DM.ONE_DAY_MS);
                    workingDate = DM.clearTime(workingDate);
                    if (i >= 0 && i <= 6) {
                        D.addClass(cell, this.Style.CSS_CELL_TOP);
                    }
                    if ((i % 7) === 0) {
                        D.addClass(cell, this.Style.CSS_CELL_LEFT);
                    }
                    if (((i + 1) % 7) === 0) {
                        D.addClass(cell, this.Style.CSS_CELL_RIGHT);
                    }
                    var postDays = this.postMonthDays;
                    if (hideBlankWeeks && postDays >= 7) {
                        var blankWeeks = Math.floor(postDays / 7);
                        for (var p = 0; p < blankWeeks; ++p) {
                            postDays -= 7;
                        }
                    }
                    if (i >= ((this.preMonthDays + postDays + this.monthDays) - 7)) {
                        D.addClass(cell, this.Style.CSS_CELL_BOTTOM);
                    }
                    html[html.length] = tempDiv.innerHTML;
                    i++;
                }
                if (showWeekFooter) {
                    html = this.renderRowFooter(weekNum, html);
                }
                html[html.length] = "</tr>";
            }
        }
        html[html.length] = "</tbody>";
        return html;
    },
    renderFooter: function(html) {
        return html;
    },
    render: function() {
        this.beforeRenderEvent.fire();
        var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
        var workingDate = YAHOO.widget.DateMath.findMonthStart(this.cfg.getProperty(defCfg.PAGEDATE.key));
        this.resetRenderers();
        this.cellDates.length = 0;
        YAHOO.util.Event.purgeElement(this.oDomContainer, true);
        var html = [];
        html[html.length] = '<table cellSpacing="0" class="' + this.Style.CSS_CALENDAR + " y" + workingDate.getFullYear() + '" id="' + this.id + '">';
        html = this.renderHeader(html);
        html = this.renderBody(workingDate, html);
        html = this.renderFooter(html);
        html[html.length] = "</table>";
        this.oDomContainer.innerHTML = html.join("\n");
        this.applyListeners();
        this.cells = this.oDomContainer.getElementsByTagName("td");
        this.cfg.refireEvent(defCfg.TITLE.key);
        this.cfg.refireEvent(defCfg.CLOSE.key);
        this.cfg.refireEvent(defCfg.IFRAME.key);
        this.renderEvent.fire();
    },
    applyListeners: function() {
        var root = this.oDomContainer;
        var cal = this.parent || this;
        var anchor = "a";
        var mousedown = "mousedown";
        var linkLeft = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, anchor, root);
        var linkRight = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, anchor, root);
        if (linkLeft && linkLeft.length > 0) {
            this.linkLeft = linkLeft[0];
            YAHOO.util.Event.addListener(this.linkLeft, mousedown, cal.previousMonth, cal, true);
        }
        if (linkRight && linkRight.length > 0) {
            this.linkRight = linkRight[0];
            YAHOO.util.Event.addListener(this.linkRight, mousedown, cal.nextMonth, cal, true);
        }
        if (cal.cfg.getProperty("navigator") !== null) {
            this.applyNavListeners();
        }
        if (this.domEventMap) {
            var el, elements;
            for (var cls in this.domEventMap) {
                if (YAHOO.lang.hasOwnProperty(this.domEventMap, cls)) {
                    var items = this.domEventMap[cls];
                    if (! (items instanceof Array)) {
                        items = [items];
                    }
                    for (var i = 0; i < items.length; i++) {
                        var item = items[i];
                        elements = YAHOO.util.Dom.getElementsByClassName(cls, item.tag, this.oDomContainer);
                        for (var c = 0; c < elements.length; c++) {
                            el = elements[c];
                            YAHOO.util.Event.addListener(el, item.event, item.handler, item.scope, item.correct);
                        }
                    }
                }
            }
        }
        YAHOO.util.Event.addListener(this.oDomContainer, "click", this.doSelectCell, this);
        YAHOO.util.Event.addListener(this.oDomContainer, "mouseover", this.doCellMouseOver, this);
        YAHOO.util.Event.addListener(this.oDomContainer, "mouseout", this.doCellMouseOut, this);
    },
    applyNavListeners: function() {
        var E = YAHOO.util.Event;
        var calParent = this.parent || this;
        var cal = this;
        var navBtns = YAHOO.util.Dom.getElementsByClassName(this.Style.CSS_NAV, "a", this.oDomContainer);
        if (navBtns.length > 0) {
            function show(e, obj) {
                var target = E.getTarget(e);
                if (this === target || YAHOO.util.Dom.isAncestor(this, target)) {
                    E.preventDefault(e);
                }
                var navigator = calParent.oNavigator;
                if (navigator) {
                    var pgdate = cal.cfg.getProperty("pagedate");
                    navigator.setYear(pgdate.getFullYear());
                    navigator.setMonth(pgdate.getMonth());
                    navigator.show();
                }
            }
            E.addListener(navBtns, "click", show);
        }
    },
    getDateByCellId: function(id) {
        var date = this.getDateFieldsByCellId(id);
        return YAHOO.widget.DateMath.getDate(date[0], date[1] - 1, date[2]);
    },
    getDateFieldsByCellId: function(id) {
        id = id.toLowerCase().split("_cell")[1];
        id = parseInt(id, 10);
        return this.cellDates[id];
    },
    getCellIndex: function(date) {
        var idx = -1;
        if (date) {
            var m = date.getMonth(),
            y = date.getFullYear(),
            d = date.getDate(),
            dates = this.cellDates;
            for (var i = 0; i < dates.length; ++i) {
                var cellDate = dates[i];
                if (cellDate[0] === y && cellDate[1] === m + 1 && cellDate[2] === d) {
                    idx = i;
                    break;
                }
            }
        }
        return idx;
    },
    renderOutOfBoundsDate: function(workingDate, cell) {
        YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOB);
        cell.innerHTML = workingDate.getDate();
        return YAHOO.widget.Calendar.STOP_RENDER;
    },
    renderRowHeader: function(weekNum, html) {
        html[html.length] = '<th class="calrowhead">' + weekNum + "</th>";
        return html;
    },
    renderRowFooter: function(weekNum, html) {
        html[html.length] = '<th class="calrowfoot">' + weekNum + "</th>";
        return html;
    },
    renderCellDefault: function(workingDate, cell) {
        cell.innerHTML = '<a href="#" class="' + this.Style.CSS_CELL_SELECTOR + '">' + this.buildDayLabel(workingDate) + "</a>";
    },
    styleCellDefault: function(workingDate, cell) {
        YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTABLE);
    },
    renderCellStyleHighlight1: function(workingDate, cell) {
        YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);
    },
    renderCellStyleHighlight2: function(workingDate, cell) {
        YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);
    },
    renderCellStyleHighlight3: function(workingDate, cell) {
        YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);
    },
    renderCellStyleHighlight4: function(workingDate, cell) {
        YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
    },
    renderCellStyleToday: function(workingDate, cell) {
        YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_TODAY);
    },
    renderCellStyleSelected: function(workingDate, cell) {
        YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);
    },
    renderCellNotThisMonth: function(workingDate, cell) {
        YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);
        cell.innerHTML = workingDate.getDate();
        return YAHOO.widget.Calendar.STOP_RENDER;
    },
    renderBodyCellRestricted: function(workingDate, cell) {
        YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL);
        YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
        cell.innerHTML = workingDate.getDate();
        return YAHOO.widget.Calendar.STOP_RENDER;
    },
    addMonths: function(count) {
        var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
        this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.add(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.MONTH, count));
        this.resetRenderers();
        this.changePageEvent.fire();
    },
    subtractMonths: function(count) {
        var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
        this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.subtract(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.MONTH, count));
        this.resetRenderers();
        this.changePageEvent.fire();
    },
    addYears: function(count) {
        var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
        this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.add(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.YEAR, count));
        this.resetRenderers();
        this.changePageEvent.fire();
    },
    subtractYears: function(count) {
        var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
        this.cfg.setProperty(cfgPageDate, YAHOO.widget.DateMath.subtract(this.cfg.getProperty(cfgPageDate), YAHOO.widget.DateMath.YEAR, count));
        this.resetRenderers();
        this.changePageEvent.fire();
    },
    nextMonth: function() {
        this.addMonths(1);
    },
    previousMonth: function() {
        this.subtractMonths(1);
    },
    nextYear: function() {
        this.addYears(1);
    },
    previousYear: function() {
        this.subtractYears(1);
    },
    reset: function() {
        var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
        this.cfg.resetProperty(defCfg.SELECTED.key);
        this.cfg.resetProperty(defCfg.PAGEDATE.key);
        this.resetEvent.fire();
    },
    clear: function() {
        var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
        this.cfg.setProperty(defCfg.SELECTED.key, []);
        this.cfg.setProperty(defCfg.PAGEDATE.key, new Date(this.today.getTime()));
        this.clearEvent.fire();
    },
    select: function(date) {
        var aToBeSelected = this._toFieldArray(date);
        var validDates = [];
        var selected = [];
        var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
        for (var a = 0; a < aToBeSelected.length; ++a) {
            var toSelect = aToBeSelected[a];
            if (!this.isDateOOB(this._toDate(toSelect))) {
                if (validDates.length === 0) {
                    this.beforeSelectEvent.fire();
                    selected = this.cfg.getProperty(cfgSelected);
                }
                validDates.push(toSelect);
                if (this._indexOfSelectedFieldArray(toSelect) == -1) {
                    selected[selected.length] = toSelect;
                }
            }
        }
        if (validDates.length > 0) {
            if (this.parent) {
                this.parent.cfg.setProperty(cfgSelected, selected);
            } else {
                this.cfg.setProperty(cfgSelected, selected);
            }
            this.selectEvent.fire(validDates);
        }
        return this.getSelectedDates();
    },
    selectCell: function(cellIndex) {
        var cell = this.cells[cellIndex];
        var cellDate = this.cellDates[cellIndex];
        var dCellDate = this._toDate(cellDate);
        var selectable = YAHOO.util.Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
        if (selectable) {
            this.beforeSelectEvent.fire();
            var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
            var selected = this.cfg.getProperty(cfgSelected);
            var selectDate = cellDate.concat();
            if (this._indexOfSelectedFieldArray(selectDate) == -1) {
                selected[selected.length] = selectDate;
            }
            if (this.parent) {
                this.parent.cfg.setProperty(cfgSelected, selected);
            } else {
                this.cfg.setProperty(cfgSelected, selected);
            }
            this.renderCellStyleSelected(dCellDate, cell);
            this.selectEvent.fire([selectDate]);
            this.doCellMouseOut.call(cell, null, this);
        }
        return this.getSelectedDates();
    },
    deselect: function(date) {
        var aToBeDeselected = this._toFieldArray(date);
        var validDates = [];
        var selected = [];
        var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
        for (var a = 0; a < aToBeDeselected.length; ++a) {
            var toDeselect = aToBeDeselected[a];
            if (!this.isDateOOB(this._toDate(toDeselect))) {
                if (validDates.length === 0) {
                    this.beforeDeselectEvent.fire();
                    selected = this.cfg.getProperty(cfgSelected);
                }
                validDates.push(toDeselect);
                var index = this._indexOfSelectedFieldArray(toDeselect);
                if (index != -1) {
                    selected.splice(index, 1);
                }
            }
        }
        if (validDates.length > 0) {
            if (this.parent) {
                this.parent.cfg.setProperty(cfgSelected, selected);
            } else {
                this.cfg.setProperty(cfgSelected, selected);
            }
            this.deselectEvent.fire(validDates);
        }
        return this.getSelectedDates();
    },
    deselectCell: function(cellIndex) {
        var cell = this.cells[cellIndex];
        var cellDate = this.cellDates[cellIndex];
        var cellDateIndex = this._indexOfSelectedFieldArray(cellDate);
        var selectable = YAHOO.util.Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
        if (selectable) {
            this.beforeDeselectEvent.fire();
            var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
            var selected = this.cfg.getProperty(defCfg.SELECTED.key);
            var dCellDate = this._toDate(cellDate);
            var selectDate = cellDate.concat();
            if (cellDateIndex > -1) {
                if (this.cfg.getProperty(defCfg.PAGEDATE.key).getMonth() == dCellDate.getMonth() && this.cfg.getProperty(defCfg.PAGEDATE.key).getFullYear() == dCellDate.getFullYear()) {
                    YAHOO.util.Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
                }
                selected.splice(cellDateIndex, 1);
            }
            if (this.parent) {
                this.parent.cfg.setProperty(defCfg.SELECTED.key, selected);
            } else {
                this.cfg.setProperty(defCfg.SELECTED.key, selected);
            }
            this.deselectEvent.fire(selectDate);
        }
        return this.getSelectedDates();
    },
    deselectAll: function() {
        this.beforeDeselectEvent.fire();
        var cfgSelected = YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key;
        var selected = this.cfg.getProperty(cfgSelected);
        var count = selected.length;
        var sel = selected.concat();
        if (this.parent) {
            this.parent.cfg.setProperty(cfgSelected, []);
        } else {
            this.cfg.setProperty(cfgSelected, []);
        }
        if (count > 0) {
            this.deselectEvent.fire(sel);
        }
        return this.getSelectedDates();
    },
    _toFieldArray: function(date) {
        var returnDate = [];
        if (date instanceof Date) {
            returnDate = [[date.getFullYear(), date.getMonth() + 1, date.getDate()]];
        } else {
            if (YAHOO.lang.isString(date)) {
                returnDate = this._parseDates(date);
            } else {
                if (YAHOO.lang.isArray(date)) {
                    for (var i = 0; i < date.length; ++i) {
                        var d = date[i];
                        returnDate[returnDate.length] = [d.getFullYear(), d.getMonth() + 1, d.getDate()];
                    }
                }
            }
        }
        return returnDate;
    },
    toDate: function(dateFieldArray) {
        return this._toDate(dateFieldArray);
    },
    _toDate: function(dateFieldArray) {
        if (dateFieldArray instanceof Date) {
            return dateFieldArray;
        } else {
            return YAHOO.widget.DateMath.getDate(dateFieldArray[0], dateFieldArray[1] - 1, dateFieldArray[2]);
        }
    },
    _fieldArraysAreEqual: function(array1, array2) {
        var match = false;
        if (array1[0] == array2[0] && array1[1] == array2[1] && array1[2] == array2[2]) {
            match = true;
        }
        return match;
    },
    _indexOfSelectedFieldArray: function(find) {
        var selected = -1;
        var seldates = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);
        for (var s = 0; s < seldates.length; ++s) {
            var sArray = seldates[s];
            if (find[0] == sArray[0] && find[1] == sArray[1] && find[2] == sArray[2]) {
                selected = s;
                break;
            }
        }
        return selected;
    },
    isDateOOM: function(date) {
        return (date.getMonth() != this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key).getMonth());
    },
    isDateOOB: function(date) {
        var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
        var minDate = this.cfg.getProperty(defCfg.MINDATE.key);
        var maxDate = this.cfg.getProperty(defCfg.MAXDATE.key);
        var dm = YAHOO.widget.DateMath;
        if (minDate) {
            minDate = dm.clearTime(minDate);
        }
        if (maxDate) {
            maxDate = dm.clearTime(maxDate);
        }
        var clearedDate = new Date(date.getTime());
        clearedDate = dm.clearTime(clearedDate);
        return ((minDate && clearedDate.getTime() < minDate.getTime()) || (maxDate && clearedDate.getTime() > maxDate.getTime()));
    },
    _parsePageDate: function(date) {
        var parsedDate;
        var defCfg = YAHOO.widget.Calendar._DEFAULT_CONFIG;
        if (date) {
            if (date instanceof Date) {
                parsedDate = YAHOO.widget.DateMath.findMonthStart(date);
            } else {
                var month, year, aMonthYear;
                aMonthYear = date.split(this.cfg.getProperty(defCfg.DATE_FIELD_DELIMITER.key));
                month = parseInt(aMonthYear[this.cfg.getProperty(defCfg.MY_MONTH_POSITION.key) - 1], 10) - 1;
                year = parseInt(aMonthYear[this.cfg.getProperty(defCfg.MY_YEAR_POSITION.key) - 1], 10);
                parsedDate = YAHOO.widget.DateMath.getDate(year, month, 1);
            }
        } else {
            parsedDate = YAHOO.widget.DateMath.getDate(this.today.getFullYear(), this.today.getMonth(), 1);
        }
        return parsedDate;
    },
    onBeforeSelect: function() {
        if (this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.MULTI_SELECT.key) === false) {
            if (this.parent) {
                this.parent.callChildFunction("clearAllBodyCellStyles", this.Style.CSS_CELL_SELECTED);
                this.parent.deselectAll();
            } else {
                this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);
                this.deselectAll();
            }
        }
    },
    onSelect: function(selected) {},
    onBeforeDeselect: function() {},
    onDeselect: function(deselected) {},
    onChangePage: function() {
        this.render();
    },
    onRender: function() {},
    onReset: function() {
        this.render();
    },
    onClear: function() {
        this.render();
    },
    validate: function() {
        return true;
    },
    _parseDate: function(sDate) {
        var aDate = sDate.split(this.Locale.DATE_FIELD_DELIMITER);
        var rArray;
        if (aDate.length == 2) {
            rArray = [aDate[this.Locale.MD_MONTH_POSITION - 1], aDate[this.Locale.MD_DAY_POSITION - 1]];
            rArray.type = YAHOO.widget.Calendar.MONTH_DAY;
        } else {
            rArray = [aDate[this.Locale.MDY_YEAR_POSITION - 1], aDate[this.Locale.MDY_MONTH_POSITION - 1], aDate[this.Locale.MDY_DAY_POSITION - 1]];
            rArray.type = YAHOO.widget.Calendar.DATE;
        }
        for (var i = 0; i < rArray.length; i++) {
            rArray[i] = parseInt(rArray[i], 10);
        }
        return rArray;
    },
    _parseDates: function(sDates) {
        var aReturn = [];
        var aDates = sDates.split(this.Locale.DATE_DELIMITER);
        for (var d = 0; d < aDates.length; ++d) {
            var sDate = aDates[d];
            if (sDate.indexOf(this.Locale.DATE_RANGE_DELIMITER) != -1) {
                var aRange = sDate.split(this.Locale.DATE_RANGE_DELIMITER);
                var dateStart = this._parseDate(aRange[0]);
                var dateEnd = this._parseDate(aRange[1]);
                var fullRange = this._parseRange(dateStart, dateEnd);
                aReturn = aReturn.concat(fullRange);
            } else {
                var aDate = this._parseDate(sDate);
                aReturn.push(aDate);
            }
        }
        return aReturn;
    },
    _parseRange: function(startDate, endDate) {
        var dCurrent = YAHOO.widget.DateMath.add(YAHOO.widget.DateMath.getDate(startDate[0], startDate[1] - 1, startDate[2]), YAHOO.widget.DateMath.DAY, 1);
        var dEnd = YAHOO.widget.DateMath.getDate(endDate[0], endDate[1] - 1, endDate[2]);
        var results = [];
        results.push(startDate);
        while (dCurrent.getTime() <= dEnd.getTime()) {
            results.push([dCurrent.getFullYear(), dCurrent.getMonth() + 1, dCurrent.getDate()]);
            dCurrent = YAHOO.widget.DateMath.add(dCurrent, YAHOO.widget.DateMath.DAY, 1);
        }
        return results;
    },
    resetRenderers: function() {
        this.renderStack = this._renderStack.concat();
    },
    removeRenderers: function() {
        this._renderStack = [];
        this.renderStack = [];
    },
    clearElement: function(cell) {
        cell.innerHTML = "&#160;";
        cell.className = "";
    },
    addRenderer: function(sDates, fnRender) {
        var aDates = this._parseDates(sDates);
        for (var i = 0; i < aDates.length; ++i) {
            var aDate = aDates[i];
            if (aDate.length == 2) {
                if (aDate[0] instanceof Array) {
                    this._addRenderer(YAHOO.widget.Calendar.RANGE, aDate, fnRender);
                } else {
                    this._addRenderer(YAHOO.widget.Calendar.MONTH_DAY, aDate, fnRender);
                }
            } else {
                if (aDate.length == 3) {
                    this._addRenderer(YAHOO.widget.Calendar.DATE, aDate, fnRender);
                }
            }
        }
    },
    _addRenderer: function(type, aDates, fnRender) {
        var add = [type, aDates, fnRender];
        this.renderStack.unshift(add);
        this._renderStack = this.renderStack.concat();
    },
    addMonthRenderer: function(month, fnRender) {
        this._addRenderer(YAHOO.widget.Calendar.MONTH, [month], fnRender);
    },
    addWeekdayRenderer: function(weekday, fnRender) {
        this._addRenderer(YAHOO.widget.Calendar.WEEKDAY, [weekday], fnRender);
    },
    clearAllBodyCellStyles: function(style) {
        for (var c = 0; c < this.cells.length; ++c) {
            YAHOO.util.Dom.removeClass(this.cells[c], style);
        }
    },
    setMonth: function(month) {
        var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
        var current = this.cfg.getProperty(cfgPageDate);
        current.setMonth(parseInt(month, 10));
        this.cfg.setProperty(cfgPageDate, current);
    },
    setYear: function(year) {
        var cfgPageDate = YAHOO.widget.Calendar._DEFAULT_CONFIG.PAGEDATE.key;
        var current = this.cfg.getProperty(cfgPageDate);
        current.setFullYear(parseInt(year, 10));
        this.cfg.setProperty(cfgPageDate, current);
    },
    getSelectedDates: function() {
        var returnDates = [];
        var selected = this.cfg.getProperty(YAHOO.widget.Calendar._DEFAULT_CONFIG.SELECTED.key);
        for (var d = 0; d < selected.length; ++d) {
            var dateArray = selected[d];
            var date = YAHOO.widget.DateMath.getDate(dateArray[0], dateArray[1] - 1, dateArray[2]);
            returnDates.push(date);
        }
        returnDates.sort(function(a, b) {
            return a - b;
        });
        return returnDates;
    },
    hide: function() {
        if (this.beforeHideEvent.fire()) {
            this.oDomContainer.style.display = "none";
            this.hideEvent.fire();
        }
    },
    show: function() {
        if (this.beforeShowEvent.fire()) {
            this.oDomContainer.style.display = "block";
            this.showEvent.fire();
        }
    },
    browser: (function() {
        var ua = navigator.userAgent.toLowerCase();
        if (ua.indexOf("opera") != -1) {
            return "opera";
        } else {
            if (ua.indexOf("msie 7") != -1) {
                return "ie7";
            } else {
                if (ua.indexOf("msie") != -1) {
                    return "ie";
                } else {
                    if (ua.indexOf("safari") != -1) {
                        return "safari";
                    } else {
                        if (ua.indexOf("gecko") != -1) {
                            return "gecko";
                        } else {
                            return false;
                        }
                    }
                }
            }
        }
    })(),
    toString: function() {
        return "Calendar " + this.id;
    }
};
YAHOO.widget.Calendar_Core = YAHOO.widget.Calendar;
YAHOO.widget.Cal_Core = YAHOO.widget.Calendar;
YAHOO.widget.CalendarGroup = function(id, containerId, config) {
    if (arguments.length > 0) {
        this.init.apply(this, arguments);
    }
};
YAHOO.widget.CalendarGroup.prototype = {
    init: function(id, container, config) {
        var nArgs = this._parseArgs(arguments);
        id = nArgs.id;
        container = nArgs.container;
        config = nArgs.config;
        this.oDomContainer = YAHOO.util.Dom.get(container);
        if (!this.oDomContainer.id) {
            this.oDomContainer.id = YAHOO.util.Dom.generateId();
        }
        if (!id) {
            id = this.oDomContainer.id + "_t";
        }
        this.id = id;
        this.containerId = this.oDomContainer.id;
        this.initEvents();
        this.initStyles();
        this.pages = [];
        YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_CONTAINER);
        YAHOO.util.Dom.addClass(this.oDomContainer, YAHOO.widget.CalendarGroup.CSS_MULTI_UP);
        this.cfg = new YAHOO.util.Config(this);
        this.Options = {};
        this.Locale = {};
        this.setupConfig();
        if (config) {
            this.cfg.applyConfig(config, true);
        }
        this.cfg.fireQueue();
        if (YAHOO.env.ua.opera) {
            this.renderEvent.subscribe(this._fixWidth, this, true);
            this.showEvent.subscribe(this._fixWidth, this, true);
        }
    },
    setupConfig: function() {
        var defCfg = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG;
        this.cfg.addProperty(defCfg.PAGES.key, {
            value: defCfg.PAGES.value,
            validator: this.cfg.checkNumber,
            handler: this.configPages
        });
        this.cfg.addProperty(defCfg.PAGEDATE.key, {
            value: new Date(),
            handler: this.configPageDate
        });
        this.cfg.addProperty(defCfg.SELECTED.key, {
            value: [],
            handler: this.configSelected
        });
        this.cfg.addProperty(defCfg.TITLE.key, {
            value: defCfg.TITLE.value,
            handler: this.configTitle
        });
        this.cfg.addProperty(defCfg.CLOSE.key, {
            value: defCfg.CLOSE.value,
            handler: this.configClose
        });
        this.cfg.addProperty(defCfg.IFRAME.key, {
            value: defCfg.IFRAME.value,
            handler: this.configIframe,
            validator: this.cfg.checkBoolean
        });
        this.cfg.addProperty(defCfg.MINDATE.key, {
            value: defCfg.MINDATE.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.MAXDATE.key, {
            value: defCfg.MAXDATE.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.MULTI_SELECT.key, {
            value: defCfg.MULTI_SELECT.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkBoolean
        });
        this.cfg.addProperty(defCfg.START_WEEKDAY.key, {
            value: defCfg.START_WEEKDAY.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.SHOW_WEEKDAYS.key, {
            value: defCfg.SHOW_WEEKDAYS.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkBoolean
        });
        this.cfg.addProperty(defCfg.SHOW_WEEK_HEADER.key, {
            value: defCfg.SHOW_WEEK_HEADER.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkBoolean
        });
        this.cfg.addProperty(defCfg.SHOW_WEEK_FOOTER.key, {
            value: defCfg.SHOW_WEEK_FOOTER.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkBoolean
        });
        this.cfg.addProperty(defCfg.HIDE_BLANK_WEEKS.key, {
            value: defCfg.HIDE_BLANK_WEEKS.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkBoolean
        });
        this.cfg.addProperty(defCfg.NAV_ARROW_LEFT.key, {
            value: defCfg.NAV_ARROW_LEFT.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.NAV_ARROW_RIGHT.key, {
            value: defCfg.NAV_ARROW_RIGHT.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.MONTHS_SHORT.key, {
            value: defCfg.MONTHS_SHORT.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.MONTHS_LONG.key, {
            value: defCfg.MONTHS_LONG.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.WEEKDAYS_1CHAR.key, {
            value: defCfg.WEEKDAYS_1CHAR.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.WEEKDAYS_SHORT.key, {
            value: defCfg.WEEKDAYS_SHORT.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.WEEKDAYS_MEDIUM.key, {
            value: defCfg.WEEKDAYS_MEDIUM.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.WEEKDAYS_LONG.key, {
            value: defCfg.WEEKDAYS_LONG.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.LOCALE_MONTHS.key, {
            value: defCfg.LOCALE_MONTHS.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.LOCALE_WEEKDAYS.key, {
            value: defCfg.LOCALE_WEEKDAYS.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.DATE_DELIMITER.key, {
            value: defCfg.DATE_DELIMITER.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.DATE_FIELD_DELIMITER.key, {
            value: defCfg.DATE_FIELD_DELIMITER.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.DATE_RANGE_DELIMITER.key, {
            value: defCfg.DATE_RANGE_DELIMITER.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.MY_MONTH_POSITION.key, {
            value: defCfg.MY_MONTH_POSITION.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MY_YEAR_POSITION.key, {
            value: defCfg.MY_YEAR_POSITION.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MD_MONTH_POSITION.key, {
            value: defCfg.MD_MONTH_POSITION.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MD_DAY_POSITION.key, {
            value: defCfg.MD_DAY_POSITION.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MDY_MONTH_POSITION.key, {
            value: defCfg.MDY_MONTH_POSITION.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MDY_DAY_POSITION.key, {
            value: defCfg.MDY_DAY_POSITION.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MDY_YEAR_POSITION.key, {
            value: defCfg.MDY_YEAR_POSITION.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MY_LABEL_MONTH_POSITION.key, {
            value: defCfg.MY_LABEL_MONTH_POSITION.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MY_LABEL_YEAR_POSITION.key, {
            value: defCfg.MY_LABEL_YEAR_POSITION.value,
            handler: this.delegateConfig,
            validator: this.cfg.checkNumber
        });
        this.cfg.addProperty(defCfg.MY_LABEL_MONTH_SUFFIX.key, {
            value: defCfg.MY_LABEL_MONTH_SUFFIX.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.MY_LABEL_YEAR_SUFFIX.key, {
            value: defCfg.MY_LABEL_YEAR_SUFFIX.value,
            handler: this.delegateConfig
        });
        this.cfg.addProperty(defCfg.NAV.key, {
            value: defCfg.NAV.value,
            handler: this.configNavigator
        });
    },
    initEvents: function() {
        var me = this;
        var strEvent = "Event";
        var sub = function(fn, obj, bOverride) {
            for (var p = 0; p < me.pages.length; ++p) {
                var cal = me.pages[p];
                cal[this.type + strEvent].subscribe(fn, obj, bOverride);
            }
        };
        var unsub = function(fn, obj) {
            for (var p = 0; p < me.pages.length; ++p) {
                var cal = me.pages[p];
                cal[this.type + strEvent].unsubscribe(fn, obj);
            }
        };
        var defEvents = YAHOO.widget.Calendar._EVENT_TYPES;
        this.beforeSelectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SELECT);
        this.beforeSelectEvent.subscribe = sub;
        this.beforeSelectEvent.unsubscribe = unsub;
        this.selectEvent = new YAHOO.util.CustomEvent(defEvents.SELECT);
        this.selectEvent.subscribe = sub;
        this.selectEvent.unsubscribe = unsub;
        this.beforeDeselectEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_DESELECT);
        this.beforeDeselectEvent.subscribe = sub;
        this.beforeDeselectEvent.unsubscribe = unsub;
        this.deselectEvent = new YAHOO.util.CustomEvent(defEvents.DESELECT);
        this.deselectEvent.subscribe = sub;
        this.deselectEvent.unsubscribe = unsub;
        this.changePageEvent = new YAHOO.util.CustomEvent(defEvents.CHANGE_PAGE);
        this.changePageEvent.subscribe = sub;
        this.changePageEvent.unsubscribe = unsub;
        this.beforeRenderEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER);
        this.beforeRenderEvent.subscribe = sub;
        this.beforeRenderEvent.unsubscribe = unsub;
        this.renderEvent = new YAHOO.util.CustomEvent(defEvents.RENDER);
        this.renderEvent.subscribe = sub;
        this.renderEvent.unsubscribe = unsub;
        this.resetEvent = new YAHOO.util.CustomEvent(defEvents.RESET);
        this.resetEvent.subscribe = sub;
        this.resetEvent.unsubscribe = unsub;
        this.clearEvent = new YAHOO.util.CustomEvent(defEvents.CLEAR);
        this.clearEvent.subscribe = sub;
        this.clearEvent.unsubscribe = unsub;
        this.beforeShowEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SHOW);
        this.showEvent = new YAHOO.util.CustomEvent(defEvents.SHOW);
        this.beforeHideEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_HIDE);
        this.hideEvent = new YAHOO.util.CustomEvent(defEvents.HIDE);
        this.beforeShowNavEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_SHOW_NAV);
        this.showNavEvent = new YAHOO.util.CustomEvent(defEvents.SHOW_NAV);
        this.beforeHideNavEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_HIDE_NAV);
        this.hideNavEvent = new YAHOO.util.CustomEvent(defEvents.HIDE_NAV);
        this.beforeRenderNavEvent = new YAHOO.util.CustomEvent(defEvents.BEFORE_RENDER_NAV);
        this.renderNavEvent = new YAHOO.util.CustomEvent(defEvents.RENDER_NAV);
    },
    configPages: function(type, args, obj) {
        var pageCount = args[0];
        var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
        var sep = "_";
        var groupCalClass = "groupcal";
        var firstClass = "first-of-type";
        var lastClass = "last-of-type";
        for (var p = 0; p < pageCount; ++p) {
            var calId = this.id + sep + p;
            var calContainerId = this.containerId + sep + p;
            var childConfig = this.cfg.getConfig();
            childConfig.close = false;
            childConfig.title = false;
            childConfig.navigator = null;
            var cal = this.constructChild(calId, calContainerId, childConfig);
            var caldate = cal.cfg.getProperty(cfgPageDate);
            this._setMonthOnDate(caldate, caldate.getMonth() + p);
            cal.cfg.setProperty(cfgPageDate, caldate);
            YAHOO.util.Dom.removeClass(cal.oDomContainer, this.Style.CSS_SINGLE);
            YAHOO.util.Dom.addClass(cal.oDomContainer, groupCalClass);
            if (p === 0) {
                YAHOO.util.Dom.addClass(cal.oDomContainer, firstClass);
            }
            if (p == (pageCount - 1)) {
                YAHOO.util.Dom.addClass(cal.oDomContainer, lastClass);
            }
            cal.parent = this;
            cal.index = p;
            this.pages[this.pages.length] = cal;
        }
    },
    configPageDate: function(type, args, obj) {
        var val = args[0];
        var firstPageDate;
        var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            if (p === 0) {
                firstPageDate = cal._parsePageDate(val);
                cal.cfg.setProperty(cfgPageDate, firstPageDate);
            } else {
                var pageDate = new Date(firstPageDate);
                this._setMonthOnDate(pageDate, pageDate.getMonth() + p);
                cal.cfg.setProperty(cfgPageDate, pageDate);
            }
        }
    },
    configSelected: function(type, args, obj) {
        var cfgSelected = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key;
        this.delegateConfig(type, args, obj);
        var selected = (this.pages.length > 0) ? this.pages[0].cfg.getProperty(cfgSelected) : [];
        this.cfg.setProperty(cfgSelected, selected, true);
    },
    delegateConfig: function(type, args, obj) {
        var val = args[0];
        var cal;
        for (var p = 0; p < this.pages.length; p++) {
            cal = this.pages[p];
            cal.cfg.setProperty(type, val);
        }
    },
    setChildFunction: function(fnName, fn) {
        var pageCount = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);
        for (var p = 0; p < pageCount; ++p) {
            this.pages[p][fnName] = fn;
        }
    },
    callChildFunction: function(fnName, args) {
        var pageCount = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES.key);
        for (var p = 0; p < pageCount; ++p) {
            var page = this.pages[p];
            if (page[fnName]) {
                var fn = page[fnName];
                fn.call(page, args);
            }
        }
    },
    constructChild: function(id, containerId, config) {
        var container = document.getElementById(containerId);
        if (!container) {
            container = document.createElement("div");
            container.id = containerId;
            this.oDomContainer.appendChild(container);
        }
        return new YAHOO.widget.Calendar(id, containerId, config);
    },
    setMonth: function(month) {
        month = parseInt(month, 10);
        var currYear;
        var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            var pageDate = cal.cfg.getProperty(cfgPageDate);
            if (p === 0) {
                currYear = pageDate.getFullYear();
            } else {
                pageDate.setFullYear(currYear);
            }
            this._setMonthOnDate(pageDate, month + p);
            cal.cfg.setProperty(cfgPageDate, pageDate);
        }
    },
    setYear: function(year) {
        var cfgPageDate = YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGEDATE.key;
        year = parseInt(year, 10);
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            var pageDate = cal.cfg.getProperty(cfgPageDate);
            if ((pageDate.getMonth() + 1) == 1 && p > 0) {
                year += 1;
            }
            cal.setYear(year);
        }
    },
    render: function() {
        this.renderHeader();
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.render();
        }
        this.renderFooter();
    },
    select: function(date) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.select(date);
        }
        return this.getSelectedDates();
    },
    selectCell: function(cellIndex) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.selectCell(cellIndex);
        }
        return this.getSelectedDates();
    },
    deselect: function(date) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.deselect(date);
        }
        return this.getSelectedDates();
    },
    deselectAll: function() {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.deselectAll();
        }
        return this.getSelectedDates();
    },
    deselectCell: function(cellIndex) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.deselectCell(cellIndex);
        }
        return this.getSelectedDates();
    },
    reset: function() {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.reset();
        }
    },
    clear: function() {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.clear();
        }
    },
    nextMonth: function() {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.nextMonth();
        }
    },
    previousMonth: function() {
        for (var p = this.pages.length - 1; p >= 0; --p) {
            var cal = this.pages[p];
            cal.previousMonth();
        }
    },
    nextYear: function() {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.nextYear();
        }
    },
    previousYear: function() {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.previousYear();
        }
    },
    getSelectedDates: function() {
        var returnDates = [];
        var selected = this.cfg.getProperty(YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.SELECTED.key);
        for (var d = 0; d < selected.length; ++d) {
            var dateArray = selected[d];
            var date = YAHOO.widget.DateMath.getDate(dateArray[0], dateArray[1] - 1, dateArray[2]);
            returnDates.push(date);
        }
        returnDates.sort(function(a, b) {
            return a - b;
        });
        return returnDates;
    },
    addRenderer: function(sDates, fnRender) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.addRenderer(sDates, fnRender);
        }
    },
    addMonthRenderer: function(month, fnRender) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.addMonthRenderer(month, fnRender);
        }
    },
    addWeekdayRenderer: function(weekday, fnRender) {
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            cal.addWeekdayRenderer(weekday, fnRender);
        }
    },
    removeRenderers: function() {
        this.callChildFunction("removeRenderers");
    },
    renderHeader: function() {},
    renderFooter: function() {},
    addMonths: function(count) {
        this.callChildFunction("addMonths", count);
    },
    subtractMonths: function(count) {
        this.callChildFunction("subtractMonths", count);
    },
    addYears: function(count) {
        this.callChildFunction("addYears", count);
    },
    subtractYears: function(count) {
        this.callChildFunction("subtractYears", count);
    },
    getCalendarPage: function(date) {
        var cal = null;
        if (date) {
            var y = date.getFullYear(),
            m = date.getMonth();
            var pages = this.pages;
            for (var i = 0; i < pages.length; ++i) {
                var pageDate = pages[i].cfg.getProperty("pagedate");
                if (pageDate.getFullYear() === y && pageDate.getMonth() === m) {
                    cal = pages[i];
                    break;
                }
            }
        }
        return cal;
    },
    _setMonthOnDate: function(date, iMonth) {
        if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420 && (iMonth < 0 || iMonth > 11)) {
            var DM = YAHOO.widget.DateMath;
            var newDate = DM.add(date, DM.MONTH, iMonth - date.getMonth());
            date.setTime(newDate.getTime());
        } else {
            date.setMonth(iMonth);
        }
    },
    _fixWidth: function() {
        var w = 0;
        for (var p = 0; p < this.pages.length; ++p) {
            var cal = this.pages[p];
            w += cal.oDomContainer.offsetWidth;
        }
        if (w > 0) {
            this.oDomContainer.style.width = w + "px";
        }
    },
    toString: function() {
        return "CalendarGroup " + this.id;
    }
};
YAHOO.widget.CalendarGroup.CSS_CONTAINER = "yui-calcontainer";
YAHOO.widget.CalendarGroup.CSS_MULTI_UP = "multi";
YAHOO.widget.CalendarGroup.CSS_2UPTITLE = "title";
YAHOO.widget.CalendarGroup.CSS_2UPCLOSE = "close-icon";
YAHOO.lang.augmentProto(YAHOO.widget.CalendarGroup, YAHOO.widget.Calendar, "buildDayLabel", "buildMonthLabel", "renderOutOfBoundsDate", "renderRowHeader", "renderRowFooter", "renderCellDefault", "styleCellDefault", "renderCellStyleHighlight1", "renderCellStyleHighlight2", "renderCellStyleHighlight3", "renderCellStyleHighlight4", "renderCellStyleToday", "renderCellStyleSelected", "renderCellNotThisMonth", "renderBodyCellRestricted", "initStyles", "configTitle", "configClose", "configIframe", "configNavigator", "createTitleBar", "createCloseButton", "removeTitleBar", "removeCloseButton", "hide", "show", "toDate", "_toDate", "_parseArgs", "browser");
YAHOO.widget.CalendarGroup._DEFAULT_CONFIG = YAHOO.widget.Calendar._DEFAULT_CONFIG;
YAHOO.widget.CalendarGroup._DEFAULT_CONFIG.PAGES = {
    key: "pages",
    value: 2
};
YAHOO.widget.CalGrp = YAHOO.widget.CalendarGroup;
YAHOO.widget.Calendar2up = function(id, containerId, config) {
    this.init(id, containerId, config);
};
YAHOO.extend(YAHOO.widget.Calendar2up, YAHOO.widget.CalendarGroup);
YAHOO.widget.Cal2up = YAHOO.widget.Calendar2up;
YAHOO.widget.CalendarNavigator = function(cal) {
    this.init(cal);
};
(function() {
    var CN = YAHOO.widget.CalendarNavigator;
    CN.CLASSES = {
        NAV: "yui-cal-nav",
        NAV_VISIBLE: "yui-cal-nav-visible",
        MASK: "yui-cal-nav-mask",
        YEAR: "yui-cal-nav-y",
        MONTH: "yui-cal-nav-m",
        BUTTONS: "yui-cal-nav-b",
        BUTTON: "yui-cal-nav-btn",
        ERROR: "yui-cal-nav-e",
        YEAR_CTRL: "yui-cal-nav-yc",
        MONTH_CTRL: "yui-cal-nav-mc",
        INVALID: "yui-invalid",
        DEFAULT: "yui-default"
    };
    CN._DEFAULT_CFG = {
        strings: {
            month: "Month",
            year: "Year",
            submit: "Okay",
            cancel: "Cancel",
            invalidYear: "Year needs to be a number"
        },
        monthFormat: YAHOO.widget.Calendar.LONG,
        initialFocus: "year"
    };
    CN.ID_SUFFIX = "_nav";
    CN.MONTH_SUFFIX = "_month";
    CN.YEAR_SUFFIX = "_year";
    CN.ERROR_SUFFIX = "_error";
    CN.CANCEL_SUFFIX = "_cancel";
    CN.SUBMIT_SUFFIX = "_submit";
    CN.YR_MAX_DIGITS = 4;
    CN.YR_MINOR_INC = 1;
    CN.YR_MAJOR_INC = 10;
    CN.UPDATE_DELAY = 50;
    CN.YR_PATTERN = /^\d+$/;
    CN.TRIM = /^\s*(.*?)\s*$/;
})();
YAHOO.widget.CalendarNavigator.prototype = {
    id: null,
    cal: null,
    navEl: null,
    maskEl: null,
    yearEl: null,
    monthEl: null,
    errorEl: null,
    submitEl: null,
    cancelEl: null,
    firstCtrl: null,
    lastCtrl: null,
    _doc: null,
    _year: null,
    _month: 0,
    __rendered: false,
    init: function(cal) {
        var calBox = cal.oDomContainer;
        this.cal = cal;
        this.id = calBox.id + YAHOO.widget.CalendarNavigator.ID_SUFFIX;
        this._doc = calBox.ownerDocument;
        var ie = YAHOO.env.ua.ie;
        this.__isIEQuirks = (ie && ((ie <= 6) || (ie === 7 && this._doc.compatMode == "BackCompat")));
    },
    show: function() {
        var CLASSES = YAHOO.widget.CalendarNavigator.CLASSES;
        if (this.cal.beforeShowNavEvent.fire()) {
            if (!this.__rendered) {
                this.render();
            }
            this.clearErrors();
            this._updateMonthUI();
            this._updateYearUI();
            this._show(this.navEl, true);
            this.setInitialFocus();
            this.showMask();
            YAHOO.util.Dom.addClass(this.cal.oDomContainer, CLASSES.NAV_VISIBLE);
            this.cal.showNavEvent.fire();
        }
    },
    hide: function() {
        var CLASSES = YAHOO.widget.CalendarNavigator.CLASSES;
        if (this.cal.beforeHideNavEvent.fire()) {
            this._show(this.navEl, false);
            this.hideMask();
            YAHOO.util.Dom.removeClass(this.cal.oDomContainer, CLASSES.NAV_VISIBLE);
            this.cal.hideNavEvent.fire();
        }
    },
    showMask: function() {
        this._show(this.maskEl, true);
        if (this.__isIEQuirks) {
            this._syncMask();
        }
    },
    hideMask: function() {
        this._show(this.maskEl, false);
    },
    getMonth: function() {
        return this._month;
    },
    getYear: function() {
        return this._year;
    },
    setMonth: function(nMonth) {
        if (nMonth >= 0 && nMonth < 12) {
            this._month = nMonth;
        }
        this._updateMonthUI();
    },
    setYear: function(nYear) {
        var yrPattern = YAHOO.widget.CalendarNavigator.YR_PATTERN;
        if (YAHOO.lang.isNumber(nYear) && yrPattern.test(nYear + "")) {
            this._year = nYear;
        }
        this._updateYearUI();
    },
    render: function() {
        this.cal.beforeRenderNavEvent.fire();
        if (!this.__rendered) {
            this.createNav();
            this.createMask();
            this.applyListeners();
            this.__rendered = true;
        }
        this.cal.renderNavEvent.fire();
    },
    createNav: function() {
        var NAV = YAHOO.widget.CalendarNavigator;
        var doc = this._doc;
        var d = doc.createElement("div");
        d.className = NAV.CLASSES.NAV;
        var htmlBuf = this.renderNavContents([]);
        d.innerHTML = htmlBuf.join("");
        this.cal.oDomContainer.appendChild(d);
        this.navEl = d;
        this.yearEl = doc.getElementById(this.id + NAV.YEAR_SUFFIX);
        this.monthEl = doc.getElementById(this.id + NAV.MONTH_SUFFIX);
        this.errorEl = doc.getElementById(this.id + NAV.ERROR_SUFFIX);
        this.submitEl = doc.getElementById(this.id + NAV.SUBMIT_SUFFIX);
        this.cancelEl = doc.getElementById(this.id + NAV.CANCEL_SUFFIX);
        if (YAHOO.env.ua.gecko && this.yearEl && this.yearEl.type == "text") {
            this.yearEl.setAttribute("autocomplete", "off");
        }
        this._setFirstLastElements();
    },
    createMask: function() {
        var C = YAHOO.widget.CalendarNavigator.CLASSES;
        var d = this._doc.createElement("div");
        d.className = C.MASK;
        this.cal.oDomContainer.appendChild(d);
        this.maskEl = d;
    },
    _syncMask: function() {
        var c = this.cal.oDomContainer;
        if (c && this.maskEl) {
            var r = YAHOO.util.Dom.getRegion(c);
            YAHOO.util.Dom.setStyle(this.maskEl, "width", r.right - r.left + "px");
            YAHOO.util.Dom.setStyle(this.maskEl, "height", r.bottom - r.top + "px");
        }
    },
    renderNavContents: function(html) {
        var NAV = YAHOO.widget.CalendarNavigator,
        C = NAV.CLASSES,
        h = html;
        h[h.length] = '<div class="' + C.MONTH + '">';
        this.renderMonth(h);
        h[h.length] = "</div>";
        h[h.length] = '<div class="' + C.YEAR + '">';
        this.renderYear(h);
        h[h.length] = "</div>";
        h[h.length] = '<div class="' + C.BUTTONS + '">';
        this.renderButtons(h);
        h[h.length] = "</div>";
        h[h.length] = '<div class="' + C.ERROR + '" id="' + this.id + NAV.ERROR_SUFFIX + '"></div>';
        return h;
    },
    renderMonth: function(html) {
        var NAV = YAHOO.widget.CalendarNavigator,
        C = NAV.CLASSES;
        var id = this.id + NAV.MONTH_SUFFIX,
        mf = this.__getCfg("monthFormat"),
        months = this.cal.cfg.getProperty((mf == YAHOO.widget.Calendar.SHORT) ? "MONTHS_SHORT": "MONTHS_LONG"),
        h = html;
        if (months && months.length > 0) {
            h[h.length] = '<label for="' + id + '">';
            h[h.length] = this.__getCfg("month", true);
            h[h.length] = "</label>";
            h[h.length] = '<select name="' + id + '" id="' + id + '" class="' + C.MONTH_CTRL + '">';
            for (var i = 0; i < months.length; i++) {
                h[h.length] = '<option value="' + i + '">';
                h[h.length] = months[i];
                h[h.length] = "</option>";
            }
            h[h.length] = "</select>";
        }
        return h;
    },
    renderYear: function(html) {
        var NAV = YAHOO.widget.CalendarNavigator,
        C = NAV.CLASSES;
        var id = this.id + NAV.YEAR_SUFFIX,
        size = NAV.YR_MAX_DIGITS,
        h = html;
        h[h.length] = '<label for="' + id + '">';
        h[h.length] = this.__getCfg("year", true);
        h[h.length] = "</label>";
        h[h.length] = '<input type="text" name="' + id + '" id="' + id + '" class="' + C.YEAR_CTRL + '" maxlength="' + size + '"/>';
        return h;
    },
    renderButtons: function(html) {
        var C = YAHOO.widget.CalendarNavigator.CLASSES;
        var h = html;
        h[h.length] = '<span class="' + C.BUTTON + " " + C.DEFAULT + '">';
        h[h.length] = '<button type="button" id="' + this.id + '_submit">';
        h[h.length] = this.__getCfg("submit", true);
        h[h.length] = "</button>";
        h[h.length] = "</span>";
        h[h.length] = '<span class="' + C.BUTTON + '">';
        h[h.length] = '<button type="button" id="' + this.id + '_cancel">';
        h[h.length] = this.__getCfg("cancel", true);
        h[h.length] = "</button>";
        h[h.length] = "</span>";
        return h;
    },
    applyListeners: function() {
        var E = YAHOO.util.Event;
        function yearUpdateHandler() {
            if (this.validate()) {
                this.setYear(this._getYearFromUI());
            }
        }
        function monthUpdateHandler() {
            this.setMonth(this._getMonthFromUI());
        }
        E.on(this.submitEl, "click", this.submit, this, true);
        E.on(this.cancelEl, "click", this.cancel, this, true);
        E.on(this.yearEl, "blur", yearUpdateHandler, this, true);
        E.on(this.monthEl, "change", monthUpdateHandler, this, true);
        if (this.__isIEQuirks) {
            YAHOO.util.Event.on(this.cal.oDomContainer, "resize", this._syncMask, this, true);
        }
        this.applyKeyListeners();
    },
    purgeListeners: function() {
        var E = YAHOO.util.Event;
        E.removeListener(this.submitEl, "click", this.submit);
        E.removeListener(this.cancelEl, "click", this.cancel);
        E.removeListener(this.yearEl, "blur");
        E.removeListener(this.monthEl, "change");
        if (this.__isIEQuirks) {
            E.removeListener(this.cal.oDomContainer, "resize", this._syncMask);
        }
        this.purgeKeyListeners();
    },
    applyKeyListeners: function() {
        var E = YAHOO.util.Event,
        ua = YAHOO.env.ua;
        var arrowEvt = (ua.ie || ua.webkit) ? "keydown": "keypress";
        var tabEvt = (ua.ie || ua.opera || ua.webkit) ? "keydown": "keypress";
        E.on(this.yearEl, "keypress", this._handleEnterKey, this, true);
        E.on(this.yearEl, arrowEvt, this._handleDirectionKeys, this, true);
        E.on(this.lastCtrl, tabEvt, this._handleTabKey, this, true);
        E.on(this.firstCtrl, tabEvt, this._handleShiftTabKey, this, true);
    },
    purgeKeyListeners: function() {
        var E = YAHOO.util.Event,
        ua = YAHOO.env.ua;
        var arrowEvt = (ua.ie || ua.webkit) ? "keydown": "keypress";
        var tabEvt = (ua.ie || ua.opera || ua.webkit) ? "keydown": "keypress";
        E.removeListener(this.yearEl, "keypress", this._handleEnterKey);
        E.removeListener(this.yearEl, arrowEvt, this._handleDirectionKeys);
        E.removeListener(this.lastCtrl, tabEvt, this._handleTabKey);
        E.removeListener(this.firstCtrl, tabEvt, this._handleShiftTabKey);
    },
    submit: function() {
        if (this.validate()) {
            this.hide();
            this.setMonth(this._getMonthFromUI());
            this.setYear(this._getYearFromUI());
            var cal = this.cal;
            var nav = this;
            function update() {
                cal.setYear(nav.getYear());
                cal.setMonth(nav.getMonth());
                cal.render();
            }
            var delay = YAHOO.widget.CalendarNavigator.UPDATE_DELAY;
            if (delay > 0) {
                window.setTimeout(update, delay);
            } else {
                update();
            }
        }
    },
    cancel: function() {
        this.hide();
    },
    validate: function() {
        if (this._getYearFromUI() !== null) {
            this.clearErrors();
            return true;
        } else {
            this.setYearError();
            this.setError(this.__getCfg("invalidYear", true));
            return false;
        }
    },
    setError: function(msg) {
        if (this.errorEl) {
            this.errorEl.innerHTML = msg;
            this._show(this.errorEl, true);
        }
    },
    clearError: function() {
        if (this.errorEl) {
            this.errorEl.innerHTML = "";
            this._show(this.errorEl, false);
        }
    },
    setYearError: function() {
        YAHOO.util.Dom.addClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
    },
    clearYearError: function() {
        YAHOO.util.Dom.removeClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
    },
    clearErrors: function() {
        this.clearError();
        this.clearYearError();
    },
    setInitialFocus: function() {
        var el = this.submitEl,
        f = this.__getCfg("initialFocus");
        if (f && f.toLowerCase) {
            f = f.toLowerCase();
            if (f == "year") {
                el = this.yearEl;
                try {
                    this.yearEl.select();
                } catch(err) {}
            } else {
                if (f == "month") {
                    el = this.monthEl;
                }
            }
        }
        if (el && YAHOO.lang.isFunction(el.focus)) {
            try {
                el.focus();
            } catch(err) {}
        }
    },
    erase: function() {
        if (this.__rendered) {
            this.purgeListeners();
            this.yearEl = null;
            this.monthEl = null;
            this.errorEl = null;
            this.submitEl = null;
            this.cancelEl = null;
            this.firstCtrl = null;
            this.lastCtrl = null;
            if (this.navEl) {
                this.navEl.innerHTML = "";
            }
            var p = this.navEl.parentNode;
            if (p) {
                p.removeChild(this.navEl);
            }
            this.navEl = null;
            var pm = this.maskEl.parentNode;
            if (pm) {
                pm.removeChild(this.maskEl);
            }
            this.maskEl = null;
            this.__rendered = false;
        }
    },
    destroy: function() {
        this.erase();
        this._doc = null;
        this.cal = null;
        this.id = null;
    },
    _show: function(el, bShow) {
        if (el) {
            YAHOO.util.Dom.setStyle(el, "display", (bShow) ? "block": "none");
        }
    },
    _getMonthFromUI: function() {
        if (this.monthEl) {
            return this.monthEl.selectedIndex;
        } else {
            return 0;
        }
    },
    _getYearFromUI: function() {
        var NAV = YAHOO.widget.CalendarNavigator;
        var yr = null;
        if (this.yearEl) {
            var value = this.yearEl.value;
            value = value.replace(NAV.TRIM, "$1");
            if (NAV.YR_PATTERN.test(value)) {
                yr = parseInt(value, 10);
            }
        }
        return yr;
    },
    _updateYearUI: function() {
        if (this.yearEl && this._year !== null) {
            this.yearEl.value = this._year;
        }
    },
    _updateMonthUI: function() {
        if (this.monthEl) {
            this.monthEl.selectedIndex = this._month;
        }
    },
    _setFirstLastElements: function() {
        this.firstCtrl = this.monthEl;
        this.lastCtrl = this.cancelEl;
        if (this.__isMac) {
            if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420) {
                this.firstCtrl = this.monthEl;
                this.lastCtrl = this.yearEl;
            }
            if (YAHOO.env.ua.gecko) {
                this.firstCtrl = this.yearEl;
                this.lastCtrl = this.yearEl;
            }
        }
    },
    _handleEnterKey: function(e) {
        var KEYS = YAHOO.util.KeyListener.KEY;
        if (YAHOO.util.Event.getCharCode(e) == KEYS.ENTER) {
            YAHOO.util.Event.preventDefault(e);
            this.submit();
        }
    },
    _handleDirectionKeys: function(e) {
        var E = YAHOO.util.Event,
        KEYS = YAHOO.util.KeyListener.KEY,
        NAV = YAHOO.widget.CalendarNavigator;
        var value = (this.yearEl.value) ? parseInt(this.yearEl.value, 10) : null;
        if (isFinite(value)) {
            var dir = false;
            switch (E.getCharCode(e)) {
            case KEYS.UP:
                this.yearEl.value = value + NAV.YR_MINOR_INC;
                dir = true;
                break;
            case KEYS.DOWN:
                this.yearEl.value = Math.max(value - NAV.YR_MINOR_INC, 0);
                dir = true;
                break;
            case KEYS.PAGE_UP:
                this.yearEl.value = value + NAV.YR_MAJOR_INC;
                dir = true;
                break;
            case KEYS.PAGE_DOWN:
                this.yearEl.value = Math.max(value - NAV.YR_MAJOR_INC, 0);
                dir = true;
                break;
            default:
                break;
            }
            if (dir) {
                E.preventDefault(e);
                try {
                    this.yearEl.select();
                } catch(err) {}
            }
        }
    },
    _handleTabKey: function(e) {
        var E = YAHOO.util.Event,
        KEYS = YAHOO.util.KeyListener.KEY;
        if (E.getCharCode(e) == KEYS.TAB && !e.shiftKey) {
            try {
                E.preventDefault(e);
                this.firstCtrl.focus();
            } catch(err) {}
        }
    },
    _handleShiftTabKey: function(e) {
        var E = YAHOO.util.Event,
        KEYS = YAHOO.util.KeyListener.KEY;
        if (e.shiftKey && E.getCharCode(e) == KEYS.TAB) {
            try {
                E.preventDefault(e);
                this.lastCtrl.focus();
            } catch(err) {}
        }
    },
    __getCfg: function(prop, bIsStr) {
        var DEF_CFG = YAHOO.widget.CalendarNavigator._DEFAULT_CFG;
        var cfg = this.cal.cfg.getProperty("navigator");
        if (bIsStr) {
            return (cfg !== true && cfg.strings && cfg.strings[prop]) ? cfg.strings[prop] : DEF_CFG.strings[prop];
        } else {
            return (cfg !== true && cfg[prop]) ? cfg[prop] : DEF_CFG[prop];
        }
    },
    __isMac: (navigator.userAgent.toLowerCase().indexOf("macintosh") != -1)
};
YAHOO.register("calendar", YAHOO.widget.Calendar, {
    version: "2.5.2",
    build: "1076"
});
/*############ End common/js/yahoo/yui-calendar.js ############*/
/*############ Begin common/js/tracking/wtInit.js ############*/
function DcsInit() {
    var that = this;
    this.dcsid = tempDcsId;
    this.domain = "statse.webtrendslive.com";
    this.enabled = true;
    this.exre = (function() {
        return (window.RegExp ? new RegExp("dcs(uri)|(ref)|(aut)|(met)|(sta)|(sip)|(pro)|(byt)|(dat)|(p3p)|(cfg)|(redirect)|(cip)", "i") : "");
    })();
    this.fpc = "WT_FPC";
    this.fpcdom = G_DOMAIN;
    this.i18n = false;
    this.images = [];
    this.index = 0;
    this.qp = [];
    this.re = (function() {
        return (window.RegExp ? (that.i18n ? {
            "%25": /\%/g
        }: {
            "%09": /\t/g,
            "%20": / /g,
            "%23": /\#/g,
            "%26": /\&/g,
            "%2B": /\+/g,
            "%3F": /\?/g,
            "%5C": /\\/g,
            "%22": /\"/g,
            "%7F": /\x7F/g,
            "%A0": /\xA0/g
        }) : "");
    })();
    this.onsitedoms = "";
    this.adclickparam = "WT.ac";
    this.downloadtypes = "xls,doc,pdf,txt,csv,zip";
    this.rightclicktypes = "xls,doc,pdf,txt,csv,zip";
    this.timezone = -8;
    this.trackevents = true;
    (function() {
        if (that.enabled && (document.cookie.indexOf(that.fpc + "=") == -1) && (document.cookie.indexOf("WTLOPTOUT=") == -1)) {
            document.write("<script type='text/javascript' src='http" + (window.location.protocol.indexOf("https:") == 0 ? "s": "") + "://" + that.domain + "/" + that.dcsid + "/wtid.js'><\/script>");
        }
    })();
}
var DCS = {};
var WT = {};
var DCSext = {};
var dcsInit = new DcsInit();
/*############ End common/js/tracking/wtInit.js ############*/
/*############ Begin common/js/tracking/wtBase.js ############*/
function dcsCookie() {
    if (typeof(dcsOther) == "function") {
        dcsOther();
    } else {
        if (typeof(dcsFPC) == "function") {
            dcsFPC(dcsInit.timezone);
        }
    }
}
function dcsGetCookie(name) {
    var cookies = document.cookie.split("; ");
    var cmatch = [];
    var idx = 0;
    var i = 0;
    var namelen = name.length;
    var clen = cookies.length;
    for (i = 0; i < clen; i++) {
        var c = cookies[i];
        if ((c.substring(0, namelen + 1)) == (name + "=")) {
            cmatch[idx++] = c;
        }
    }
    var cmatchCount = cmatch.length;
    if (cmatchCount > 0) {
        idx = 0;
        if ((cmatchCount > 1) && (name == dcsInit.fpc)) {
            var dLatest = new Date(0);
            for (i = 0; i < cmatchCount; i++) {
                var lv = parseInt(dcsGetCrumb(cmatch[i], "lv"));
                var dLst = new Date(lv);
                if (dLst > dLatest) {
                    dLatest.setTime(dLst.getTime());
                    idx = i;
                }
            }
        }
        return unescape(cmatch[idx].substring(namelen + 1));
    } else {
        return null;
    }
}
function dcsGetCrumb(cval, crumb) {
    var aCookie = cval.split(":");
    for (var i = 0; i < aCookie.length; i++) {
        var aCrumb = aCookie[i].split("=");
        if (crumb == aCrumb[0]) {
            return aCrumb[1];
        }
    }
    return null;
}
function dcsGetIdCrumb(cval, crumb) {
    var id = cval.substring(0, cval.indexOf(":lv="));
    var aCrumb = id.split("=");
    for (var i = 0; i < aCrumb.length; i++) {
        if (crumb == aCrumb[0]) {
            return aCrumb[1];
        }
    }
    return null;
}
function dcsIsFpcSet(name, id, lv, ss) {
    var c = dcsGetCookie(name);
    if (c) {
        return ((id == dcsGetIdCrumb(c, "id")) && (lv == dcsGetCrumb(c, "lv")) && (ss = dcsGetCrumb(c, "ss"))) ? 0 : 3;
    }
    return 2;
}
function dcsFPC(offset) {
    if (typeof(offset) == "undefined") {
        return;
    }
    if (document.cookie.indexOf("WTLOPTOUT=") != -1) {
        return;
    }
    var name = dcsInit.fpc;
    var dCur = new Date();
    var adj = (dCur.getTimezoneOffset() * 60000) + (offset * 3600000);
    dCur.setTime(dCur.getTime() + adj);
    var dExp = new Date(dCur.getTime() + 315360000000);
    var dSes = new Date(dCur.getTime());
    WT.co_f = WT.vt_sid = WT.vt_f = WT.vt_f_a = WT.vt_f_s = WT.vt_f_d = WT.vt_f_tlh = WT.vt_f_tlv = "";
    if (document.cookie.indexOf(name + "=") == -1) {
        if ((typeof(gWtId) != "undefined") && (gWtId != "")) {
            WT.co_f = gWtId;
        } else {
            if ((typeof(gTempWtId) != "undefined") && (gTempWtId != "")) {
                WT.co_f = gTempWtId;
                WT.vt_f = "1";
            } else {
                WT.co_f = "2";
                var cur = dCur.getTime().toString();
                for (var i = 2; i <= (32 - cur.length); i++) {
                    WT.co_f += Math.floor(Math.random() * 16).toString(16);
                }
                WT.co_f += cur;
                WT.vt_f = "1";
            }
        }
        if (typeof(gWtAccountRollup) == "undefined") {
            WT.vt_f_a = "1";
        }
        WT.vt_f_s = WT.vt_f_d = "1";
        WT.vt_f_tlh = WT.vt_f_tlv = "0";
    } else {
        var c = dcsGetCookie(name);
        var id = dcsGetIdCrumb(c, "id");
        var lv = parseInt(dcsGetCrumb(c, "lv"));
        var ss = parseInt(dcsGetCrumb(c, "ss"));
        if ((id == null) || (id == "null") || isNaN(lv) || isNaN(ss)) {
            return;
        }
        WT.co_f = id;
        var dLst = new Date(lv);
        WT.vt_f_tlh = Math.floor((dLst.getTime() - adj) / 1000);
        dSes.setTime(ss);
        if ((dCur.getTime() > (dLst.getTime() + 1800000)) || (dCur.getTime() > (dSes.getTime() + 28800000))) {
            WT.vt_f_tlv = Math.floor((dSes.getTime() - adj) / 1000);
            dSes.setTime(dCur.getTime());
            WT.vt_f_s = "1";
        }
        if ((dCur.getDay() != dLst.getDay()) || (dCur.getMonth() != dLst.getMonth()) || (dCur.getYear() != dLst.getYear())) {
            WT.vt_f_d = "1";
        }
    }
    WT.co_f = escape(WT.co_f);
    WT.vt_sid = WT.co_f + "." + (dSes.getTime() - adj);
    var expiry = "; expires=" + dExp.toGMTString();
    var cur = dCur.getTime().toString();
    var ses = dSes.getTime().toString();
    document.cookie = name + "=id=" + WT.co_f + ":lv=" + cur + ":ss=" + ses + expiry + "; path=/" + (((dcsInit.fpcdom != "")) ? ("; domain=" + dcsInit.fpcdom) : (""));
    var rc = dcsIsFpcSet(name, WT.co_f, cur, ses);
    if (rc != 0) {
        WT.co_f = WT.vt_sid = WT.vt_f_s = WT.vt_f_d = WT.vt_f_tlh = WT.vt_f_tlv = "";
        WT.vt_f = WT.vt_f_a = rc;
    }
}
function dcsAdSearch() {
    if (document.links) {
        var param = dcsInit.adclickparam + "=";
        var paramlen = param.length;
        var paramre = new RegExp(param, "i");
        var len = document.links.length;
        for (var i = 0; i < len; i++) {
            if (document.links[i].href) {
                var anch = document.links[i].href + "";
                var pos = anch.search(paramre);
                if (pos != -1) {
                    var start = pos + paramlen;
                    var end = anch.indexOf("&", start);
                    var value = anch.substring(start, (end != -1) ? end: anch.length);
                    WT.ad = WT.ad ? (WT.ad + ";" + value) : value;
                }
            }
        }
    }
}
function dcsIsOnsite(host) {
    host = host.toLowerCase();
    if (host == window.location.hostname.toLowerCase()) {
        return true;
    }
    if (typeof(dcsInit.onsitedoms.test) == "function") {
        return dcsInit.onsitedoms.test(host);
    } else {
        if (dcsInit.onsitedoms.length > 0) {
            var doms = dcsInit.onsitedoms.toLowerCase().split(",");
            var len = doms.length;
            for (var i = 0; i < len; i++) {
                if (host == doms[i]) {
                    return true;
                }
            }
        }
    }
    return false;
}
function dcsTypeMatch(pth, typelist) {
    var type = pth.substring(pth.lastIndexOf(".") + 1, pth.length);
    var types = typelist.split(",");
    for (var i = 0; i < types.length; i++) {
        if (type == types[i]) {
            return true;
        }
    }
    return false;
}
function dcsEvt(evt, tag) {
    var e = evt.target || evt.srcElement;
    if (!e || e.tagName == "") {
        return false;
    }
    while (e.tagName && (e.tagName != tag)) {
        e = e.parentElement || e.parentNode;
        if (!e || e.tagName == "") {
            return false;
        }
    }
    return e;
}
function dcsNavigation(evt) {
    return "";
}
function dcsBind(event, func) {
    if ((typeof(window[func]) == "function") && document.body) {
        if (document.body.addEventListener) {
            document.body.addEventListener(event, window[func], true);
        } else {
            if (document.body.attachEvent) {
                document.body.attachEvent("on" + event, window[func]);
            }
        }
    }
}
function dcsET() {
    var e = (navigator.appVersion.indexOf("MSIE") != -1) ? "click": "mousedown";
    dcsBind(e, "dcsDownload");
    dcsBind(e, "dcsDynamic");
    dcsBind(e, "dcsFormButton");
    dcsBind(e, "dcsOffsite");
    dcsBind(e, "dcsAnchor");
    dcsBind("contextmenu", "dcsRightClick");
    dcsBind(e, "dcsImageMap");
}
function dcsMultiTrack() {
    if (arguments.length % 2 == 0) {
        for (var i = 0; i < arguments.length; i += 2) {
            if (arguments[i].indexOf("WT.") == 0) {
                WT[arguments[i].substring(3)] = arguments[i + 1];
            } else {
                if (arguments[i].indexOf("DCS.") == 0) {
                    DCS[arguments[i].substring(4)] = arguments[i + 1];
                } else {
                    if (arguments[i].indexOf("DCSext.") == 0) {
                        DCSext[arguments[i].substring(7)] = arguments[i + 1];
                    }
                }
            }
        }
        var dCurrent = new Date();
        DCS.dcsdat = dCurrent.getTime();
        dcsFunc("dcsCookie");
        dcsTag();
    }
}
function dcsDownload(evt) {
    evt = evt || (window.event || "");
    if (evt && ((typeof(evt.which) != "number") || (evt.which == 1))) {
        var e = dcsEvt(evt, "A");
        if (e == "") {
            return false;
        }
        if (e.hostname && dcsIsOnsite(e.hostname)) {
            if (dcsTypeMatch(e.pathname, dcsInit.downloadtypes)) {
                var qry = e.search ? e.search.substring(e.search.indexOf("?") + 1, e.search.length) : "";
                var pth = e.pathname ? ((e.pathname.indexOf("/") != 0) ? "/" + e.pathname: e.pathname) : "/";
                var ttl = "";
                var text = document.all ? e.innerText: e.text;
                var img = dcsEvt(evt, "IMG");
                if (img.alt) {
                    ttl = img.alt;
                } else {
                    if (text) {
                        ttl = text;
                    } else {
                        if (e.innerHTML) {
                            ttl = e.innerHTML;
                        }
                    }
                }
                dcsMultiTrack("DCS.dcssip", e.hostname, "DCS.dcsuri", pth, "DCS.dcsqry", e.search || "", "WT.ti", "Download:" + ttl, "WT.dl", "20", "WT.nv", dcsNavigation(evt));
                DCS.dcssip = DCS.dcsuri = DCS.dcsqry = WT.ti = WT.dl = WT.nv = "";
            }
        }
    }
}
function dcsRightClick(evt) {
    evt = evt || (window.event || "");
    if (evt) {
        var btn = evt.which || evt.button;
        if ((btn != 1) || (navigator.userAgent.indexOf("Safari") != -1)) {
            var e = dcsEvt(evt, "A");
            if (e == "") {
                return false;
            }
            if ((typeof(e.href) != "undefined") && e.href) {
                if ((typeof(e.protocol) != "undefined") && e.protocol && (e.protocol.indexOf("http") != -1)) {
                    if ((typeof(e.pathname) != "undefined") && dcsTypeMatch(e.pathname, dcsInit.rightclicktypes)) {
                        var pth = e.pathname ? ((e.pathname.indexOf("/") != 0) ? "/" + e.pathname: e.pathname) : "/";
                        dcsMultiTrack("DCS.dcssip", e.hostname, "DCS.dcsuri", pth, "DCS.dcsqry", "", "WT.ti", "RightClick:" + pth, "WT.dl", "25");
                        DCS.dcssip = DCS.dcsuri = WT.ti = WT.dl = WT.nv = "";
                    }
                }
            }
        }
    }
}
function dcsOffsite(evt) {
    evt = evt || (window.event || "");
    if (evt && ((typeof(evt.which) != "number") || (evt.which == 1))) {
        var e = dcsEvt(evt, "A");
        if (e == "") {
            return false;
        }
        if (e.hostname && !dcsIsOnsite(e.hostname)) {
            var qry = e.search ? e.search.substring(e.search.indexOf("?") + 1, e.search.length) : "";
            var pth = e.pathname ? ((e.pathname.indexOf("/") != 0) ? "/" + e.pathname: e.pathname) : "/";
            var trim = true;
            dcsMultiTrack("DCS.dcssip", e.hostname, "DCS.dcsuri", pth, "DCS.dcsqry", trim ? "": qry, "WT.ti", "Offsite:" + e.hostname + pth + qry, "WT.dl", "24", "WT.nv", dcsNavigation(evt));
            DCS.dcssip = DCS.dcsuri = DCS.dcsqry = WT.ti = WT.dl = WT.nv = "";
        }
    }
}
function dcsCQP() {
    var qry = window.location.search.toLowerCase();
    if ((qry && (qry.indexOf("wt.mc_id") != -1) && (qry.indexOf("wt.mc_ev") == -1)) || ((WT.mc_id != null) && (WT.mc_id.toString() != ""))) {
        return "click";
    } else {
        return "";
    }
}
function dcsCleanUp() {
    DCS = new Object();
    WT = new Object();
    DCSext = new Object();
    if (arguments.length % 2 == 0) {
        for (var i = 0; i < arguments.length; i += 2) {
            if (arguments[i].indexOf("WT.") == 0) {
                WT[arguments[i].substring(3)] = arguments[i + 1];
            } else {
                if (arguments[i].indexOf("DCS.") == 0) {
                    DCS[arguments[i].substring(4)] = arguments[i + 1];
                } else {
                    if (arguments[i].indexOf("DCSext.") == 0) {
                        DCSext[arguments[i].substring(7)] = arguments[i + 1];
                    }
                }
            }
        }
    }
}
function dcsAdv() {
    if (dcsInit.trackevents) {
        dcsFunc("dcsET");
    }
    dcsFunc("dcsCookie");
    dcsFunc("dcsAdSearch");
    dcsFunc("dcsTP");
    dcsFunc("dcsMetaCap");
}
function dcsVar() {
    var dCurrent = new Date();
    WT.tz = (dCurrent.getTimezoneOffset() / 60 * -1) || "0";
    WT.bh = dCurrent.getHours() || "0";
    WT.ul = navigator.appName == "Netscape" ? navigator.language: navigator.userLanguage;
    if (typeof(screen) == "object") {
        WT.cd = navigator.appName == "Netscape" ? screen.pixelDepth: screen.colorDepth;
        WT.sr = screen.width + "x" + screen.height;
    }
    if (typeof(navigator.javaEnabled()) == "boolean") {
        WT.jo = navigator.javaEnabled() ? "Yes": "No";
    }
    if (document.title) {
        if (window.RegExp) {
            var tire = new RegExp("^" + window.location.protocol + "//" + window.location.hostname + "\\s-\\s");
            WT.ti = document.title.replace(tire, "");
        } else {
            WT.ti = document.title;
        }
    }
    WT.js = "Yes";
    WT.jv = dcsJV();
    if (document.body && document.body.addBehavior) {
        document.body.addBehavior("#default#clientCaps");
        WT.ct = document.body.connectionType || "unknown";
        document.body.addBehavior("#default#homePage");
        WT.hp = document.body.isHomePage(location.href) ? "1": "0";
    } else {
        WT.ct = "unknown";
    }
    if (document.all) {
        WT.bs = document.body ? document.body.offsetWidth + "x" + document.body.offsetHeight: "unknown";
    } else {
        WT.bs = window.innerWidth + "x" + window.innerHeight;
    }
    WT.fi = "No";
    if (window.ActiveXObject) {
        for (var i = 10; i > 0; i--) {
            try {
                var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
                WT.fi = "Yes";
                WT.fv = i + ".0";
                break;
            } catch(e) {}
        }
    } else {
        if (navigator.plugins && navigator.plugins.length) {
            for (var i = 0; i < navigator.plugins.length; i++) {
                if (navigator.plugins[i].name.indexOf("Shockwave Flash") != -1) {
                    WT.fi = "Yes";
                    WT.fv = navigator.plugins[i].description.split(" ")[2];
                    break;
                }
            }
        }
    }
    if (dcsInit.i18n) {
        if (typeof(document.defaultCharset) == "string") {
            WT.le = document.defaultCharset;
        } else {
            if (typeof(document.characterSet) == "string") {
                WT.le = document.characterSet;
            } else {
                WT.le = "unknown";
            }
        }
    }
    WT.tv = "1.1.1";
    WT.dl = "0";
    DCS.dcsdat = dCurrent.getTime();
    DCS.dcssip = window.location.hostname;
    DCS.dcsuri = window.location.pathname;
    WT.es = DCS.dcssip + DCS.dcsuri;
    if (window.location.search) {
        DCS.dcsqry = window.location.search;
        if (dcsInit.qp.length > 0) {
            for (var i = 0;
            i < dcsInit.qp.length; i++) {
                var pos = DCS.dcsqry.indexOf(dcsInit.qp[i]);
                if (pos != -1) {
                    var front = DCS.dcsqry.substring(0, pos);
                    var end = DCS.dcsqry.substring(pos + dcsInit.qp[i].length, DCS.dcsqry.length);
                    DCS.dcsqry = front + end;
                }
            }
        }
    }
    if ((window.document.referrer != "") && (window.document.referrer != "-")) {
        if (! (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) < 4)) {
            DCS.dcsref = window.document.referrer;
        }
    }
}
function dcsA(N, V) {
    if (dcsInit.i18n && (dcsInit.exre != "") && !dcsInit.exre.test(N)) {
        if (N == "dcsqry") {
            var newV = "";
            var params = V.substring(1).split("&");
            for (var i = 0; i < params.length; i++) {
                var pair = params[i];
                var pos = pair.indexOf("=");
                if (pos != -1) {
                    var key = pair.substring(0, pos);
                    var val = pair.substring(pos + 1);
                    if (i != 0) {
                        newV += "&";
                    }
                    newV += key + "=" + dcsEncode(val);
                }
            }
            V = V.substring(0, 1) + newV;
        } else {
            V = dcsEncode(V);
        }
    }
    return "&" + N + "=" + dcsEscape(V, dcsInit.re);
}
function dcsEscape(S, REL) {
    if (REL != "") {
        S = S.toString();
        for (var R in REL) {
            S = S.replace(REL[R], R);
        }
        return S;
    } else {
        return escape(S);
    }
}
function dcsEncode(S) {
    return (typeof(encodeURIComponent) == "function") ? encodeURIComponent(S) : escape(S);
}
function dcsCreateImage(dcsSrc) {
    if (document.images) {
        dcsInit.images[dcsInit.index] = new Image;
        dcsInit.images[dcsInit.index].src = dcsSrc;
        dcsInit.index++;
    } else {
        document.write('<IMG ALT="" BORDER="0" NAME="DCSIMG" WIDTH="1" HEIGHT="1" SRC="' + dcsSrc + '">');
    }
}
function dcsMeta() {
    var elems;
    if (document.all) {
        elems = document.all.tags("meta");
    } else {
        if (document.documentElement) {
            elems = document.getElementsByTagName("meta");
        }
    }
    if (typeof(elems) != "undefined") {
        var length = elems.length;
        for (var i = 0; i < length; i++) {
            var name = elems.item(i).name;
            var content = elems.item(i).content;
            var equiv = elems.item(i).httpEquiv;
            if (name.length > 0) {
                if (name.indexOf("WT.") == 0) {
                    WT[name.substring(3)] = content;
                } else {
                    if (name.indexOf("DCSext.") == 0) {
                        DCSext[name.substring(7)] = content;
                    } else {
                        if (name.indexOf("DCS.") == 0) {
                            DCS[name.substring(4)] = content;
                        }
                    }
                }
            }
        }
    }
}
function dcsTag() {
    if (document.cookie.indexOf("WTLOPTOUT=") != -1) {
        return;
    }
    var P = "http" + (window.location.protocol.indexOf("https:") == 0 ? "s": "") + "://" + dcsInit.domain + (dcsInit.dcsid == "" ? "": "/" + dcsInit.dcsid) + "/dcs.gif?";
    if (dcsInit.i18n) {
        WT.dep = "";
    }
    for (var N in DCS) {
        if (DCS[N]) {
            P += dcsA(N, DCS[N]);
        }
    }
    var keys = ["co_f", "vt_sid", "vt_f_tlv"];
    for (var i = 0; i < keys.length; i++) {
        var key = keys[i];
        if (WT[key]) {
            P += dcsA("WT." + key, WT[key]);
            delete WT[key];
        }
    }
    for (N in WT) {
        if (WT[N]) {
            P += dcsA("WT." + N, WT[N]);
        }
    }
    for (N in DCSext) {
        if (DCSext[N]) {
            if (dcsInit.i18n) {
                WT.dep = (WT.dep.length == 0) ? N: (WT.dep + ";" + N);
            }
            P += dcsA(N, DCSext[N]);
        }
    }
    if (dcsInit.i18n && (WT.dep.length > 0)) {
        P += dcsA("WT.dep", WT.dep);
    }
    if (P.length > 2048 && navigator.userAgent.indexOf("MSIE") >= 0) {
        P = P.substring(0, 2040) + "&WT.tu=1";
    }
    dcsCreateImage(P);
    WT.ad = "";
    dcsCleanUp("WT.co_f", WT.co_f, "WT.vt_sid", WT.vt_sid, "WT.z_brand", WT.z_brand, "DCS.dcsaut", DCS.dcsaut, "WT.dcsvid", WT.dcsvid);
}
function dcsJV() {
    var agt = navigator.userAgent.toLowerCase();
    var major = parseInt(navigator.appVersion);
    var mac = (agt.indexOf("mac") != -1);
    var ff = (agt.indexOf("firefox") != -1);
    var ff0 = (agt.indexOf("firefox/0.") != -1);
    var ff10 = (agt.indexOf("firefox/1.0") != -1);
    var ff15 = (agt.indexOf("firefox/1.5") != -1);
    var ff20 = (agt.indexOf("firefox/2.0") != -1);
    var ff3up = (ff && !ff0 && !ff10 & !ff15 & !ff20);
    var nn = (!ff && (agt.indexOf("mozilla") != -1) && (agt.indexOf("compatible") == -1));
    var nn4 = (nn && (major == 4));
    var nn6up = (nn && (major >= 5));
    var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var ie4 = (ie && (major == 4) && (agt.indexOf("msie 4") != -1));
    var ie5up = (ie && !ie4);
    var op = (agt.indexOf("opera") != -1);
    var op5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
    var op6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1);
    var op7up = (op && !op5 && !op6);
    var jv = "1.1";
    if (ff3up) {
        jv = "1.8";
    } else {
        if (ff20) {
            jv = "1.7";
        } else {
            if (ff15) {
                jv = "1.6";
            } else {
                if (ff0 || ff10 || nn6up || op7up) {
                    jv = "1.5";
                } else {
                    if ((mac && ie5up) || op6) {
                        jv = "1.4";
                    } else {
                        if (ie5up || nn4 || op5) {
                            jv = "1.3";
                        } else {
                            if (ie4) {
                                jv = "1.2";
                            }
                        }
                    }
                }
            }
        }
    }
    return jv;
}
function dcsFunc(func) {
    if (typeof(window[func]) == "function") {
        window[func]();
    }
}
jQuery(document).ready(function() {
    if (dcsInit.enabled) {
        dcsVar();
        dcsMeta();
        WT.mc_ev = dcsCQP();
        dcsFunc("dcsAdv");
        dcsTag();
    }
});
/*############ End common/js/tracking/wtBase.js ############*/
