// Begin ~/Scripts/jquery.utilities.js

(function($) { $.fn.reverseOrder = function() { return this.each(function() { $(this).prependTo($(this).parent()); }); }; })(jQuery); jQuery.fn.reverse = function() { return this.pushStack(this.get().reverse(), arguments); }; jQuery.fn.sort = function() { return this.pushStack([].sort.apply(this, arguments), []); };

// End ~/Scripts/jquery.utilities.js

// Begin ~/Scripts/jquery.autocomplete.js

jQuery.autocomplete = function(input, options) {
    var me = this; var $input = $(input).attr("autocomplete", "off"); if (options.inputClass) $input.addClass(options.inputClass); var results = document.createElement("div"); var $results = $(results); $results.hide().addClass(options.resultsClass).css("position", "absolute"); if (options.width > 0) $results.css("width", options.width); $("body").append(results); input.autocompleter = me; var timeout = null; var prev = null; var active = -1; var cache = {}; var keyb = false; var hasFocus = false; var lastKeyPressCode = null; function flushCache() { cache = {}; cache.data = {}; cache.length = 0; }; flushCache(); if (options.data != null) {
        var sFirstChar = "", stMatchSets = {}, row = []; if (typeof options.url != "string") options.cacheLength = 1; for (var i = 0; i < options.data.length; i++) { row = ((typeof options.data[i] == "string") ? [options.data[i]] : options.data[i]); if (row[0].length > 0) { sFirstChar = row[0].substring(0, 1).toLowerCase(); if (!stMatchSets[sFirstChar]) stMatchSets[sFirstChar] = []; stMatchSets[sFirstChar].push(row); } }
        for (var k in stMatchSets) { options.cacheLength++; addToCache(k, stMatchSets[k]); } 
    }
    $input.keydown(function(e) {
        lastKeyPressCode = e.keyCode; switch (e.keyCode) {
            case 38: e.preventDefault(); moveSelect(-1); break; case 40: e.preventDefault(); moveSelect(1); break; case 9: case 13: if (selectCurrent()) { $input.get(0).blur(); e.preventDefault(); }
                break; default: active = -1; if (timeout) clearTimeout(timeout); timeout = setTimeout(function() { onChange(); }, options.delay); break;
        } 
    }).focus(function() {
        if (options.minChars == -1) { requestData(""); }
        hasFocus = true;
    }).blur(function() { hasFocus = false; hideResults(); }); hideResultsNow(); function onChange() { if (lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32)) return $results.hide(); var v = $input.val(); prev = v; if (v.length >= options.minChars) { $input.addClass(options.loadingClass); requestData(v); } else { $input.removeClass(options.loadingClass); $results.hide(); } }; function moveSelect(step) {
        var lis = $("li", results); if (!lis) return; active += step; if (active < 0) { active = 0; } else if (active >= lis.size()) { active = lis.size() - 1; }
        lis.removeClass("ac_over"); $(lis[active]).addClass("ac_over");
    }; function selectCurrent() {
        var li = $("li.ac_over", results)[0]; if (!li) { var $li = $("li", results); if (options.selectOnly) { if ($li.length == 1) li = $li[0]; } else if (options.selectFirst) { li = $li[0]; } }
        if (li) { selectItem(li); return true; } else { return false; } 
    }; function selectItem(li) {
        if (!li) { li = document.createElement("li"); li.extra = []; li.selectValue = ""; }
        var v = $.trim(li.selectValue ? li.selectValue : li.innerHTML); input.lastSelected = v; prev = v; $results.html(""); $input.val(v); hideResultsNow(); if (options.onItemSelect) setTimeout(function() { options.onItemSelect(li) }, 1);
    }; function createSelection(start, end) {
        var field = $input.get(0); if (field.createTextRange) { var selRange = field.createTextRange(); selRange.collapse(true); selRange.moveStart("character", start); selRange.moveEnd("character", end); selRange.select(); } else if (field.setSelectionRange) { field.setSelectionRange(start, end); } else { if (field.selectionStart) { field.selectionStart = start; field.selectionEnd = end; } }
        field.focus();
    }; function autoFill(sValue) { if (lastKeyPressCode != 8) { $input.val($input.val() + sValue.substring(prev.length)); createSelection(prev.length, sValue.length); } }; function showResults() { var pos = findPos(input); var iWidth = (options.width > 0) ? options.width : $input.width(); $results.css({ width: parseInt(iWidth) + "px", top: (pos.y + input.offsetHeight) + "px", left: pos.x + "px" }).show(); }; function hideResults() { if (timeout) clearTimeout(timeout); timeout = setTimeout(hideResultsNow, 200); }; function hideResultsNow() {
        if (timeout) clearTimeout(timeout); $input.removeClass(options.loadingClass); if ($results.is(":visible")) { $results.hide(); }
        if (options.mustMatch) { var v = $input.val(); if (v != input.lastSelected) { } } 
    }; function receiveData(q, data) {
        if (data) {
            $input.removeClass(options.loadingClass); results.innerHTML = ""; if (!hasFocus || data.length == 0) return hideResultsNow(); if ($.browser.msie) { $results.append(document.createElement('iframe')); }
            results.appendChild(dataToDom(data)); if (options.autoFill && ($input.val().toLowerCase() == q.toLowerCase())) autoFill(data[0][0]); showResults();
        } else { hideResultsNow(); } 
    }; function parseData(data) {
        if (!data) return null; var parsed = []; var rows = data.split(options.lineSeparator); for (var i = 0; i < rows.length; i++) { var row = $.trim(rows[i]); if (row) { parsed[parsed.length] = row.split(options.cellSeparator); } }
        return parsed;
    }; function dataToDom(data) {
        var ul = document.createElement("ul"); var num = data.length; if ((options.maxItemsToShow > 0) && (options.maxItemsToShow < num)) num = options.maxItemsToShow; for (var i = 0; i < num; i++) {
            var row = data[i]; if (!row) continue; var li = document.createElement("li"); if (options.formatItem) { li.innerHTML = options.formatItem(row, i, num); li.selectValue = row[0]; } else { li.innerHTML = row[0]; li.selectValue = row[0]; }
            var extra = null; if (row.length > 1) { extra = []; for (var j = 1; j < row.length; j++) { extra[extra.length] = row[j]; } }
            li.extra = extra; ul.appendChild(li); $(li).hover(function() { $("li", ul).removeClass("ac_over"); $(this).addClass("ac_over"); active = $("li", ul).indexOf($(this).get(0)); }, function() { $(this).removeClass("ac_over"); }).click(function(e) { e.preventDefault(); e.stopPropagation(); selectItem(this) });
        }
        return ul;
    }; function requestData(q) { if (!options.matchCase) q = q.toLowerCase(); var data = options.cacheLength ? loadFromCache(q) : null; if (data) { receiveData(q, data); } else if ((typeof options.url == "string") && (options.url.length > 0)) { $.get(makeUrl(q), function(data) { data = parseData(data); addToCache(q, data); receiveData(q, data); }); } else { $input.removeClass(options.loadingClass); } }; function makeUrl(q) {
        var url = options.url + "?q=" + encodeURI(q); for (var i in options.extraParams) { url += "&" + i + "=" + encodeURI(options.extraParams[i]); }
        return url;
    }; function loadFromCache(q) {
        if (!q) return null; if (cache.data[q]) return cache.data[q]; if (options.matchSubset) {
            for (var i = q.length - 1; i >= options.minChars; i--) {
                var qs = q.substr(0, i); var c = cache.data[qs]; if (c) {
                    var csub = []; for (var j = 0; j < c.length; j++) { var x = c[j]; var x0 = x[0]; if (matchSubset(x0, q)) { csub[csub.length] = x; } }
                    return csub;
                } 
            } 
        }
        return null;
    }; function matchSubset(s, sub) { if (!options.matchCase) s = s.toLowerCase(); var i = s.indexOf(sub); if (i == -1) return false; return i == 0 || options.matchContains; }; this.flushCache = function() { flushCache(); }; this.setExtraParams = function(p) { options.extraParams = p; }; this.findValue = function() {
        var q = $input.val(); if (!options.matchCase) q = q.toLowerCase(); var data = options.cacheLength ? loadFromCache(q) : null; if (data) { findValueCallback(q, data); } else if ((typeof options.url == "string") && (options.url.length > 0)) {
            $.get(makeUrl(q), function(data) {
                data = parseData(data)
                addToCache(q, data); findValueCallback(q, data);
            });
        } else { findValueCallback(q, null); } 
    }
    function findValueCallback(q, data) {
        if (data) $input.removeClass(options.loadingClass); var num = (data) ? data.length : 0; var li = null; for (var i = 0; i < num; i++) {
            var row = data[i]; if (row[0].toLowerCase() == q.toLowerCase()) {
                li = document.createElement("li"); if (options.formatItem) { li.innerHTML = options.formatItem(row, i, num); li.selectValue = row[0]; } else { li.innerHTML = row[0]; li.selectValue = row[0]; }
                var extra = null; if (row.length > 1) { extra = []; for (var j = 1; j < row.length; j++) { extra[extra.length] = row[j]; } }
                li.extra = extra;
            } 
        }
        if (options.onFindValue) setTimeout(function() { options.onFindValue(li) }, 1);
    }
    function addToCache(q, data) {
        if (!data || !q || !options.cacheLength) return; if (!cache.length || cache.length > options.cacheLength) { flushCache(); cache.length++; } else if (!cache[q]) { cache.length++; }
        cache.data[q] = data;
    }; function findPos(obj) {
        var curleft = obj.offsetLeft || 0; var curtop = obj.offsetTop || 0; while (obj = obj.offsetParent) {
            curleft += obj.offsetLeft
            curtop += obj.offsetTop
        }
        return { x: curleft, y: curtop };
    } 
}
jQuery.fn.autocomplete = function(url, options, data) { options = options || {}; options.url = url; options.data = ((typeof data == "object") && (data.constructor == Array)) ? data : null; options.inputClass = options.inputClass || "ac_input"; options.resultsClass = options.resultsClass || "ac_results"; options.lineSeparator = options.lineSeparator || "\n"; options.cellSeparator = options.cellSeparator || "|"; options.minChars = options.minChars || 1; options.delay = options.delay || 400; options.matchCase = options.matchCase || 0; options.matchSubset = options.matchSubset || 1; options.matchContains = options.matchContains || 0; options.cacheLength = options.cacheLength || 1; options.mustMatch = options.mustMatch || 0; options.extraParams = options.extraParams || {}; options.loadingClass = options.loadingClass || "ac_loading"; options.selectFirst = options.selectFirst || false; options.selectOnly = options.selectOnly || false; options.maxItemsToShow = options.maxItemsToShow || -1; options.autoFill = options.autoFill || false; options.width = parseInt(options.width, 10) || 0; this.each(function() { var input = this; new jQuery.autocomplete(input, options); }); return this; }
jQuery.fn.autocompleteArray = function(data, options) { return this.autocomplete(null, options, data); }
jQuery.fn.indexOf = function(e) {
    for (var i = 0; i < this.length; i++) { if (this[i] == e) return i; }
    return -1;
};
// End ~/Scripts/jquery.autocomplete.js

// Begin ~/Scripts/jquery.boxy.js

/**
* Boxy 0.1.4 - Facebook-style dialog, with frills
*
* (c) 2008 Jason Frame
* Licensed under the MIT License (LICENSE)
*/

/*
* jQuery plugin
*
* Options:
*   message: confirmation message for form submit hook (default: "Please confirm:")
* 
* Any other options - e.g. 'clone' - will be passed onto the boxy constructor (or
* Boxy.load for AJAX operations)
*/
jQuery.fn.boxy = function(options) {
    options = options || {};
    return this.each(function() {
        var node = this.nodeName.toLowerCase(), self = this;
        if (node == 'a') {
            jQuery(this).click(function() {
                var active = Boxy.linkedTo(this),
                    href = this.getAttribute('href'),
                    localOptions = jQuery.extend({ actuator: this, title: this.title }, options);

                if (active) {
                    active.show();
                } else if (href.indexOf('#') >= 0) {
                    var content = jQuery(href.substr(href.indexOf('#'))),
                        newContent = content.clone(true);
                    content.remove();
                    localOptions.unloadOnHide = false;
                    new Boxy(newContent, localOptions);
                } else { // fall back to AJAX; could do with a same-origin check
                    if (!localOptions.cache) localOptions.unloadOnHide = true;
                    Boxy.load(this.href, localOptions);
                }

                return false;
            });
        } else if (node == 'form') {
            jQuery(this).bind('submit.boxy', function() {
                Boxy.confirm(options.message || 'Please confirm:', function() {
                    jQuery(self).unbind('submit.boxy').submit();
                });
                return false;
            });
        }
    });
};

//
// Boxy Class

function Boxy(element, options) {

    this.boxy = jQuery(Boxy.WRAPPER);
    jQuery.data(this.boxy[0], 'boxy', this);

    this.visible = false;
    this.options = jQuery.extend({}, Boxy.DEFAULTS, options || {});

    if (this.options.modal) {
        this.options = jQuery.extend(this.options, { center: true, draggable: false });
    }

    // options.actuator == DOM element that opened this boxy
    // association will be automatically deleted when this boxy is remove()d
    if (this.options.actuator) {
        jQuery.data(this.options.actuator, 'active.boxy', this);
    }

    this.setContent(element || "<div></div>");
    this._setupTitleBar();

    this.boxy.css('display', 'none').appendTo(document.body);
    this.toTop();

    if (this.options.fixed) {
        if (jQuery.browser.msie && jQuery.browser.version < 7) {
            this.options.fixed = false; // IE6 doesn't support fixed positioning
        } else {
            this.boxy.addClass('fixed');
        }
    }

    if (this.options.center && Boxy._u(this.options.x, this.options.y)) {
        this.center();
    } else {
        this.moveTo(
            Boxy._u(this.options.x) ? this.options.x : Boxy.DEFAULT_X,
            Boxy._u(this.options.y) ? this.options.y : Boxy.DEFAULT_Y
        );
    }

    if (this.options.show) this.show();

};

Boxy.EF = function() { };

jQuery.extend(Boxy, {

    WRAPPER: "<table cellspacing='0' cellpadding='0' border='0' class='boxy-wrapper'>" +
                "<tr><td class='top-left'></td><td class='top'></td><td class='top-right'></td></tr>" +
                "<tr><td class='left'></td><td class='boxy-inner'></td><td class='right'></td></tr>" +
                "<tr><td class='bottom-left'></td><td class='bottom'></td><td class='bottom-right'></td></tr>" +
                "</table>",

    DEFAULTS: {
        title: null,           // titlebar text. titlebar will not be visible if not set.
        closeable: true,           // display close link in titlebar?
        draggable: true,           // can this dialog be dragged?
        clone: false,          // clone content prior to insertion into dialog?
        actuator: null,           // element which opened this dialog
        center: true,           // center dialog in viewport?
        show: true,           // show dialog immediately?
        modal: false,          // make dialog modal?
        fixed: true,           // use fixed positioning, if supported? absolute positioning used otherwise
        closeText: '[x]',      // text to use for default close link
        unloadOnHide: false,          // should this dialog be removed from the DOM after being hidden?
        clickToFront: false,          // bring dialog to foreground on any click (not just titlebar)?
        behaviours: Boxy.EF,        // function used to apply behaviours to all content embedded in dialog.
        afterDrop: Boxy.EF,        // callback fired after dialog is dropped. executes in context of Boxy instance.
        afterShow: Boxy.EF,        // callback fired after dialog becomes visible. executes in context of Boxy instance.
        afterHide: Boxy.EF,        // callback fired after dialog is hidden. executed in context of Boxy instance.
        beforeUnload: Boxy.EF         // callback fired after dialog is unloaded. executed in context of Boxy instance.
    },

    DEFAULT_X: 50,
    DEFAULT_Y: 50,
    zIndex: 10000, // original value was 1337 ... value was raised to ensure it appeared on top of everything else
    dragConfigured: false, // only set up one drag handler for all boxys
    resizeConfigured: false,
    dragging: null,

    // load a URL and display in boxy
    // url - url to load
    // options keys (any not listed below are passed to boxy constructor)
    //   type: HTTP method, default: GET
    //   cache: cache retrieved content? default: false
    //   filter: jQuery selector used to filter remote content
    load: function(url, options) {

        options = options || {};

        var ajax = {
            url: url, type: 'GET', dataType: 'html', cache: false, success: function(html) {
                html = jQuery(html);
                if (options.filter) html = jQuery(options.filter, html);
                new Boxy(html, options);
            }
        };

        jQuery.each(['type', 'cache'], function() {
            if (this in options) {
                ajax[this] = options[this];
                delete options[this];
            }
        });

        jQuery.ajax(ajax);

    },

    // allows you to get a handle to the containing boxy instance of any element
    // e.g. <a href='#' onclick='alert(Boxy.get(this));'>inspect!</a>.
    // this returns the actual instance of the boxy 'class', not just a DOM element.
    // Boxy.get(this).hide() would be valid, for instance.
    get: function(ele) {
        var p = jQuery(ele).parents('.boxy-wrapper');
        return p.length ? jQuery.data(p[0], 'boxy') : null;
    },

    // returns the boxy instance which has been linked to a given element via the
    // 'actuator' constructor option.
    linkedTo: function(ele) {
        return jQuery.data(ele, 'active.boxy');
    },

    // displays an alert box with a given message, calling optional callback
    // after dismissal.
    alert: function(message, callback, options) {
        return Boxy.ask(message, ['OK'], callback, options);
    },

    // displays an alert box with a given message, calling after callback iff
    // user selects OK.
    confirm: function(message, after, options) {
        return Boxy.ask(message, ['OK', 'Cancel'], function(response) {
            if (response == 'OK') after();
        }, options);
    },

    // asks a question with multiple responses presented as buttons
    // selected item is returned to a callback method.
    // answers may be either an array or a hash. if it's an array, the
    // the callback will received the selected value. if it's a hash,
    // you'll get the corresponding key.
    ask: function(question, answers, callback, options) {

        options = jQuery.extend({ modal: true, closeable: false },
                                options || {},
                                { show: true, unloadOnHide: true });

        var body = jQuery('<div></div>').append(jQuery('<div class="question"></div>').html(question));

        // ick
        var map = {}, answerStrings = [];
        if (answers instanceof Array) {
            for (var i = 0; i < answers.length; i++) {
                map[answers[i]] = answers[i];
                answerStrings.push(answers[i]);
            }
        } else {
            for (var k in answers) {
                map[answers[k]] = k;
                answerStrings.push(answers[k]);
            }
        }

        var buttons = jQuery('<form class="answers"></form>');
        buttons.html(jQuery.map(answerStrings, function(v) {
            return "<input type='button' value='" + v + "' />";
        }).join(' '));

        jQuery('input[type=button]', buttons).click(function() {
            var clicked = this;
            Boxy.get(this).hide(function() {
                if (callback) callback(map[clicked.value]);
            });
        });

        body.append(buttons);

        new Boxy(body, options);

    },

    // returns true if a modal boxy is visible, false otherwise
    isModalVisible: function() {
        return jQuery('.boxy-modal-blackout').length > 0;
    },

    _u: function() {
        for (var i = 0; i < arguments.length; i++)
            if (typeof arguments[i] != 'undefined') return false;
        return true;
    },

    _handleResize: function(evt) {
        var d = jQuery(document);
        jQuery('.boxy-modal-blackout').css('display', 'none').css({
            width: d.width(), height: d.height()
        }).css('display', 'block');
    },

    _handleDrag: function(evt) {
        var d;
        if (d = Boxy.dragging) {
            d[0].boxy.css({ left: evt.pageX - d[1], top: evt.pageY - d[2] });
        }
    },

    _nextZ: function() {
        return Boxy.zIndex++;
    },

    _viewport: function() {
        var d = document.documentElement, b = document.body, w = window;
        return jQuery.extend(
            jQuery.browser.msie ?
                { left: b.scrollLeft || d.scrollLeft, top: b.scrollTop || d.scrollTop} :
                { left: w.pageXOffset, top: w.pageYOffset },
            !Boxy._u(w.innerWidth) ?
                { width: w.innerWidth, height: w.innerHeight} :
                (!Boxy._u(d) && !Boxy._u(d.clientWidth) && d.clientWidth != 0 ?
                    { width: d.clientWidth, height: d.clientHeight} :
                    { width: b.clientWidth, height: b.clientHeight }));
    }

});

Boxy.prototype = {

    // Returns the size of this boxy instance without displaying it.
    // Do not use this method if boxy is already visible, use getSize() instead.
    estimateSize: function() {
        this.boxy.css({ visibility: 'hidden', display: 'block' });
        var dims = this.getSize();
        this.boxy.css('display', 'none').css('visibility', 'visible');
        return dims;
    },

    // Returns the dimensions of the entire boxy dialog as [width,height]
    getSize: function() {
        return [this.boxy.width(), this.boxy.height()];
    },

    // Returns the dimensions of the content region as [width,height]
    getContentSize: function() {
        var c = this.getContent();
        return [c.width(), c.height()];
    },

    // Returns the position of this dialog as [x,y]
    getPosition: function() {
        var b = this.boxy[0];
        return [b.offsetLeft, b.offsetTop];
    },

    // Returns the center point of this dialog as [x,y]
    getCenter: function() {
        var p = this.getPosition();
        var s = this.getSize();
        return [Math.floor(p[0] + s[0] / 2), Math.floor(p[1] + s[1] / 2)];
    },

    // Returns a jQuery object wrapping the inner boxy region.
    // Not much reason to use this, you're probably more interested in getContent()
    getInner: function() {
        return jQuery('.boxy-inner', this.boxy);
    },

    // Returns a jQuery object wrapping the boxy content region.
    // This is the user-editable content area (i.e. excludes titlebar)
    getContent: function() {
        return jQuery('.boxy-content', this.boxy);
    },

    // Replace dialog content
    setContent: function(newContent) {
        newContent = jQuery(newContent).css({ display: 'block' }).addClass('boxy-content');
        if (this.options.clone) newContent = newContent.clone(true);
        this.getContent().remove();
        this.getInner().append(newContent);
        this._setupDefaultBehaviours(newContent);
        this.options.behaviours.call(this, newContent);
        return this;
    },

    // Move this dialog to some position, funnily enough
    moveTo: function(x, y) {
        this.moveToX(x).moveToY(y);
        return this;
    },

    // Move this dialog (x-coord only)
    moveToX: function(x) {
        if (typeof x == 'number') this.boxy.css({ left: x });
        else this.centerX();
        return this;
    },

    // Move this dialog (y-coord only)
    moveToY: function(y) {
        if (typeof y == 'number') this.boxy.css({ top: y });
        else this.centerY();
        return this;
    },

    // Move this dialog so that it is centered at (x,y)
    centerAt: function(x, y) {
        var s = this[this.visible ? 'getSize' : 'estimateSize']();
        if (typeof x == 'number') this.moveToX(x - s[0] / 2);
        if (typeof y == 'number') this.moveToY(y - s[1] / 2);
        return this;
    },

    centerAtX: function(x) {
        return this.centerAt(x, null);
    },

    centerAtY: function(y) {
        return this.centerAt(null, y);
    },

    // Center this dialog in the viewport
    // axis is optional, can be 'x', 'y'.
    center: function(axis) {
        var v = Boxy._viewport();
        var o = this.options.fixed ? [0, 0] : [v.left, v.top];
        if (!axis || axis == 'x') this.centerAt(o[0] + v.width / 2, null);
        if (!axis || axis == 'y') this.centerAt(null, o[1] + v.height / 2);
        return this;
    },

    // Center this dialog in the viewport (x-coord only)
    centerX: function() {
        return this.center('x');
    },

    // Center this dialog in the viewport (y-coord only)
    centerY: function() {
        return this.center('y');
    },

    // Resize the content region to a specific size
    resize: function(width, height, after) {
        if (!this.visible) return;
        var bounds = this._getBoundsForResize(width, height);
        this.boxy.css({ left: bounds[0], top: bounds[1] });
        this.getContent().css({ width: bounds[2], height: bounds[3] });
        if (after) after(this);
        return this;
    },

    // Tween the content region to a specific size
    tween: function(width, height, after) {
        if (!this.visible) return;
        var bounds = this._getBoundsForResize(width, height);
        var self = this;
        this.boxy.stop().animate({ left: bounds[0], top: bounds[1] });
        this.getContent().stop().animate({ width: bounds[2], height: bounds[3] }, function() {
            if (after) after(self);
        });
        return this;
    },

    // Returns true if this dialog is visible, false otherwise
    isVisible: function() {
        return this.visible;
    },

    // Make this boxy instance visible
    show: function() {
        if (this.visible) return;
        if (this.options.modal) {
            var self = this;
            if (!Boxy.resizeConfigured) {
                Boxy.resizeConfigured = true;
                jQuery(window).resize(function() { Boxy._handleResize(); });
            }
            this.modalBlackout = jQuery('<div class="boxy-modal-blackout"></div>')
                .css({ zIndex: Boxy._nextZ(),
                    opacity: 0.7,
                    width: jQuery(document).width(),
                    height: jQuery(document).height()
                })
                .appendTo(document.body);
            this.toTop();
            if (this.options.closeable) {
                jQuery(document.body).bind('keypress.boxy', function(evt) {
                    var key = evt.which || evt.keyCode;
                    if (key == 27) {
                        self.hide();
                        jQuery(document.body).unbind('keypress.boxy');
                    }
                });
            }
        }
        this.boxy.stop().css({ opacity: 1 }).show();
        this.visible = true;
        //hide the select elements for IE6
        if (document.all && !window.XMLHttpRequest) {
            $("select").css({ visibility: "hidden" });
            //we need to make the select elements inside the boxy pop-up
            visible
            $(".boxy-content select").css({ visibility: "visible" });
        }
        this._fire('afterShow');
        return this;
    },

    // Hide this boxy instance
    hide: function(after) {
        if (!this.visible) return;
        var self = this;
        if (this.options.modal) {
            jQuery(document.body).unbind('keypress.boxy');
            this.modalBlackout.animate({ opacity: 0 }, function() {
                jQuery(this).remove();
            });
        }
        this.boxy.stop().animate({ opacity: 0 }, 300, function() {
            self.boxy.css({ display: 'none' });
            self.visible = false;
            self._fire('afterHide');
            if (after) after(self);
            if (self.options.unloadOnHide) self.unload();
        });
        //show the select elements for IE6
        if (document.all && !window.XMLHttpRequest) {
            $("select").css({ visibility: "visible" });
        }
        return this;
    },

    toggle: function() {
        this[this.visible ? 'hide' : 'show']();
        return this;
    },

    hideAndUnload: function(after) {
        this.options.unloadOnHide = true;
        this.hide(after);
        return this;
    },

    unload: function() {
        this._fire('beforeUnload');
        this.boxy.remove();
        if (this.options.actuator) {
            jQuery.data(this.options.actuator, 'active.boxy', false);
        }
    },

    // Move this dialog box above all other boxy instances
    toTop: function() {
        this.boxy.css({ zIndex: Boxy._nextZ() });
        return this;
    },

    // Returns the title of this dialog
    getTitle: function() {
        return jQuery('> .title-bar h2', this.getInner()).html();
    },

    // Sets the title of this dialog
    setTitle: function(t) {
        jQuery('> .title-bar h2', this.getInner()).html(t);
        return this;
    },

    //
    // Don't touch these privates

    _getBoundsForResize: function(width, height) {
        var csize = this.getContentSize();
        var delta = [width - csize[0], height - csize[1]];
        var p = this.getPosition();
        return [Math.max(p[0] - delta[0] / 2, 0),
                Math.max(p[1] - delta[1] / 2, 0), width, height];
    },

    _setupTitleBar: function() {
        if (this.options.title) {
            var self = this;
            var tb = jQuery("<div class='title-bar'></div>").html("<h2>" + this.options.title + "</h2>");
            if (this.options.closeable) {
                tb.append(jQuery("<a href='#' class='close'></a>").html(this.options.closeText));
            }
            if (this.options.draggable) {
                tb[0].onselectstart = function() { return false; }
                tb[0].unselectable = 'on';
                tb[0].style.MozUserSelect = 'none';
                if (!Boxy.dragConfigured) {
                    jQuery(document).mousemove(Boxy._handleDrag);
                    Boxy.dragConfigured = true;
                }
                tb.mousedown(function(evt) {
                    self.toTop();
                    Boxy.dragging = [self, evt.pageX - self.boxy[0].offsetLeft, evt.pageY - self.boxy[0].offsetTop];
                    jQuery(this).addClass('dragging');
                }).mouseup(function() {
                    jQuery(this).removeClass('dragging');
                    Boxy.dragging = null;
                    self._fire('afterDrop');
                });
            }
            this.getInner().prepend(tb);
            this._setupDefaultBehaviours(tb);
        }
    },

    _setupDefaultBehaviours: function(root) {
        var self = this;
        if (this.options.clickToFront) {
            root.click(function() { self.toTop(); });
        }
        jQuery('.close', root).click(function() {
            self.hide();
            return false;
        }).mousedown(function(evt) { evt.stopPropagation(); });
    },

    _fire: function(event) {
        this.options[event].call(this);
    }

};

