﻿/*
* jQuery Corners 0.3
* Copyright (c) 2008 David Turnbull, Steven Wittens
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*/
jQuery.fn.corners = function(C) { var N = "rounded_by_jQuery_corners"; var V = B(C); var F = false; try { F = (document.body.style.WebkitBorderRadius !== undefined); var Y = navigator.userAgent.indexOf("Chrome"); if (Y >= 0) { F = false } } catch (E) { } var W = false; try { W = (document.body.style.MozBorderRadius !== undefined); var Y = navigator.userAgent.indexOf("Firefox"); if (Y >= 0 && parseInt(navigator.userAgent.substring(Y + 8)) < 3) { W = false } } catch (E) { } return this.each(function(b, h) { $e = jQuery(h); if ($e.hasClass(N)) { return } $e.addClass(N); var a = /{(.*)}/.exec(h.className); var c = a ? B(a[1], V) : V; var j = h.nodeName.toLowerCase(); if (j == "input") { h = O(h) } if (F && c.webkit) { K(h, c) } else { if (W && c.mozilla && (c.sizex == c.sizey)) { M(h, c) } else { var d = D(h.parentNode); var f = D(h); switch (j) { case "a": case "input": Z(h, c, d, f); break; default: R(h, c, d, f); break } } } }); function K(d, c) { var a = "" + c.sizex + "px " + c.sizey + "px"; var b = jQuery(d); if (c.tl) { b.css("WebkitBorderTopLeftRadius", a) } if (c.tr) { b.css("WebkitBorderTopRightRadius", a) } if (c.bl) { b.css("WebkitBorderBottomLeftRadius", a) } if (c.br) { b.css("WebkitBorderBottomRightRadius", a) } } function M(d, c) { var a = "" + c.sizex + "px"; var b = jQuery(d); if (c.tl) { b.css("-moz-border-radius-topleft", a) } if (c.tr) { b.css("-moz-border-radius-topright", a) } if (c.bl) { b.css("-moz-border-radius-bottomleft", a) } if (c.br) { b.css("-moz-border-radius-bottomright", a) } } function Z(k, n, l, a) { var m = S("table"); var i = S("tbody"); m.appendChild(i); var j = S("tr"); var d = S("td", "top"); j.appendChild(d); var h = S("tr"); var c = T(k, n, S("td")); h.appendChild(c); var f = S("tr"); var b = S("td", "bottom"); f.appendChild(b); if (n.tl || n.tr) { i.appendChild(j); X(d, n, l, a, true) } i.appendChild(h); if (n.bl || n.br) { i.appendChild(f); X(b, n, l, a, false) } k.appendChild(m); if (jQuery.browser.msie) { m.onclick = Q } k.style.overflow = "hidden" } function Q() { if (!this.parentNode.onclick) { this.parentNode.click() } } function O(c) { var b = document.createElement("a"); b.id = c.id; b.className = c.className; if (c.onclick) { b.href = "javascript:"; b.onclick = c.onclick } else { jQuery(c).parent("form").each(function() { b.href = this.action }); b.onclick = I } var a = document.createTextNode(c.value); b.appendChild(a); c.parentNode.replaceChild(b, c); return b } function I() { jQuery(this).parent("form").each(function() { this.submit() }); return false } function R(d, a, b, c) { var f = T(d, a, document.createElement("div")); d.appendChild(f); if (a.tl || a.tr) { X(d, a, b, c, true) } if (a.bl || a.br) { X(d, a, b, c, false) } } function T(j, i, k) { var b = jQuery(j); var l; while (l = j.firstChild) { k.appendChild(l) } if (j.style.height) { var f = parseInt(b.css("height")); k.style.height = f + "px"; f += parseInt(b.css("padding-top")) + parseInt(b.css("padding-bottom")); j.style.height = f + "px" } if (j.style.width) { var a = parseInt(b.css("width")); k.style.width = a + "px"; a += parseInt(b.css("padding-left")) + parseInt(b.css("padding-right")); j.style.width = a + "px" } k.style.paddingLeft = b.css("padding-left"); k.style.paddingRight = b.css("padding-right"); if (i.tl || i.tr) { k.style.paddingTop = U(j, i, b.css("padding-top"), true) } else { k.style.paddingTop = b.css("padding-top") } if (i.bl || i.br) { k.style.paddingBottom = U(j, i, b.css("padding-bottom"), false) } else { k.style.paddingBottom = b.css("padding-bottom") } j.style.padding = 0; return k } function U(f, a, d, c) { if (d.indexOf("px") < 0) { try { console.error("%s padding not in pixels", (c ? "top" : "bottom"), f) } catch (b) { } d = a.sizey + "px" } d = parseInt(d); if (d - a.sizey < 0) { try { console.error("%s padding is %ipx for %ipx corner:", (c ? "top" : "bottom"), d, a.sizey, f) } catch (b) { } d = a.sizey } return d - a.sizey + "px" } function S(b, a) { var c = document.createElement(b); c.style.border = "none"; c.style.borderCollapse = "collapse"; c.style.borderSpacing = 0; c.style.padding = 0; c.style.margin = 0; if (a) { c.style.verticalAlign = a } return c } function D(b) { try { var d = jQuery.css(b, "background-color"); if (d.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i) && b.parentNode) { return D(b.parentNode) } if (d == null) { return "#ffffff" } if (d.indexOf("rgb") > -1) { d = A(d) } if (d.length == 4) { d = L(d) } return d } catch (a) { return "#ffffff" } } function L(a) { return "#" + a.substring(1, 2) + a.substring(1, 2) + a.substring(2, 3) + a.substring(2, 3) + a.substring(3, 4) + a.substring(3, 4) } function A(h) { var a = 255; var d = ""; var b; var e = /([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/; var f = e.exec(h); for (b = 1; b < 4; b++) { d += ("0" + parseInt(f[b]).toString(16)).slice(-2) } return "#" + d } function B(b, d) { var b = b || ""; var c = { sizex: 5, sizey: 5, tl: false, tr: false, bl: false, br: false, webkit: true, mozilla: true, transparent: false }; if (d) { c.sizex = d.sizex; c.sizey = d.sizey; c.webkit = d.webkit; c.transparent = d.transparent; c.mozilla = d.mozilla } var a = false; var e = false; jQuery.each(b.split(" "), function(f, j) { j = j.toLowerCase(); var h = parseInt(j); if (h > 0 && j == h + "px") { c.sizey = h; if (!a) { c.sizex = h } a = true } else { switch (j) { case "no-native": c.webkit = c.mozilla = false; break; case "webkit": c.webkit = true; break; case "no-webkit": c.webkit = false; break; case "mozilla": c.mozilla = true; break; case "no-mozilla": c.mozilla = false; break; case "anti-alias": c.transparent = false; break; case "transparent": c.transparent = true; break; case "top": e = c.tl = c.tr = true; break; case "right": e = c.tr = c.br = true; break; case "bottom": e = c.bl = c.br = true; break; case "left": e = c.tl = c.bl = true; break; case "top-left": e = c.tl = true; break; case "top-right": e = c.tr = true; break; case "bottom-left": e = c.bl = true; break; case "bottom-right": e = c.br = true; break } } }); if (!e) { if (!d) { c.tl = c.tr = c.bl = c.br = true } else { c.tl = d.tl; c.tr = d.tr; c.bl = d.bl; c.br = d.br } } return c } function P(f, d, h) { var e = Array(parseInt("0x" + f.substring(1, 3)), parseInt("0x" + f.substring(3, 5)), parseInt("0x" + f.substring(5, 7))); var c = Array(parseInt("0x" + d.substring(1, 3)), parseInt("0x" + d.substring(3, 5)), parseInt("0x" + d.substring(5, 7))); r = "0" + Math.round(e[0] + (c[0] - e[0]) * h).toString(16); g = "0" + Math.round(e[1] + (c[1] - e[1]) * h).toString(16); d = "0" + Math.round(e[2] + (c[2] - e[2]) * h).toString(16); return "#" + r.substring(r.length - 2) + g.substring(g.length - 2) + d.substring(d.length - 2) } function X(f, a, b, d, c) { if (a.transparent) { G(f, a, b, c) } else { J(f, a, b, d, c) } } function J(k, z, p, a, n) { var h, f; var l = document.createElement("div"); l.style.fontSize = "1px"; l.style.backgroundColor = p; var b = 0; for (h = 1; h <= z.sizey; h++) { var u, t, q; arc = Math.sqrt(1 - Math.pow(1 - h / z.sizey, 2)) * z.sizex; var c = z.sizex - Math.ceil(arc); var w = Math.floor(b); var v = z.sizex - c - w; var o = document.createElement("div"); var m = l; o.style.margin = "0px " + c + "px"; o.style.height = "1px"; o.style.overflow = "hidden"; for (f = 1; f <= v; f++) { if (f == 1) { if (f == v) { u = ((arc + b) * 0.5) - w } else { t = Math.sqrt(1 - Math.pow(1 - (c + 1) / z.sizex, 2)) * z.sizey; u = (t - (z.sizey - h)) * (arc - w - v + 1) * 0.5 } } else { if (f == v) { t = Math.sqrt(1 - Math.pow((z.sizex - c - f + 1) / z.sizex, 2)) * z.sizey; u = 1 - (1 - (t - (z.sizey - h))) * (1 - (b - w)) * 0.5 } else { q = Math.sqrt(1 - Math.pow((z.sizex - c - f) / z.sizex, 2)) * z.sizey; t = Math.sqrt(1 - Math.pow((z.sizex - c - f + 1) / z.sizex, 2)) * z.sizey; u = ((t + q) * 0.5) - (z.sizey - h) } } H(z, o, m, n, P(p, a, u)); m = o; var o = m.cloneNode(false); o.style.margin = "0px 1px" } H(z, o, m, n, a); b = arc } if (n) { k.insertBefore(l, k.firstChild) } else { k.appendChild(l) } } function H(c, a, e, d, b) { if (d && !c.tl) { a.style.marginLeft = 0 } if (d && !c.tr) { a.style.marginRight = 0 } if (!d && !c.bl) { a.style.marginLeft = 0 } if (!d && !c.br) { a.style.marginRight = 0 } a.style.backgroundColor = b; if (d) { e.appendChild(a) } else { e.insertBefore(a, e.firstChild) } } function G(c, o, l, h) { var f = document.createElement("div"); f.style.fontSize = "1px"; var a = document.createElement("div"); a.style.overflow = "hidden"; a.style.height = "1px"; a.style.borderColor = l; a.style.borderStyle = "none solid"; var m = o.sizex - 1; var j = o.sizey - 1; if (!j) { j = 1 } for (var b = 0; b < o.sizey; b++) { var n = m - Math.floor(Math.sqrt(1 - Math.pow(1 - b / j, 2)) * m); if (b == 2 && o.sizex == 6 && o.sizey == 6) { n = 2 } var k = a.cloneNode(false); k.style.borderWidth = "0 " + n + "px"; if (h) { k.style.borderWidth = "0 " + (o.tr ? n : 0) + "px 0 " + (o.tl ? n : 0) + "px" } else { k.style.borderWidth = "0 " + (o.br ? n : 0) + "px 0 " + (o.bl ? n : 0) + "px" } h ? f.appendChild(k) : f.insertBefore(k, f.firstChild) } if (h) { c.insertBefore(f, c.firstChild) } else { c.appendChild(f) } } };

/*
* Copyright (c) 2007-2008 Josh Bush (digitalbush.com)
* 
* 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. 
*/

/*
* Version: 1.1.4
* Release: 2008-07-29
*/
(function($) {

    //Helper Function for Caret positioning
    $.fn.caret = function(begin, end) {
        if (this.length == 0) return;
        if (typeof begin == 'number') {
            end = (typeof end == 'number') ? end : begin;
            return this.each(function() {
                if (this.setSelectionRange) {
                    this.focus();
                    this.setSelectionRange(begin, end);
                } else if (this.createTextRange) {
                    var range = this.createTextRange();
                    range.collapse(true);
                    range.moveEnd('character', end);
                    range.moveStart('character', begin);
                    range.select();
                }
            });
        } else {
            if (this[0].setSelectionRange) {
                begin = this[0].selectionStart;
                end = this[0].selectionEnd;
            } else if (document.selection && document.selection.createRange) {
                var range = document.selection.createRange();
                begin = 0 - range.duplicate().moveStart('character', -100000);
                end = begin + range.text.length;
            }
            return { begin: begin, end: end };
        }
    };

    //Predefined character definitions
    var charMap = {
        '9': "[0-9]",
        'a': "[A-Za-z]",
        '*': "[A-Za-z0-9]"
    };

    //Helper method to inject character definitions
    $.mask = {
        addPlaceholder: function(c, r) {
            charMap[c] = r;
        }
    };

    $.fn.unmask = function() {
        return this.trigger("unmask");
    };

    //Main Method
    $.fn.mask = function(mask, settings) {
        settings = $.extend({
            placeholder: "_",
            completed: null
        }, settings);

        //Build Regex for format validation
        var re = new RegExp("^" +
		$.map(mask.split(""), function(c, i) {
		    return charMap[c] || ((/[A-Za-z0-9]/.test(c) ? "" : "\\") + c);
		}).join('') +
		"$");

        return this.each(function() {
            var input = $(this);
            var buffer = new Array(mask.length);
            var locked = new Array(mask.length);
            var valid = false;
            var ignore = false;  			//Variable for ignoring control keys
            var firstNonMaskPos = null;

            //Build buffer layout from mask & determine the first non masked character			
            $.each(mask.split(""), function(i, c) {
                locked[i] = (charMap[c] == null);
                buffer[i] = locked[i] ? c : settings.placeholder;
                if (!locked[i] && firstNonMaskPos == null)
                    firstNonMaskPos = i;
            });

            function focusEvent() {
                checkVal();
                writeBuffer();
                setTimeout(function() {
                    $(input[0]).caret(valid ? mask.length : firstNonMaskPos);
                }, 0);
            };

            function keydownEvent(e) {
                var pos = $(this).caret();
                var k = e.keyCode;
                ignore = (k < 16 || (k > 16 && k < 32) || (k > 32 && k < 41));

                //delete selection before proceeding
                if ((pos.begin - pos.end) != 0 && (!ignore || k == 8 || k == 46)) {
                    clearBuffer(pos.begin, pos.end);
                }
                //backspace and delete get special treatment
                if (k == 8) {//backspace					
                    while (pos.begin-- >= 0) {
                        if (!locked[pos.begin]) {
                            buffer[pos.begin] = settings.placeholder;
                            if ($.browser.opera) {
                                //Opera won't let you cancel the backspace, so we'll let it backspace over a dummy character.								
                                s = writeBuffer();
                                input.val(s.substring(0, pos.begin) + " " + s.substring(pos.begin));
                                $(this).caret(pos.begin + 1);
                            } else {
                                writeBuffer();
                                $(this).caret(Math.max(firstNonMaskPos, pos.begin));
                            }
                            return false;
                        }
                    }
                } else if (k == 46) {//delete
                    clearBuffer(pos.begin, pos.begin + 1);
                    writeBuffer();
                    $(this).caret(Math.max(firstNonMaskPos, pos.begin));
                    return false;
                } else if (k == 27) {//escape
                    clearBuffer(0, mask.length);
                    writeBuffer();
                    $(this).caret(firstNonMaskPos);
                    return false;
                }
            };

            function keypressEvent(e) {
                if (ignore) {
                    ignore = false;
                    //Fixes Mac FF bug on backspace
                    return (e.keyCode == 8) ? false : null;
                }
                e = e || window.event;
                var k = e.charCode || e.keyCode || e.which;
                var pos = $(this).caret();

                if (e.ctrlKey || e.altKey) {//Ignore
                    return true;
                } else if ((k >= 41 && k <= 122) || k == 32 || k > 186) {//typeable characters
                    var p = seekNext(pos.begin - 1);
                    if (p < mask.length) {
                        if (new RegExp(charMap[mask.charAt(p)]).test(String.fromCharCode(k))) {
                            buffer[p] = String.fromCharCode(k);
                            writeBuffer();
                            var next = seekNext(p);
                            $(this).caret(next);
                            if (settings.completed && next == mask.length)
                                settings.completed.call(input);
                        }
                    }
                }
                return false;
            };

            function clearBuffer(start, end) {
                for (var i = start; i < end && i < mask.length; i++) {
                    if (!locked[i])
                        buffer[i] = settings.placeholder;
                }
            };

            function writeBuffer() {
                return input.val(buffer.join('')).val();
            };

            function checkVal() {
                //try to place charcters where they belong
                var test = input.val();
                var pos = firstNonMaskPos;
                for (var i = 0; i < mask.length; i++) {
                    if (!locked[i]) {
                        buffer[i] = settings.placeholder;
                        while (pos++ < test.length) {
                            //Regex Test each char here.
                            var reChar = new RegExp(charMap[mask.charAt(i)]);
                            if (test.charAt(pos - 1).match(reChar)) {
                                buffer[i] = test.charAt(pos - 1);
                                break;
                            }
                        }
                    }
                }
                var s = writeBuffer();
                if (!s.match(re)) {
                    input.val("");
                    clearBuffer(0, mask.length);
                    valid = false;
                } else
                    valid = true;
            };

            function seekNext(pos) {
                while (++pos < mask.length) {
                    if (!locked[pos])
                        return pos;
                }
                return mask.length;
            };

            input.one("unmask", function() {
                input.unbind("focus", focusEvent);
                input.unbind("blur", checkVal);
                input.unbind("keydown", keydownEvent);
                input.unbind("keypress", keypressEvent);
                if ($.browser.msie)
                    this.onpaste = null;
                else if ($.browser.mozilla)
                    this.removeEventListener('input', checkVal, false);
            });
            input.bind("focus", focusEvent);
            input.bind("blur", checkVal);
            input.bind("keydown", keydownEvent);
            input.bind("keypress", keypressEvent);
            //Paste events for IE and Mozilla thanks to Kristinn Sigmundsson
            if ($.browser.msie)
                this.onpaste = function() { setTimeout(checkVal, 0); };
            else if ($.browser.mozilla)
                this.addEventListener('input', checkVal, false);

            checkVal(); //Perform initial check for existing values
        });
    };
})(jQuery);


/*
* Autocomplete - jQuery plugin 1.0.2
*
* Copyright (c) 2007 Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 5747 2008-06-25 18:30:55Z joern.zaefferer $
*
*/
; (function($) {
    $.fn.extend({ autocomplete: function(urlOrData, options) { var isUrl = typeof urlOrData == "string"; options = $.extend({}, $.Autocompleter.defaults, { url: isUrl ? urlOrData : null, data: isUrl ? null : urlOrData, delay: isUrl ? $.Autocompleter.defaults.delay : 10, max: options && !options.scroll ? 10 : 150 }, options); options.highlight = options.highlight || function(value) { return value; }; options.formatMatch = options.formatMatch || options.formatItem; return this.each(function() { new $.Autocompleter(this, options); }); }, result: function(handler) { return this.bind("result", handler); }, search: function(handler) { return this.trigger("search", [handler]); }, flushCache: function() { return this.trigger("flushCache"); }, setOptions: function(options) { return this.trigger("setOptions", [options]); }, unautocomplete: function() { return this.trigger("unautocomplete"); } }); $.Autocompleter = function(input, options) {
        var KEY = { UP: 38, DOWN: 40, DEL: 46, TAB: 9, RETURN: 13, ESC: 27, COMMA: 188, PAGEUP: 33, PAGEDOWN: 34, BACKSPACE: 8 }; var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); var timeout; var previousValue = ""; var cache = $.Autocompleter.Cache(options); var hasFocus = 0; var lastKeyPressCode; var config = { mouseDownOnSelect: false }; var select = $.Autocompleter.Select(options, input, selectCurrent, config); var blockSubmit; $.browser.opera && $(input.form).bind("submit.autocomplete", function() { if (blockSubmit) { blockSubmit = false; return false; } }); $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { lastKeyPressCode = event.keyCode; switch (event.keyCode) { case KEY.UP: event.preventDefault(); if (select.visible()) { select.prev(); } else { onChange(0, true); } break; case KEY.DOWN: event.preventDefault(); if (select.visible()) { select.next(); } else { onChange(0, true); } break; case KEY.PAGEUP: event.preventDefault(); if (select.visible()) { select.pageUp(); } else { onChange(0, true); } break; case KEY.PAGEDOWN: event.preventDefault(); if (select.visible()) { select.pageDown(); } else { onChange(0, true); } break; case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: case KEY.TAB: case KEY.RETURN: if (selectCurrent()) { event.preventDefault(); blockSubmit = true; return false; } break; case KEY.ESC: select.hide(); break; default: clearTimeout(timeout); timeout = setTimeout(onChange, options.delay); break; } }).focus(function() { hasFocus++; }).blur(function() { hasFocus = 0; if (!config.mouseDownOnSelect) { hideResults(); } }).click(function() { if (hasFocus++ > 1 && !select.visible()) { onChange(0, true); } }).bind("search", function() { var fn = (arguments.length > 1) ? arguments[1] : null; function findValueCallback(q, data) { var result; if (data && data.length) { for (var i = 0; i < data.length; i++) { if (data[i].result.toLowerCase() == q.toLowerCase()) { result = data[i]; break; } } } if (typeof fn == "function") fn(result); else $input.trigger("result", result && [result.data, result.value]); } $.each(trimWords($input.val()), function(i, value) { request(value, findValueCallback, findValueCallback); }); }).bind("flushCache", function() { cache.flush(); }).bind("setOptions", function() { $.extend(options, arguments[1]); if ("data" in arguments[1]) cache.populate(); }).bind("unautocomplete", function() { select.unbind(); $input.unbind(); $(input.form).unbind(".autocomplete"); }); function selectCurrent() { var selected = select.selected(); if (!selected) return false; var v = selected.result; previousValue = v; if (options.multiple) { var words = trimWords($input.val()); if (words.length > 1) { v = words.slice(0, words.length - 1).join(options.multipleSeparator) + options.multipleSeparator + v; } v += options.multipleSeparator; } $input.val(v); hideResultsNow(); $input.trigger("result", [selected.data, selected.value]); return true; } function onChange(crap, skipPrevCheck) { if (lastKeyPressCode == KEY.DEL) { select.hide(); return; } var currentValue = $input.val(); if (!skipPrevCheck && currentValue == previousValue) return; previousValue = currentValue; currentValue = lastWord(currentValue); if (currentValue.length >= options.minChars) { $input.addClass(options.loadingClass); if (!options.matchCase) currentValue = currentValue.toLowerCase(); request(currentValue, receiveData, hideResultsNow); } else { stopLoading(); select.hide(); } }; function trimWords(value) { if (!value) { return [""]; } var words = value.split(options.multipleSeparator); var result = []; $.each(words, function(i, value) { if ($.trim(value)) result[i] = $.trim(value); }); return result; } function lastWord(value) { if (!options.multiple) return value; var words = trimWords(value); return words[words.length - 1]; } function autoFill(q, sValue) { if (options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE) { $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); $.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length); } }; function hideResults() { clearTimeout(timeout); timeout = setTimeout(hideResultsNow, 200); }; function hideResultsNow() {
            var wasVisible = select.visible(); select.hide(); clearTimeout(timeout); stopLoading(); if (options.mustMatch) {
                $input.search(function(result) {
                    if (!result) {
                        if (options.multiple) { var words = trimWords($input.val()).slice(0, -1); $input.val(words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "")); } else
                            $input.val("");
                    } 
                });
            } if (wasVisible) $.Autocompleter.Selection(input, input.value.length, input.value.length);
        }; function receiveData(q, data) { if (data && data.length && hasFocus) { stopLoading(); select.display(data, q); autoFill(q, data[0].value); select.show(); } else { hideResultsNow(); } }; function request(term, success, failure) { if (!options.matchCase) term = term.toLowerCase(); var data = cache.load(term); if (data && data.length) { success(term, data); } else if ((typeof options.url == "string") && (options.url.length > 0)) { var extraParams = { timestamp: +new Date() }; $.each(options.extraParams, function(key, param) { extraParams[key] = typeof param == "function" ? param() : param; }); $.ajax({ mode: "abort", port: "autocomplete" + input.name, dataType: options.dataType, url: options.url, data: $.extend({ q: lastWord(term), limit: options.max }, extraParams), success: function(data) { var parsed = options.parse && options.parse(data) || parse(data); cache.add(term, parsed); success(term, parsed); } }); } else { select.emptyList(); failure(term); } }; function parse(data) { var parsed = []; var rows = data.split("\n"); for (var i = 0; i < rows.length; i++) { var row = $.trim(rows[i]); if (row) { row = row.split("|"); parsed[parsed.length] = { data: row, value: row[0], result: options.formatResult && options.formatResult(row, row[0]) || row[0] }; } } return parsed; }; function stopLoading() { $input.removeClass(options.loadingClass); };
    }; $.Autocompleter.defaults = { inputClass: "ac_input", resultsClass: "ac_results", loadingClass: "ac_loading", minChars: 1, delay: 400, matchCase: false, matchSubset: true, matchContains: false, cacheLength: 10, max: 100, mustMatch: false, extraParams: {}, selectFirst: true, formatItem: function(row) { return row[0]; }, formatMatch: null, autoFill: false, width: 0, multiple: false, multipleSeparator: ", ", highlight: function(value, term) { return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>"); }, scroll: true, scrollHeight: 180 }; $.Autocompleter.Cache = function(options) {
        var data = {}; var length = 0; 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; }; function add(q, value) { if (length > options.cacheLength) { flush(); } if (!data[q]) { length++; } data[q] = value; } function populate() { if (!options.data) return false; var stMatchSets = {}, nullData = 0; if (!options.url) options.cacheLength = 1; stMatchSets[""] = []; for (var i = 0, ol = options.data.length; i < ol; i++) { var rawValue = options.data[i]; rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; var value = options.formatMatch(rawValue, i + 1, options.data.length); if (value === false) continue; var firstChar = value.charAt(0).toLowerCase(); if (!stMatchSets[firstChar]) stMatchSets[firstChar] = []; var row = { value: value, data: rawValue, result: options.formatResult && options.formatResult(rawValue) || value }; stMatchSets[firstChar].push(row); if (nullData++ < options.max) { stMatchSets[""].push(row); } }; $.each(stMatchSets, function(i, value) { options.cacheLength++; add(i, value); }); } setTimeout(populate, 25); function flush() { data = {}; length = 0; } return { flush: flush, add: add, populate: populate, load: function(q) {
            if (!options.cacheLength || !length) return null; if (!options.url && options.matchContains) { var csub = []; for (var k in data) { if (k.length > 0) { var c = data[k]; $.each(c, function(i, x) { if (matchSubset(x.value, q)) { csub.push(x); } }); } } return csub; } else
                if (data[q]) { return data[q]; } else
                if (options.matchSubset) { for (var i = q.length - 1; i >= options.minChars; i--) { var c = data[q.substr(0, i)]; if (c) { var csub = []; $.each(c, function(i, x) { if (matchSubset(x.value, q)) { csub[csub.length] = x; } }); return csub; } } } return null;
        } 
        };
    }; $.Autocompleter.Select = function(options, input, select, config) { var CLASSES = { ACTIVE: "ac_over" }; var listItems, active = -1, data, term = "", needsInit = true, element, list; function init() { if (!needsInit) return; element = $("<div/>").hide().addClass(options.resultsClass).css("position", "absolute").appendTo(document.body); list = $("<ul/>").appendTo(element).mouseover(function(event) { if (target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); $(target(event)).addClass(CLASSES.ACTIVE); } }).click(function(event) { $(target(event)).addClass(CLASSES.ACTIVE); select(); input.focus(); return false; }).mousedown(function() { config.mouseDownOnSelect = true; }).mouseup(function() { config.mouseDownOnSelect = false; }); if (options.width > 0) element.css("width", options.width); needsInit = false; } function target(event) { var element = event.target; while (element && element.tagName != "LI") element = element.parentNode; if (!element) return []; return element; } function moveSelect(step) { listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); movePosition(step); var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); if (options.scroll) { var offset = 0; listItems.slice(0, active).each(function() { offset += this.offsetHeight; }); if ((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); } else if (offset < list.scrollTop()) { list.scrollTop(offset); } } }; function movePosition(step) { active += step; if (active < 0) { active = listItems.size() - 1; } else if (active >= listItems.size()) { active = 0; } } function limitNumberOfItems(available) { return options.max && options.max < available ? options.max : available; } function fillList() { list.empty(); var max = limitNumberOfItems(data.length); for (var i = 0; i < max; i++) { if (!data[i]) continue; var formatted = options.formatItem(data[i].data, i + 1, max, data[i].value, term); if (formatted === false) continue; var li = $("<li/>").html(options.highlight(formatted, term)).addClass(i % 2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; $.data(li, "ac_data", data[i]); } listItems = list.find("li"); if (options.selectFirst) { listItems.slice(0, 1).addClass(CLASSES.ACTIVE); active = 0; } if ($.fn.bgiframe) list.bgiframe(); } return { display: function(d, q) { init(); data = d; term = q; fillList(); }, next: function() { moveSelect(1); }, prev: function() { moveSelect(-1); }, pageUp: function() { if (active != 0 && active - 8 < 0) { moveSelect(-active); } else { moveSelect(-8); } }, pageDown: function() { if (active != listItems.size() - 1 && active + 8 > listItems.size()) { moveSelect(listItems.size() - 1 - active); } else { moveSelect(8); } }, hide: function() { element && element.hide(); listItems && listItems.removeClass(CLASSES.ACTIVE); active = -1; }, visible: function() { return element && element.is(":visible"); }, current: function() { return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); }, show: function() { var offset = $(input).offset(); element.css({ width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(), top: offset.top + input.offsetHeight, left: offset.left }).show(); if (options.scroll) { list.scrollTop(0); list.css({ maxHeight: options.scrollHeight, overflow: 'auto' }); if ($.browser.msie && typeof document.body.style.maxHeight === "undefined") { var listHeight = 0; listItems.each(function() { listHeight += this.offsetHeight; }); var scrollbarsVisible = listHeight > options.scrollHeight; list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight); if (!scrollbarsVisible) { listItems.width(list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right"))); } } } }, selected: function() { var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); return selected && selected.length && $.data(selected[0], "ac_data"); }, emptyList: function() { list && list.empty(); }, unbind: function() { element && element.remove(); } }; }; $.Autocompleter.Selection = function(field, start, end) { 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(); };
})(jQuery);


/*---------------------------------- ASM ------------------------------------ */

/*
 * Alternate Select Multiple (asmSelect) 1.0.4 beta - jQuery Plugin
 * http://www.ryancramer.com/projects/asmselect/
 * 
 * Copyright (c) 2008 by Ryan Cramer - http://www.ryancramer.com
 * 
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 */

(function($) {

    $.fn.asmSelect = function(customOptions) {

        var options = {

            listType: 'ol', 					// Ordered list 'ol', or unordered list 'ul'
            sortable: false, 					// Should the list be sortable?
            highlight: false, 				// Use the highlight feature? 
            animate: false, 					// Animate the the adding/removing of items in the list?
            addItemTarget: 'bottom', 			// Where to place new selected items in list: top or bottom
            hideWhenAdded: false, 				// Hide the option when added to the list? works only in FF
            debugMode: false, 				// Debug mode keeps original select visible 

            removeLabel: 'remove', 				// Text used in the "remove" link
            highlightAddedLabel: 'Added: ', 			// Text that precedes highlight of added item
            highlightRemovedLabel: 'Removed: ', 		// Text that precedes highlight of removed item

            containerClass: 'asmContainer', 			// Class for container that wraps this widget
            selectClass: 'asmSelect', 			// Class for the newly created <select>
            optionDisabledClass: 'asmOptionDisabled', 	// Class for items that are already selected / disabled
            listClass: 'asmList', 				// Class for the list ($ol)
            listSortableClass: 'asmListSortable', 		// Another class given to the list when it is sortable
            listItemClass: 'asmListItem', 			// Class for the <li> list items
            listItemLabelClass: 'asmListItemLabel', 		// Class for the label text that appears in list items
            removeClass: 'asmListItemRemove', 		// Class given to the "remove" link
            highlightClass: 'asmHighlight'				// Class given to the highlight <span>

        };

        $.extend(options, customOptions);

        return this.each(function(index) {

            var $original = $(this); 				// the original select multiple
            var $container; 					// a container that is wrapped around our widget
            var $select; 						// the new select we have created
            var $ol; 						// the list that we are manipulating
            var buildingSelect = false; 				// is the new select being constructed right now?
            var ieClick = false; 				// in IE, has a click event occurred? ignore if not
            var ignoreOriginalChangeEvent = false; 		// originalChangeEvent bypassed when this is true

            function init() {

                // initialize the alternate select multiple

                // this loop ensures uniqueness, in case of existing asmSelects placed by ajax (1.0.3)
                while ($("#" + options.containerClass + index).size() > 0) index++;

                $select = $("<select></select>")
					.addClass(options.selectClass)
					.attr('name', options.selectClass + index)
					.attr('id', options.selectClass + index);

                $selectRemoved = $("<select></select>");

                $ol = $("<" + options.listType + "></" + options.listType + ">")
					.addClass(options.listClass)
					.attr('id', options.listClass + index);

                $container = $("<div></div>")
					.addClass(options.containerClass)
					.attr('id', options.containerClass + index);

                buildSelect();

                $select.change(selectChangeEvent)
					.click(selectClickEvent);

                $original.change(originalChangeEvent)
					.wrap($container).before($select).before($ol);

                if (options.sortable) makeSortable();

                if ($.browser.msie) $ol.css('display', 'inline-block');
            }

            function makeSortable() {

                // make any items in the selected list sortable
                // requires jQuery UI sortables, draggables, droppables

                $ol.sortable({
                    items: 'li.' + options.listItemClass,
                    handle: '.' + options.listItemLabelClass,
                    axis: 'y',
                    update: function(e, data) {

                        var updatedOptionId;

                        $(this).children("li").each(function(n) {

                            $option = $('#' + $(this).attr('rel'));

                            if ($(this).is(".ui-sortable-helper")) {
                                updatedOptionId = $option.attr('id');
                                return;
                            }

                            $original.append($option);
                        });

                        if (updatedOptionId) triggerOriginalChange(updatedOptionId, 'sort');
                    }

                }).addClass(options.listSortableClass);
            }

            function selectChangeEvent(e) {

                // an item has been selected on the regular select we created
                // check to make sure it's not an IE screwup, and add it to the list

                if ($.browser.msie && $.browser.version < 7 && !ieClick) return;
                var id = $(this).children("option:selected").slice(0, 1).attr('rel');
                addListItem(id);
                ieClick = false;
                triggerOriginalChange(id, 'add'); // for use by user-defined callbacks
            }

            function selectClickEvent() {

                // IE6 lets you scroll around in a select without it being pulled down
                // making sure a click preceded the change() event reduces the chance
                // if unintended items being added. there may be a better solution?

                ieClick = true;
            }

            function originalChangeEvent(e) {

                // select or option change event manually triggered
                // on the original <select multiple>, so rebuild ours

                if (ignoreOriginalChangeEvent) {
                    ignoreOriginalChangeEvent = false;
                    return;
                }

                $select.empty();
                $ol.empty();
                buildSelect();

                // opera has an issue where it needs a force redraw, otherwise
                // the items won't appear until something else forces a redraw
                if ($.browser.opera) $ol.hide().fadeIn("fast");
            }

            function buildSelect() {

                // build or rebuild the new select that the user
                // will select items from

                buildingSelect = true;

                // add a first option to be the home option / default selectLabel
                $select.prepend("<option>" + $original.attr('title') + "</option>");

                $original.children("option").each(function(n) {

                    var $t = $(this);
                    var id;

                    if (!$t.attr('id')) $t.attr('id', 'asm' + index + 'option' + n);
                    id = $t.attr('id');

                    if ($t.is(":selected")) {
                        addListItem(id);
                        addSelectOption(id, true);
                    } else {
                        addSelectOption(id);
                    }
                });

                if (!options.debugMode) $original.hide(); // IE6 requires this on every buildSelect()
                selectFirstItem();
                buildingSelect = false;
            }

            function addSelectOption(optionId, disabled) {

                // add an <option> to the <select>
                // used only by buildSelect()

                if (disabled == undefined) var disabled = false;

                var $O = $('#' + optionId);
                var $option = $("<option>" + $O.text() + "</option>")
					.val($O.val())
					.attr('rel', optionId);

                if (disabled) disableSelectOption($option);

                $select.append($option);
            }

            function selectFirstItem() {

                // select the firm item from the regular select that we created

                $select.children(":eq(0)").attr("selected", true);
            }

            function disableSelectOption($option) {

                // make an option disabled, indicating that it's already been selected
                // because safari is the only browser that makes disabled items look 'disabled'
                // we apply a class that reproduces the disabled look in other browsers

                $option.addClass(options.optionDisabledClass)
					.attr("selected", false)
					.attr("disabled", true);

                if (options.hideWhenAdded) $option.hide();
                if ($.browser.msie) $select.hide().show(); // this forces IE to update display
            }

            function enableSelectOption($option) {

                // given an already disabled select option, enable it

                $option.removeClass(options.optionDisabledClass)
					.attr("disabled", false);

                if (options.hideWhenAdded) $option.show();
                if ($.browser.msie) $select.hide().show(); // this forces IE to update display
            }

            function addListItem(optionId) {

                // add a new item to the html list

                var $O = $('#' + optionId);

                if (!$O) return; // this is the first item, selectLabel

                // MKC: hack
                var $removeLink;
                if (options.removeLabel == "") {
                    $removeLink = $("<a></a>")
					.attr("href", "#")
					.addClass(options.removeClass)
					.prepend(options.removeLabel)
					.click(function() {
					    //dropListItem($(this).parent('li').attr('rel'));
					    return false;
					});
                }
                else {
                    $removeLink = $("<a></a>")
					.attr("href", "#")
					.addClass(options.removeClass)
					.prepend(options.removeLabel)
					.click(function() {
					    dropListItem($(this).parent('li').attr('rel'));
					    return false;
					});
                }

                var $itemLabel = $("<span></span>")
					.addClass(options.listItemLabelClass)
					.html($O.html());

                var $item = $("<li></li>")
					.attr('rel', optionId)
					.addClass(options.listItemClass)
					.append($itemLabel)
					.append($removeLink)
					.hide();

                if (!buildingSelect) {
                    if ($O.is(":selected")) return; // already have it
                    $O.attr('selected', true);
                }

                if (options.addItemTarget == 'top' && !buildingSelect) {
                    $ol.prepend($item);
                    if (options.sortable) $original.prepend($O);
                } else {
                    $ol.append($item);
                    if (options.sortable) $original.append($O);
                }

                addListItemShow($item);

                disableSelectOption($("[rel=" + optionId + "]", $select));

                if (!buildingSelect) {
                    setHighlight($item, options.highlightAddedLabel);
                    selectFirstItem();
                    if (options.sortable) $ol.sortable("refresh");
                }

            }

            function addListItemShow($item) {

                // reveal the currently hidden item with optional animation
                // used only by addListItem()

                if (options.animate && !buildingSelect) {
                    $item.animate({
                        opacity: "show",
                        height: "show"
                    }, 100, "swing", function() {
                        $item.animate({
                            height: "+=2px"
                        }, 50, "swing", function() {
                            $item.animate({
                                height: "-=2px"
                            }, 25, "swing");
                        });
                    });
                } else {
                    $item.show();
                }
            }

            function dropListItem(optionId, highlightItem) {

                // remove an item from the html list

                if (highlightItem == undefined) var highlightItem = true;
                var $O = $('#' + optionId);

                $O.attr('selected', false);
                $item = $ol.children("li[rel=" + optionId + "]");

                dropListItemHide($item);
                enableSelectOption($("[rel=" + optionId + "]", options.removeWhenAdded ? $selectRemoved : $select));

                if (highlightItem) setHighlight($item, options.highlightRemovedLabel);

                triggerOriginalChange(optionId, 'drop');

            }

            function dropListItemHide($item) {

                // remove the currently visible item with optional animation
                // used only by dropListItem()

                if (options.animate && !buildingSelect) {

                    $prevItem = $item.prev("li");

                    $item.animate({
                        opacity: "hide",
                        height: "hide"
                    }, 100, "linear", function() {
                        $prevItem.animate({
                            height: "-=2px"
                        }, 50, "swing", function() {
                            $prevItem.animate({
                                height: "+=2px"
                            }, 100, "swing");
                        });
                        $item.remove();
                    });

                } else {
                    $item.remove();
                }
            }

            function setHighlight($item, label) {

                // set the contents of the highlight area that appears
                // directly after the <select> single
                // fade it in quickly, then fade it out

                if (!options.highlight) return;

                $select.next("#" + options.highlightClass + index).remove();

                var $highlight = $("<span></span>")
					.hide()
					.addClass(options.highlightClass)
					.attr('id', options.highlightClass + index)
					.html(label + $item.children("." + options.listItemLabelClass).slice(0, 1).text());

                $select.after($highlight);

                $highlight.fadeIn("fast", function() {
                    setTimeout(function() { $highlight.fadeOut("slow"); }, 50);
                });
            }

            function triggerOriginalChange(optionId, type) {

                // trigger a change event on the original select multiple
                // so that other scripts can pick them up

                ignoreOriginalChangeEvent = true;
                $option = $("#" + optionId);

                $original.trigger('change', [{
                    'option': $option,
                    'value': $option.val(),
                    'id': optionId,
                    'item': $ol.children("[rel=" + optionId + "]"),
                    'type': type
}]);
                }

                init();
            });
        };

    })(jQuery);



/* -------------------- jqModal ---------------------------- */

/*
* jqModal - Minimalist Modaling with jQuery
*   (http://dev.iceburg.net/jquery/jqModal/)
*
* Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
* 
* $Version: 07/06/2008 +r13
*/
(function($) {
    $.fn.jqm = function(o) {
        var p = {
            overlay: 50,
            overlayClass: 'jqmOverlay',
            closeClass: 'jqmClose',
            trigger: '.jqModal',
            ajax: F,
            ajaxText: '',
            target: F,
            modal: F,
            toTop: F,
            onShow: F,
            onHide: F,
            onLoad: F
        };
        return this.each(function() {
            if (this._jqm) return H[this._jqm].c = $.extend({}, H[this._jqm].c, o); s++; this._jqm = s;
            H[s] = { c: $.extend(p, $.jqm.params, o), a: F, w: $(this).addClass('jqmID' + s), s: s };
            if (p.trigger) $(this).jqmAddTrigger(p.trigger);
        });
    };

    $.fn.jqmAddClose = function(e) { return hs(this, e, 'jqmHide'); };
    $.fn.jqmAddTrigger = function(e) { return hs(this, e, 'jqmShow'); };
    $.fn.jqmShow = function(t) { return this.each(function() { $.jqm.open(this._jqm, t); }); };
    $.fn.jqmHide = function(t) { return this.each(function() { $.jqm.close(this._jqm, t) }); };

    $.jqm = {
        hash: {},
        open: function(s, t) {
            var h = H[s], c = h.c, cc = '.' + c.closeClass, z = (parseInt(h.w.css('z-index'))), z = (z > 0) ? z : 3000, o = $('<div></div>').css({ height: '100%', width: '100%', position: 'fixed', left: 0, top: 0, 'z-index': z - 1, opacity: c.overlay / 100 }); if (h.a) return F; h.t = t; h.a = true; h.w.css('z-index', z);
            if (c.modal) { if (!A[0]) L('bind'); A.push(s); }
            else if (c.overlay > 0) h.w.jqmAddClose(o);
            else o = F;

            h.o = (o) ? o.addClass(c.overlayClass).prependTo('body') : F;
            if (ie6) { $('html,body').css({ height: '100%', width: '100%' }); if (o) { o = o.css({ position: 'absolute' })[0]; for (var y in { Top: 1, Left: 1 }) o.style.setExpression(y.toLowerCase(), "(_=(document.documentElement.scroll" + y + " || document.body.scroll" + y + "))+'px'"); } }

            if (c.ajax) {
                var r = c.target || h.w, u = c.ajax, r = (typeof r == 'string') ? $(r, h.w) : $(r), u = (u.substr(0, 1) == '@') ? $(t).attr(u.substring(1)) : u;
                r.html(c.ajaxText).load(u, function() { if (c.onLoad) c.onLoad.call(this, h); if (cc) h.w.jqmAddClose($(cc, h.w)); e(h); });
            }
            else if (cc) h.w.jqmAddClose($(cc, h.w));

            if (c.toTop && h.o) h.w.before('<span id="jqmP' + h.w[0]._jqm + '"></span>').insertAfter(h.o);
            (c.onShow) ? c.onShow(h) : h.w.show(); e(h); return F;
        },
        close: function(s) {
            var h = H[s]; if (!h.a) return F; h.a = F;
            if (A[0]) { A.pop(); if (!A[0]) L('unbind'); }
            if (h.c.toTop && h.o) $('#jqmP' + h.w[0]._jqm).after(h.w).remove();
            if (h.c.onHide) h.c.onHide(h); else { h.w.hide(); if (h.o) h.o.remove(); } return F;
        },
        params: {}
    };
    var s = 0, H = $.jqm.hash, A = [], ie6 = $.browser.msie && ($.browser.version == "6.0"), F = false,
i = $('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({ opacity: 0 }),
e = function(h) { if (ie6) if (h.o) h.o.html('<p style="width:100%;height:100%"/>').prepend(i); else if (!$('iframe.jqm', h.w)[0]) h.w.prepend(i); f(h); },
f = function(h) { try { $(':input:visible', h.w)[0].focus(); } catch (_) { } },
L = function(t) { $()[t]("keypress", m)[t]("keydown", m)[t]("mousedown", m); },
m = function(e) { var h = H[A[A.length - 1]], r = (!$(e.target).parents('.jqmID' + h.s)[0]); if (r) f(h); return !r; },
hs = function(w, t, c) {
    return w.each(function() {
        var s = this._jqm; $(t).each(function() {
            if (!this[c]) { this[c] = []; $(this).click(function() { for (var i in { jqmShow: 1, jqmHide: 1 }) for (var s in this[i]) if (H[this[i][s]]) H[this[i][s]].w[i](this); return F; }); } this[c].push(s);
        });
    });
};
})(jQuery);