// End ~/Scripts/jquery.boxy.js

// Begin ~/Scripts/jquery.growl.js

(function($) {
    $.growl = function(title, message, image, priority) { notify(title, message, image, priority); }
    $.growl.version = "1.0.0-b2"; function create(rebuild) {
        var instance = document.getElementById('growlDock'); if (!instance || rebuild) { instance = $(jQuery.growl.settings.dockTemplate).attr('id', 'growlDock').addClass('growl'); if (jQuery.growl.settings.defaultStylesheet) { $('head').append('<link rel="stylesheet" type="text/css" href="' + jQuery.growl.settings.defaultStylesheet + '" />'); } } else { instance = $(instance); }
        $('body').append(instance.css(jQuery.growl.settings.dockCss)); return instance;
    }; function r(text, expr, val) {
        while (expr.test(text)) { text = text.replace(expr, val); }
        return text;
    }; function notify(title, message, image, priority) { var instance = create(); var html = jQuery.growl.settings.noticeTemplate; if (typeof (html) == 'object') html = $(html).html(); html = r(html, /%message%/, (message ? message : '')); html = r(html, /%title%/, (title ? title : '')); html = r(html, /%image%/, (image ? image : jQuery.growl.settings.defaultImage)); html = r(html, /%priority%/, (priority ? priority : 'normal')); var notice = $(html).hide().css(jQuery.growl.settings.noticeCss).fadeIn(jQuery.growl.settings.notice); ; $.growl.settings.noticeDisplay(notice); instance.append(notice); if ($.growl.settings.displayTimeout > 0) { setTimeout(function() { jQuery.growl.settings.noticeRemove(notice, function() { notice.remove(); }); }, jQuery.growl.settings.displayTimeout); } }; $.growl.settings = { dockTemplate: '<div></div>', dockCss: { position: 'fixed', top: '10px', right: '10px', width: '300px', zIndex: 50000 }, noticeTemplate: '<div class="notice growl">' + ' <h3 style="margin-top: 15px">%title%</h3>' + ' <p>%message%</p>' + '</div>', noticeCss: { opacity: .95, backgroundColor: '#FFCC00', color: '#000' }, noticeDisplay: function(notice) { notice.css({ 'opacity': '0' }).fadeIn(jQuery.growl.settings.noticeFadeTimeout); }, noticeRemove: function(notice, callback) { notice.animate({ opacity: '0', height: '0px' }, { duration: jQuery.growl.settings.noticeFadeTimeout, complete: callback }); }, noticeFadeTimeout: 'slow', displayTimeout: 3500, defaultImage: 'growl.jpg', defaultStylesheet: null, noticeElement: function(el) { $.growl.settings.noticeTemplate = $(el); } };
})(jQuery);
// End ~/Scripts/jquery.growl.js

// Begin ~/Scripts/jquery.defaultvalue.js

(function($) {
    $.fn.defaultvalue = function() {
        var elements = this; var args = arguments; var c = 0; return (elements.each(function() {
            var el = $(this); var def = args[c++]; el.val(def).focus(function() {
                if (el.val() == def) { el.val("").removeClass("ghosttext"); }
                el.blur(function() { if (el.val() == "") { el.val(def).addClass("ghosttext"); } });
            });
        }));
    } 
})(jQuery)
// End ~/Scripts/jquery.defaultvalue.js

// Begin ~/Scripts/jquery.innerfade.js

;
(function($) {

    $.fn.innerfade = function(options) {
        return this.each(function() {
            $.innerfade(this, options);
        });
    };

    $.innerfade = function(container, options) {
        var settings = {
            'animationtype': 'fade',
            'speed': 'normal',
            'type': 'sequence',
            'timeout': 2000,
            'containerheight': 'auto',
            'runningclass': 'innerfade',
            'children': null
        };
        if (options)
            $.extend(settings, options);
        if (settings.children === null)
            var elements = $(container).children();
        else
            var elements = $(container).children(settings.children);
        if (elements.length > 1) {
            $(container).css('position', 'relative').css('height', settings.containerheight).addClass(settings.runningclass);
            for (var i = 0; i < elements.length; i++) {
                $(elements[i]).css('z-index', String(elements.length - i)).css('position', 'absolute').hide();
            };
            if (settings.type == "sequence") {
                setTimeout(function() {
                    $.innerfade.next(elements, settings, 1, 0);
                }, settings.timeout);
                $(elements[0]).show();
            } else if (settings.type == "random") {
                var last = Math.floor(Math.random() * (elements.length));
                setTimeout(function() {
                    do {
                        current = Math.floor(Math.random() * (elements.length));
                    } while (last == current);
                    $.innerfade.next(elements, settings, current, last);
                }, settings.timeout);
                $(elements[last]).show();
            } else if (settings.type == 'random_start') {
                settings.type = 'sequence';
                var current = Math.floor(Math.random() * (elements.length));
                setTimeout(function() {
                    $.innerfade.next(elements, settings, (current + 1) % elements.length, current);
                }, settings.timeout);
                $(elements[current]).show();
            } else {
                alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
            }
        }
    };

    $.innerfade.next = function(elements, settings, current, last) {
        if (settings.animationtype == 'slide') {
            $(elements[last]).slideUp(settings.speed);
            $(elements[current]).slideDown(settings.speed);
        } else if (settings.animationtype == 'fade') {
            $(elements[last]).fadeOut(settings.speed);
            $(elements[current]).fadeIn(settings.speed, function() {
                removeFilter($(this)[0]);
            });
        } else
            alert('Innerfade-animationtype must either be \'slide\' or \'fade\'');
        if (settings.type == "sequence") {
            if ((current + 1) < elements.length) {
                current = current + 1;
                last = current - 1;
            } else {
                current = 0;
                last = elements.length - 1;
            }
        } else if (settings.type == "random") {
            last = current;
            while (current == last)
                current = Math.floor(Math.random() * elements.length);
        } else
            alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
        setTimeout((function() {
            $.innerfade.next(elements, settings, current, last);
        }), settings.timeout);
    };

})(jQuery);

// **** remove Opacity-Filter in ie ****
function removeFilter(element) {
    if (element.style.removeAttribute) {
        element.style.removeAttribute('filter');
    }
}

// End ~/Scripts/jquery.innerfade.js

// Begin ~/Scripts/jquery.printarea.js

(function($) {
    var printAreaCount = 0; $.fn.printArea = function() { var ele = $(this); var idPrefix = "printArea_"; removePrintArea(idPrefix + printAreaCount); printAreaCount++; var iframeId = idPrefix + printAreaCount; var iframeStyle = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;'; iframe = document.createElement('IFRAME'); $(iframe).attr({ style: iframeStyle, id: iframeId }); document.body.appendChild(iframe); var doc = iframe.contentWindow.document; $(document).find("link").filter(function() { return $(this).attr("rel").toLowerCase() == "stylesheet"; }).each(function() { doc.write('<link type="text/css" rel="stylesheet" href="' + $(this).attr("href") + '" >'); }); doc.write('<div class="' + $(ele).attr("class") + '">' + $(ele).html() + '</div>'); doc.close(); var frameWindow = iframe.contentWindow; frameWindow.close(); frameWindow.focus(); frameWindow.print(); }
    var removePrintArea = function(id) { $("iframe#" + id).remove(); };
})(jQuery);
// End ~/Scripts/jquery.printarea.js

// Begin ~/Scripts/jquery.cookie.js

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // NOTE Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
// End ~/Scripts/jquery.cookie.js

// Begin ~/Scripts/superfish.js

; (function($) {
    $.fn.superfish = function(op) { var sf = $.fn.superfish, c = sf.c, $arrow = $(['<span class="', c.arrowClass, '"> �</span>'].join('')), over = function() { var $$ = $(this), menu = getMenu($$); clearTimeout(menu.sfTimer); $$.showSuperfishUl().siblings().hideSuperfishUl(); }, out = function() { var $$ = $(this), menu = getMenu($$), o = sf.op; clearTimeout(menu.sfTimer); menu.sfTimer = setTimeout(function() { o.retainPath = ($.inArray($$[0], o.$path) > -1); $$.hideSuperfishUl(); if (o.$path.length && $$.parents(['li.', o.hoverClass].join('')).length < 1) { over.call(o.$path); } }, o.delay); }, getMenu = function($menu) { var menu = $menu.parents(['ul.', c.menuClass, ':first'].join(''))[0]; sf.op = sf.o[menu.serial]; return menu; }, addArrow = function($a) { $a.addClass(c.anchorClass).append($arrow.clone()); }; return this.each(function() { var s = this.serial = sf.o.length; var o = $.extend({}, sf.defaults, op); o.$path = $('li.' + o.pathClass, this).slice(0, o.pathLevels).each(function() { $(this).addClass([o.hoverClass, c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass); }); sf.o[s] = sf.op = o; $('li:has(ul)', this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over, out).each(function() { if (o.autoArrows) addArrow($('>a:first-child', this)); }).not('.' + c.bcClass).hideSuperfishUl(); var $a = $('a', this); $a.each(function(i) { var $li = $a.eq(i).parents('li'); $a.eq(i).focus(function() { over.call($li); }).blur(function() { out.call($li); }); }); o.onInit.call(this); }).addClass([c.menuClass, c.shadowClass].join(' ')); }; var sf = $.fn.superfish; sf.o = []; sf.op = {}; sf.IE7fix = function() {
        var o = sf.op; if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity != undefined)
            this.toggleClass(sf.c.shadowClass + '-off');
    }; sf.c = { bcClass: 'sf-breadcrumb', menuClass: 'sf-js-enabled', anchorClass: 'sf-with-ul', arrowClass: 'sf-sub-indicator', shadowClass: '' }; sf.defaults = { hoverClass: 'sfHover', pathClass: 'overideThisToUse', pathLevels: 1, delay: 25, animation: { opacity: 'show' }, speed: 20, autoArrows: false, dropShadows: false, disableHI: false, onInit: function() { }, onBeforeShow: function() { }, onShow: function() { }, onHide: function() { } }; $.fn.extend({ hideSuperfishUl: function() { var o = sf.op, not = (o.retainPath === true) ? o.$path : ''; o.retainPath = false; var $ul = $(['li.', o.hoverClass].join(''), this).add(this).not(not).removeClass(o.hoverClass).find('>ul').hide().css('visibility', 'hidden'); $ul.animate(o.animation, o.speed, function() { o.onHide.call($ul); }); return this; }, showSuperfishUl: function() { var o = sf.op, sh = sf.c.shadowClass + '-off', $ul = this.addClass(o.hoverClass).find('>ul:hidden').css('visibility', 'visible'); sf.IE7fix.call($ul); o.onBeforeShow.call($ul); return this; } });
})(jQuery);
// End ~/Scripts/superfish.js

// Begin ~/Scripts/jquery.tooltip.js

(function($) {
    $.fn.extend({ bstip: function(options) {
        var opts = $.extend({}, $.fn.bstip.defaults, options); return this.each(function(i) {
            var nowid = $(this).id, nowtitle = $(this).attr("title"), here = $(this); var nowclass = here.attr("class"), nowrel = here.attr("rel"); here.addClass("souniqueithurts"); if (nowclass == "") { newclass = ""; } else { newclass = nowclass; newclass = newclass.replace(/ /, ""); }
            if (nowid == "") { newid = ""; } else { newid = nowid; }
            if (nowrel == "") { newrel = ""; } else { newrel = nowrel; }
            if (opts.type == "tip") { $("body").append("<div class='" + opts.color + "' id='bs" + i + newclass + newid + newrel + "'>" + opts.forewrap + nowtitle + opts.backwrap + "</div>"); } else if (opts.type == "menu") { nextitem = $('#' + nowtitle); nextcont = nextitem.html(); $("body").append("<div class='" + opts.color + "' id='bs" + i + newclass + newid + newrel + "'>" + opts.forewrap + nextcont + opts.backwrap + "</div>"); nextitem.remove(); }
            var bs_tooltip = $("#bs" + i + newclass + newid + newrel); tipwidth = bs_tooltip.width()
            tipheight = bs_tooltip.height()
            offset = here.offset(); left = offset.left; right = offset.right; nwidth = $(this).width(); nheight = $(this).height(); if (opts.hook == "bottom-right" || opts.hook == "mid-right" || opts.hook == "top-right") { bleft = offset.left + nwidth + opts.xnudge; } else if (opts.hook == "bottom-mid" || opts.hook == "mid-mid" || opts.hook == "top-mid") { bleft = offset.left + (nwidth / 2) - (tipwidth / 2) + opts.xnudge; } else if (opts.hook == "bottom-left" || opts.hook == "mid-left" || opts.hook == "top-left") { bleft = offset.left - opts.xnudge - tipwidth; }
            if (opts.hook == "top-right" || opts.hook == "top-mid" || opts.hook == "top-left") { btop = offset.top - opts.ynudge - tipheight; } else if (opts.hook == "mid-right" || opts.hook == "mid-mid" || opts.hook == "mid-left") { btop = offset.top + opts.ynudge; } else if (opts.hook == "bottom-right" || opts.hook == "bottom-mid" || opts.hook == "bottom-left") { btop = offset.top + nheight + opts.ynudge; }
            bs_tooltip.css({ top: btop, left: bleft, position: "absolute", display: "none" }); if (opts.sticky == "none") { $(this).removeAttr("title").hover(function() { bs_tooltip.css({ "opacity": opts.opacity }).fadeIn(opts.speed); }, function() { t = setTimeout(function() { bs_tooltip.fadeOut(opts.speed); }, opts.tack); }); bs_tooltip.hover(function() { clearTimeout(t); }, function() { t = setTimeout(function() { bs_tooltip.fadeOut(opts.speed); }, opts.tack); }); } else if (opts.sticky == "move") {
                $(this).removeAttr("title").mouseover(function() { bs_tooltip.css({ opacity: opts.opacity, display: "none" }).fadeIn(opts.speed); }).mousemove(function(kmouse) {
                    tipwidth = bs_tooltip.width()
                    tipheight = bs_tooltip.height()
                    if (opts.hook == "bottom-right" || opts.hook == "mid-right" || opts.hook == "top-right") { bleft = kmouse.pageX + opts.xnudge; } else if (opts.hook == "bottom-mid" || opts.hook == "mid-mid" || opts.hook == "top-mid") { bleft = kmouse.pageX - (tipwidth / 2) + opts.xnudge; } else if (opts.hook == "bottom-left" || opts.hook == "mid-left" || opts.hook == "top-left") { bleft = kmouse.pageX - opts.xnudge - tipwidth; }
                    if (opts.hook == "top-right" || opts.hook == "top-mid" || opts.hook == "top-left") { btop = kmouse.pageY - tipheight - opts.ynudge; } else if (opts.hook == "mid-right" || opts.hook == "mid-mid" || opts.hook == "mid-left") { btop = kmouse.pageY - (tipheight / 2) + opts.ynudge; } else if (opts.hook == "bottom-right" || opts.hook == "bottom-mid" || opts.hook == "bottom-left") { btop = kmouse.pageY + opts.ynudge; }
                    bs_tooltip.css({ left: bleft, top: btop });
                }).mouseout(function() { bs_tooltip.fadeOut(opts.speed); });
            } else if (opts.sticky == "slide") {
                $(this).removeAttr("title").mouseover(function() { bs_tooltip.css({ opacity: opts.opacity, display: "none" }).fadeIn(opts.speed); }).mousemove(function(kmouse) {
                    if (opts.hook == "bottom-right" || opts.hook == "mid-right" || opts.hook == "top-right") { bleft = kmouse.pageX + opts.xnudge; } else if (opts.hook == "bottom-mid" || opts.hook == "mid-mid" || opts.hook == "top-mid") { bleft = kmouse.pageX - (tipwidth / 2) + opts.xnudge; } else if (opts.hook == "bottom-left" || opts.hook == "mid-left" || opts.hook == "top-left") { bleft = kmouse.pageX - opts.xnudge - tipwidth; }
                    if (opts.hook == "top-right" || opts.hook == "top-mid" || opts.hook == "top-left") { btop = top - opts.ynudge - tipheight; } else if (opts.hook == "mid-right" || opts.hook == "mid-mid" || opts.hook == "mid-left") { btop = top + opts.ynudge; } else if (opts.hook == "bottom-right" || opts.hook == "bottom-mid" || opts.hook == "bottom-left") { btop = top + nheight + opts.ynudge; }
                    bs_tooltip.css({ left: bleft, top: btop });
                }).mouseout(function() { t = setTimeout(function() { bs_tooltip.fadeOut(opts.speed); }, opts.tack); }); bs_tooltip.hover(function() { clearTimeout(t); }, function() { t = setTimeout(function() { bs_tooltip.fadeOut(opts.speed); }, opts.tack); });
            } 
        });
    } 
    }); $.fn.bstip.defaults = { sticky: 'move', forewrap: '<p>', backwrap: '</p>', hook: 'bottom-right', color: 'bstip', speed: 'fast', type: 'tip', tack: 0, keep: 2000, ynudge: 10, xnudge: 10, opacity: .9 };
})(jQuery);
// End ~/Scripts/jquery.tooltip.js

// Begin ~/Scripts/jquery.validate.min.js

/*
 * jQuery validation plug-in 1.5.2
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 *
 * $Id: jquery.validate.js 6243 2009-02-19 11:40:49Z joern.zaefferer $
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){validator.settings.submitHandler.call(validator,validator.currentForm);return false;}return true;}if(validator.cancelSubmit){validator.cancelSubmit=false;return handle();}if(validator.form()){if(validator.pendingRequest){validator.formSubmitted=true;return false;}return handle();}else{validator.focusInvalid();return false;}});}return validator;},valid:function(){if($(this[0]).is('form')){return this.validate().form();}else{var valid=false;var validator=$(this[0].form).validate();this.each(function(){valid|=validator.element(this);});return valid;}},removeAttrs:function(attributes){var result={},$element=this;$.each(attributes.split(/\s/),function(index,value){result[value]=$element.attr(value);$element.removeAttr(value);});return result;},rules:function(command,argument){var element=this[0];if(command){var settings=$.data(element.form,'validator').settings;var staticRules=settings.rules;var existingRules=$.validator.staticRules(element);switch(command){case"add":$.extend(existingRules,$.validator.normalizeRule(argument));staticRules[element.name]=existingRules;if(argument.messages)settings.messages[element.name]=$.extend(settings.messages[element.name],argument.messages);break;case"remove":if(!argument){delete staticRules[element.name];return existingRules;}var filtered={};$.each(argument.split(/\s/),function(index,method){filtered[method]=existingRules[method];delete existingRules[method];});return filtered;}}var data=$.validator.normalizeRules($.extend({},$.validator.metadataRules(element),$.validator.classRules(element),$.validator.attributeRules(element),$.validator.staticRules(element)),element);if(data.required){var param=data.required;delete data.required;data=$.extend({required:param},data);}return data;}});$.extend($.expr[":"],{blank:function(a){return!$.trim(a.value);},filled:function(a){return!!$.trim(a.value);},unchecked:function(a){return!a.checked;}});$.format=function(source,params){if(arguments.length==1)return function(){var args=$.makeArray(arguments);args.unshift(source);return $.format.apply(this,args);};if(arguments.length>2&&params.constructor!=Array){params=$.makeArray(arguments).slice(1);}if(params.constructor!=Array){params=[params];}$.each(params,function(i,n){source=source.replace(new RegExp("\\{"+i+"\\}","g"),n);});return source;};$.validator=function(options,form){this.settings=$.extend({},$.validator.defaults,options);this.currentForm=form;this.init();};$.extend($.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",errorElement:"label",focusInvalid:true,errorContainer:$([]),errorLabelContainer:$([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(element){this.lastActive=element;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,element,this.settings.errorClass);this.errorsFor(element).hide();}},onfocusout:function(element){if(!this.checkable(element)&&(element.name in this.submitted||!this.optional(element))){this.element(element);}},onkeyup:function(element){if(element.name in this.submitted||element==this.lastElement){this.element(element);}},onclick:function(element){if(element.name in this.submitted)this.element(element);},highlight:function(element,errorClass){$(element).addClass(errorClass);},unhighlight:function(element,errorClass){$(element).removeClass(errorClass);}},setDefaults:function(settings){$.extend($.validator.defaults,settings);},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",dateDE:"Bitte geben Sie ein gültiges Datum ein.",number:"Please enter a valid number.",numberDE:"Bitte geben Sie eine Nummer ein.",digits:"Please enter only digits",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.format("Please enter no more than {0} characters."),minlength:$.format("Please enter at least {0} characters."),rangelength:$.format("Please enter a value between {0} and {1} characters long."),range:$.format("Please enter a value between {0} and {1}."),max:$.format("Please enter a value less than or equal to {0}."),min:$.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){this.labelContainer=$(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||$(this.currentForm);this.containers=$(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var groups=(this.groups={});$.each(this.settings.groups,function(key,value){$.each(value.split(/\s/),function(index,name){groups[name]=key;});});var rules=this.settings.rules;$.each(rules,function(key,value){rules[key]=$.validator.normalizeRule(value);});function delegate(event){var validator=$.data(this[0].form,"validator");validator.settings["on"+event.type]&&validator.settings["on"+event.type].call(validator,this[0]);}$(this.currentForm).delegate("focusin focusout keyup",":text, :password, :file, select, textarea",delegate).delegate("click",":radio, :checkbox",delegate);if(this.settings.invalidHandler)$(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler);},form:function(){this.checkForm();$.extend(this.submitted,this.errorMap);this.invalid=$.extend({},this.errorMap);if(!this.valid())$(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid();},checkForm:function(){this.prepareForm();for(var i=0,elements=(this.currentElements=this.elements());elements[i];i++){this.check(elements[i]);}return this.valid();},element:function(element){element=this.clean(element);this.lastElement=element;this.prepareElement(element);this.currentElements=$(element);var result=this.check(element);if(result){delete this.invalid[element.name];}else{this.invalid[element.name]=true;}if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers);}this.showErrors();return result;},showErrors:function(errors){if(errors){$.extend(this.errorMap,errors);this.errorList=[];for(var name in errors){this.errorList.push({message:errors[name],element:this.findByName(name)[0]});}this.successList=$.grep(this.successList,function(element){return!(element.name in errors);});}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors();},resetForm:function(){if($.fn.resetForm)$(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass);},numberOfInvalids:function(){return this.objectLength(this.invalid);},objectLength:function(obj){var count=0;for(var i in obj)count++;return count;},hideErrors:function(){this.addWrapper(this.toHide).hide();},valid:function(){return this.size()==0;},size:function(){return this.errorList.length;},focusInvalid:function(){if(this.settings.focusInvalid){try{$(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus();}catch(e){}}},findLastActive:function(){var lastActive=this.lastActive;return lastActive&&$.grep(this.errorList,function(n){return n.element.name==lastActive.name;}).length==1&&lastActive;},elements:function(){var validator=this,rulesCache={};return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&validator.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in rulesCache||!validator.objectLength($(this).rules()))return false;rulesCache[this.name]=true;return true;});},clean:function(selector){return $(selector)[0];},errors:function(){return $(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext);},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=$([]);this.toHide=$([]);this.formSubmitted=false;this.currentElements=$([]);},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers);},prepareElement:function(element){this.reset();this.toHide=this.errorsFor(element);},check:function(element){element=this.clean(element);if(this.checkable(element)){element=this.findByName(element.name)[0];}var rules=$(element).rules();var dependencyMismatch=false;for(method in rules){var rule={method:method,parameters:rules[method]};try{var result=$.validator.methods[method].call(this,element.value.replace(/\r/g,""),element,rule.parameters);if(result=="dependency-mismatch"){dependencyMismatch=true;continue;}dependencyMismatch=false;if(result=="pending"){this.toHide=this.toHide.not(this.errorsFor(element));return;}if(!result){this.formatAndAdd(element,rule);return false;}}catch(e){this.settings.debug&&window.console&&console.log("exception occured when checking element "+element.id
+", check the '"+rule.method+"' method");throw e;}}if(dependencyMismatch)return;if(this.objectLength(rules))this.successList.push(element);return true;},customMetaMessage:function(element,method){if(!$.metadata)return;var meta=this.settings.meta?$(element).metadata()[this.settings.meta]:$(element).metadata();return meta&&meta.messages&&meta.messages[method];},customMessage:function(name,method){var m=this.settings.messages[name];return m&&(m.constructor==String?m:m[method]);},findDefined:function(){for(var i=0;i<arguments.length;i++){if(arguments[i]!==undefined)return arguments[i];}return undefined;},defaultMessage:function(element,method){return this.findDefined(this.customMessage(element.name,method),this.customMetaMessage(element,method),!this.settings.ignoreTitle&&element.title||undefined,$.validator.messages[method],"<strong>Warning: No message defined for "+element.name+"</strong>");},formatAndAdd:function(element,rule){var message=this.defaultMessage(element,rule.method);if(typeof message=="function")message=message.call(this,rule.parameters,element);this.errorList.push({message:message,element:element});this.errorMap[element.name]=message;this.submitted[element.name]=message;},addWrapper:function(toToggle){if(this.settings.wrapper)toToggle=toToggle.add(toToggle.parents(this.settings.wrapper));return toToggle;},defaultShowErrors:function(){for(var i=0;this.errorList[i];i++){var error=this.errorList[i];this.settings.highlight&&this.settings.highlight.call(this,error.element,this.settings.errorClass);this.showLabel(error.element,error.message);}if(this.errorList.length){this.toShow=this.toShow.add(this.containers);}if(this.settings.success){for(var i=0;this.successList[i];i++){this.showLabel(this.successList[i]);}}if(this.settings.unhighlight){for(var i=0,elements=this.validElements();elements[i];i++){this.settings.unhighlight.call(this,elements[i],this.settings.errorClass);}}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show();},validElements:function(){return this.currentElements.not(this.invalidElements());},invalidElements:function(){return $(this.errorList).map(function(){return this.element;});},showLabel:function(element,message){var label=this.errorsFor(element);if(label.length){label.removeClass().addClass(this.settings.errorClass);label.attr("generated")&&label.html(message);}else{label=$("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(element),generated:true}).addClass(this.settings.errorClass).html(message||"");if(this.settings.wrapper){label=label.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();}if(!this.labelContainer.append(label).length)this.settings.errorPlacement?this.settings.errorPlacement(label,$(element)):label.insertAfter(element);}if(!message&&this.settings.success){label.text("");typeof this.settings.success=="string"?label.addClass(this.settings.success):this.settings.success(label);}this.toShow=this.toShow.add(label);},errorsFor:function(element){return this.errors().filter("[for='"+this.idOrName(element)+"']");},idOrName:function(element){return this.groups[element.name]||(this.checkable(element)?element.name:element.id||element.name);},checkable:function(element){return/radio|checkbox/i.test(element.type);},findByName:function(name){var form=this.currentForm;return $(document.getElementsByName(name)).map(function(index,element){return element.form==form&&element.name==name&&element||null;});},getLength:function(value,element){switch(element.nodeName.toLowerCase()){case'select':return $("option:selected",element).length;case'input':if(this.checkable(element))return this.findByName(element.name).filter(':checked').length;}return value.length;},depend:function(param,element){return this.dependTypes[typeof param]?this.dependTypes[typeof param](param,element):true;},dependTypes:{"boolean":function(param,element){return param;},"string":function(param,element){return!!$(param,element.form).length;},"function":function(param,element){return param(element);}},optional:function(element){return!$.validator.methods.required.call(this,$.trim(element.value),element)&&"dependency-mismatch";},startRequest:function(element){if(!this.pending[element.name]){this.pendingRequest++;this.pending[element.name]=true;}},stopRequest:function(element,valid){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[element.name];if(valid&&this.pendingRequest==0&&this.formSubmitted&&this.form()){$(this.currentForm).submit();}else if(!valid&&this.pendingRequest==0&&this.formSubmitted){$(this.currentForm).triggerHandler("invalid-form",[this]);}},previousValue:function(element){return $.data(element,"previousValue")||$.data(element,"previousValue",previous={old:null,valid:true,message:this.defaultMessage(element,"remote")});}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(className,rules){className.constructor==String?this.classRuleSettings[className]=rules:$.extend(this.classRuleSettings,className);},classRules:function(element){var rules={};var classes=$(element).attr('class');classes&&$.each(classes.split(' '),function(){if(this in $.validator.classRuleSettings){$.extend(rules,$.validator.classRuleSettings[this]);}});return rules;},attributeRules:function(element){var rules={};var $element=$(element);for(method in $.validator.methods){var value=$element.attr(method);if(value){rules[method]=value;}}if(rules.maxlength&&/-1|2147483647|524288/.test(rules.maxlength)){delete rules.maxlength;}return rules;},metadataRules:function(element){if(!$.metadata)return{};var meta=$.data(element.form,'validator').settings.meta;return meta?$(element).metadata()[meta]:$(element).metadata();},staticRules:function(element){var rules={};var validator=$.data(element.form,'validator');if(validator.settings.rules){rules=$.validator.normalizeRule(validator.settings.rules[element.name])||{};}return rules;},normalizeRules:function(rules,element){$.each(rules,function(prop,val){if(val===false){delete rules[prop];return;}if(val.param||val.depends){var keepRule=true;switch(typeof val.depends){case"string":keepRule=!!$(val.depends,element.form).length;break;case"function":keepRule=val.depends.call(element,element);break;}if(keepRule){rules[prop]=val.param!==undefined?val.param:true;}else{delete rules[prop];}}});$.each(rules,function(rule,parameter){rules[rule]=$.isFunction(parameter)?parameter(element):parameter;});$.each(['minlength','maxlength','min','max'],function(){if(rules[this]){rules[this]=Number(rules[this]);}});$.each(['rangelength','range'],function(){if(rules[this]){rules[this]=[Number(rules[this][0]),Number(rules[this][1])];}});if($.validator.autoCreateRanges){if(rules.min&&rules.max){rules.range=[rules.min,rules.max];delete rules.min;delete rules.max;}if(rules.minlength&&rules.maxlength){rules.rangelength=[rules.minlength,rules.maxlength];delete rules.minlength;delete rules.maxlength;}}if(rules.messages){delete rules.messages}return rules;},normalizeRule:function(data){if(typeof data=="string"){var transformed={};$.each(data.split(/\s/),function(){transformed[this]=true;});data=transformed;}return data;},addMethod:function(name,method,message){$.validator.methods[name]=method;$.validator.messages[name]=message;if(method.length<3){$.validator.addClassRules(name,$.validator.normalizeRule(name));}},methods:{required:function(value,element,param){if(!this.depend(param,element))return"dependency-mismatch";switch(element.nodeName.toLowerCase()){case'select':var options=$("option:selected",element);return options.length>0&&(element.type=="select-multiple"||($.browser.msie&&!(options[0].attributes['value'].specified)?options[0].text:options[0].value).length>0);case'input':if(this.checkable(element))return this.getLength(value,element)>0;default:return $.trim(value).length>0;}},remote:function(value,element,param){if(this.optional(element))return"dependency-mismatch";var previous=this.previousValue(element);if(!this.settings.messages[element.name])this.settings.messages[element.name]={};this.settings.messages[element.name].remote=typeof previous.message=="function"?previous.message(value):previous.message;param=typeof param=="string"&&{url:param}||param;if(previous.old!==value){previous.old=value;var validator=this;this.startRequest(element);var data={};data[element.name]=value;$.ajax($.extend(true,{url:param,mode:"abort",port:"validate"+element.name,dataType:"json",data:data,success:function(response){if(response){var submitted=validator.formSubmitted;validator.prepareElement(element);validator.formSubmitted=submitted;validator.successList.push(element);validator.showErrors();}else{var errors={};errors[element.name]=response||validator.defaultMessage(element,"remote");validator.showErrors(errors);}previous.valid=response;validator.stopRequest(element,response);}},param));return"pending";}else if(this.pending[element.name]){return"pending";}return previous.valid;},minlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)>=param;},maxlength:function(value,element,param){return this.optional(element)||this.getLength($.trim(value),element)<=param;},rangelength:function(value,element,param){var length=this.getLength($.trim(value),element);return this.optional(element)||(length>=param[0]&&length<=param[1]);},min:function(value,element,param){return this.optional(element)||value>=param;},max:function(value,element,param){return this.optional(element)||value<=param;},range:function(value,element,param){return this.optional(element)||(value>=param[0]&&value<=param[1]);},email:function(value,element){return this.optional(element)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);},url:function(value,element){return this.optional(element)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);},date:function(value,element){return this.optional(element)||!/Invalid|NaN/.test(new Date(value));},dateISO:function(value,element){return this.optional(element)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);},dateDE:function(value,element){return this.optional(element)||/^\d\d?\.\d\d?\.\d\d\d?\d?$/.test(value);},number:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);},numberDE:function(value,element){return this.optional(element)||/^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);},digits:function(value,element){return this.optional(element)||/^\d+$/.test(value);},creditcard:function(value,element){if(this.optional(element))return"dependency-mismatch";if(/[^0-9-]+/.test(value))return false;var nCheck=0,nDigit=0,bEven=false;value=value.replace(/\D/g,"");for(n=value.length-1;n>=0;n--){var cDigit=value.charAt(n);var nDigit=parseInt(cDigit,10);if(bEven){if((nDigit*=2)>9)nDigit-=9;}nCheck+=nDigit;bEven=!bEven;}return(nCheck%10)==0;},accept:function(value,element,param){param=typeof param=="string"?param:"png|jpe?g|gif";return this.optional(element)||value.match(new RegExp(".("+param+")$","i"));},equalTo:function(value,element,param){return value==$(param).val();}}});})(jQuery);;(function($){var ajax=$.ajax;var pendingRequests={};$.ajax=function(settings){settings=$.extend(settings,$.extend({},$.ajaxSettings,settings));var port=settings.port;if(settings.mode=="abort"){if(pendingRequests[port]){pendingRequests[port].abort();}return(pendingRequests[port]=ajax.apply(this,arguments));}return ajax.apply(this,arguments);};})(jQuery);;(function($){$.each({focus:'focusin',blur:'focusout'},function(original,fix){$.event.special[fix]={setup:function(){if($.browser.msie)return false;this.addEventListener(original,$.event.special[fix].handler,true);},teardown:function(){if($.browser.msie)return false;this.removeEventListener(original,$.event.special[fix].handler,true);},handler:function(e){arguments[0]=$.event.fix(e);arguments[0].type=fix;return $.event.handle.apply(this,arguments);}};});$.extend($.fn,{delegate:function(type,delegate,handler){return this.bind(type,function(event){var target=$(event.target);if(target.is(delegate)){return handler.apply(target,arguments);}});},triggerEvent:function(type,target){return this.triggerHandler(type,[$.event.fix({type:type,target:target})]);}})})(jQuery);
// End ~/Scripts/jquery.validate.min.js

// Begin ~/Scripts/jquery.maskedinput.js

/*
Masked Input plugin for jQuery
Copyright (c) 2007-2009 Josh Bush (digitalbush.com)
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license) 
Version: 1.2.2 (03/09/2009 22:39:06)
*/
(function(a) { var c = (a.browser.msie ? "paste" : "input") + ".mask"; var b = (window.orientation != undefined); a.mask = { definitions: { "9": "[0-9]", a: "[A-Za-z]", "*": "[A-Za-z0-9]"} }; a.fn.extend({ caret: function(e, f) { if (this.length == 0) { return } if (typeof e == "number") { f = (typeof f == "number") ? f : e; return this.each(function() { if (this.setSelectionRange) { this.focus(); this.setSelectionRange(e, f) } else { if (this.createTextRange) { var g = this.createTextRange(); g.collapse(true); g.moveEnd("character", f); g.moveStart("character", e); g.select() } } }) } else { if (this[0].setSelectionRange) { e = this[0].selectionStart; f = this[0].selectionEnd } else { if (document.selection && document.selection.createRange) { var d = document.selection.createRange(); e = 0 - d.duplicate().moveStart("character", -100000); f = e + d.text.length } } return { begin: e, end: f} } }, unmask: function() { return this.trigger("unmask") }, mask: function(j, d) { if (!j && this.length > 0) { var f = a(this[0]); var g = f.data("tests"); return a.map(f.data("buffer"), function(l, m) { return g[m] ? l : null }).join("") } d = a.extend({ placeholder: "_", completed: null }, d); var k = a.mask.definitions; var g = []; var e = j.length; var i = null; var h = j.length; a.each(j.split(""), function(m, l) { if (l == "?") { h--; e = m } else { if (k[l]) { g.push(new RegExp(k[l])); if (i == null) { i = g.length - 1 } } else { g.push(null) } } }); return this.each(function() { var r = a(this); var m = a.map(j.split(""), function(x, y) { if (x != "?") { return k[x] ? d.placeholder : x } }); var n = false; var q = r.val(); r.data("buffer", m).data("tests", g); function v(x) { while (++x <= h && !g[x]) { } return x } function t(x) { while (!g[x] && --x >= 0) { } for (var y = x; y < h; y++) { if (g[y]) { m[y] = d.placeholder; var z = v(y); if (z < h && g[y].test(m[z])) { m[y] = m[z] } else { break } } } s(); r.caret(Math.max(i, x)) } function u(y) { for (var A = y, z = d.placeholder; A < h; A++) { if (g[A]) { var B = v(A); var x = m[A]; m[A] = z; if (B < h && g[B].test(x)) { z = x } else { break } } } } function l(y) { var x = a(this).caret(); var z = y.keyCode; n = (z < 16 || (z > 16 && z < 32) || (z > 32 && z < 41)); if ((x.begin - x.end) != 0 && (!n || z == 8 || z == 46)) { w(x.begin, x.end) } if (z == 8 || z == 46 || (b && z == 127)) { t(x.begin + (z == 46 ? 0 : -1)); return false } else { if (z == 27) { r.val(q); r.caret(0, p()); return false } } } function o(B) { if (n) { n = false; return (B.keyCode == 8) ? false : null } B = B || window.event; var C = B.charCode || B.keyCode || B.which; var z = a(this).caret(); if (B.ctrlKey || B.altKey || B.metaKey) { return true } else { if ((C >= 32 && C <= 125) || C > 186) { var x = v(z.begin - 1); if (x < h) { var A = String.fromCharCode(C); if (g[x].test(A)) { u(x); m[x] = A; s(); var y = v(x); a(this).caret(y); if (d.completed && y == h) { d.completed.call(r) } } } } } return false } function w(x, y) { for (var z = x; z < y && z < h; z++) { if (g[z]) { m[z] = d.placeholder } } } function s() { return r.val(m.join("")).val() } function p(y) { var z = r.val(); var C = -1; for (var B = 0, x = 0; B < h; B++) { if (g[B]) { m[B] = d.placeholder; while (x++ < z.length) { var A = z.charAt(x - 1); if (g[B].test(A)) { m[B] = A; C = B; break } } if (x > z.length) { break } } else { if (m[B] == z[x] && B != e) { x++; C = B } } } if (!y && C + 1 < e) { r.val(""); w(0, h) } else { if (y || C + 1 >= e) { s(); if (!y) { r.val(r.val().substring(0, C + 1)) } } } return (e ? B : i) } if (!r.attr("readonly")) { r.one("unmask", function() { r.unbind(".mask").removeData("buffer").removeData("tests") }).bind("focus.mask", function() { q = r.val(); var x = p(); s(); setTimeout(function() { if (x == j.length) { r.caret(0, x) } else { r.caret(x) } }, 0) }).bind("blur.mask", function() { p(); if (r.val() != q) { r.change() } }).bind("keydown.mask", l).bind("keypress.mask", o).bind(c, function() { setTimeout(function() { r.caret(p(true)) }, 0) }) } p() }) } }) })(jQuery);

(function($) {

    $.fn.alphanumeric = function(p) {

        p = $.extend({
            ichars: "!@#$%^&*()+=[]\\\';,/{}|\":<>?~`.- ",
            nchars: "",
            allow: ""
        }, p);

        return this.each
			(
				function() {

				    if (p.nocaps) p.nchars += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
				    if (p.allcaps) p.nchars += "abcdefghijklmnopqrstuvwxyz";

				    s = p.allow.split('');
				    for (i = 0; i < s.length; i++) if (p.ichars.indexOf(s[i]) != -1) s[i] = "\\" + s[i];
				    p.allow = s.join('|');

				    var reg = new RegExp(p.allow, 'gi');
				    var ch = p.ichars + p.nchars;
				    ch = ch.replace(reg, '');

				    $(this).keypress
						(
							function(e) {

							    if (!e.charCode) k = String.fromCharCode(e.which);
							    else k = String.fromCharCode(e.charCode);

							    if (ch.indexOf(k) != -1) e.preventDefault();
							    if (e.ctrlKey && k == 'v') e.preventDefault();

							}

						);

				    $(this).bind('contextmenu', function() { return false });

				}
			);

    };

    $.fn.numeric = function(p) {

        var az = "abcdefghijklmnopqrstuvwxyz";
        az += az.toUpperCase();

        p = $.extend({
            nchars: az
        }, p);

        return this.each(function() {
            $(this).alphanumeric(p);
        }
		);

    };

    $.fn.alpha = function(p) {

        var nm = "1234567890";

        p = $.extend({
            nchars: nm
        }, p);

        return this.each(function() {
            $(this).alphanumeric(p);
        }
		);

    };

})(jQuery);

// End ~/Scripts/jquery.maskedinput.js

// Begin ~/Scripts/jquery.bigPicture-min.js

(function($) {
    $.jquery = $.jquery || {};
    $.jquery.ux = $.jquery.ux || {};
    $.jquery.ux.ui = $.jquery.ux.ui || {};
    $.jquery.ux.ui.BPHelper = function() {
        return {
            AUTO_ID: 1001,
            galleries: {},
            isBoxRendered: function() {
                return $('#bp').size() > 0 ? true : false
            },
            isBoxVisible: function() {
                return $('#bp > .bp-wrap').is(':visible')
            },
            renderBox: function() {
                if ($.jquery.ux.ui.BPHelper.isBoxRendered()) {
                    return
                }
                var sbox = document.createElement('div');
                var mask = document.createElement('div');
                var wrap = document.createElement('div');
                var main = document.createElement('div');
                var view = document.createElement('div');
                var bbar = document.createElement('div');
                $(bbar).addClass('bp-bbar').append('<div class="bp-hide-link"><a href="#"><span>Close</span></a></div>').append('<div class="bp-info-link"><a href="#"><span>Image info</span></a></div>').append('<div class="bp-clear"></div>');
                $(view).addClass('bp-view').css({
                    'margin': 0
                }).append('<div class="bp-nav bp-prev-link"><a href="#"><span>Prev</span></a></div>').append('<div class="bp-nav bp-next-link"><a href="#"><span>Next</span></a></div>').append('<div class="bp-info-wrap"><div class="bp-info"></div></div>');
                $(main).addClass('bp-main').css({
                    'margin-left': 'auto',
                    'margin-right': 'auto'
                }).append(view).append(bbar);
                $(wrap).addClass('bp-wrap').append(main);
                $(mask).addClass('bp-mask');
                $(sbox).attr('id', 'bp').append(mask).append(wrap).appendTo('body');
                $(window).resize(function(e) {
                    if ($.jquery.ux.ui.BPHelper.isBoxVisible()) {
                        $.jquery.ux.ui.BPHelper.onWindowResize()
                    }
                });
                $(mask).click(function(e) {
                    $.jquery.ux.ui.BPHelper.hideBox()
                });
                $(wrap).click(function(e) {
                    $.jquery.ux.ui.BPHelper.hideBox()
                });
                $(main).click(function(e) {
                    e.preventDefault();
                    return false
                });
                $('.bp-hide-link', bbar).click(function(e) {
                    e.preventDefault();
                    $.jquery.ux.ui.BPHelper.hideBox()
                })
            },
            showBox: function() {
                $.jquery.ux.ui.BPHelper.onWindowResize();
                $('#bp .bp-mask').show();
                $('#bp .bp-wrap').show()
            },
            hideBox: function() {
                $.jquery.ux.ui.BPHelper.resetBox();
                $('#bp .bp-wrap').fadeOut('fast',
                function() {
                    $('#bp .bp-mask').hide()
                })
            },
            resetBox: function() {
                $('#bp .bp-bbar').stop().hide();
                $('#bp .bp-info-wrap').stop().hide().css({
                    'marginTop': 0
                });
                $('#bp .bp-info-link > a').removeClass('active');
                $('#bp .bp-view > img').remove()
            },
            onWindowResize: function() {
                var ds = $.jquery.ux.ui.BPHelper.getDimensions();
                var ps = $.jquery.ux.ui.BPHelper.getPageScroll();
                $('#bp .bp-mask').width(ds.pageWidth).height(ds.pageHeight);
                $('#bp .bp-wrap').css({
                    'left': 0,
                    'top': ps.y + (ds.windowHeight * 0.08)
                })
            },
            getDimensions: function() {
                var dims = {};
                var dbw, dbh;
                if (window.innerHeight && window.scrollMaxY) {
                    dbw = window.innerWidth + window.scrollMaxX;
                    dbh = window.innerHeight + window.scrollMaxY
                } else if (document.body.scrollHeight > document.body.offsetHeight) {
                    dbw = document.body.scrollWidth;
                    dbh = document.body.scrollHeight
                } else {
                    dbw = document.body.offsetWidth;
                    dbh = document.body.offsetHeight
                }
                if (self.innerHeight) {
                    if (document.documentElement.clientWidth) {
                        dims.windowWidth = document.documentElement.clientWidth
                    } else {
                        dims.windowWidth = self.innerWidth
                    }
                    dims.windowHeight = self.innerHeight
                } else if (document.documentElement && document.documentElement.clientHeight) {
                    dims.windowWidth = document.documentElement.clientWidth;
                    dims.windowHeight = document.documentElement.clientHeight
                } else if (document.body) {
                    dims.windowWidth = document.body.clientWidth;
                    dims.windowHeight = document.body.clientHeight
                }
                dims.pageHeight = Math.max(dbh, dims.windowHeight);
                dims.pageWidth = Math.max(dbw, dims.windowWidth);
                return dims
            },
            getPageScroll: function() {
                var scroll = {};
                if (self.pageYOffset) {
                    scroll.y = self.pageYOffset;
                    scroll.x = self.pageXOffset
                } else if (document.documentElement && document.documentElement.scrollTop) {
                    scroll.y = document.documentElement.scrollTop;
                    scroll.x = document.documentElement.scrollLeft
                } else if (document.body) {
                    scroll.y = document.body.scrollTop;
                    scroll.x = document.body.scrollLeft
                }
                return scroll
            }
        }
    } ();
    $.jquery.ux.ui.BigPicture = function(el, conf) {
        this.images = [];
        this.index = 0;
        this.gallery = '';
        this.offset = false;
        conf = $.extend({
            'cls': '',
            'prevLabel': 'Prev',
            'nextLabel': 'Next',
            'infoLabel': 'Image info',
            'hideLabel': 'Close',
            'boxEaseFn': '',
            'boxEaseSpeed': 750,
            'enableInfo': false,
            'infoPosition': 'bottom',
            'infoEaseFn': '',
            'infoEaseSpeed': 500
        },
        conf);
        if (!$(el).attr('id')) {
            $(el).attr('id', 'bigPicture-' + $.jquery.ux.ui.BPHelper.AUTO_ID++)
        }
        this.gallery = $(el).attr('rel');
        if (this.gallery && !$.jquery.ux.ui.BPHelper.galleries[this.gallery]) {
            $.jquery.ux.ui.BPHelper.galleries[this.gallery] = $("a[rel='" + this.gallery + "']").get()
        }
        this.launchBox = function() {
            if (this.images.length == 0) {
                if (this.gallery) {
                    this.images = $.jquery.ux.ui.BPHelper.galleries[this.gallery]
                } else {
                    this.images.push(el)
                }
            }
            this.index = 0;
            for (var i = 0; i < this.images.length; i++) {
                if (this.images[i].id == el.id) {
                    this.index = i;
                    break
                }
            }
            this.show()
        };
        this.show = function() {
            $.jquery.ux.ui.BPHelper.renderBox();
            $('#bp').removeClass().addClass(conf.cls);
            $('#bp .bp-prev-link > a > span').html(conf.prevLabel);
            $('#bp .bp-next-link > a > span').html(conf.nextLabel);
            $('#bp .bp-info-link > a > span').html(conf.infoLabel);
            $('#bp .bp-hide-link > a > span').html(conf.hideLabel);
            var sbox = this;
            $('#bp .bp-view').unbind('mouseenter.bp').unbind('mouseleave.bp').bind('mouseenter.bp',
            function() {
                sbox.toggleNavigation(true)
            }).bind('mouseleave.bp',
            function() {
                sbox.toggleNavigation(false)
            });
            $('#bp .bp-prev-link > a').unbind('click.bp').bind('click.bp',
            function(e) {
                e.preventDefault();
                sbox.back()
            });
            $('#bp .bp-next-link > a').unbind('click.bp').bind('click.bp',
            function(e) {
                e.preventDefault();
                sbox.next()
            });
            if (conf.enableInfo) {
                $('#bp .bp-info-link').show();
                $('#bp .bp-info-link > a').unbind('click.bp').bind('click.bp',
                function(e) {
                    e.preventDefault();
                    sbox.toggleInfo(this)
                })
            } else {
                $('#bp .bp-info-link').hide()
            }
            $('#bp .bp-main').width(64).height(64);
            if (!$.jquery.ux.ui.BPHelper.isBoxVisible()) {
                $.jquery.ux.ui.BPHelper.showBox()
            }
            this.load()
        };
        this.hide = function() {
            $.jquery.ux.ui.BPHelper.hideBox()
        };
        this.reset = function() {
            $.jquery.ux.ui.BPHelper.resetBox()
        };
        this.load = function() {
            this.reset();
            $('#bp .bp-main').addClass('loading');
            this.calculateOffset();
            var box = this;
            var img = new Image();
            $(img).load(function() {
                $('#bp .bp-main').animate({
                    'width': img.width + box.offset.x,
                    'height': img.height + box.offset.y
                },
                conf.boxEaseSpeed, conf.boxEaseFn,
                function() {
                    box.onLoad(img)
                })
            }).error(function() {
                box.hide();
                alert('There was an error loading the image')
            }).attr('src', $(this.images[this.index]).attr('href'))
        };
        this.onLoad = function(img) {
            if (conf.enableInfo) {
                var title = $(this.images[this.index]).attr('title');
                var divId = $(this.images[this.index]).attr('name');
                var count = this.images.length;
                var $wrap = $('#bp .bp-info-wrap');
                var txt = '';
                if (count > 1) {
                    txt += '<div class="bp-count">Image ' + (this.index + 1) + ' of ' + count + '</div>'
                }
                txt += title ? '<h2>' + title + '</h2>' : '';
                $('#bp .bp-info').html(txt).append($('#' + divId).contents().clone(true));
                $('#bp .bp-info a').click(function(e) {
                    var href = $(this).attr('href');
                    if (href && href.charAt(0) != '#') {
                        document.location = href
                    }
                });
                var y = conf.infoPosition == 'top' ? (-1 * $wrap.outerHeight()) : img.height;
                $wrap.css({
                    'top': y
                })
            }
            $('#bp .bp-main').removeClass('loading');
            $('#bp .bp-info-wrap').before(img);
            $('#bp .bp-view').width(img.width).height(img.height).fadeIn('normal');
            $('#bp .bp-nav > a').width(Math.floor(img.width / 2)).height(img.height);
            var bh = img.height + this.offset.y + $('#bp .bp-bbar').outerHeight();
            $('#bp .bp-bbar').show();
            $('#bp .bp-nav').show().fadeTo("fast", 0.25);
            $('#bp .bp-main').animate({
                'height': bh
            },
            350);
            $(img).click().focus()
        };
        this.toggleInfo = function(link) {
            if (!conf.enableInfo) {
                return
            }
            var h = $('#bp .bp-info-wrap').outerHeight();
            var b = conf.infoPosition == 'top' ? 0 : $('#bp .bp-view > img').height();
            var hide = false;
            if ($(link).hasClass('active')) {
                $(link).removeClass('active');
                h = conf.infoPosition == 'top' ? h : 0;
                hide = true
            } else {
                $(link).addClass('active');
                h = conf.infoPosition == 'top' ? 0 : h
            }
            $('#bp .bp-info-wrap').show().animate({
                'top': b - h
            },
            conf.infoEaseSpeed, conf.infoEaseFn,
            function() {
                if (hide) {
                    $('#bp .bp-info-wrap').hide()
                }
            })
        };
        this.toggleNavigation = function(show) {
            if (show == true && this.images.length > 1) {
                $('#bp .bp-nav').fadeTo("fast", 1.0)
            } else {
                $('#bp .bp-nav').fadeTo("fast", 0.25)
            }
            return false
        };
        this.back = function() {
            this.index--;
            if (this.index < 0) {
                this.index = this.images.length - 1
            }
            this.load()
        };
        this.next = function() {
            this.index++;
            if (this.index == this.images.length) {
                this.index = 0
            }
            this.load()
        };
        this.calculateOffset = function() {
            if (this.offset) {
                return
            }
            var $view = $('#bp .bp-view');
            this.offset = {
                x: 0,
                y: 0
            };
            this.offset.x = $view.outerWidth() - $view.width();
            this.offset.y = $view.outerHeight() - $view.height()
        }
    };
    $.fn.bigPicture = function(p) {
        return this.each(function() {
            if (this.bigPicture instanceof $.jquery.ux.ui.BigPicture) {
                return this
            }
            var box = new $.jquery.ux.ui.BigPicture(this, p);
            $(this).click(function(e) {
                e.preventDefault();
                box.launchBox()
            });
            this.bigPicture = box;
            return this
        })
    }
})(jQuery);
// End ~/Scripts/jquery.bigPicture-min.js

// Begin ~/Scripts/jquery-ui-personalized-1.5.3.js

;
(function($) {
    $.ui = {
        plugin: {
            add: function(module, option, set) {
                var proto = $.ui[module].prototype;
                for (var i in set) {
                    proto.plugins[i] = proto.plugins[i] || [];
                    proto.plugins[i].push([option, set[i]]);
                }
            },
            call: function(instance, name, args) {
                var set = instance.plugins[name];
                if (!set) {
                    return;
                }
                for (var i = 0; i < set.length; i++) {
                    if (instance.options[set[i][0]]) {
                        set[i][1].apply(instance.element, args);
                    }
                }
            }
        },
        cssCache: {},
        css: function(name) {
            if ($.ui.cssCache[name]) {
                return $.ui.cssCache[name];
            }
            var tmp = $('<div class="ui-gen">').addClass(name).css({
                position: 'absolute',
                top: '-5000px',
                left: '-5000px',
                display: 'block'
            }).appendTo('body');
            $.ui.cssCache[name] = !!((!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor'))));
            try {
                $('body').get(0).removeChild(tmp.get(0));
            } catch (e) { }
            return $.ui.cssCache[name];
        },
        disableSelection: function(el) {
            $(el).attr('unselectable', 'on').css('MozUserSelect', 'none');
        },
        enableSelection: function(el) {
            $(el).attr('unselectable', 'off').css('MozUserSelect', '');
        },
        hasScroll: function(e, a) {
            var scroll = /top/.test(a || "top") ? 'scrollTop' : 'scrollLeft',
            has = false;
            if (e[scroll] > 0) return true;
            e[scroll] = 1;
            has = e[scroll] > 0 ? true : false;
            e[scroll] = 0;
            return has;
        }
    };
    var _remove = $.fn.remove;
    $.fn.remove = function() {
        $("*", this).add(this).triggerHandler("remove");
        return _remove.apply(this, arguments);
    };
    function getter(namespace, plugin, method) {
        var methods = $[namespace][plugin].getter || [];
        methods = (typeof methods == "string" ? methods.split(/,?\s+/) : methods);
        return ($.inArray(method, methods) != -1);
    }
    $.widget = function(name, prototype) {
        var namespace = name.split(".")[0];
        name = name.split(".")[1];
        $.fn[name] = function(options) {
            var isMethodCall = (typeof options == 'string'),
            args = Array.prototype.slice.call(arguments, 1);
            if (isMethodCall && getter(namespace, name, options)) {
                var instance = $.data(this[0], name);
                return (instance ? instance[options].apply(instance, args) : undefined);
            }
            return this.each(function() {
                var instance = $.data(this, name);
                if (isMethodCall && instance && $.isFunction(instance[options])) {
                    instance[options].apply(instance, args);
                } else if (!isMethodCall) {
                    $.data(this, name, new $[namespace][name](this, options));
                }
            });
        };
        $[namespace][name] = function(element, options) {
            var self = this;
            this.widgetName = name;
            this.widgetBaseClass = namespace + '-' + name;
            this.options = $.extend({},
            $.widget.defaults, $[namespace][name].defaults, options);
            this.element = $(element).bind('setData.' + name,
            function(e, key, value) {
                return self.setData(key, value);
            }).bind('getData.' + name,
            function(e, key) {
                return self.getData(key);
            }).bind('remove',
            function() {
                return self.destroy();
            });
            this.init();
        };
        $[namespace][name].prototype = $.extend({},
        $.widget.prototype, prototype);
    };
    $.widget.prototype = {
        init: function() { },
        destroy: function() {
            this.element.removeData(this.widgetName);
        },
        getData: function(key) {
            return this.options[key];
        },
        setData: function(key, value) {
            this.options[key] = value;
            if (key == 'disabled') {
                this.element[value ? 'addClass' : 'removeClass'](this.widgetBaseClass + '-disabled');
            }
        },
        enable: function() {
            this.setData('disabled', false);
        },
        disable: function() {
            this.setData('disabled', true);
        }
    };
    $.widget.defaults = {
        disabled: false
    };
    $.ui.mouse = {
        mouseInit: function() {
            var self = this;
            this.element.bind('mousedown.' + this.widgetName,
            function(e) {
                return self.mouseDown(e);
            });
            if ($.browser.msie) {
                this._mouseUnselectable = this.element.attr('unselectable');
                this.element.attr('unselectable', 'on');
            }
            this.started = false;
        },
        mouseDestroy: function() {
            this.element.unbind('.' + this.widgetName);
            ($.browser.msie && this.element.attr('unselectable', this._mouseUnselectable));
        },
        mouseDown: function(e) {
            (this._mouseStarted && this.mouseUp(e));
            this._mouseDownEvent = e;
            var self = this,
            btnIsLeft = (e.which == 1),
            elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).parents().add(e.target).filter(this.options.cancel).length : false);
            if (!btnIsLeft || elIsCancel || !this.mouseCapture(e)) {
                return true;
            }
            this._mouseDelayMet = !this.options.delay;
            if (!this._mouseDelayMet) {
                this._mouseDelayTimer = setTimeout(function() {
                    self._mouseDelayMet = true;
                },
                this.options.delay);
            }
            if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {
                this._mouseStarted = (this.mouseStart(e) !== false);
                if (!this._mouseStarted) {
                    e.preventDefault();
                    return true;
                }
            }
            this._mouseMoveDelegate = function(e) {
                return self.mouseMove(e);
            };
            this._mouseUpDelegate = function(e) {
                return self.mouseUp(e);
            };
            $(document).bind('mousemove.' + this.widgetName, this._mouseMoveDelegate).bind('mouseup.' + this.widgetName, this._mouseUpDelegate);
            return false;
        },
        mouseMove: function(e) {
            if ($.browser.msie && !e.button) {
                return this.mouseUp(e);
            }
            if (this._mouseStarted) {
                this.mouseDrag(e);
                return false;
            }
            if (this.mouseDistanceMet(e) && this.mouseDelayMet(e)) {
                this._mouseStarted = (this.mouseStart(this._mouseDownEvent, e) !== false);
                (this._mouseStarted ? this.mouseDrag(e) : this.mouseUp(e));
            }
            return !this._mouseStarted;
        },
        mouseUp: function(e) {
            $(document).unbind('mousemove.' + this.widgetName, this._mouseMoveDelegate).unbind('mouseup.' + this.widgetName, this._mouseUpDelegate);
            if (this._mouseStarted) {
                this._mouseStarted = false;
                this.mouseStop(e);
            }
            return false;
        },
        mouseDistanceMet: function(e) {
            return (Math.max(Math.abs(this._mouseDownEvent.pageX - e.pageX), Math.abs(this._mouseDownEvent.pageY - e.pageY)) >= this.options.distance);
        },
        mouseDelayMet: function(e) {
            return this._mouseDelayMet;
        },
        mouseStart: function(e) { },
        mouseDrag: function(e) { },
        mouseStop: function(e) { },
        mouseCapture: function(e) {
            return true;
        }
    };
    $.ui.mouse.defaults = {
        cancel: null,
        distance: 1,
        delay: 0
    };
})(jQuery);
(function($) {
    $.widget("ui.draggable", $.extend({},
    $.ui.mouse, {
        init: function() {
            var o = this.options;
            if (o.helper == 'original' && !(/(relative|absolute|fixed)/).test(this.element.css('position'))) this.element.css('position', 'relative');
            this.element.addClass('ui-draggable');
            (o.disabled && this.element.addClass('ui-draggable-disabled'));
            this.mouseInit();
        },
        mouseStart: function(e) {
            var o = this.options;
            if (this.helper || o.disabled || $(e.target).is('.ui-resizable-handle')) return false;
            var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
            $(this.options.handle, this.element).find("*").andSelf().each(function() {
                if (this == e.target) handle = true;
            });
            if (!handle) return false;
            if ($.ui.ddmanager) $.ui.ddmanager.current = this;
            this.helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [e])) : (o.helper == 'clone' ? this.element.clone() : this.element);
            if (!this.helper.parents('body').length) this.helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
            if (this.helper[0] != this.element[0] && !(/(fixed|absolute)/).test(this.helper.css("position"))) this.helper.css("position", "absolute");
            this.margins = {
                left: (parseInt(this.element.css("marginLeft"), 10) || 0),
                top: (parseInt(this.element.css("marginTop"), 10) || 0)
            };
            this.cssPosition = this.helper.css("position");
            this.offset = this.element.offset();
            this.offset = {
                top: this.offset.top - this.margins.top,
                left: this.offset.left - this.margins.left
            };
            this.offset.click = {
                left: e.pageX - this.offset.left,
                top: e.pageY - this.offset.top
            };
            this.offsetParent = this.helper.offsetParent();
            var po = this.offsetParent.offset();
            if (this.offsetParent[0] == document.body && $.browser.mozilla) po = {
                top: 0,
                left: 0
            };
            this.offset.parent = {
                top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
                left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
            };
            var p = this.element.position();
            this.offset.relative = this.cssPosition == "relative" ? {
                top: p.top - (parseInt(this.helper.css("top"), 10) || 0) + this.offsetParent[0].scrollTop,
                left: p.left - (parseInt(this.helper.css("left"), 10) || 0) + this.offsetParent[0].scrollLeft
} : {
    top: 0,
    left: 0
};
                this.originalPosition = this.generatePosition(e);
                this.helperProportions = {
                    width: this.helper.outerWidth(),
                    height: this.helper.outerHeight()
                };
                if (o.cursorAt) {
                    if (o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left + this.margins.left;
                    if (o.cursorAt.right != undefined) this.offset.click.left = this.helperProportions.width - o.cursorAt.right + this.margins.left;
                    if (o.cursorAt.top != undefined) this.offset.click.top = o.cursorAt.top + this.margins.top;
                    if (o.cursorAt.bottom != undefined) this.offset.click.top = this.helperProportions.height - o.cursorAt.bottom + this.margins.top;
                }
                if (o.containment) {
                    if (o.containment == 'parent') o.containment = this.helper[0].parentNode;
                    if (o.containment == 'document' || o.containment == 'window') this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, $(o.containment == 'document' ? document : window).width() - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"), 10) || 0), ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"), 10) || 0)];
                    if (!(/^(document|window|parent)$/).test(o.containment)) {
                        var ce = $(o.containment)[0];
                        var co = $(o.containment).offset();
                        this.containment = [co.left + (parseInt($(ce).css("borderLeftWidth"), 10) || 0) - this.offset.relative.left - this.offset.parent.left, co.top + (parseInt($(ce).css("borderTopWidth"), 10) || 0) - this.offset.relative.top - this.offset.parent.top, co.left + Math.max(ce.scrollWidth, ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"), 10) || 0) - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"), 10) || 0), co.top + Math.max(ce.scrollHeight, ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"), 10) || 0) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"), 10) || 0)];
                    }
                }
                this.propagate("start", e);
                this.helperProportions = {
                    width: this.helper.outerWidth(),
                    height: this.helper.outerHeight()
                };
                if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);
                this.helper.addClass("ui-draggable-dragging");
                this.mouseDrag(e);
                return true;
            },
            convertPositionTo: function(d, pos) {
                if (!pos) pos = this.position;
                var mod = d == "absolute" ? 1 : -1;
                return {
                    top: (pos.top + this.offset.relative.top * mod + this.offset.parent.top * mod - (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollTop) * mod + (this.cssPosition == "fixed" ? $(document).scrollTop() : 0) * mod + this.margins.top * mod),
                    left: (pos.left + this.offset.relative.left * mod + this.offset.parent.left * mod - (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollLeft) * mod + (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0) * mod + this.margins.left * mod)
                };
            },
            generatePosition: function(e) {
                var o = this.options;
                var position = {
                    top: (e.pageY - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollTop) - (this.cssPosition == "fixed" ? $(document).scrollTop() : 0)),
                    left: (e.pageX - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + (this.cssPosition == "fixed" || (this.cssPosition == "absolute" && this.offsetParent[0] == document.body) ? 0 : this.offsetParent[0].scrollLeft) - (this.cssPosition == "fixed" ? $(document).scrollLeft() : 0))
                };
                if (!this.originalPosition) return position;
                if (this.containment) {
                    if (position.left < this.containment[0]) position.left = this.containment[0];
                    if (position.top < this.containment[1]) position.top = this.containment[1];
                    if (position.left > this.containment[2]) position.left = this.containment[2];
                    if (position.top > this.containment[3]) position.top = this.containment[3];
                }
                if (o.grid) {
                    var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1];
                    position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
                    var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0];
                    position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
                }
                return position;
            },
            mouseDrag: function(e) {
                this.position = this.generatePosition(e);
                this.positionAbs = this.convertPositionTo("absolute");
                this.position = this.propagate("drag", e) || this.position;
                if (!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left + 'px';
                if (!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top + 'px';
                if ($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
                return false;
            },
            mouseStop: function(e) {
                var dropped = false;
                if ($.ui.ddmanager && !this.options.dropBehaviour) var dropped = $.ui.ddmanager.drop(this, e);
                if ((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true) {
                    var self = this;
                    $(this.helper).animate(this.originalPosition, parseInt(this.options.revert, 10) || 500,
                function() {
                    self.propagate("stop", e);
                    self.clear();
                });
                } else {
                    this.propagate("stop", e);
                    this.clear();
                }
                return false;
            },
            clear: function() {
                this.helper.removeClass("ui-draggable-dragging");
                if (this.options.helper != 'original' && !this.cancelHelperRemoval) this.helper.remove();
                this.helper = null;
                this.cancelHelperRemoval = false;
            },
            plugins: {},
            uiHash: function(e) {
                return {
                    helper: this.helper,
                    position: this.position,
                    absolutePosition: this.positionAbs,
                    options: this.options
                };
            },
            propagate: function(n, e) {
                $.ui.plugin.call(this, n, [e, this.uiHash()]);
                if (n == "drag") this.positionAbs = this.convertPositionTo("absolute");
                return this.element.triggerHandler(n == "drag" ? n : "drag" + n, [e, this.uiHash()], this.options[n]);
            },
            destroy: function() {
                if (!this.element.data('draggable')) return;
                this.element.removeData("draggable").unbind(".draggable").removeClass('ui-draggable');
                this.mouseDestroy();
            }
        }));
        $.extend($.ui.draggable, {
            defaults: {
                appendTo: "parent",
                axis: false,
                cancel: ":input",
                delay: 0,
                distance: 1,
                helper: "original"
            }
        });
        $.ui.plugin.add("draggable", "cursor", {
            start: function(e, ui) {
                var t = $('body');
                if (t.css("cursor")) ui.options._cursor = t.css("cursor");
                t.css("cursor", ui.options.cursor);
            },
            stop: function(e, ui) {
                if (ui.options._cursor) $('body').css("cursor", ui.options._cursor);
            }
        });
        $.ui.plugin.add("draggable", "zIndex", {
            start: function(e, ui) {
                var t = $(ui.helper);
                if (t.css("zIndex")) ui.options._zIndex = t.css("zIndex");
                t.css('zIndex', ui.options.zIndex);
            },
            stop: function(e, ui) {
                if (ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex);
            }
        });
        $.ui.plugin.add("draggable", "opacity", {
            start: function(e, ui) {
                var t = $(ui.helper);
                if (t.css("opacity")) ui.options._opacity = t.css("opacity");
                t.css('opacity', ui.options.opacity);
            },
            stop: function(e, ui) {
                if (ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity);
            }
        });
        $.ui.plugin.add("draggable", "iframeFix", {
            start: function(e, ui) {
                $(ui.options.iframeFix === true ? "iframe" : ui.options.iframeFix).each(function() {
                    $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({
                        width: this.offsetWidth + "px",
                        height: this.offsetHeight + "px",
                        position: "absolute",
                        opacity: "0.001",
                        zIndex: 1000
                    }).css($(this).offset()).appendTo("body");
                });
            },
            stop: function(e, ui) {
                $("div.DragDropIframeFix").each(function() {
                    this.parentNode.removeChild(this);
                });
            }
        });
        $.ui.plugin.add("draggable", "scroll", {
            start: function(e, ui) {
                var o = ui.options;
                var i = $(this).data("draggable");
                o.scrollSensitivity = o.scrollSensitivity || 20;
                o.scrollSpeed = o.scrollSpeed || 20;
                i.overflowY = function(el) {
                    do {
                        if (/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el;
                        el = el.parent();
                    } while (el[0].parentNode);
                    return $(document);
                } (this);
                i.overflowX = function(el) {
                    do {
                        if (/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el;
                        el = el.parent();
                    } while (el[0].parentNode);
                    return $(document);
                } (this);
                if (i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') i.overflowYOffset = i.overflowY.offset();
                if (i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') i.overflowXOffset = i.overflowX.offset();
            },
            drag: function(e, ui) {
                var o = ui.options;
                var i = $(this).data("draggable");
                if (i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {
                    if ((i.overflowYOffset.top + i.overflowY[0].offsetHeight) - e.pageY < o.scrollSensitivity) i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed;
                    if (e.pageY - i.overflowYOffset.top < o.scrollSensitivity) i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed;
                } else {
                    if (e.pageY - $(document).scrollTop() < o.scrollSensitivity) $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
                    if ($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity) $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
                }
                if (i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
                    if ((i.overflowXOffset.left + i.overflowX[0].offsetWidth) - e.pageX < o.scrollSensitivity) i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed;
                    if (e.pageX - i.overflowXOffset.left < o.scrollSensitivity) i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed;
                } else {
                    if (e.pageX - $(document).scrollLeft() < o.scrollSensitivity) $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
                    if ($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity) $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
                }
            }
        });
        $.ui.plugin.add("draggable", "snap", {
            start: function(e, ui) {
                var inst = $(this).data("draggable");
                inst.snapElements = [];
                $(ui.options.snap === true ? '.ui-draggable' : ui.options.snap).each(function() {
                    var $t = $(this);
                    var $o = $t.offset();
                    if (this != inst.element[0]) inst.snapElements.push({
                        item: this,
                        width: $t.outerWidth(),
                        height: $t.outerHeight(),
                        top: $o.top,
                        left: $o.left
                    });
                });
            },
            drag: function(e, ui) {
                var inst = $(this).data("draggable");
                var d = ui.options.snapTolerance || 20;
                var x1 = ui.absolutePosition.left,
            x2 = x1 + inst.helperProportions.width,
            y1 = ui.absolutePosition.top,
            y2 = y1 + inst.helperProportions.height;
                for (var i = inst.snapElements.length - 1; i >= 0; i--) {
                    var l = inst.snapElements[i].left,
                r = l + inst.snapElements[i].width,
                t = inst.snapElements[i].top,
                b = t + inst.snapElements[i].height;
                    if (!((l - d < x1 && x1 < r + d && t - d < y1 && y1 < b + d) || (l - d < x1 && x1 < r + d && t - d < y2 && y2 < b + d) || (l - d < x2 && x2 < r + d && t - d < y1 && y1 < b + d) || (l - d < x2 && x2 < r + d && t - d < y2 && y2 < b + d))) continue;
                    if (ui.options.snapMode != 'inner') {
                        var ts = Math.abs(t - y2) <= 20;
                        var bs = Math.abs(b - y1) <= 20;
                        var ls = Math.abs(l - x2) <= 20;
                        var rs = Math.abs(r - x1) <= 20;
                        if (ts) ui.position.top = inst.convertPositionTo("relative", {
                            top: t - inst.helperProportions.height,
                            left: 0
                        }).top;
                        if (bs) ui.position.top = inst.convertPositionTo("relative", {
                            top: b,
                            left: 0
                        }).top;
                        if (ls) ui.position.left = inst.convertPositionTo("relative", {
                            top: 0,
                            left: l - inst.helperProportions.width
                        }).left;
                        if (rs) ui.position.left = inst.convertPositionTo("relative", {
                            top: 0,
                            left: r
                        }).left;
                    }
                    if (ui.options.snapMode != 'outer') {
                        var ts = Math.abs(t - y1) <= 20;
                        var bs = Math.abs(b - y2) <= 20;
                        var ls = Math.abs(l - x1) <= 20;
                        var rs = Math.abs(r - x2) <= 20;
                        if (ts) ui.position.top = inst.convertPositionTo("relative", {
                            top: t,
                            left: 0
                        }).top;
                        if (bs) ui.position.top = inst.convertPositionTo("relative", {
                            top: b - inst.helperProportions.height,
                            left: 0
                        }).top;
                        if (ls) ui.position.left = inst.convertPositionTo("relative", {
                            top: 0,
                            left: l
                        }).left;
                        if (rs) ui.position.left = inst.convertPositionTo("relative", {
                            top: 0,
                            left: r - inst.helperProportions.width
                        }).left;
                    }
                };
            }
        });
        $.ui.plugin.add("draggable", "connectToSortable", {
            start: function(e, ui) {
                var inst = $(this).data("draggable");
                inst.sortables = [];
                $(ui.options.connectToSortable).each(function() {
                    if ($.data(this, 'sortable')) {
                        var sortable = $.data(this, 'sortable');
                        inst.sortables.push({
                            instance: sortable,
                            shouldRevert: sortable.options.revert
                        });
                        sortable.refreshItems();
                        sortable.propagate("activate", e, inst);
                    }
                });
            },
            stop: function(e, ui) {
                var inst = $(this).data("draggable");
                $.each(inst.sortables,
            function() {
                if (this.instance.isOver) {
                    this.instance.isOver = 0;
                    inst.cancelHelperRemoval = true;
                    this.instance.cancelHelperRemoval = false;
                    if (this.shouldRevert) this.instance.options.revert = true;
                    this.instance.mouseStop(e);
                    this.instance.element.triggerHandler("sortreceive", [e, $.extend(this.instance.ui(), {
                        sender: inst.element
                    })], this.instance.options["receive"]);
                    this.instance.options.helper = this.instance.options._helper;
                } else {
                    this.instance.propagate("deactivate", e, inst);
                }
            });
            },
            drag: function(e, ui) {
                var inst = $(this).data("draggable"),
            self = this;
                var checkPos = function(o) {
                    var l = o.left,
                r = l + o.width,
                t = o.top,
                b = t + o.height;
                    return (l < (this.positionAbs.left + this.offset.click.left) && (this.positionAbs.left + this.offset.click.left) < r && t < (this.positionAbs.top + this.offset.click.top) && (this.positionAbs.top + this.offset.click.top) < b);
                };
                $.each(inst.sortables,
            function(i) {
                if (checkPos.call(inst, this.instance.containerCache)) {
                    if (!this.instance.isOver) {
                        this.instance.isOver = 1;
                        this.instance.currentItem = $(self).clone().appendTo(this.instance.element).data("sortable-item", true);
                        this.instance.options._helper = this.instance.options.helper;
                        this.instance.options.helper = function() {
                            return ui.helper[0];
                        };
                        e.target = this.instance.currentItem[0];
                        this.instance.mouseCapture(e, true);
                        this.instance.mouseStart(e, true, true);
                        this.instance.offset.click.top = inst.offset.click.top;
                        this.instance.offset.click.left = inst.offset.click.left;
                        this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
                        this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
                        inst.propagate("toSortable", e);
                    }
                    if (this.instance.currentItem) this.instance.mouseDrag(e);
                } else {
                    if (this.instance.isOver) {
                        this.instance.isOver = 0;
                        this.instance.cancelHelperRemoval = true;
                        this.instance.options.revert = false;
                        this.instance.mouseStop(e, true);
                        this.instance.options.helper = this.instance.options._helper;
                        this.instance.currentItem.remove();
                        if (this.instance.placeholder) this.instance.placeholder.remove();
                        inst.propagate("fromSortable", e);
                    }
                };
            });
            }
        });
        $.ui.plugin.add("draggable", "stack", {
            start: function(e, ui) {
                var group = $.makeArray($(ui.options.stack.group)).sort(function(a, b) {
                    return (parseInt($(a).css("zIndex"), 10) || ui.options.stack.min) - (parseInt($(b).css("zIndex"), 10) || ui.options.stack.min);
                });
                $(group).each(function(i) {
                    this.style.zIndex = ui.options.stack.min + i;
                });
                this[0].style.zIndex = ui.options.stack.min + group.length;
            }
        });
    })(jQuery);
    (function($) {
        $.widget("ui.accordion", {
            init: function() {
                var options = this.options;
                if (options.navigation) {
                    var current = this.element.find("a").filter(options.navigationFilter);
                    if (current.length) {
                        if (current.filter(options.header).length) {
                            options.active = current;
                        } else {
                            options.active = current.parent().parent().prev();
                            current.addClass("current");
                        }
                    }
                }
                options.headers = this.element.find(options.header);
                options.active = findActive(options.headers, options.active);
                if ($.browser.msie) {
                    this.element.find('a').css('zoom', '1');
                }
                if (!this.element.hasClass("ui-accordion")) {
                    this.element.addClass("ui-accordion");
                    $("<span class='ui-accordion-left'/>").insertBefore(options.headers);
                    $("<span class='ui-accordion-right'/>").appendTo(options.headers);
                    options.headers.addClass("ui-accordion-header").attr("tabindex", "0");
                }
                var maxHeight;
                if (options.fillSpace) {
                    maxHeight = this.element.parent().height();
                    options.headers.each(function() {
                        maxHeight -= $(this).outerHeight();
                    });
                    var maxPadding = 0;
                    options.headers.next().each(function() {
                        maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
                    }).height(maxHeight - maxPadding);
                } else if (options.autoHeight) {
                    maxHeight = 0;
                    options.headers.next().each(function() {
                        maxHeight = Math.max(maxHeight, $(this).outerHeight());
                    }).height(maxHeight);
                }
                options.headers.not(options.active || "").next().hide();
                options.active.parent().andSelf().addClass(options.selectedClass);
                if (options.event) {
                    this.element.bind((options.event) + ".accordion", clickHandler);
                }
            },
            activate: function(index) {
                clickHandler.call(this.element[0], {
                    target: findActive(this.options.headers, index)[0]
                });
            },
            destroy: function() {
                this.options.headers.next().css("display", "");
                if (this.options.fillSpace || this.options.autoHeight) {
                    this.options.headers.next().css("height", "");
                }
                $.removeData(this.element[0], "accordion");
                this.element.removeClass("ui-accordion").unbind(".accordion");
            }
        });
        function scopeCallback(callback, scope) {
            return function() {
                return callback.apply(scope, arguments);
            };
        };
        function completed(cancel) {
            if (!$.data(this, "accordion")) {
                return;
            }
            var instance = $.data(this, "accordion");
            var options = instance.options;
            options.running = cancel ? 0 : --options.running;
            if (options.running) {
                return;
            }
            if (options.clearStyle) {
                options.toShow.add(options.toHide).css({
                    height: "",
                    overflow: ""
                });
            }
            $(this).triggerHandler("accordionchange", [$.event.fix({
                type: 'accordionchange',
                target: instance.element[0]
            }), options.data], options.change);
        }
        function toggle(toShow, toHide, data, clickedActive, down) {
            var options = $.data(this, "accordion").options;
            options.toShow = toShow;
            options.toHide = toHide;
            options.data = data;
            var complete = scopeCallback(completed, this);
            options.running = toHide.size() === 0 ? toShow.size() : toHide.size();
            if (options.animated) {
                if (!options.alwaysOpen && clickedActive) {
                    $.ui.accordion.animations[options.animated]({
                        toShow: jQuery([]),
                        toHide: toHide,
                        complete: complete,
                        down: down,
                        autoHeight: options.autoHeight
                    });
                } else {
                    $.ui.accordion.animations[options.animated]({
                        toShow: toShow,
                        toHide: toHide,
                        complete: complete,
                        down: down,
                        autoHeight: options.autoHeight
                    });
                }
            } else {
                if (!options.alwaysOpen && clickedActive) {
                    toShow.toggle();
                } else {
                    toHide.hide();
                    toShow.show();
                }
                complete(true);
            }
        }
        function clickHandler(event) {
            var options = $.data(this, "accordion").options;
            if (options.disabled) {
                return false;
            }
            if (!event.target && !options.alwaysOpen) {
                options.active.parent().andSelf().toggleClass(options.selectedClass);
                var toHide = options.active.next(),
            data = {
                options: options,
                newHeader: jQuery([]),
                oldHeader: options.active,
                newContent: jQuery([]),
                oldContent: toHide
            },
            toShow = (options.active = $([]));
                toggle.call(this, toShow, toHide, data);
                return false;
            }
            var clicked = $(event.target);
            clicked = $(clicked.parents(options.header)[0] || clicked);
            var clickedActive = clicked[0] == options.active[0];
            if (options.running || (options.alwaysOpen && clickedActive)) {
                return false;
            }
            if (!clicked.is(options.header)) {
                return;
            }
            options.active.parent().andSelf().toggleClass(options.selectedClass);
            if (!clickedActive) {
                clicked.parent().andSelf().addClass(options.selectedClass);
            }
            var toShow = clicked.next(),
        toHide = options.active.next(),
        data = {
            options: options,
            newHeader: clicked,
            oldHeader: options.active,
            newContent: toShow,
            oldContent: toHide
        },
        down = options.headers.index(options.active[0]) > options.headers.index(clicked[0]);
            options.active = clickedActive ? $([]) : clicked;
            toggle.call(this, toShow, toHide, data, clickedActive, down);
            return false;
        };
        function findActive(headers, selector) {
            return selector != undefined ? typeof selector == "number" ? headers.filter(":eq(" + selector + ")") : headers.not(headers.not(selector)) : selector === false ? $([]) : headers.filter(":eq(0)");
        }
        $.extend($.ui.accordion, {
            defaults: {
                selectedClass: "selected",
                alwaysOpen: true,
                animated: 'slide',
                event: "click",
                header: "a",
                autoHeight: true,
                running: 0,
                navigationFilter: function() {
                    return this.href.toLowerCase() == location.href.toLowerCase();
                }
            },
            animations: {
                slide: function(options, additions) {
                    options = $.extend({
                        easing: "swing",
                        duration: 300
                    },
                options, additions);
                    if (!options.toHide.size()) {
                        options.toShow.animate({
                            height: "show"
                        },
                    options);
                        return;
                    }
                    var hideHeight = options.toHide.height(),
                showHeight = options.toShow.height(),
                difference = showHeight / hideHeight;
                    options.toShow.css({
                        height: 0,
                        overflow: 'hidden'
                    }).show();
                    options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({
                        height: "hide"
                    },
                {
                    step: function(now) {
                        var current = (hideHeight - now) * difference;
                        if ($.browser.msie || $.browser.opera) {
                            current = Math.ceil(current);
                        }
                        options.toShow.height(current);
                    },
                    duration: options.duration,
                    easing: options.easing,
                    complete: function() {
                        if (!options.autoHeight) {
                            options.toShow.css("height", "auto");
                        }
                        options.complete();
                    }
                });
                },
                bounceslide: function(options) {
                    this.slide(options, {
                        easing: options.down ? "bounceout" : "swing",
                        duration: options.down ? 1000 : 200
                    });
                },
                easeslide: function(options) {
                    this.slide(options, {
                        easing: "easeinout",
                        duration: 700
                    });
                }
            }
        });
        $.fn.activate = function(index) {
            return this.accordion("activate", index);
        };
    })(jQuery);
    (function($) {
        $.widget("ui.tabs", {
            init: function() {
                this.options.event += '.tabs';
                this.tabify(true);
            },
            setData: function(key, value) {
                if ((/^selected/).test(key)) this.select(value);
                else {
                    this.options[key] = value;
                    this.tabify();
                }
            },
            length: function() {
                return this.$tabs.length;
            },
            tabId: function(a) {
                return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') || this.options.idPrefix + $.data(a);
            },
            ui: function(tab, panel) {
                return {
                    options: this.options,
                    tab: tab,
                    panel: panel,
                    index: this.$tabs.index(tab)
                };
            },
            tabify: function(init) {
                this.$lis = $('ul.tabs>li:has(a[href])', this.element);
                this.$tabs = this.$lis.map(function() {
                    return $('a', this)[0];
                });
                this.$panels = $([]);
                var self = this,
            o = this.options;
                this.$tabs.each(function(i, a) {
                    if (a.hash && a.hash.replace('#', '')) self.$panels = self.$panels.add(a.hash);
                    else if ($(a).attr('href') != '#') {
                        $.data(a, 'href.tabs', a.href);
                        $.data(a, 'load.tabs', a.href);
                        var id = self.tabId(a);
                        a.href = '#' + id;
                        var $panel = $('#' + id);
                        if (!$panel.length) {
                            $panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass).insertAfter(self.$panels[i - 1] || self.element);
                            $panel.data('destroy.tabs', true);
                        }
                        self.$panels = self.$panels.add($panel);
                    }
                    else o.disabled.push(i + 1);
                });
                if (init) {
                    this.element.addClass(o.navClass);
                    this.$panels.each(function() {
                        var $this = $(this);
                        $this.addClass(o.panelClass);
                    });
                    if (o.selected === undefined) {
                        if (location.hash) {
                            this.$tabs.each(function(i, a) {
                                if (a.hash == location.hash) {
                                    o.selected = i;
                                    if ($.browser.msie || $.browser.opera) {
                                        var $toShow = $(location.hash),
                                    toShowId = $toShow.attr('id');
                                        $toShow.attr('id', '');
                                        setTimeout(function() {
                                            $toShow.attr('id', toShowId);
                                        },
                                    500);
                                    }
                                    scrollTo(0, 0);
                                    return false;
                                }
                            });
                        }
                        else if (o.cookie) {
                            var index = parseInt($.cookie('ui-tabs' + $.data(self.element)), 10);
                            if (index && self.$tabs[index]) o.selected = index;
                        }
                        else if (self.$lis.filter('.' + o.selectedClass).length) o.selected = self.$lis.index(self.$lis.filter('.' + o.selectedClass)[0]);
                    }
                    o.selected = o.selected === null || o.selected !== undefined ? o.selected : 0;
                    o.disabled = $.unique(o.disabled.concat($.map(this.$lis.filter('.' + o.disabledClass),
                function(n, i) {
                    return self.$lis.index(n);
                }))).sort();
                    if ($.inArray(o.selected, o.disabled) != -1) o.disabled.splice($.inArray(o.selected, o.disabled), 1);
                    this.$panels.addClass(o.hideClass);
                    this.$lis.removeClass(o.selectedClass);
                    if (o.selected !== null) {
                        this.$panels.eq(o.selected).show().removeClass(o.hideClass);
                        this.$lis.eq(o.selected).addClass(o.selectedClass);
                        var onShow = function() {
                            $(self.element).triggerHandler('tabsshow', [self.fakeEvent('tabsshow'), self.ui(self.$tabs[o.selected], self.$panels[o.selected])], o.show);
                        };
                        if ($.data(this.$tabs[o.selected], 'load.tabs')) this.load(o.selected, onShow);
                        else onShow();
                    }
                    $(window).bind('unload',
                function() {
                    self.$tabs.unbind('.tabs');
                    self.$lis = self.$tabs = self.$panels = null;
                });
                }
                for (var i = 0, li; li = this.$lis[i]; i++)
                    $(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass);
                if (o.cache === false) this.$tabs.removeData('cache.tabs');
                var hideFx, showFx, baseFx = {
                    'min-width': 0,
                    duration: 1
                },
            baseDuration = 'normal';
                if (o.fx && o.fx.constructor == Array) hideFx = o.fx[0] || baseFx,
            showFx = o.fx[1] || baseFx;
                else hideFx = showFx = o.fx || baseFx;
                var resetCSS = {
                    display: '',
                    overflow: '',
                    height: ''
                };
                if (!$.browser.msie) resetCSS.opacity = '';
                function hideTab(clicked, $hide, $show) {
                    $hide.animate(hideFx, hideFx.duration || baseDuration,
                function() {
                    $hide.addClass(o.hideClass).css(resetCSS);
                    if ($.browser.msie && hideFx.opacity) $hide[0].style.filter = '';
                    if ($show) showTab(clicked, $show, $hide);
                });
                }
                function showTab(clicked, $show, $hide) {
                    if (showFx === baseFx) $show.css('display', 'block');
                    $show.animate(showFx, showFx.duration || baseDuration,
                function() {
                    $show.removeClass(o.hideClass).css(resetCSS);
                    if ($.browser.msie && showFx.opacity) $show[0].style.filter = '';
                    $(self.element).triggerHandler('tabsshow', [self.fakeEvent('tabsshow'), self.ui(clicked, $show[0])], o.show);
                });
                }
                function switchTab(clicked, $li, $hide, $show) {
                    $li.addClass(o.selectedClass).siblings().removeClass(o.selectedClass);
                    hideTab(clicked, $hide, $show);
                }
                this.$tabs.unbind('.tabs').bind(o.event,
            function() {
                var $li = $(this).parents('li:eq(0)'),
                $hide = self.$panels.filter(':visible'),
                $show = $(this.hash);
                if (($li.hasClass(o.selectedClass) && !o.unselect) || $li.hasClass(o.disabledClass) || $(this).hasClass(o.loadingClass) || $(self.element).triggerHandler('tabsselect', [self.fakeEvent('tabsselect'), self.ui(this, $show[0])], o.select) === false) {
                    this.blur();
                    return false;
                }
                self.options.selected = self.$tabs.index(this);
                if (o.unselect) {
                    if ($li.hasClass(o.selectedClass)) {
                        self.options.selected = null;
                        $li.removeClass(o.selectedClass);
                        self.$panels.stop();
                        hideTab(this, $hide);
                        this.blur();
                        return false;
                    } else if (!$hide.length) {
                        self.$panels.stop();
                        var a = this;
                        self.load(self.$tabs.index(this),
                        function() {
                            $li.addClass(o.selectedClass).addClass(o.unselectClass);
                            showTab(a, $show);
                        });
                        this.blur();
                        return false;
                    }
                }
                if (o.cookie) $.cookie('ui-tabs' + $.data(self.element), self.options.selected, o.cookie);
                self.$panels.stop();
                if ($show.length) {
                    var a = this;
                    self.load(self.$tabs.index(this), $hide.length ?
                    function() {
                        switchTab(a, $li, $hide, $show);
                    } : function() {
                        $li.addClass(o.selectedClass);
                        showTab(a, $show);
                    });
                } else throw 'jQuery UI Tabs: Mismatching fragment identifier.';
                if ($.browser.msie) this.blur();
                return false;
            });
                if (!(/^click/).test(o.event)) this.$tabs.bind('click.tabs',
            function() {
                return false;
            });
            },
            add: function(url, label, index) {
                if (index == undefined) index = this.$tabs.length;
                var o = this.options;
                var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label));
                $li.data('destroy.tabs', true);
                var id = url.indexOf('#') == 0 ? url.replace('#', '') : this.tabId($('a:first-child', $li)[0]);
                var $panel = $('#' + id);
                if (!$panel.length) {
                    $panel = $(o.panelTemplate).attr('id', id).addClass(o.hideClass).data('destroy.tabs', true);
                }
                $panel.addClass(o.panelClass);
                if (index >= this.$lis.length) {
                    $li.appendTo(this.element);
                    $panel.appendTo(this.element[0].parentNode);
                } else {
                    $li.insertBefore(this.$lis[index]);
                    $panel.insertBefore(this.$panels[index]);
                }
                o.disabled = $.map(o.disabled,
            function(n, i) {
                return n >= index ? ++n : n
            });
                this.tabify();
                if (this.$tabs.length == 1) {
                    $li.addClass(o.selectedClass);
                    $panel.removeClass(o.hideClass);
                    var href = $.data(this.$tabs[0], 'load.tabs');
                    if (href) this.load(index, href);
                }
                this.element.triggerHandler('tabsadd', [this.fakeEvent('tabsadd'), this.ui(this.$tabs[index], this.$panels[index])], o.add);
            },
            remove: function(index) {
                var o = this.options,
            $li = this.$lis.eq(index).remove(),
            $panel = this.$panels.eq(index).remove();
                if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1) this.select(index + (index + 1 < this.$tabs.length ? 1 : -1));
                o.disabled = $.map($.grep(o.disabled,
            function(n, i) {
                return n != index;
            }),
            function(n, i) {
                return n >= index ? --n : n
            });
                this.tabify();
                this.element.triggerHandler('tabsremove', [this.fakeEvent('tabsremove'), this.ui($li.find('a')[0], $panel[0])], o.remove);
            },
            enable: function(index) {
                var o = this.options;
                if ($.inArray(index, o.disabled) == -1) return;
                var $li = this.$lis.eq(index).removeClass(o.disabledClass);
                if ($.browser.safari) {
                    $li.css('display', 'inline-block');
                    setTimeout(function() {
                        $li.css('display', 'block');
                    },
                0);
                }
                o.disabled = $.grep(o.disabled,
            function(n, i) {
                return n != index;
            });
                this.element.triggerHandler('tabsenable', [this.fakeEvent('tabsenable'), this.ui(this.$tabs[index], this.$panels[index])], o.enable);
            },
            disable: function(index) {
                var self = this,
            o = this.options;
                if (index != o.selected) {
                    this.$lis.eq(index).addClass(o.disabledClass);
                    o.disabled.push(index);
                    o.disabled.sort();
                    this.element.triggerHandler('tabsdisable', [this.fakeEvent('tabsdisable'), this.ui(this.$tabs[index], this.$panels[index])], o.disable);
                }
            },
            select: function(index) {
                if (typeof index == 'string') index = this.$tabs.index(this.$tabs.filter('[href$=' + index + ']')[0]);
                this.$tabs.eq(index).trigger(this.options.event);
            },
            load: function(index, callback) {
                var self = this,
            o = this.options,
            $a = this.$tabs.eq(index),
            a = $a[0],
            bypassCache = callback == undefined || callback === false,
            url = $a.data('load.tabs');
                callback = callback ||
            function() { };
                if (!url || !bypassCache && $.data(a, 'cache.tabs')) {
                    callback();
                    return;
                }
                var inner = function(parent) {
                    var $parent = $(parent),
                $inner = $parent.find('*:last');
                    return $inner.length && $inner.is(':not(img)') && $inner || $parent;
                };
                var cleanup = function() {
                    self.$tabs.filter('.' + o.loadingClass).removeClass(o.loadingClass).each(function() {
                        if (o.spinner) inner(this).parent().html(inner(this).data('label.tabs'));
                    });
                    self.xhr = null;
                };
                if (o.spinner) {
                    var label = inner(a).html();
                    inner(a).wrapInner('<em></em>').find('em').data('label.tabs', label).html(o.spinner);
                }
                var ajaxOptions = $.extend({},
            o.ajaxOptions, {
                url: url,
                success: function(r, s) {
                    $(a.hash).html(r);
                    cleanup();
                    if (o.cache) $.data(a, 'cache.tabs', true);
                    $(self.element).triggerHandler('tabsload', [self.fakeEvent('tabsload'), self.ui(self.$tabs[index], self.$panels[index])], o.load);
                    o.ajaxOptions.success && o.ajaxOptions.success(r, s);
                    callback();
                }
            });
                if (this.xhr) {
                    this.xhr.abort();
                    cleanup();
                }
                $a.addClass(o.loadingClass);
                setTimeout(function() {
                    self.xhr = $.ajax(ajaxOptions);
                },
            0);
            },
            url: function(index, url) {
                this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs', url);
            },
            destroy: function() {
                var o = this.options;
                this.element.unbind('.tabs').removeClass(o.navClass).removeData('tabs');
                this.$tabs.each(function() {
                    var href = $.data(this, 'href.tabs');
                    if (href) this.href = href;
                    var $this = $(this).unbind('.tabs');
                    $.each(['href', 'load', 'cache'],
                function(i, prefix) {
                    $this.removeData(prefix + '.tabs');
                });
                });
                this.$lis.add(this.$panels).each(function() {
                    if ($.data(this, 'destroy.tabs')) $(this).remove();
                    else $(this).removeClass([o.selectedClass, o.unselectClass, o.disabledClass, o.panelClass, o.hideClass].join(' '));
                });
            },
            fakeEvent: function(type) {
                return $.event.fix({
                    type: type,
                    target: this.element[0]
                });
            }
        });
        $.ui.tabs.defaults = {
            unselect: false,
            event: 'click',
            disabled: [],
            cookie: null,
            spinner: 'Loading…',
            cache: false,
            idPrefix: 'ui-tabs-',
            ajaxOptions: {},
            fx: null,
            tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>',
            panelTemplate: '<div></div>',
            navClass: 'ui-tabs-nav',
            selectedClass: 'ui-tabs-selected',
            unselectClass: 'ui-tabs-unselect',
            disabledClass: 'ui-tabs-disabled',
            panelClass: 'ui-tabs-panel',
            hideClass: 'ui-tabs-hide',
            loadingClass: 'ui-tabs-loading'
        };
        $.ui.tabs.getter = "length";
        $.extend($.ui.tabs.prototype, {
            rotation: null,
            rotate: function(ms, continuing) {
                continuing = continuing || false;
                var self = this,
            t = this.options.selected;
                function start() {
                    self.rotation = setInterval(function() {
                        t = ++t < self.$tabs.length ? t : 0;
                        self.select(t);
                    },
                ms);
                }
                function stop(e) {
                    if (!e || e.clientX) {
                        clearInterval(self.rotation);
                    }
                }
                if (ms) {
                    start();
                    if (!continuing) this.$tabs.bind(this.options.event, stop);
                    else this.$tabs.bind(this.options.event,
                function() {
                    stop();
                    t = self.options.selected;
                    start();
                });
                }
                else {
                    stop();
                    this.$tabs.unbind(this.options.event, stop);
                }
            }
        });
    })(jQuery);
    (function($) {
        var PROP_NAME = 'datepicker';
        function Datepicker() {
            this.debug = false;
            this._curInst = null;
            this._disabledInputs = [];
            this._datepickerShowing = false;
            this._inDialog = false;
            this._mainDivId = 'ui-datepicker-div';
            this._appendClass = 'ui-datepicker-append';
            this._triggerClass = 'ui-datepicker-trigger';
            this._dialogClass = 'ui-datepicker-dialog';
            this._promptClass = 'ui-datepicker-prompt';
            this._unselectableClass = 'ui-datepicker-unselectable';
            this._currentClass = 'ui-datepicker-current-day';
            this.regional = [];
            this.regional[''] = {
                clearText: 'Clear',
                clearStatus: 'Erase the current date',
                closeText: 'Close',
                closeStatus: 'Close without change',
                prevText: '<Prev',
                prevStatus: 'Show the previous month',
                nextText: 'Next>',
                nextStatus: 'Show the next month',
                currentText: 'Today',
                currentStatus: 'Show the current month',
                monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
                monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
                monthStatus: 'Show a different month',
                yearStatus: 'Show a different year',
                weekHeader: 'Wk',
                weekStatus: 'Week of the year',
                dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
                dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
                dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
                dayStatus: 'Set DD as first week day',
                dateStatus: 'Select DD, M d',
                dateFormat: 'mm/dd/yy',
                firstDay: 0,
                initStatus: 'Select a date',
                isRTL: false
            };
            this._defaults = {
                showOn: 'focus',
                showAnim: 'show',
                showOptions: {},
                defaultDate: null,
                appendText: '',
                buttonText: '...',
                buttonImage: '',
                buttonImageOnly: false,
                closeAtTop: true,
                mandatory: false,
                hideIfNoPrevNext: false,
                navigationAsDateFormat: false,
                gotoCurrent: false,
                changeMonth: true,
                changeYear: true,
                yearRange: '-10:+10',
                changeFirstDay: true,
                highlightWeek: false,
                showOtherMonths: false,
                showWeeks: false,
                calculateWeek: this.iso8601Week,
                shortYearCutoff: '+10',
                showStatus: false,
                statusForDate: this.dateStatus,
                minDate: null,
                maxDate: null,
                duration: 'normal',
                beforeShowDay: null,
                beforeShow: null,
                onSelect: null,
                onChangeMonthYear: null,
                onClose: null,
                numberOfMonths: 1,
                stepMonths: 1,
                rangeSelect: false,
                rangeSeparator: ' - ',
                altField: '',
                altFormat: ''
            };
            $.extend(this._defaults, this.regional['']);
            this.dpDiv = $('<div id="' + this._mainDivId + '" style="display: none;"></div>');
        }
        $.extend(Datepicker.prototype, {
            markerClassName: 'hasDatepicker',
            log: function() {
                if (this.debug) console.log.apply('', arguments);
            },
            setDefaults: function(settings) {
                extendRemove(this._defaults, settings || {});
                return this;
            },
            _attachDatepicker: function(target, settings) {
                var inlineSettings = null;
                for (attrName in this._defaults) {
                    var attrValue = target.getAttribute('date:' + attrName);
                    if (attrValue) {
                        inlineSettings = inlineSettings || {};
                        try {
                            inlineSettings[attrName] = eval(attrValue);
                        } catch (err) {
                            inlineSettings[attrName] = attrValue;
                        }
                    }
                }
                var nodeName = target.nodeName.toLowerCase();
                var inline = (nodeName == 'div' || nodeName == 'span');
                if (!target.id) target.id = 'dp' + new Date().getTime();
                var inst = this._newInst($(target), inline);
                inst.settings = $.extend({},
            settings || {},
            inlineSettings || {});
                if (nodeName == 'input') {
                    this._connectDatepicker(target, inst);
                } else if (inline) {
                    this._inlineDatepicker(target, inst);
                }
            },
            _newInst: function(target, inline) {
                return {
                    id: target[0].id,
                    input: target,
                    selectedDay: 0,
                    selectedMonth: 0,
                    selectedYear: 0,
                    drawMonth: 0,
                    drawYear: 0,
                    inline: inline,
                    dpDiv: (!inline ? this.dpDiv : $('<div class="ui-datepicker-inline"></div>'))
                };
            },
            _connectDatepicker: function(target, inst) {
                var input = $(target);
                if (input.hasClass(this.markerClassName)) return;
                var appendText = this._get(inst, 'appendText');
                var isRTL = this._get(inst, 'isRTL');
                if (appendText) input[isRTL ? 'before' : 'after']('<span class="' + this._appendClass + '">' + appendText + '</span>');
                var showOn = this._get(inst, 'showOn');
                if (showOn == 'focus' || showOn == 'both') input.focus(this._showDatepicker);
                if (showOn == 'button' || showOn == 'both') {
                    var buttonText = this._get(inst, 'buttonText');
                    var buttonImage = this._get(inst, 'buttonImage');
                    var trigger = $(this._get(inst, 'buttonImageOnly') ? $('<img/>').addClass(this._triggerClass).attr({
                        src: buttonImage,
                        alt: buttonText,
                        title: buttonText
                    }) : $('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage == '' ? buttonText : $('<img/>').attr({
                        src: buttonImage,
                        alt: buttonText,
                        title: buttonText
                    })));
                    input[isRTL ? 'before' : 'after'](trigger);
                    trigger.click(function() {
                        if ($.datepicker._datepickerShowing && $.datepicker._lastInput == target) $.datepicker._hideDatepicker();
                        else $.datepicker._showDatepicker(target);
                        return false;
                    });
                }
                input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",
            function(event, key, value) {
                inst.settings[key] = value;
            }).bind("getData.datepicker",
            function(event, key) {
                return this._get(inst, key);
            });
                $.data(target, PROP_NAME, inst);
            },
            _inlineDatepicker: function(target, inst) {
                var input = $(target);
                if (input.hasClass(this.markerClassName)) return;
                input.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",
            function(event, key, value) {
                inst.settings[key] = value;
            }).bind("getData.datepicker",
            function(event, key) {
                return this._get(inst, key);
            });
                $.data(target, PROP_NAME, inst);
                this._setDate(inst, this._getDefaultDate(inst));
                this._updateDatepicker(inst);
            },
            _dialogDatepicker: function(input, dateText, onSelect, settings, pos) {
                var inst = this._dialogInst;
                if (!inst) {
                    var id = 'dp' + new Date().getTime();
                    this._dialogInput = $('<input type="text" id="' + id + '" size="1" style="position: absolute; top: -100px;"/>');
                    this._dialogInput.keydown(this._doKeyDown);
                    $('body').append(this._dialogInput);
                    inst = this._dialogInst = this._newInst(this._dialogInput, false);
                    inst.settings = {};
                    $.data(this._dialogInput[0], PROP_NAME, inst);
                }
                extendRemove(inst.settings, settings || {});
                this._dialogInput.val(dateText);
                this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
                if (!this._pos) {
                    var browserWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
                    var browserHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
                    var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
                    var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
                    this._pos = [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
                }
                this._dialogInput.css('left', this._pos[0] + 'px').css('top', this._pos[1] + 'px');
                inst.settings.onSelect = onSelect;
                this._inDialog = true;
                this.dpDiv.addClass(this._dialogClass);
                this._showDatepicker(this._dialogInput[0]);
                if ($.blockUI) $.blockUI(this.dpDiv);
                $.data(this._dialogInput[0], PROP_NAME, inst);
                return this;
            },
            _destroyDatepicker: function(target) {
                var nodeName = target.nodeName.toLowerCase();
                var $target = $(target);
                $.removeData(target, PROP_NAME);
                if (nodeName == 'input') {
                    $target.siblings('.' + this._appendClass).remove().end().siblings('.' + this._triggerClass).remove().end().removeClass(this.markerClassName).unbind('focus', this._showDatepicker).unbind('keydown', this._doKeyDown).unbind('keypress', this._doKeyPress);
                } else if (nodeName == 'div' || nodeName == 'span') $target.removeClass(this.markerClassName).empty();
            },
            _enableDatepicker: function(target) {
                target.disabled = false;
                $(target).siblings('button.' + this._triggerClass).each(function() {
                    this.disabled = false;
                }).end().siblings('img.' + this._triggerClass).css({
                    opacity: '1.0',
                    cursor: ''
                });
                this._disabledInputs = $.map(this._disabledInputs,
            function(value) {
                return (value == target ? null : value);
            });
            },
            _disableDatepicker: function(target) {
                target.disabled = true;
                $(target).siblings('button.' + this._triggerClass).each(function() {
                    this.disabled = true;
                }).end().siblings('img.' + this._triggerClass).css({
                    opacity: '0.5',
                    cursor: 'default'
                });
                this._disabledInputs = $.map(this._disabledInputs,
            function(value) {
                return (value == target ? null : value);
            });
                this._disabledInputs[this._disabledInputs.length] = target;
            },
            _isDisabledDatepicker: function(target) {
                if (!target) return false;
                for (var i = 0; i < this._disabledInputs.length; i++) {
                    if (this._disabledInputs[i] == target) return true;
                }
                return false;
            },
            _changeDatepicker: function(target, name, value) {
                var settings = name || {};
                if (typeof name == 'string') {
                    settings = {};
                    settings[name] = value;
                }
                if (inst = $.data(target, PROP_NAME)) {
                    extendRemove(inst.settings, settings);
                    this._updateDatepicker(inst);
                }
            },
            _setDateDatepicker: function(target, date, endDate) {
                var inst = $.data(target, PROP_NAME);
                if (inst) {
                    this._setDate(inst, date, endDate);
                    this._updateDatepicker(inst);
                }
            },
            _getDateDatepicker: function(target) {
                var inst = $.data(target, PROP_NAME);
                if (inst) this._setDateFromField(inst);
                return (inst ? this._getDate(inst) : null);
            },
            _doKeyDown: function(e) {
                var inst = $.data(e.target, PROP_NAME);
                var handled = true;
                if ($.datepicker._datepickerShowing) switch (e.keyCode) {
                    case 9:
                        $.datepicker._hideDatepicker(null, '');
                        break;
                    case 13:
                        $.datepicker._selectDay(e.target, inst.selectedMonth, inst.selectedYear, $('td.ui-datepicker-days-cell-over', inst.dpDiv)[0]);
                        return false;
                        break;
                    case 27:
                        $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
                        break;
                    case 33:
                        $.datepicker._adjustDate(e.target, (e.ctrlKey ? -1 : -$.datepicker._get(inst, 'stepMonths')), (e.ctrlKey ? 'Y' : 'M'));
                        break;
                    case 34:
                        $.datepicker._adjustDate(e.target, (e.ctrlKey ? +1 : +$.datepicker._get(inst, 'stepMonths')), (e.ctrlKey ? 'Y' : 'M'));
                        break;
                    case 35:
                        if (e.ctrlKey) $.datepicker._clearDate(e.target);
                        break;
                    case 36:
                        if (e.ctrlKey) $.datepicker._gotoToday(e.target);
                        break;
                    case 37:
                        if (e.ctrlKey) $.datepicker._adjustDate(e.target, -1, 'D');
                        break;
                    case 38:
                        if (e.ctrlKey) $.datepicker._adjustDate(e.target, -7, 'D');
                        break;
                    case 39:
                        if (e.ctrlKey) $.datepicker._adjustDate(e.target, +1, 'D');
                        break;
                    case 40:
                        if (e.ctrlKey) $.datepicker._adjustDate(e.target, +7, 'D');
                        break;
                    default:
                        handled = false;
                }
                else if (e.keyCode == 36 && e.ctrlKey) $.datepicker._showDatepicker(this);
                else handled = false;
                if (handled) {
                    e.preventDefault();
                    e.stopPropagation();
                }
            },
            _doKeyPress: function(e) {
                var inst = $.data(e.target, PROP_NAME);
                var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
                var chr = String.fromCharCode(e.charCode == undefined ? e.keyCode : e.charCode);
                return e.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
            },
            _showDatepicker: function(input) {
                input = input.target || input;
                if (input.nodeName.toLowerCase() != 'input') input = $('input', input.parentNode)[0];
                if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) return;
                var inst = $.data(input, PROP_NAME);
                var beforeShow = $.datepicker._get(inst, 'beforeShow');
                extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
                $.datepicker._hideDatepicker(null, '');
                $.datepicker._lastInput = input;
                $.datepicker._setDateFromField(inst);
                if ($.datepicker._inDialog) input.value = '';
                if (!$.datepicker._pos) {
                    $.datepicker._pos = $.datepicker._findPos(input);
                    $.datepicker._pos[1] += input.offsetHeight;
                }
                var isFixed = false;
                $(input).parents().each(function() {
                    isFixed |= $(this).css('position') == 'fixed';
                    return !isFixed;
                });
                if (isFixed && $.browser.opera) {
                    $.datepicker._pos[0] -= document.documentElement.scrollLeft;
                    $.datepicker._pos[1] -= document.documentElement.scrollTop;
                }
                var offset = {
                    left: $.datepicker._pos[0],
                    top: $.datepicker._pos[1]
                };
                $.datepicker._pos = null;
                inst.rangeStart = null;
                inst.dpDiv.css({
                    position: 'absolute',
                    display: 'block',
                    top: '-1000px'
                });
                $.datepicker._updateDatepicker(inst);
                inst.dpDiv.width($.datepicker._getNumberOfMonths(inst)[1] * $('.ui-datepicker', inst.dpDiv[0])[0].offsetWidth);
                offset = $.datepicker._checkOffset(inst, offset, isFixed);
                inst.dpDiv.css({
                    position: ($.datepicker._inDialog && $.blockUI ? 'static' : (isFixed ? 'fixed' : 'absolute')),
                    display: 'none',
                    left: offset.left + 'px',
                    top: offset.top + 'px'
                });
                if (!inst.inline) {
                    var showAnim = $.datepicker._get(inst, 'showAnim') || 'show';
                    var duration = $.datepicker._get(inst, 'duration');
                    var postProcess = function() {
                        $.datepicker._datepickerShowing = true;
                        if ($.browser.msie && parseInt($.browser.version) < 7) $('iframe.ui-datepicker-cover').css({
                            width: inst.dpDiv.width() + 4,
                            height: inst.dpDiv.height() + 4
                        });
                    };
                    if ($.effects && $.effects[showAnim]) inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
                    else inst.dpDiv[showAnim](duration, postProcess);
                    if (duration == '') postProcess();
                    if (inst.input[0].type != 'hidden') inst.input[0].focus();
                    $.datepicker._curInst = inst;
                }
            },
            _updateDatepicker: function(inst) {
                var dims = {
                    width: inst.dpDiv.width() + 4,
                    height: inst.dpDiv.height() + 4
                };
                inst.dpDiv.empty().append(this._generateDatepicker(inst)).find('iframe.ui-datepicker-cover').css({
                    width: dims.width,
                    height: dims.height
                });
                var numMonths = this._getNumberOfMonths(inst);
                inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') + 'Class']('ui-datepicker-multi');
                inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + 'Class']('ui-datepicker-rtl');
                if (inst.input && inst.input[0].type != 'hidden') $(inst.input[0]).focus();
            },
            _checkOffset: function(inst, offset, isFixed) {
                var pos = inst.input ? this._findPos(inst.input[0]) : null;
                var browserWidth = window.innerWidth || document.documentElement.clientWidth;
                var browserHeight = window.innerHeight || document.documentElement.clientHeight;
                var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
                var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
                if (this._get(inst, 'isRTL') || (offset.left + inst.dpDiv.width() - scrollX) > browserWidth) offset.left = Math.max((isFixed ? 0 : scrollX), pos[0] + (inst.input ? inst.input.width() : 0) - (isFixed ? scrollX : 0) - inst.dpDiv.width() - (isFixed && $.browser.opera ? document.documentElement.scrollLeft : 0));
                else offset.left -= (isFixed ? scrollX : 0);
                if ((offset.top + inst.dpDiv.height() - scrollY) > browserHeight) offset.top = Math.max((isFixed ? 0 : scrollY), pos[1] - (isFixed ? scrollY : 0) - (this._inDialog ? 0 : inst.dpDiv.height()) - (isFixed && $.browser.opera ? document.documentElement.scrollTop : 0));
                else offset.top -= (isFixed ? scrollY : 0);
                return offset;
            },
            _findPos: function(obj) {
                while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
                    obj = obj.nextSibling;
                }
                var position = $(obj).offset();
                return [position.left, position.top];
            },
            _hideDatepicker: function(input, duration) {
                var inst = this._curInst;
                if (!inst) return;
                var rangeSelect = this._get(inst, 'rangeSelect');
                if (rangeSelect && this._stayOpen) this._selectDate('#' + inst.id, this._formatDate(inst, inst.currentDay, inst.currentMonth, inst.currentYear));
                this._stayOpen = false;
                if (this._datepickerShowing) {
                    duration = (duration != null ? duration : this._get(inst, 'duration'));
                    var showAnim = this._get(inst, 'showAnim');
                    var postProcess = function() {
                        $.datepicker._tidyDialog(inst);
                    };
                    if (duration != '' && $.effects && $.effects[showAnim]) inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
                    else inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' : (showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess);
                    if (duration == '') this._tidyDialog(inst);
                    var onClose = this._get(inst, 'onClose');
                    if (onClose) onClose.apply((inst.input ? inst.input[0] : null), [this._getDate(inst), inst]);
                    this._datepickerShowing = false;
                    this._lastInput = null;
                    inst.settings.prompt = null;
                    if (this._inDialog) {
                        this._dialogInput.css({
                            position: 'absolute',
                            left: '0',
                            top: '-100px'
                        });
                        if ($.blockUI) {
                            $.unblockUI();
                            $('body').append(this.dpDiv);
                        }
                    }
                    this._inDialog = false;
                }
                this._curInst = null;
            },
            _tidyDialog: function(inst) {
                inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker');
                $('.' + this._promptClass, inst.dpDiv).remove();
            },
            _checkExternalClick: function(event) {
                if (!$.datepicker._curInst) return;
                var $target = $(event.target);
                if (($target.parents('#' + $.datepicker._mainDivId).length == 0) && !$target.hasClass($.datepicker.markerClassName) && !$target.hasClass($.datepicker._triggerClass) && $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI)) $.datepicker._hideDatepicker(null, '');
            },
            _adjustDate: function(id, offset, period) {
                var target = $(id);
                var inst = $.data(target[0], PROP_NAME);
                this._adjustInstDate(inst, offset, period);
                this._updateDatepicker(inst);
            },
            _gotoToday: function(id) {
                var target = $(id);
                var inst = $.data(target[0], PROP_NAME);
                if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
                    inst.selectedDay = inst.currentDay;
                    inst.drawMonth = inst.selectedMonth = inst.currentMonth;
                    inst.drawYear = inst.selectedYear = inst.currentYear;
                }
                else {
                    var date = new Date();
                    inst.selectedDay = date.getDate();
                    inst.drawMonth = inst.selectedMonth = date.getMonth();
                    inst.drawYear = inst.selectedYear = date.getFullYear();
                }
                this._adjustDate(target);
                this._notifyChange(inst);
            },
            _selectMonthYear: function(id, select, period) {
                var target = $(id);
                var inst = $.data(target[0], PROP_NAME);
                inst._selectingMonthYear = false;
                inst[period == 'M' ? 'drawMonth' : 'drawYear'] = select.options[select.selectedIndex].value - 0;
                this._adjustDate(target);
                this._notifyChange(inst);
            },
            _clickMonthYear: function(id) {
                var target = $(id);
                var inst = $.data(target[0], PROP_NAME);
                if (inst.input && inst._selectingMonthYear && !$.browser.msie) inst.input[0].focus();
                inst._selectingMonthYear = !inst._selectingMonthYear;
            },
            _changeFirstDay: function(id, day) {
                var target = $(id);
                var inst = $.data(target[0], PROP_NAME);
                inst.settings.firstDay = day;
                this._updateDatepicker(inst);
            },
            _selectDay: function(id, month, year, td) {
                if ($(td).hasClass(this._unselectableClass)) return;
                var target = $(id);
                var inst = $.data(target[0], PROP_NAME);
                var rangeSelect = this._get(inst, 'rangeSelect');
                if (rangeSelect) {
                    this._stayOpen = !this._stayOpen;
                    if (this._stayOpen) {
                        $('.ui-datepicker td').removeClass(this._currentClass);
                        $(td).addClass(this._currentClass);
                    }
                }
                inst.selectedDay = inst.currentDay = $('a', td).html();
                inst.selectedMonth = inst.currentMonth = month;
                inst.selectedYear = inst.currentYear = year;
                if (this._stayOpen) {
                    inst.endDay = inst.endMonth = inst.endYear = null;
                }
                else if (rangeSelect) {
                    inst.endDay = inst.currentDay;
                    inst.endMonth = inst.currentMonth;
                    inst.endYear = inst.currentYear;
                }
                this._selectDate(id, this._formatDate(inst, inst.currentDay, inst.currentMonth, inst.currentYear));
                if (this._stayOpen) {
                    inst.rangeStart = this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay));
                    this._updateDatepicker(inst);
                }
                else if (rangeSelect) {
                    inst.selectedDay = inst.currentDay = inst.rangeStart.getDate();
                    inst.selectedMonth = inst.currentMonth = inst.rangeStart.getMonth();
                    inst.selectedYear = inst.currentYear = inst.rangeStart.getFullYear();
                    inst.rangeStart = null;
                    if (inst.inline) this._updateDatepicker(inst);
                }
            },
            _clearDate: function(id) {
                var target = $(id);
                var inst = $.data(target[0], PROP_NAME);
                if (this._get(inst, 'mandatory')) return;
                this._stayOpen = false;
                inst.endDay = inst.endMonth = inst.endYear = inst.rangeStart = null;
                this._selectDate(target, '');
            },
            _selectDate: function(id, dateStr) {
                var target = $(id);
                var inst = $.data(target[0], PROP_NAME);
                dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
                if (this._get(inst, 'rangeSelect') && dateStr) dateStr = (inst.rangeStart ? this._formatDate(inst, inst.rangeStart) : dateStr) + this._get(inst, 'rangeSeparator') + dateStr;
                if (inst.input) inst.input.val(dateStr);
                this._updateAlternate(inst);
                var onSelect = this._get(inst, 'onSelect');
                if (onSelect) onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
                else if (inst.input) inst.input.trigger('change');
                if (inst.inline) this._updateDatepicker(inst);
                else if (!this._stayOpen) {
                    this._hideDatepicker(null, this._get(inst, 'duration'));
                    this._lastInput = inst.input[0];
                    if (typeof (inst.input[0]) != 'object') inst.input[0].focus();
                    this._lastInput = null;
                }
            },
            _updateAlternate: function(inst) {
                var altField = this._get(inst, 'altField');
                if (altField) {
                    var altFormat = this._get(inst, 'altFormat');
                    var date = this._getDate(inst);
                    dateStr = (isArray(date) ? (!date[0] && !date[1] ? '' : this.formatDate(altFormat, date[0], this._getFormatConfig(inst)) + this._get(inst, 'rangeSeparator') + this.formatDate(altFormat, date[1] || date[0], this._getFormatConfig(inst))) : this.formatDate(altFormat, date, this._getFormatConfig(inst)));
                    $(altField).each(function() {
                        $(this).val(dateStr);
                    });
                }
            },
            noWeekends: function(date) {
                var day = date.getDay();
                return [(day > 0 && day < 6), ''];
            },
            iso8601Week: function(date) {
                var checkDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
                var firstMon = new Date(checkDate.getFullYear(), 1 - 1, 4);
                var firstDay = firstMon.getDay() || 7;
                firstMon.setDate(firstMon.getDate() + 1 - firstDay);
                if (firstDay < 4 && checkDate < firstMon) {
                    checkDate.setDate(checkDate.getDate() - 3);
                    return $.datepicker.iso8601Week(checkDate);
                } else if (checkDate > new Date(checkDate.getFullYear(), 12 - 1, 28)) {
                    firstDay = new Date(checkDate.getFullYear() + 1, 1 - 1, 4).getDay() || 7;
                    if (firstDay > 4 && (checkDate.getDay() || 7) < firstDay - 3) {
                        checkDate.setDate(checkDate.getDate() + 3);
                        return $.datepicker.iso8601Week(checkDate);
                    }
                }
                return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1;
            },
            dateStatus: function(date, inst) {
                return $.datepicker.formatDate($.datepicker._get(inst, 'dateStatus'), date, $.datepicker._getFormatConfig(inst));
            },
            parseDate: function(format, value, settings) {
                if (format == null || value == null) throw 'Invalid arguments';
                value = (typeof value == 'object' ? value.toString() : value + '');
                if (value == '') return null;
                var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
                var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
                var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
                var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
                var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
                var year = -1;
                var month = -1;
                var day = -1;
                var literal = false;
                var lookAhead = function(match) {
                    var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
                    if (matches) iFormat++;
                    return matches;
                };
                var getNumber = function(match) {
                    lookAhead(match);
                    var origSize = (match == '@' ? 14 : (match == 'y' ? 4 : 2));
                    var size = origSize;
                    var num = 0;
                    while (size > 0 && iValue < value.length && value.charAt(iValue) >= '0' && value.charAt(iValue) <= '9') {
                        num = num * 10 + (value.charAt(iValue++) - 0);
                        size--;
                    }
                    if (size == origSize) throw 'Missing number at position ' + iValue;
                    return num;
                };
                var getName = function(match, shortNames, longNames) {
                    var names = (lookAhead(match) ? longNames : shortNames);
                    var size = 0;
                    for (var j = 0; j < names.length; j++)
                        size = Math.max(size, names[j].length);
                    var name = '';
                    var iInit = iValue;
                    while (size > 0 && iValue < value.length) {
                        name += value.charAt(iValue++);
                        for (var i = 0; i < names.length; i++)
                            if (name == names[i]) return i + 1;
                        size--;
                    }
                    throw 'Unknown name at position ' + iInit;
                };
                var checkLiteral = function() {
                    if (value.charAt(iValue) != format.charAt(iFormat)) throw 'Unexpected literal at position ' + iValue;
                    iValue++;
                };
                var iValue = 0;
                for (var iFormat = 0; iFormat < format.length; iFormat++) {
                    if (literal) if (format.charAt(iFormat) == "'" && !lookAhead("'")) literal = false;
                    else checkLiteral();
                    else switch (format.charAt(iFormat)) {
                        case 'd':
                            day = getNumber('d');
                            break;
                        case 'D':
                            getName('D', dayNamesShort, dayNames);
                            break;
                        case 'm':
                            month = getNumber('m');
                            break;
                        case 'M':
                            month = getName('M', monthNamesShort, monthNames);
                            break;
                        case 'y':
                            year = getNumber('y');
                            break;
                        case '@':
                            var date = new Date(getNumber('@'));
                            year = date.getFullYear();
                            month = date.getMonth() + 1;
                            day = date.getDate();
                            break;
                        case "'":
                            if (lookAhead("'")) checkLiteral();
                            else literal = true;
                            break;
                        default:
                            checkLiteral();
                    }
                }
                if (year < 100) year += new Date().getFullYear() - new Date().getFullYear() % 100 + (year <= shortYearCutoff ? 0 : -100);
                var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
                if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) throw 'Invalid date';
                return date;
            },
            ATOM: 'yy-mm-dd',
            COOKIE: 'D, dd M yy',
            ISO_8601: 'yy-mm-dd',
            RFC_822: 'D, d M y',
            RFC_850: 'DD, dd-M-y',
            RFC_1036: 'D, d M y',
            RFC_1123: 'D, d M yy',
            RFC_2822: 'D, d M yy',
            RSS: 'D, d M y',
            TIMESTAMP: '@',
            W3C: 'yy-mm-dd',
            formatDate: function(format, date, settings) {
                if (!date) return '';
                var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
                var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
                var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
                var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
                var lookAhead = function(match) {
                    var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
                    if (matches) iFormat++;
                    return matches;
                };
                var formatNumber = function(match, value) {
                    return (lookAhead(match) && value < 10 ? '0' : '') + value;
                };
                var formatName = function(match, value, shortNames, longNames) {
                    return (lookAhead(match) ? longNames[value] : shortNames[value]);
                };
                var output = '';
                var literal = false;
                if (date) for (var iFormat = 0; iFormat < format.length; iFormat++) {
                    if (literal) if (format.charAt(iFormat) == "'" && !lookAhead("'")) literal = false;
                    else output += format.charAt(iFormat);
                    else switch (format.charAt(iFormat)) {
                        case 'd':
                            output += formatNumber('d', date.getDate());
                            break;
                        case 'D':
                            output += formatName('D', date.getDay(), dayNamesShort, dayNames);
                            break;
                        case 'm':
                            output += formatNumber('m', date.getMonth() + 1);
                            break;
                        case 'M':
                            output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
                            break;
                        case 'y':
                            output += (lookAhead('y') ? date.getFullYear() : (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
                            break;
                        case '@':
                            output += date.getTime();
                            break;
                        case "'":
                            if (lookAhead("'")) output += "'";
                            else literal = true;
                            break;
                        default:
                            output += format.charAt(iFormat);
                    }
                }
                return output;
            },
            _possibleChars: function(format) {
                var chars = '';
                var literal = false;
                for (var iFormat = 0; iFormat < format.length; iFormat++)
                    if (literal) if (format.charAt(iFormat) == "'" && !lookAhead("'")) literal = false;
                else chars += format.charAt(iFormat);
                else switch (format.charAt(iFormat)) {
                    case 'd':
                    case 'm':
                    case 'y':
                    case '@':
                        chars += '0123456789';
                        break;
                    case 'D':
                    case 'M':
                        return null;
                    case "'":
                        if (lookAhead("'")) chars += "'";
                        else literal = true;
                        break;
                    default:
                        chars += format.charAt(iFormat);
                }
                return chars;
            },
            _get: function(inst, name) {
                return inst.settings[name] !== undefined ? inst.settings[name] : this._defaults[name];
            },
            _setDateFromField: function(inst) {
                var dateFormat = this._get(inst, 'dateFormat');
                var dates = inst.input ? inst.input.val().split(this._get(inst, 'rangeSeparator')) : null;
                inst.endDay = inst.endMonth = inst.endYear = null;
                var date = defaultDate = this._getDefaultDate(inst);
                if (dates.length > 0) {
                    var settings = this._getFormatConfig(inst);
                    if (dates.length > 1) {
                        date = this.parseDate(dateFormat, dates[1], settings) || defaultDate;
                        inst.endDay = date.getDate();
                        inst.endMonth = date.getMonth();
                        inst.endYear = date.getFullYear();
                    }
                    try {
                        date = this.parseDate(dateFormat, dates[0], settings) || defaultDate;
                    } catch (e) {
                        this.log(e);
                        date = defaultDate;
                    }
                }
                inst.selectedDay = date.getDate();
                inst.drawMonth = inst.selectedMonth = date.getMonth();
                inst.drawYear = inst.selectedYear = date.getFullYear();
                inst.currentDay = (dates[0] ? date.getDate() : 0);
                inst.currentMonth = (dates[0] ? date.getMonth() : 0);
                inst.currentYear = (dates[0] ? date.getFullYear() : 0);
                this._adjustInstDate(inst);
            },
            _getDefaultDate: function(inst) {
                var date = this._determineDate(this._get(inst, 'defaultDate'), new Date());
                var minDate = this._getMinMaxDate(inst, 'min', true);
                var maxDate = this._getMinMaxDate(inst, 'max');
                date = (minDate && date < minDate ? minDate : date);
                date = (maxDate && date > maxDate ? maxDate : date);
                return date;
            },
            _determineDate: function(date, defaultDate) {
                var offsetNumeric = function(offset) {
                    var date = new Date();
                    date.setDate(date.getDate() + offset);
                    return date;
                };
                var offsetString = function(offset, getDaysInMonth) {
                    var date = new Date();
                    var year = date.getFullYear();
                    var month = date.getMonth();
                    var day = date.getDate();
                    var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
                    var matches = pattern.exec(offset);
                    while (matches) {
                        switch (matches[2] || 'd') {
                            case 'd':
                            case 'D':
                                day += (matches[1] - 0);
                                break;
                            case 'w':
                            case 'W':
                                day += (matches[1] * 7);
                                break;
                            case 'm':
                            case 'M':
                                month += (matches[1] - 0);
                                day = Math.min(day, getDaysInMonth(year, month));
                                break;
                            case 'y':
                            case 'Y':
                                year += (matches[1] - 0);
                                day = Math.min(day, getDaysInMonth(year, month));
                                break;
                        }
                        matches = pattern.exec(offset);
                    }
                    return new Date(year, month, day);
                };
                date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date, this._getDaysInMonth) : (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
                date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);
                if (date) {
                    date.setHours(0);
                    date.setMinutes(0);
                    date.setSeconds(0);
                    date.setMilliseconds(0);
                }
                return this._daylightSavingAdjust(date);
            },
            _daylightSavingAdjust: function(date) {
                if (!date) return null;
                date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
                return date;
            },
            _setDate: function(inst, date, endDate) {
                var clear = !(date);
                date = this._determineDate(date, new Date());
                inst.selectedDay = inst.currentDay = date.getDate();
                inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
                inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
                if (this._get(inst, 'rangeSelect')) {
                    if (endDate) {
                        endDate = this._determineDate(endDate, null);
                        inst.endDay = endDate.getDate();
                        inst.endMonth = endDate.getMonth();
                        inst.endYear = endDate.getFullYear();
                    } else {
                        inst.endDay = inst.currentDay;
                        inst.endMonth = inst.currentMonth;
                        inst.endYear = inst.currentYear;
                    }
                }
                this._adjustInstDate(inst);
                if (inst.input) inst.input.val(clear ? '' : this._formatDate(inst) + (!this._get(inst, 'rangeSelect') ? '' : this._get(inst, 'rangeSeparator') + this._formatDate(inst, inst.endDay, inst.endMonth, inst.endYear)));
            },
            _getDate: function(inst) {
                var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
                if (this._get(inst, 'rangeSelect')) {
                    return [inst.rangeStart || startDate, (!inst.endYear ? inst.rangeStart || startDate : this._daylightSavingAdjust(new Date(inst.endYear, inst.endMonth, inst.endDay)))];
                } else return startDate;
            },
            _generateDatepicker: function(inst) {
                var today = new Date();
                today = this._daylightSavingAdjust(new Date(today.getFullYear(), today.getMonth(), today.getDate()));
                var showStatus = this._get(inst, 'showStatus');
                var isRTL = this._get(inst, 'isRTL');
                var clear = (this._get(inst, 'mandatory') ? '' : '<div class="ui-datepicker-clear"><a onclick="jQuery.datepicker._clearDate(\'#' + inst.id + '\');"' + (showStatus ? this._addStatus(inst, this._get(inst, 'clearStatus') || ' ') : '') + '>' + this._get(inst, 'clearText') + '</a></div>');
                var controls = '<div class="ui-datepicker-control">' + (isRTL ? '' : clear) + '<div class="ui-datepicker-close"><a onclick="jQuery.datepicker._hideDatepicker();"' + (showStatus ? this._addStatus(inst, this._get(inst, 'closeStatus') || ' ') : '') + '>' + this._get(inst, 'closeText') + '</a></div>' + (isRTL ? clear : '') + '</div>';
                var prompt = this._get(inst, 'prompt');
                var closeAtTop = this._get(inst, 'closeAtTop');
                var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
                var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
                var numMonths = this._getNumberOfMonths(inst);
                var stepMonths = this._get(inst, 'stepMonths');
                var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
                var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
                var minDate = this._getMinMaxDate(inst, 'min', true);
                var maxDate = this._getMinMaxDate(inst, 'max');
                var drawMonth = inst.drawMonth;
                var drawYear = inst.drawYear;
                if (maxDate) {
                    var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), maxDate.getMonth() - numMonths[1] + 1, maxDate.getDate()));
                    maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
                    while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
                        drawMonth--;
                        if (drawMonth < 0) {
                            drawMonth = 11;
                            drawYear--;
                        }
                    }
                }
                var prevText = this._get(inst, 'prevText');
                prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst)));
                var prev = '<div class="ui-datepicker-prev">' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' + (showStatus ? this._addStatus(inst, this._get(inst, 'prevStatus') || ' ') : '') + '>' + prevText + '</a>' : (hideIfNoPrevNext ? '' : '<label>' + prevText + '</label>')) + '</div>';
                var nextText = this._get(inst, 'nextText');
                nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst)));
                var next = '<div class="ui-datepicker-next">' + (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' + (showStatus ? this._addStatus(inst, this._get(inst, 'nextStatus') || ' ') : '') + '>' + nextText + '</a>' : (hideIfNoPrevNext ? '' : '<label>' + nextText + '</label>')) + '</div>';
                var currentText = this._get(inst, 'currentText');
                currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, today, this._getFormatConfig(inst)));
                var html = (prompt ? '<div class="' + this._promptClass + '">' + prompt + '</div>' : '') + (closeAtTop && !inst.inline ? controls : '') + '<div class="ui-datepicker-links">' + (isRTL ? next : prev) + (this._isInRange(inst, (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today)) ? '<div class="ui-datepicker-current">' + '<a onclick="jQuery.datepicker._gotoToday(\'#' + inst.id + '\');"' + (showStatus ? this._addStatus(inst, this._get(inst, 'currentStatus') || ' ') : '') + '>' + currentText + '</a></div>' : '') + (isRTL ? prev : next) + '</div>';
                var firstDay = this._get(inst, 'firstDay');
                var changeFirstDay = this._get(inst, 'changeFirstDay');
                var dayNames = this._get(inst, 'dayNames');
                var dayNamesShort = this._get(inst, 'dayNamesShort');
                var dayNamesMin = this._get(inst, 'dayNamesMin');
                var monthNames = this._get(inst, 'monthNames');
                var beforeShowDay = this._get(inst, 'beforeShowDay');
                var highlightWeek = this._get(inst, 'highlightWeek');
                var showOtherMonths = this._get(inst, 'showOtherMonths');
                var showWeeks = this._get(inst, 'showWeeks');
                var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
                var status = (showStatus ? this._get(inst, 'dayStatus') || ' ' : '');
                var dateStatus = this._get(inst, 'statusForDate') || this.dateStatus;
                var endDate = inst.endDay ? this._daylightSavingAdjust(new Date(inst.endYear, inst.endMonth, inst.endDay)) : currentDate;
                for (var row = 0; row < numMonths[0]; row++)
                    for (var col = 0; col < numMonths[1]; col++) {
                    var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
                    html += '<div class="ui-datepicker-one-month' + (col == 0 ? ' ui-datepicker-new-row' : '') + '">' + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, selectedDate, row > 0 || col > 0, showStatus, monthNames) + '<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead>' + '<tr class="ui-datepicker-title-row">' + (showWeeks ? '<td>' + this._get(inst, 'weekHeader') + '</td>' : '');
                    for (var dow = 0; dow < 7; dow++) {
                        var day = (dow + firstDay) % 7;
                        var dayStatus = (status.indexOf('DD') > -1 ? status.replace(/DD/, dayNames[day]) : status.replace(/D/, dayNamesShort[day]));
                        html += '<td' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end-cell"' : '') + '>' + (!changeFirstDay ? '<span' : '<a onclick="jQuery.datepicker._changeFirstDay(\'#' + inst.id + '\', ' + day + ');"') + (showStatus ? this._addStatus(inst, dayStatus) : '') + ' title="' + dayNames[day] + '">' + dayNamesMin[day] + (changeFirstDay ? '</a>' : '</span>') + '</td>';
                    }
                    html += '</tr></thead><tbody>';
                    var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
                    if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
                    var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
                    var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7));
                    var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
                    for (var dRow = 0; dRow < numRows; dRow++) {
                        html += '<tr class="ui-datepicker-days-row">' + (showWeeks ? '<td class="ui-datepicker-week-col">' + calculateWeek(printDate) + '</td>' : '');
                        for (var dow = 0; dow < 7; dow++) {
                            var daySettings = (beforeShowDay ? beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
                            var otherMonth = (printDate.getMonth() != drawMonth);
                            var unselectable = otherMonth || !daySettings[0] || (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
                            html += '<td class="ui-datepicker-days-cell' + ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end-cell' : '') + (otherMonth ? ' ui-datepicker-otherMonth' : '') + (printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth ? ' ui-datepicker-days-cell-over' : '') + (unselectable ? ' ' + this._unselectableClass : '') + (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? ' ' + this._currentClass : '') + (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + (unselectable ? (highlightWeek ? ' onmouseover="jQuery(this).parent().addClass(\'ui-datepicker-week-over\');"' + ' onmouseout="jQuery(this).parent().removeClass(\'ui-datepicker-week-over\');"' : '') : ' onmouseover="jQuery(this).addClass(\'ui-datepicker-days-cell-over\')' + (highlightWeek ? '.parent().addClass(\'ui-datepicker-week-over\')' : '') + ';' + (!showStatus || (otherMonth && !showOtherMonths) ? '' : 'jQuery(\'#ui-datepicker-status-' + inst.id + '\').html(\'' + (dateStatus.apply((inst.input ? inst.input[0] : null), [printDate, inst]) || ' ') + '\');') + '"' + ' onmouseout="jQuery(this).removeClass(\'ui-datepicker-days-cell-over\')' + (highlightWeek ? '.parent().removeClass(\'ui-datepicker-week-over\')' : '') + ';' + (!showStatus || (otherMonth && !showOtherMonths) ? '' : 'jQuery(\'#ui-datepicker-status-' + inst.id + '\').html(\' \');') + '" onclick="jQuery.datepicker._selectDay(\'#' + inst.id + '\',' + drawMonth + ',' + drawYear + ', this);"') + '>' + (otherMonth ? (showOtherMonths ? printDate.getDate() : ' ') : (unselectable ? printDate.getDate() : '<a>' + printDate.getDate() + '</a>')) + '</td>';
                            printDate.setDate(printDate.getDate() + 1);
                            printDate = this._daylightSavingAdjust(printDate);
                        }
                        html += '</tr>';
                    }
                    drawMonth++;
                    if (drawMonth > 11) {
                        drawMonth = 0;
                        drawYear++;
                    }
                    html += '</tbody></table></div>';
                }
                html += (showStatus ? '<div style="clear: both;"></div><div id="ui-datepicker-status-' + inst.id + '" class="ui-datepicker-status">' + (this._get(inst, 'initStatus') || ' ') + '</div>' : '') + (!closeAtTop && !inst.inline ? controls : '') + '<div style="clear: both;"></div>' + ($.browser.msie && parseInt($.browser.version) < 7 && !inst.inline ? '<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>' : '');
                return html;
            },
            _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, selectedDate, secondary, showStatus, monthNames) {
                minDate = (inst.rangeStart && minDate && selectedDate < minDate ? selectedDate : minDate);
                var html = '<div class="ui-datepicker-header">';
                if (secondary || !this._get(inst, 'changeMonth')) html += monthNames[drawMonth] + ' ';
                else {
                    var inMinYear = (minDate && minDate.getFullYear() == drawYear);
                    var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
                    html += '<select class="ui-datepicker-new-month" ' + 'onchange="jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' + 'onclick="jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' + (showStatus ? this._addStatus(inst, this._get(inst, 'monthStatus') || ' ') : '') + '>';
                    for (var month = 0; month < 12; month++) {
                        if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) html += '<option value="' + month + '"' + (month == drawMonth ? ' selected="selected"' : '') + '>' + monthNames[month] + '</option>';
                    }
                    html += '</select>';
                }
                if (secondary || !this._get(inst, 'changeYear')) html += drawYear;
                else {
                    var years = this._get(inst, 'yearRange').split(':');
                    var year = 0;
                    var endYear = 0;
                    if (years.length != 2) {
                        year = drawYear - 10;
                        endYear = drawYear + 10;
                    } else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
                        year = endYear = new Date().getFullYear();
                        year += parseInt(years[0], 10);
                        endYear += parseInt(years[1], 10);
                    } else {
                        year = parseInt(years[0], 10);
                        endYear = parseInt(years[1], 10);
                    }
                    year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
                    endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
                    html += '<select class="ui-datepicker-new-year" ' + 'onchange="jQuery.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' + 'onclick="jQuery.datepicker._clickMonthYear(\'#' + inst.id + '\');"' + (showStatus ? this._addStatus(inst, this._get(inst, 'yearStatus') || ' ') : '') + '>';
                    for (; year <= endYear; year++) {
                        html += '<option value="' + year + '"' + (year == drawYear ? ' selected="selected"' : '') + '>' + year + '</option>';
                    }
                    html += '</select>';
                }
                html += '</div>';
                return html;
            },
            _addStatus: function(inst, text) {
                return ' onmouseover="jQuery(\'#ui-datepicker-status-' + inst.id + '\').html(\'' + text + '\');" ' + 'onmouseout="jQuery(\'#ui-datepicker-status-' + inst.id + '\').html(\' \');"';
            },
            _adjustInstDate: function(inst, offset, period) {
                var year = inst.drawYear + (period == 'Y' ? offset : 0);
                var month = inst.drawMonth + (period == 'M' ? offset : 0);
                var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period == 'D' ? offset : 0);
                var date = this._daylightSavingAdjust(new Date(year, month, day));
                var minDate = this._getMinMaxDate(inst, 'min', true);
                var maxDate = this._getMinMaxDate(inst, 'max');
                date = (minDate && date < minDate ? minDate : date);
                date = (maxDate && date > maxDate ? maxDate : date);
                inst.selectedDay = date.getDate();
                inst.drawMonth = inst.selectedMonth = date.getMonth();
                inst.drawYear = inst.selectedYear = date.getFullYear();
                if (period == 'M' || period == 'Y') this._notifyChange(inst);
            },
            _notifyChange: function(inst) {
                var onChange = this._get(inst, 'onChangeMonthYear');
                if (onChange) onChange.apply((inst.input ? inst.input[0] : null), [new Date(inst.selectedYear, inst.selectedMonth, 1), inst]);
            },
            _getNumberOfMonths: function(inst) {
                var numMonths = this._get(inst, 'numberOfMonths');
                return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
            },
            _getMinMaxDate: function(inst, minMax, checkRange) {
                var date = this._determineDate(this._get(inst, minMax + 'Date'), null);
                return (!checkRange || !inst.rangeStart ? date : (!date || inst.rangeStart > date ? inst.rangeStart : date));
            },
            _getDaysInMonth: function(year, month) {
                return 32 - new Date(year, month, 32).getDate();
            },
            _getFirstDayOfMonth: function(year, month) {
                return new Date(year, month, 1).getDay();
            },
            _canAdjustMonth: function(inst, offset, curYear, curMonth) {
                var numMonths = this._getNumberOfMonths(inst);
                var date = this._daylightSavingAdjust(new Date(curYear, curMonth + (offset < 0 ? offset : numMonths[1]), 1));
                if (offset < 0) date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
                return this._isInRange(inst, date);
            },
            _isInRange: function(inst, date) {
                var newMinDate = (!inst.rangeStart ? null : this._daylightSavingAdjust(new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay)));
                newMinDate = (newMinDate && inst.rangeStart < newMinDate ? inst.rangeStart : newMinDate);
                var minDate = newMinDate || this._getMinMaxDate(inst, 'min');
                var maxDate = this._getMinMaxDate(inst, 'max');
                return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate));
            },
            _getFormatConfig: function(inst) {
                var shortYearCutoff = this._get(inst, 'shortYearCutoff');
                shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
                return {
                    shortYearCutoff: shortYearCutoff,
                    dayNamesShort: this._get(inst, 'dayNamesShort'),
                    dayNames: this._get(inst, 'dayNames'),
                    monthNamesShort: this._get(inst, 'monthNamesShort'),
                    monthNames: this._get(inst, 'monthNames')
                };
            },
            _formatDate: function(inst, day, month, year) {
                if (!day) {
                    inst.currentDay = inst.selectedDay;
                    inst.currentMonth = inst.selectedMonth;
                    inst.currentYear = inst.selectedYear;
                }
                var date = (day ? (typeof day == 'object' ? day : this._daylightSavingAdjust(new Date(year, month, day))) : this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
                return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
            }
        });
        function extendRemove(target, props) {
            $.extend(target, props);
            for (var name in props)
                if (props[name] == null || props[name] == undefined) target[name] = props[name];
            return target;
        };
        function isArray(a) {
            return (a && (($.browser.safari && typeof a == 'object' && a.length) || (a.constructor && a.constructor.toString().match(/\Array\(\)/))));
        };
        $.fn.datepicker = function(options) {
            var otherArgs = Array.prototype.slice.call(arguments, 1);
            if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate')) return $.datepicker['_' + options + 'Datepicker'].apply($.datepicker, [this[0]].concat(otherArgs));
            return this.each(function() {
                typeof options == 'string' ? $.datepicker['_' + options + 'Datepicker'].apply($.datepicker, [this].concat(otherArgs)) : $.datepicker._attachDatepicker(this, options);
            });
        };
        $.datepicker = new Datepicker();
        $(document).ready(function() {
            $(document.body).append($.datepicker.dpDiv).mousedown($.datepicker._checkExternalClick);
        });
    })(jQuery); ;
    (function($) {
        $.effects = $.effects || {};
        $.extend($.effects, {
            save: function(el, set) {
                for (var i = 0; i < set.length; i++) {
                    if (set[i] !== null) $.data(el[0], "ec.storage." + set[i], el[0].style[set[i]]);
                }
            },
            restore: function(el, set) {
                for (var i = 0; i < set.length; i++) {
                    if (set[i] !== null) el.css(set[i], $.data(el[0], "ec.storage." + set[i]));
                }
            },
            setMode: function(el, mode) {
                if (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide';
                return mode;
            },
            getBaseline: function(origin, original) {
                var y, x;
                switch (origin[0]) {
                    case 'top':
                        y = 0;
                        break;
                    case 'middle':
                        y = 0.5;
                        break;
                    case 'bottom':
                        y = 1;
                        break;
                    default:
                        y = origin[0] / original.height;
                };
                switch (origin[1]) {
                    case 'left':
                        x = 0;
                        break;
                    case 'center':
                        x = 0.5;
                        break;
                    case 'right':
                        x = 1;
                        break;
                    default:
                        x = origin[1] / original.width;
                };
                return {
                    x: x,
                    y: y
                };
            },
            createWrapper: function(el) {
                if (el.parent().attr('id') == 'fxWrapper') return el;
                var props = {
                    width: el.outerWidth({
                        margin: true
                    }),
                    height: el.outerHeight({
                        margin: true
                    }),
                    'float': el.css('float')
                };
                el.wrap('<div id="fxWrapper" style="font-size:100%;background:transparent;border:none;margin:0;padding:0"></div>');
                var wrapper = el.parent();
                if (el.css('position') == 'static') {
                    wrapper.css({
                        position: 'relative'
                    });
                    el.css({
                        position: 'relative'
                    });
                } else {
                    var top = el.css('top');
                    if (isNaN(parseInt(top))) top = 'auto';
                    var left = el.css('left');
                    if (isNaN(parseInt(left))) left = 'auto';
                    wrapper.css({
                        position: el.css('position'),
                        top: top,
                        left: left,
                        zIndex: el.css('z-index')
                    }).show();
                    el.css({
                        position: 'relative',
                        top: 0,
                        left: 0
                    });
                }
                wrapper.css(props);
                return wrapper;
            },
            removeWrapper: function(el) {
                if (el.parent().attr('id') == 'fxWrapper') return el.parent().replaceWith(el);
                return el;
            },
            setTransition: function(el, list, factor, val) {
                val = val || {};
                $.each(list,
            function(i, x) {
                unit = el.cssUnit(x);
                if (unit[0] > 0) val[x] = unit[0] * factor + unit[1];
            });
                return val;
            },
            animateClass: function(value, duration, easing, callback) {
                var cb = (typeof easing == "function" ? easing : (callback ? callback : null));
                var ea = (typeof easing == "object" ? easing : null);
                return this.each(function() {
                    var offset = {};
                    var that = $(this);
                    var oldStyleAttr = that.attr("style") || '';
                    if (typeof oldStyleAttr == 'object') oldStyleAttr = oldStyleAttr["cssText"];
                    if (value.toggle) {
                        that.hasClass(value.toggle) ? value.remove = value.toggle : value.add = value.toggle;
                    }
                    var oldStyle = $.extend({},
                (document.defaultView ? document.defaultView.getComputedStyle(this, null) : this.currentStyle));
                    if (value.add) that.addClass(value.add);
                    if (value.remove) that.removeClass(value.remove);
                    var newStyle = $.extend({},
                (document.defaultView ? document.defaultView.getComputedStyle(this, null) : this.currentStyle));
                    if (value.add) that.removeClass(value.add);
                    if (value.remove) that.addClass(value.remove);
                    for (var n in newStyle) {
                        if (typeof newStyle[n] != "function" && newStyle[n] && n.indexOf("Moz") == -1 && n.indexOf("length") == -1 && newStyle[n] != oldStyle[n] && (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n], 10)))) && (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/)))) offset[n] = newStyle[n];
                    }
                    that.animate(offset, duration, ea,
                function() {
                    if (typeof $(this).attr("style") == 'object') {
                        $(this).attr("style")["cssText"] = "";
                        $(this).attr("style")["cssText"] = oldStyleAttr;
                    } else $(this).attr("style", oldStyleAttr);
                    if (value.add) $(this).addClass(value.add);
                    if (value.remove) $(this).removeClass(value.remove);
                    if (cb) cb.apply(this, arguments);
                });
                });
            }
        });
        $.fn.extend({
            _show: $.fn.show,
            _hide: $.fn.hide,
            __toggle: $.fn.toggle,
            _addClass: $.fn.addClass,
            _removeClass: $.fn.removeClass,
            _toggleClass: $.fn.toggleClass,
            effect: function(fx, o, speed, callback) {
                return $.effects[fx] ? $.effects[fx].call(this, {
                    method: fx,
                    options: o || {},
                    duration: speed,
                    callback: callback
                }) : null;
            },
            show: function() {
                if (!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0]))) return this._show.apply(this, arguments);
                else {
                    var o = arguments[1] || {};
                    o['mode'] = 'show';
                    return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
                }
            },
            hide: function() {
                if (!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0]))) return this._hide.apply(this, arguments);
                else {
                    var o = arguments[1] || {};
                    o['mode'] = 'hide';
                    return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
                }
            },
            toggle: function() {
                if (!arguments[0] || (arguments[0].constructor == Number || /(slow|normal|fast)/.test(arguments[0])) || (arguments[0].constructor == Function)) return this.__toggle.apply(this, arguments);
                else {
                    var o = arguments[1] || {};
                    o['mode'] = 'toggle';
                    return this.effect.apply(this, [arguments[0], o, arguments[2] || o.duration, arguments[3] || o.callback]);
                }
            },
            addClass: function(classNames, speed, easing, callback) {
                return speed ? $.effects.animateClass.apply(this, [{
                    add: classNames
                },
            speed, easing, callback]) : this._addClass(classNames);
            },
            removeClass: function(classNames, speed, easing, callback) {
                return speed ? $.effects.animateClass.apply(this, [{
                    remove: classNames
                },
            speed, easing, callback]) : this._removeClass(classNames);
            },
            toggleClass: function(classNames, speed, easing, callback) {
                return speed ? $.effects.animateClass.apply(this, [{
                    toggle: classNames
                },
            speed, easing, callback]) : this._toggleClass(classNames);
            },
            morph: function(remove, add, speed, easing, callback) {
                return $.effects.animateClass.apply(this, [{
                    add: add,
                    remove: remove
                },
            speed, easing, callback]);
            },
            switchClass: function() {
                return this.morph.apply(this, arguments);
            },
            cssUnit: function(key) {
                var style = this.css(key),
            val = [];
                $.each(['em', 'px', '%', 'pt'],
            function(i, unit) {
                if (style.indexOf(unit) > 0) val = [parseFloat(style), unit];
            });
                return val;
            }
        });
        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)];
            if (result = /rgba\(0, 0, 0, 0\)/.exec(color)) return colors['transparent']
            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],
            transparent: [255, 255, 255]
        };
        jQuery.easing['jswing'] = jQuery.easing['swing'];
        jQuery.extend(jQuery.easing, {
            def: 'easeOutQuad',
            swing: function(x, t, b, c, d) {
                return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
            },
            easeInQuad: function(x, t, b, c, d) {
                return c * (t /= d) * t + b;
            },
            easeOutQuad: function(x, t, b, c, d) {
                return -c * (t /= d) * (t - 2) + b;
            },
            easeInOutQuad: function(x, t, b, c, d) {
                if ((t /= d / 2) < 1) return c / 2 * t * t + b;
                return -c / 2 * ((--t) * (t - 2) - 1) + b;
            },
            easeInCubic: function(x, t, b, c, d) {
                return c * (t /= d) * t * t + b;
            },
            easeOutCubic: function(x, t, b, c, d) {
                return c * ((t = t / d - 1) * t * t + 1) + b;
            },
            easeInOutCubic: function(x, t, b, c, d) {
                if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
                return c / 2 * ((t -= 2) * t * t + 2) + b;
            },
            easeInQuart: function(x, t, b, c, d) {
                return c * (t /= d) * t * t * t + b;
            },
            easeOutQuart: function(x, t, b, c, d) {
                return -c * ((t = t / d - 1) * t * t * t - 1) + b;
            },
            easeInOutQuart: function(x, t, b, c, d) {
                if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
                return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
            },
            easeInQuint: function(x, t, b, c, d) {
                return c * (t /= d) * t * t * t * t + b;
            },
            easeOutQuint: function(x, t, b, c, d) {
                return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
            },
            easeInOutQuint: function(x, t, b, c, d) {
                if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
                return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
            },
            easeInSine: function(x, t, b, c, d) {
                return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
            },
            easeOutSine: function(x, t, b, c, d) {
                return c * Math.sin(t / d * (Math.PI / 2)) + b;
            },
            easeInOutSine: function(x, t, b, c, d) {
                return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
            },
            easeInExpo: function(x, t, b, c, d) {
                return (t == 0) ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
            },
            easeOutExpo: function(x, t, b, c, d) {
                return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
            },
            easeInOutExpo: function(x, t, b, c, d) {
                if (t == 0) return b;
                if (t == d) return b + c;
                if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
                return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
            },
            easeInCirc: function(x, t, b, c, d) {
                return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
            },
            easeOutCirc: function(x, t, b, c, d) {
                return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
            },
            easeInOutCirc: function(x, t, b, c, d) {
                if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
                return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
            },
            easeInElastic: function(x, t, b, c, d) {
                var s = 1.70158;
                var p = 0;
                var a = c;
                if (t == 0) return b;
                if ((t /= d) == 1) return b + c;
                if (!p) p = d * .3;
                if (a < Math.abs(c)) {
                    a = c;
                    var s = p / 4;
                }
                else var s = p / (2 * Math.PI) * Math.asin(c / a);
                return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
            },
            easeOutElastic: function(x, t, b, c, d) {
                var s = 1.70158;
                var p = 0;
                var a = c;
                if (t == 0) return b;
                if ((t /= d) == 1) return b + c;
                if (!p) p = d * .3;
                if (a < Math.abs(c)) {
                    a = c;
                    var s = p / 4;
                }
                else var s = p / (2 * Math.PI) * Math.asin(c / a);
                return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
            },
            easeInOutElastic: function(x, t, b, c, d) {
                var s = 1.70158;
                var p = 0;
                var a = c;
                if (t == 0) return b;
                if ((t /= d / 2) == 2) return b + c;
                if (!p) p = d * (.3 * 1.5);
                if (a < Math.abs(c)) {
                    a = c;
                    var s = p / 4;
                }
                else var s = p / (2 * Math.PI) * Math.asin(c / a);
                if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
                return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
            },
            easeInBack: function(x, t, b, c, d, s) {
                if (s == undefined) s = 1.70158;
                return c * (t /= d) * t * ((s + 1) * t - s) + b;
            },
            easeOutBack: function(x, t, b, c, d, s) {
                if (s == undefined) s = 1.70158;
                return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
            },
            easeInOutBack: function(x, t, b, c, d, s) {
                if (s == undefined) s = 1.70158;
                if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;
                return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;
            },
            easeInBounce: function(x, t, b, c, d) {
                return c - jQuery.easing.easeOutBounce(x, d - t, 0, c, d) + b;
            },
            easeOutBounce: function(x, t, b, c, d) {
                if ((t /= d) < (1 / 2.75)) {
                    return c * (7.5625 * t * t) + b;
                } else if (t < (2 / 2.75)) {
                    return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;
                } else if (t < (2.5 / 2.75)) {
                    return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;
                } else {
                    return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;
                }
            },
            easeInOutBounce: function(x, t, b, c, d) {
                if (t < d / 2) return jQuery.easing.easeInBounce(x, t * 2, 0, c, d) * .5 + b;
                return jQuery.easing.easeOutBounce(x, t * 2 - d, 0, c, d) * .5 + c * .5 + b;
            }
        });
    })(jQuery);
    (function($) {
        $.effects.bounce = function(o) {
            return this.queue(function() {
                var el = $(this),
            props = ['position', 'top', 'left'];
                var mode = $.effects.setMode(el, o.options.mode || 'effect');
                var direction = o.options.direction || 'up';
                var distance = o.options.distance || 20;
                var times = o.options.times || 5;
                var speed = o.duration || 250;
                if (/show|hide/.test(mode)) props.push('opacity');
                $.effects.save(el, props);
                el.show();
                $.effects.createWrapper(el);
                var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
                var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
                var distance = o.options.distance || (ref == 'top' ? el.outerHeight({
                    margin: true
                }) / 3 : el.outerWidth({
                    margin: true
                }) / 3);
                if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance);
                if (mode == 'hide') distance = distance / (times * 2);
                if (mode != 'hide') times--;
                if (mode == 'show') {
                    var animation = {
                        opacity: 1
                    };
                    animation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
                    el.animate(animation, speed / 2, o.options.easing);
                    distance = distance / 2;
                    times--;
                };
                for (var i = 0; i < times; i++) {
                    var animation1 = {},
                animation2 = {};
                    animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
                    animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
                    el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);
                    distance = (mode == 'hide') ? distance * 2 : distance / 2;
                };
                if (mode == 'hide') {
                    var animation = {
                        opacity: 0
                    };
                    animation[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
                    el.animate(animation, speed / 2, o.options.easing,
                function() {
                    el.hide();
                    $.effects.restore(el, props);
                    $.effects.removeWrapper(el);
                    if (o.callback) o.callback.apply(this, arguments);
                });
                } else {
                    var animation1 = {},
                animation2 = {};
                    animation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;
                    animation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;
                    el.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing,
                function() {
                    $.effects.restore(el, props);
                    $.effects.removeWrapper(el);
                    if (o.callback) o.callback.apply(this, arguments);
                });
                };
                el.queue('fx',
            function() {
                el.dequeue();
            });
                el.dequeue();
            });
        };
    })(jQuery);
    (function($) {
        $.effects.drop = function(o) {
            return this.queue(function() {
                var el = $(this),
            props = ['position', 'top', 'left', 'opacity'];
                var mode = $.effects.setMode(el, o.options.mode || 'hide');
                var direction = o.options.direction || 'left';
                $.effects.save(el, props);
                el.show();
                $.effects.createWrapper(el);
                var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
                var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
                var distance = o.options.distance || (ref == 'top' ? el.outerHeight({
                    margin: true
                }) / 2 : el.outerWidth({
                    margin: true
                }) / 2);
                if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance);
                var animation = {
                    opacity: mode == 'show' ? 1 : 0
                };
                animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
                el.animate(animation, {
                    queue: false,
                    duration: o.duration,
                    easing: o.options.easing,
                    complete: function() {
                        if (mode == 'hide') el.hide();
                        $.effects.restore(el, props);
                        $.effects.removeWrapper(el);
                        if (o.callback) o.callback.apply(this, arguments);
                        el.dequeue();
                    }
                });
            });
        };
    })(jQuery);
    (function($) {
        $.effects.puff = function(o) {
            return this.queue(function() {
                var el = $(this);
                var options = $.extend(true, {},
            o.options);
                var mode = $.effects.setMode(el, o.options.mode || 'hide');
                var percent = parseInt(o.options.percent) || 150;
                options.fade = true;
                var original = {
                    height: el.height(),
                    width: el.width()
                };
                var factor = percent / 100;
                el.from = (mode == 'hide') ? original : {
                    height: original.height * factor,
                    width: original.width * factor
                };
                options.from = el.from;
                options.percent = (mode == 'hide') ? percent : 100;
                options.mode = mode;
                el.effect('scale', options, o.duration, o.callback);
                el.dequeue();
            });
        };
        $.effects.scale = function(o) {
            return this.queue(function() {
                var el = $(this);
                var options = $.extend(true, {},
            o.options);
                var mode = $.effects.setMode(el, o.options.mode || 'effect');
                var percent = parseInt(o.options.percent) || (parseInt(o.options.percent) == 0 ? 0 : (mode == 'hide' ? 0 : 100));
                var direction = o.options.direction || 'both';
                var origin = o.options.origin;
                if (mode != 'effect') {
                    options.origin = origin || ['middle', 'center'];
                    options.restore = true;
                }
                var original = {
                    height: el.height(),
                    width: el.width()
                };
                el.from = o.options.from || (mode == 'show' ? {
                    height: 0,
                    width: 0
} : original);
                    var factor = {
                        y: direction != 'horizontal' ? (percent / 100) : 1,
                        x: direction != 'vertical' ? (percent / 100) : 1
                    };
                    el.to = {
                        height: original.height * factor.y,
                        width: original.width * factor.x
                    };
                    if (o.options.fade) {
                        if (mode == 'show') {
                            el.from.opacity = 0;
                            el.to.opacity = 1;
                        };
                        if (mode == 'hide') {
                            el.from.opacity = 1;
                            el.to.opacity = 0;
                        };
                    };
                    options.from = el.from;
                    options.to = el.to;
                    options.mode = mode;
                    el.effect('size', options, o.duration, o.callback);
                    el.dequeue();
                });
            };
            $.effects.size = function(o) {
                return this.queue(function() {
                    var el = $(this),
            props = ['position', 'top', 'left', 'width', 'height', 'overflow', 'opacity'];
                    var props1 = ['position', 'top', 'left', 'overflow', 'opacity'];
                    var props2 = ['width', 'height', 'overflow'];
                    var cProps = ['fontSize'];
                    var vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];
                    var hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];
                    var mode = $.effects.setMode(el, o.options.mode || 'effect');
                    var restore = o.options.restore || false;
                    var scale = o.options.scale || 'both';
                    var origin = o.options.origin;
                    var original = {
                        height: el.height(),
                        width: el.width()
                    };
                    el.from = o.options.from || original;
                    el.to = o.options.to || original;
                    if (origin) {
                        var baseline = $.effects.getBaseline(origin, original);
                        el.from.top = (original.height - el.from.height) * baseline.y;
                        el.from.left = (original.width - el.from.width) * baseline.x;
                        el.to.top = (original.height - el.to.height) * baseline.y;
                        el.to.left = (original.width - el.to.width) * baseline.x;
                    };
                    var factor = {
                        from: {
                            y: el.from.height / original.height,
                            x: el.from.width / original.width
                        },
                        to: {
                            y: el.to.height / original.height,
                            x: el.to.width / original.width
                        }
                    };
                    if (scale == 'box' || scale == 'both') {
                        if (factor.from.y != factor.to.y) {
                            props = props.concat(vProps);
                            el.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);
                            el.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);
                        };
                        if (factor.from.x != factor.to.x) {
                            props = props.concat(hProps);
                            el.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);
                            el.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);
                        };
                    };
                    if (scale == 'content' || scale == 'both') {
                        if (factor.from.y != factor.to.y) {
                            props = props.concat(cProps);
                            el.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);
                            el.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);
                        };
                    };
                    $.effects.save(el, restore ? props : props1);
                    el.show();
                    $.effects.createWrapper(el);
                    el.css('overflow', 'hidden').css(el.from);
                    if (scale == 'content' || scale == 'both') {
                        vProps = vProps.concat(['marginTop', 'marginBottom']).concat(cProps);
                        hProps = hProps.concat(['marginLeft', 'marginRight']);
                        props2 = props.concat(vProps).concat(hProps);
                        el.find("*[width]").each(function() {
                            child = $(this);
                            if (restore) $.effects.save(child, props2);
                            var c_original = {
                                height: child.height(),
                                width: child.width()
                            };
                            child.from = {
                                height: c_original.height * factor.from.y,
                                width: c_original.width * factor.from.x
                            };
                            child.to = {
                                height: c_original.height * factor.to.y,
                                width: c_original.width * factor.to.x
                            };
                            if (factor.from.y != factor.to.y) {
                                child.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);
                                child.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);
                            };
                            if (factor.from.x != factor.to.x) {
                                child.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);
                                child.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);
                            };
                            child.css(child.from);
                            child.animate(child.to, o.duration, o.options.easing,
                    function() {
                        if (restore) $.effects.restore(child, props2);
                    });
                        });
                    };
                    el.animate(el.to, {
                        queue: false,
                        duration: o.duration,
                        easing: o.options.easing,
                        complete: function() {
                            if (mode == 'hide') el.hide();
                            $.effects.restore(el, restore ? props : props1);
                            $.effects.removeWrapper(el);
                            if (o.callback) o.callback.apply(this, arguments);
                            el.dequeue();
                        }
                    });
                });
            };
        })(jQuery);
        (function($) {
            $.effects.slide = function(o) {
                return this.queue(function() {
                    var el = $(this),
            props = ['position', 'top', 'left'];
                    var mode = $.effects.setMode(el, o.options.mode || 'show');
                    var direction = o.options.direction || 'left';
                    $.effects.save(el, props);
                    el.show();
                    $.effects.createWrapper(el).css({
                        overflow: 'hidden'
                    });
                    var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';
                    var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';
                    var distance = o.options.distance || (ref == 'top' ? el.outerHeight({
                        margin: true
                    }) : el.outerWidth({
                        margin: true
                    }));
                    if (mode == 'show') el.css(ref, motion == 'pos' ? -distance : distance);
                    var animation = {};
                    animation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;
                    el.animate(animation, {
                        queue: false,
                        duration: o.duration,
                        easing: o.options.easing,
                        complete: function() {
                            if (mode == 'hide') el.hide();
                            $.effects.restore(el, props);
                            $.effects.removeWrapper(el);
                            if (o.callback) o.callback.apply(this, arguments);
                            el.dequeue();
                        }
                    });
                });
            };
        })(jQuery);
        (function($) {
            $.effects.transfer = function(o) {
                return this.queue(function() {
                    var el = $(this);
                    var mode = $.effects.setMode(el, o.options.mode || 'effect');
                    var target = $(o.options.to);
                    var position = el.offset();
                    var transfer = $('<div class="ui-effects-transfer"></div>').appendTo(document.body);
                    if (o.options.className) transfer.addClass(o.options.className);
                    transfer.addClass(o.options.className);
                    transfer.css({
                        top: position.top,
                        left: position.left,
                        height: el.outerHeight() - parseInt(transfer.css('borderTopWidth')) - parseInt(transfer.css('borderBottomWidth')),
                        width: el.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth')),
                        position: 'absolute'
                    });
                    position = target.offset();
                    animation = {
                        top: position.top,
                        left: position.left,
                        height: target.outerHeight() - parseInt(transfer.css('borderTopWidth')) - parseInt(transfer.css('borderBottomWidth')),
                        width: target.outerWidth() - parseInt(transfer.css('borderLeftWidth')) - parseInt(transfer.css('borderRightWidth'))
                    };
                    transfer.animate(animation, o.duration, o.options.easing,
            function() {
                transfer.remove();
                if (o.callback) o.callback.apply(el[0], arguments);
                el.dequeue();
            });
                });
            };
        })(jQuery);
// End ~/Scripts/jquery-ui-personalized-1.5.3.js

// Begin ~/Scripts/jquery.jplayer.js

/*
Copyright (c) 2009 Happyworm Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Author: Mark J Panaghiston
Version: 0.2.1.beta
Documentation: www.happyworm.com/jquery/jplayer
*/

(function($) {
	$.jPlayerCount = 0;
	
	var methods = {
		jPlayer: function(options) {
			$.jPlayerCount++;
			
			var config = {
				ready: null,
				cssPrefix: "jqjp",
				swfPath: "js",
				quality: "high",
				width: 0,
				height: 0,
				top: 0,
				left: 0,
				position: "absolute",
				bgcolor: "#ffffff"
			};

			$.extend(config, options);

			var configWithoutOptions = {
				id: $(this).attr("id"),
				swf: config.swfPath + ((config.swfPath != "") ? "/" : "") + "Jplayer.swf",
				fid: config.cssPrefix + "_flash_" + $.jPlayerCount,
				hid: config.cssPrefix + "_force_" + $.jPlayerCount
			};

			$.extend(config, configWithoutOptions);

			$(this).data("jPlayer.config", config);
			
			var events = {
				change: function(e, f) {
					var fid = $(this).data("jPlayer.config").fid;
					var m = $(this).data("jPlayer.getMovie")(fid);
					m.fl_change_mp3(f);
					$(this).trigger("jPlayer.screenUpdate", false);
				},
				play: function(e) {
					var fid = $(this).data("jPlayer.config").fid;
					var m = $(this).data("jPlayer.getMovie")(fid);
					var r = m.fl_play_mp3();
					if(r) {
						$(this).trigger("jPlayer.screenUpdate", true);
					}
					
				},
				pause: function(e) {
					var fid = $(this).data("jPlayer.config").fid;
					var m = $(this).data("jPlayer.getMovie")(fid);
					var r = m.fl_pause_mp3();
					if(r) {
						$(this).trigger("jPlayer.screenUpdate", false);
					}
				},
				stopAudio: function(e) {
					var fid = $(this).data("jPlayer.config").fid;
					var m = $(this).data("jPlayer.getMovie")(fid);
					var r = m.fl_stop_mp3();
					if(r) {
						$(this).trigger("jPlayer.screenUpdate", false);
					}
				},
				playHead: function(e, p) {
					var fid = $(this).data("jPlayer.config").fid;
					var m = $(this).data("jPlayer.getMovie")(fid);
					var r = m.fl_play_head_mp3(p);
					if(r) {
						$(this).trigger("jPlayer.screenUpdate", true);
					}
				},
				volume: function(e, v) {
					var fid = $(this).data("jPlayer.config").fid;
					var m = $(this).data("jPlayer.getMovie")(fid);
					m.fl_volume_mp3(v);
				},
				screenUpdate: function(e, playing) {
					var playId = $(this).data("jPlayer.cssId.play");
					var pauseId = $(this).data("jPlayer.cssId.pause");
					var prefix = $(this).data("jPlayer.config").cssPrefix;

					if(playId != null && pauseId != null) {
						if(playing) {
							var style = $(this).data("jPlayer.cssDisplay.pause");
							$("#"+playId).css("display", "none");
							$("#"+pauseId).css("display", style);
						} else {
							var style = $(this).data("jPlayer.cssDisplay.play");
							$("#"+playId).css("display", style);
							$("#"+pauseId).css("display", "none");
						}
					}
				}
			};
			
			for(var event in events) {
				var e = "jPlayer." + event;
				$(this).unbind(e);
				$(this).bind(e, events[event]);
			}

			var getMovie = function(fid) {
				if ($.browser.msie) {
					return window[fid];
				} else {
					return document[fid];
				}
			};
			$(this).data("jPlayer.getMovie", getMovie);
			
			if($.browser.msie) {
				var html_obj = '<object id="' + config.fid + '"';
				html_obj += ' classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"';
				html_obj += ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"';
				html_obj += ' type="application/x-shockwave-flash"';
				html_obj += ' width="' + config.width + '" height="' + config.height + '">';
				html_obj += '</object>';
			
				var obj_param = new Array();
				obj_param[0] = '<param name="movie" value="' + config.swf + '" />';
				obj_param[1] = '<param name="quality" value="high" />';
				obj_param[2] = '<param name="FlashVars" value="id=' + escape(config.id) + '&fid=' + escape(config.fid) + '" />';
				obj_param[3] = '<param name="allowScriptAccess" value="always" />';
				obj_param[4] = '<param name="bgcolor" value="' + config.bgcolor + '" />';
				
				var ie_dom = document.createElement(html_obj);
				for(var i=0; i < obj_param.length; i++) {
					ie_dom.appendChild(document.createElement(obj_param[i]));
				}
				$(this).html(ie_dom);
			} else {
				var html_embed = '<embed name="' + config.fid + '" src="' + config.swf + '"';
				html_embed += ' width="' + config.width + '" height="' + config.height + '" bgcolor="' + config.bgcolor + '"';
				html_embed += ' quality="high" FlashVars="id=' + escape(config.id) + '&fid=' + escape(config.fid) + '"';
				html_embed += ' allowScriptAccess="always"';
				html_embed += ' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
				$(this).html(html_embed);
			}
			
			var html_hidden = '<div id="' + config.hid + '"></div>';
			$(this).append(html_hidden);
			
			$(this).css({'position':config.position, 'top':config.top, 'left':config.left});
			$("#"+config.hid).css({'text-indent':'-9999px'});
			
			return $(this);
		},

        change: function(f) {
            $(this).trigger("jPlayer.change", f);
        },
		play: function() {
			$(this).trigger("jPlayer.play");
		},
		changeAndPlay: function(f) {
			$(this).trigger("jPlayer.change", f);
			$(this).trigger("jPlayer.play");
		},
		pause: function() {
			$(this).trigger("jPlayer.pause");
		},
		stopAudio: function() {
		$(this).trigger("jPlayer.stopAudio");
		},
		playHead: function(p) {
			$(this).trigger("jPlayer.playHead", p);
		},
		volume: function(v) {
			$(this).trigger("jPlayer.volume", v);
		},
		jPlayerId: function(fn, id) {
			if(id != null) {
				var isValid = eval("$(this)."+fn);
				if(isValid != null) {
					$(this).data("jPlayer.cssId." + fn, id);
					var jPlayerId = $(this).data("jPlayer.config").id;
					eval("var myHandler = function(e) { $(\"#" + jPlayerId + "\")." + fn + "(e); return false; }");
					$("#"+id).click(myHandler).hover(this.rollOver, this.rollOut).data("jPlayerId", jPlayerId);
					
					var display = $("#"+id).css("display");
					$(this).data("jPlayer.cssDisplay." + fn, display);
					
					if(fn == "pause") {
						$("#"+id).css("display", "none");
					}
				} else {
					alert("Unknown function assigned in: jPlayerId( fn="+fn+", id="+id+" )");
				}
			} else {
				id = $(this).data("jPlayer.cssId." + fn);
				if(id != null) {
					return id;
				} else {
					alert("Unknown function id requested: jPlayerId( fn="+fn+" )");
					return false;
				}
			}
		},
		loadBar: function(e) {
			var lbId = $(this).data("jPlayer.cssId.loadBar");
			if( lbId != null ) {
				var offset = $("#"+lbId).offset();
				var x = e.pageX - offset.left;
				var w = $("#"+lbId).width();
				var p = 100*x/w;
				$(this).playHead(p);
			}
		},
		playBar: function(e) {
			this.loadBar(e);
		},
		onProgressChange: function(fn) {
			$(this).data("jPlayer.jsFn.onProgressChange", fn);
		},
		updateProgress: function(loadPercent, playedPercentRelative, playedPercentAbsolute, playedTime, totalTime) { // Called from Flash
			var lbId = $(this).data("jPlayer.cssId.loadBar");
			if (lbId != null) {
				$("#"+lbId).width(loadPercent+"%");
			}
			var pbId = $(this).data("jPlayer.cssId.playBar");
			if (pbId != null ) {
				$("#"+pbId).width(playedPercentRelative+"%");
			}
			var onProgressChangeFn = $(this).data("jPlayer.jsFn.onProgressChange");
			if(onProgressChangeFn != null) {
				onProgressChangeFn(loadPercent, playedPercentRelative, playedPercentAbsolute, playedTime, totalTime);
			}
			if (lbId != null || pbId != null || onProgressChangeFn != null) {
				this.forceScreenUpdate();
				return true;
			} else {
				return false;
			}
		},
		volumeMin: function() {
			$(this).volume(0);
		},
		volumeMax: function() {
			$(this).volume(100);
		},
		volumeBar: function(e) {
			var vbId = $(this).data("jPlayer.cssId.volumeBar");
			if( vbId != null ) {
				var offset = $("#"+vbId).offset();
				var x = e.pageX - offset.left;
				var w = $("#"+vbId).width();
				var p = 100*x/w;
				$(this).volume(p);
			}
		},
		volumeBarValue: function(e) {
			this.volumeBar(e);
		},
		updateVolume: function(v) { // Called from Flash
			var vbvId = $(this).data("jPlayer.cssId.volumeBarValue");
			if( vbvId != null ) {
				$("#"+vbvId).width(v+"%");
				this.forceScreenUpdate();
				return true;
			}
		},
		onSoundComplete: function(fn) {
			$(this).data("jPlayer.jsFn.onSoundComplete", fn);
		},
		finishedPlaying: function() { // Called from Flash
			var onSoundCompleteFn = $(this).data("jPlayer.jsFn.onSoundComplete");
			$(this).trigger("jPlayer.screenUpdate", false);
			if(onSoundCompleteFn != null) {
				onSoundCompleteFn();
				return true;
			} else {
				return false;
			}
		},
		setBufferState: function (b) { // Called from Flash
			var lbId = $(this).data("jPlayer.cssId.loadBar");
			if( lbId != null ) {
				var prefix = $(this).data("jPlayer.config").cssPrefix;
				if(b) {
					$("#"+lbId).addClass(prefix + "_buffer");
				} else {
					$("#"+lbId).removeClass(prefix + "_buffer");
				}
				return true;
			} else {
				return false;
			}
		},
		bufferMsg: function() {
			// Empty: Initialized to enable jPlayerId() to work.
			// See setBufferMsg() for code.
		},
		setBufferMsg: function (msg) { // Called from Flash
			var bmId = $(this).data("jPlayer.cssId.bufferMsg");
			if( bmId != null ) {
				$("#"+bmId).html(msg);
				return true;
			} else {
				return false;
			}
		},
		forceScreenUpdate: function() { // For Safari and Chrome
			var hid = $(this).data("jPlayer.config").hid;
			$("#"+hid).html(Math.random());
		},
		rollOver: function() {
			var jPlayerId = $(this).data("jPlayerId");
			var prefix = $("#"+jPlayerId).data("jPlayer.config").cssPrefix;
			$(this).addClass(prefix + "_hover");
		},
		rollOut: function() {
			var jPlayerId = $(this).data("jPlayerId");
			var prefix = $("#"+jPlayerId).data("jPlayer.config").cssPrefix;
			$(this).removeClass(prefix + "_hover");
		},
		flashReady: function() { // Called from Flash
			var readyFn = $(this).data("jPlayer.config").ready;
			if(readyFn != null) {
				readyFn();
			}
		}
	};

	$.each(methods, function(i) {
		$.fn[i] = this;
	});
})(jQuery);

// End ~/Scripts/jquery.jplayer.js

// Begin ~/Scripts/jquery.swfobject.min.js

/* jquery.swfobject.license.txt */
(function(A){A.flashPlayerVersion=function(){var D,B=null,I=false,H="ShockwaveFlash.ShockwaveFlash";if(!(D=navigator.plugins["Shockwave Flash"])){try{B=new ActiveXObject(H+".7")}catch(G){try{B=new ActiveXObject(H+".6");D=[6,0,21];B.AllowScriptAccess="always"}catch(F){if(D&&D[0]===6){I=true}}if(!I){try{B=new ActiveXObject(H)}catch(E){D="X 0,0,0"}}}if(!I&&B){try{D=B.GetVariable("$version")}catch(C){}}}else{D=D.description}D=D.match(/^[A-Za-z\s]*?(\d+)(\.|,)(\d+)(\s+r|,)(\d+)/);return[D[1]*1,D[3]*1,D[5]*1]}();A.flashExpressInstaller="expressInstall.swf";A.hasFlashPlayer=(A.flashPlayerVersion[0]!==0);A.hasFlashPlayerVersion=function(C){var B=A.flashPlayerVersion;C=(/string|integer/.test(typeof C))?C.toString().split("."):C;return(C)?(B[0]>=(C.major||C[0]||B[0])&&B[1]>=(C.minor||C[1]||B[1])&&B[2]>=(C.release||C[2]||B[2])):(B[0]!==0)};A.flash=function(M){if(!A.hasFlashPlayer){return false}var C=M.swf||"",K=M.params||{},E=document.createElement("body"),B,L,H,D,J,I,G,F;M.height=M.height||180;M.width=M.width||320;if(M.hasVersion&&!A.hasFlashPlayerVersion(M.hasVersion)){A.extend(M,{id:"SWFObjectExprInst",height:Math.max(M.height,137),width:Math.max(M.width,214)});C=M.expressInstaller||A.flashExpressInstaller;K={flashvars:{MMredirectURL:window.location.href,MMplayerType:(A.browser.msie&&A.browser.win)?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}}if(M.flashvars&&typeof K==="object"){A.extend(K,{flashvars:M.flashvars})}for(J in (I=["swf","expressInstall","hasVersion","params","flashvars"])){delete M[I[J]]}B=[];for(J in M){if(typeof M[J]==="object"){L=[];for(I in M[J]){L.push(I.replace(/([A-Z])/,"-$1").toLowerCase()+":"+M[J][I]+";")}M[J]=L.join("")}B.push(J+'="'+M[J]+'"')}M=B.join(" ");if(typeof K==="object"){B=[];for(J in K){if(typeof K[J]==="object"){L=[];for(I in K[J]){if(typeof K[J][I]==="object"){H=[];for(G in K[J][I]){if(typeof K[J][I][G]==="object"){D=[];for(F in K[J][I][G]){D.push(F.replace(/([A-Z])/,"-$1").toLowerCase()+":"+K[J][I][G][F]+";")}K[J][I][G]=D.join("")}H.push(G+"{"+K[J][I][G]+"}")}K[J][I]=H.join("")}L.push(window.escape(I)+"="+window.escape(K[J][I]))}K[J]=L.join("&amp;")}B.push('<PARAM NAME="'+J+'" VALUE="'+K[J]+'">')}K=B.join("")}if(!(/style=/.test(M))){M+=' style="vertical-align:text-top;"'}if(!(/style=(.*?)vertical-align/.test(M))){M=M.replace(/style="/,'style="vertical-align:text-top;')}if(A.browser.msie){M+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';K='<PARAM NAME="movie" VALUE="'+C+'">'+K}else{M+=' type="application/x-shockwave-flash" data="'+C+'"'}E.innerHTML="<OBJECT "+M+">"+K+"</OBJECT>";return A(E.firstChild)};A.fn.flash=function(C){if(!A.hasFlashPlayer){return this}var B=0,D;while((D=this.eq(B++))[0]){D.html(A.flash(A.extend({},C)));if(D[0].firstChild.getAttribute("id")==="SWFObjectExprInst"){B=this.length}}return this}}(jQuery));
// End ~/Scripts/jquery.swfobject.min.js

