﻿/*!
* jQuery Tools v1.2.6 - The missing UI library for the Web
* 
* tooltip/tooltip.js
* tooltip/tooltip.dynamic.js
* tooltip/tooltip.slide.js
* 
* NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
* 
* http://flowplayer.org/tools/
* 
*/
(function (a) { a.tools = a.tools || { version: "v1.2.6" }, a.tools.tooltip = { conf: { effect: "toggle", fadeOutSpeed: "fast", predelay: 0, delay: 30, opacity: 1, tip: 0, fadeIE: !1, position: ["top", "center"], offset: [0, 0], relative: !1, cancelDefault: !0, events: { def: "mouseenter,mouseleave", input: "focus,blur", widget: "focus mouseenter,blur mouseleave", tooltip: "mouseenter,mouseleave" }, layout: "<div/>", tipClass: "tooltip" }, addEffect: function (a, c, d) { b[a] = [c, d] } }; var b = { toggle: [function (a) { var b = this.getConf(), c = this.getTip(), d = b.opacity; d < 1 && c.css({ opacity: d }), c.show(), a.call() }, function (a) { this.getTip().hide(), a.call() } ], fade: [function (b) { var c = this.getConf(); !a.browser.msie || c.fadeIE ? this.getTip().fadeTo(c.fadeInSpeed, c.opacity, b) : (this.getTip().show(), b()) }, function (b) { var c = this.getConf(); !a.browser.msie || c.fadeIE ? this.getTip().fadeOut(c.fadeOutSpeed, b) : (this.getTip().hide(), b()) } ] }; function c(b, c, d) { var e = d.relative ? b.position().top : b.offset().top, f = d.relative ? b.position().left : b.offset().left, g = d.position[0]; e -= c.outerHeight() - d.offset[0], f += b.outerWidth() + d.offset[1], /iPad/i.test(navigator.userAgent) && (e -= a(window).scrollTop()); var h = c.outerHeight() + b.outerHeight(); g == "center" && (e += h / 2), g == "bottom" && (e += h), g = d.position[1]; var i = c.outerWidth() + b.outerWidth(); g == "center" && (f -= i / 2), g == "left" && (f -= i); return { top: e, left: f} } function d(d, e) { var f = this, g = d.add(f), h, i = 0, j = 0, k = d.attr("title"), l = d.attr("data-tooltip"), m = b[e.effect], n, o = d.is(":input"), p = o && d.is(":checkbox, :radio, select, :button, :submit"), q = d.attr("type"), r = e.events[q] || e.events[o ? p ? "widget" : "input" : "def"]; if (!m) throw "Nonexistent effect \"" + e.effect + "\""; r = r.split(/,\s*/); if (r.length != 2) throw "Tooltip: bad events configuration for " + q; d.bind(r[0], function (a) { clearTimeout(i), e.predelay ? j = setTimeout(function () { f.show(a) }, e.predelay) : f.show(a) }).bind(r[1], function (a) { clearTimeout(j), e.delay ? i = setTimeout(function () { f.hide(a) }, e.delay) : f.hide(a) }), k && e.cancelDefault && (d.removeAttr("title"), d.data("title", k)), a.extend(f, { show: function (b) { if (!h) { l ? h = a(l) : e.tip ? h = a(e.tip).eq(0) : k ? h = a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k) : (h = d.next(), h.length || (h = d.parent().next())); if (!h.length) throw "Cannot find tooltip for " + d } if (f.isShown()) return f; h.stop(!0, !0); var o = c(d, h, e); e.tip && h.html(d.data("title")), b = a.Event(), b.type = "onBeforeShow", g.trigger(b, [o]); if (b.isDefaultPrevented()) return f; o = c(d, h, e), h.css({ position: "absolute", top: o.top, left: o.left }), n = !0, m[0].call(f, function () { b.type = "onShow", n = "full", g.trigger(b) }); var p = e.events.tooltip.split(/,\s*/); h.data("__set") || (h.unbind(p[0]).bind(p[0], function () { clearTimeout(i), clearTimeout(j) }), p[1] && !d.is("input:not(:checkbox, :radio), textarea") && h.unbind(p[1]).bind(p[1], function (a) { a.relatedTarget != d[0] && d.trigger(r[1].split(" ")[0]) }), e.tip || h.data("__set", !0)); return f }, hide: function (c) { if (!h || !f.isShown()) return f; c = a.Event(), c.type = "onBeforeHide", g.trigger(c); if (!c.isDefaultPrevented()) { n = !1, b[e.effect][1].call(f, function () { c.type = "onHide", g.trigger(c) }); return f } }, isShown: function (a) { return a ? n == "full" : n }, getConf: function () { return e }, getTip: function () { return h }, getTrigger: function () { return d } }), a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","), function (b, c) { a.isFunction(e[c]) && a(f).bind(c, e[c]), f[c] = function (b) { b && a(f).bind(c, b); return f } }) } a.fn.tooltip = function (b) { var c = this.data("tooltip"); if (c) return c; b = a.extend(!0, {}, a.tools.tooltip.conf, b), typeof b.position == "string" && (b.position = b.position.split(/,?\s/)), this.each(function () { c = new d(a(this), b), a(this).data("tooltip", c) }); return b.api ? c : this } })(jQuery);
(function (a) { var b = a.tools.tooltip; b.dynamic = { conf: { classNames: "top right bottom left"} }; function c(b) { var c = a(window), d = c.width() + c.scrollLeft(), e = c.height() + c.scrollTop(); return [b.offset().top <= c.scrollTop(), d <= b.offset().left + b.width(), e <= b.offset().top + b.height(), c.scrollLeft() >= b.offset().left] } function d(a) { var b = a.length; while (b--) if (a[b]) return !1; return !0 } a.fn.dynamic = function (e) { typeof e == "number" && (e = { speed: e }), e = a.extend({}, b.dynamic.conf, e); var f = a.extend(!0, {}, e), g = e.classNames.split(/\s/), h; this.each(function () { var b = a(this).tooltip().onBeforeShow(function (b, e) { var i = this.getTip(), j = this.getConf(); h || (h = [j.position[0], j.position[1], j.offset[0], j.offset[1], a.extend({}, j)]), a.extend(j, h[4]), j.position = [h[0], h[1]], j.offset = [h[2], h[3]], i.css({ visibility: "hidden", position: "absolute", top: e.top, left: e.left }).show(); var k = a.extend(!0, {}, f), l = c(i); if (!d(l)) { l[2] && (a.extend(j, k.top), j.position[0] = "top", i.addClass(g[0])), l[3] && (a.extend(j, k.right), j.position[1] = "right", i.addClass(g[1])), l[0] && (a.extend(j, k.bottom), j.position[0] = "bottom", i.addClass(g[2])), l[1] && (a.extend(j, k.left), j.position[1] = "left", i.addClass(g[3])); if (l[0] || l[2]) j.offset[0] *= -1; if (l[1] || l[3]) j.offset[1] *= -1 } i.css({ visibility: "visible" }).hide() }); b.onBeforeShow(function () { var a = this.getConf(), b = this.getTip(); setTimeout(function () { a.position = [h[0], h[1]], a.offset = [h[2], h[3]] }, 0) }), b.onHide(function () { var a = this.getTip(); a.removeClass(e.classNames) }), ret = b }); return e.api ? ret : this } })(jQuery);
(function (a) { var b = a.tools.tooltip; a.extend(b.conf, { direction: "up", bounce: !1, slideOffset: 10, slideInSpeed: 200, slideOutSpeed: 200, slideFade: !a.browser.msie }); var c = { up: ["-", "top"], down: ["+", "top"], left: ["-", "left"], right: ["+", "left"] }; b.addEffect("slide", function (a) { var b = this.getConf(), d = this.getTip(), e = b.slideFade ? { opacity: b.opacity} : {}, f = c[b.direction] || c.up; e[f[1]] = f[0] + "=" + b.slideOffset, b.slideFade && d.css({ opacity: 0 }), d.show().animate(e, b.slideInSpeed, a) }, function (b) { var d = this.getConf(), e = d.slideOffset, f = d.slideFade ? { opacity: 0} : {}, g = c[d.direction] || c.up, h = "" + g[0]; d.bounce && (h = h == "+" ? "-" : "+"), f[g[1]] = h + "=" + e, this.getTip().animate(f, d.slideOutSpeed, function () { a(this).hide(), b.call() }) }) })(jQuery);


/**
* DropKick
*
* Highly customizable <select> lists
* https://github.com/JamieLottering/DropKick
*
* &copy; 2011 Jamie Lottering <http://github.com/JamieLottering>
*                        <http://twitter.com/JamieLottering>
* 
*/
(function ($, window, document) {

    var ie6 = false;

    // Help prevent flashes of unstyled content
    if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
        ie6 = true;
    } else {
        document.documentElement.className = document.documentElement.className + ' dk_fouc';
    }

    var 
    // Public methods exposed to $.fn.dropkick()
    methods = {},

    // Cache every <select> element that gets dropkicked
    lists = [],

    // Convenience keys for keyboard navigation
    keyMap = {
        'left': 37,
        'up': 38,
        'right': 39,
        'down': 40,
        'enter': 13
    },

    // HTML template for the dropdowns
    dropdownTemplate = [
      '<div class="dk_container" id="dk_container_{{ id }}" tabindex="{{ tabindex }}">',
        '<a class="dk_toggle">',
          '<span class="dk_label">{{ label }}</span>',
        '</a>',
        '<div class="dk_options">',
          '<ul class="dk_options_inner">',
          '</ul>',
        '</div>',
      '</div>'
    ].join(''),

    // HTML template for dropdown options
    optionTemplate = '<li class="{{ current }}"><a data-dk-dropdown-value="{{ value }}">{{ text }}</a></li>',

    // Some nice default values
    defaults = {
        startSpeed: 1000,  // I recommend a high value here, I feel it makes the changes less noticeable to the user
        theme: false,
        change: false
    },

    // Make sure we only bind keydown on the document once
    keysBound = false
  ;

    // Called by using $('foo').dropkick();
    methods.init = function (settings) {
        settings = $.extend({}, defaults, settings);

        return this.each(function () {
            var 
            // The current <select> element
        $select = $(this),

            // Store a reference to the originally selected <option> element
        $original = $select.find(':selected').first(),

            // Save all of the <option> elements
        $options = $select.find('option'),

            // We store lots of great stuff using jQuery data
        data = $select.data('dropkick') || {},

            // This gets applied to the 'dk_container' element
        id = $select.attr('id') || $select.attr('name'),

            // This gets updated to be equal to the longest <option> element
        width = settings.width || $select.outerWidth(),

            // Check if we have a tabindex set or not
        tabindex = $select.attr('tabindex') ? $select.attr('tabindex') : '',

            // The completed dk_container element
        $dk = false,

        theme
      ;

            // Dont do anything if we've already setup dropkick on this element
            if (data.id) {
                return $select;
            } else {
                data.settings = settings;
                data.tabindex = tabindex;
                data.id = id;
                data.$original = $original;
                data.$select = $select;
                data.value = _notBlank($select.val()) || _notBlank($original.attr('value'));
                data.label = $original.text();
                data.options = $options;
            }

            // Build the dropdown HTML
            $dk = _build(dropdownTemplate, data);

            // Make the dropdown fixed width if desired
            $dk.find('.dk_toggle').css({
                'width': width + 'px'
            });

            // Hide the <select> list and place our new one in front of it
            $select.before($dk);

            // Update the reference to $dk
            $dk = $('#dk_container_' + id).fadeIn(settings.startSpeed);

            // Save the current theme
            theme = settings.theme ? settings.theme : 'default';
            $dk.addClass('dk_theme_' + theme);
            data.theme = theme;

            // Save the updated $dk reference into our data object
            data.$dk = $dk;

            // Save the dropkick data onto the <select> element
            $select.data('dropkick', data);

            // Do the same for the dropdown, but add a few helpers
            $dk.data('dropkick', data);

            lists[lists.length] = $select;

            // Focus events
            if(!$.browser.msie) {
        // Focus events
        $dk.bind('focus.dropkick', function (e) {
          $dk.addClass('dk_focus');
        }).bind('blur.dropkick', function (e) {
            /*** IE moves focus from the .dk_container to .dk_options on scroll bar click ***/ 	 
           if ($(document.activeElement).closest($dk).length > 0) {
               return false;	
           }

          $dk.removeClass('dk_open dk_focus');
        });
      } else {
        $('body').click(function(event) {
          if(!$(event.target).parents('.dk_container').length) {
            _closeDropdown($dk);
          }
        });
      }

            setTimeout(function () {
                $select.hide();
            }, 0);
        });
    };

    // Allows dynamic theme changes
    methods.theme = function (newTheme) {
        var 
      $select = $(this),
      list = $select.data('dropkick'),
      $dk = list.$dk,
      oldtheme = 'dk_theme_' + list.theme
    ;

        $dk.removeClass(oldtheme).addClass('dk_theme_' + newTheme);

        list.theme = newTheme;
    };

    // Reset all <selects and dropdowns in our lists array
    methods.reset = function () {
        for (var i = 0, l = lists.length; i < l; i++) {
            var 
        listData = lists[i].data('dropkick'),
        $dk = listData.$dk,
        $current = $dk.find('li').first()
      ;

            $dk.find('.dk_label').text(listData.label);
            $dk.find('.dk_options_inner').animate({ scrollTop: 0 }, 0);

            _setCurrent($current, $dk);
            _updateFields($current, $dk, true);
        }
    };

    // Expose the plugin
    $.fn.dropkick = function (method) {
        if (!ie6) {
            if (methods[method]) {
                return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
            } else if (typeof method === 'object' || !method) {
                return methods.init.apply(this, arguments);
            }
        }
    };

    // private
    function _handleKeyBoardNav(e, $dk) {
        var 
      code = e.keyCode,
      data = $dk.data('dropkick'),
      options = $dk.find('.dk_options'),
      open = $dk.hasClass('dk_open'),
      current = $dk.find('.dk_option_current'),
      first = options.find('li').first(),
      last = options.find('li').last(),
      next,
      prev
    ;

        switch (code) {
            case keyMap.enter:
                if (open) {
                    _updateFields(current.find('a'), $dk);
                    _closeDropdown($dk);
                } else {
                    _openDropdown($dk);
                }
                e.preventDefault();
                break;

            case keyMap.up:
                prev = current.prev('li');
                if (open) {
                    if (prev.length) {
                        _setCurrent(prev, $dk);
                    } else {
                        _setCurrent(last, $dk);
                    }
                } else {
                    _openDropdown($dk);
                }
                e.preventDefault();
                break;

            case keyMap.down:
                if (open) {
                    next = current.next('li').first();
                    if (next.length) {
                        _setCurrent(next, $dk);
                    } else {
                        _setCurrent(first, $dk);
                    }
                } else {
                    _openDropdown($dk);
                }
                e.preventDefault();
                break;

            default:
                break;
        }
    }

    // Update the <select> value, and the dropdown label
    function _updateFields(option, $dk, reset) {
        var value, label, data;

        value = option.attr('data-dk-dropdown-value');
        label = option.text();
        data = $dk.data('dropkick');

        $select = data.$select;
        $select.val(value);

        $dk.find('.dk_label').text(label);

        reset = reset || false;

        if (data.settings.change && !reset) {
            data.settings.change.call($select, value, label);
        }
    }

    // Set the currently selected option
    function _setCurrent($current, $dk) {
        $dk.find('.dk_option_current').removeClass('dk_option_current');
        $current.addClass('dk_option_current');

        _setScrollPos($dk, $current);
    }

    function _setScrollPos($dk, anchor) {
        var height = anchor.prevAll('li').outerHeight() * anchor.prevAll('li').length;
        $dk.find('.dk_options_inner').animate({ scrollTop: height + 'px' }, 0);
    }

    // Close a dropdown
    function _closeDropdown($dk) {
        $dk.removeClass('dk_open');
    }

    // Open a dropdown
    function _openDropdown($dk) {
        var data = $dk.data('dropkick');
        $dk.find('.dk_options').css({ top: $dk.find('.dk_toggle').outerHeight() - 1 });
        $dk.toggleClass('dk_open');

    }

    /**
    * Turn the dropdownTemplate into a jQuery object and fill in the variables.
    */
    function _build(tpl, view) {
        var 
        // Template for the dropdown
      template = tpl,
        // Holder of the dropdowns options
      options = [],
      $dk
    ;

        template = template.replace('{{ id }}', view.id);
        template = template.replace('{{ label }}', view.label);
        template = template.replace('{{ tabindex }}', view.tabindex);

        if (view.options && view.options.length) {
            for (var i = 0, l = view.options.length; i < l; i++) {
                var 
          $option = $(view.options[i]),
          current = 'dk_option_current',
          oTemplate = optionTemplate
        ;

                oTemplate = oTemplate.replace('{{ value }}', $option.val());
                oTemplate = oTemplate.replace('{{ current }}', (_notBlank($option.val()) === view.value) ? current : '');
                oTemplate = oTemplate.replace('{{ text }}', $option.text());

                options[options.length] = oTemplate;
            }
        }

        $dk = $(template);
        $dk.find('.dk_options_inner').html(options.join(''));

        return $dk;
    }

    function _notBlank(text) {
        return ($.trim(text).length > 0) ? text : false;
    }

    $(function () {

        // Handle click events on the dropdown toggler
        $('.dk_toggle').live('click', function (e) {
            var $dk = $(this).parents('.dk_container').first();

            _openDropdown($dk);

            if ("ontouchstart" in window) {
                $dk.addClass('dk_touch');
                $dk.find('.dk_options_inner').addClass('scrollable vertical');
            }

            e.preventDefault();
            return false;
        });

        // Handle click events on individual dropdown options
        $('.dk_options a').live(($.browser.msie ? 'mousedown' : 'click'), function (e) {
            var 
        $option = $(this),
        $dk = $option.parents('.dk_container').first(),
        data = $dk.data('dropkick')
      ;

            _closeDropdown($dk);
            _updateFields($option, $dk);
            _setCurrent($option.parent(), $dk);

            e.preventDefault();
            return false;
        });

        // Setup keyboard nav
        $(document).bind('keydown.dk_nav', function (e) {
            var 
            // Look for an open dropdown...
        $open = $('.dk_container.dk_open'),

            // Look for a focused dropdown
        $focused = $('.dk_container.dk_focus'),

            // Will be either $open, $focused, or null
        $dk = null
      ;

            // If we have an open dropdown, key events should get sent to that one
            if ($open.length) {
                $dk = $open;
            } else if ($focused.length && !$open.length) {
                // But if we have no open dropdowns, use the focused dropdown instead
                $dk = $focused;
            }

            if ($dk) {
                _handleKeyBoardNav(e, $dk);
            }
        });
    });
})(jQuery, window, document);

/**
* SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
*
* SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
*/
if (typeof deconcept == "undefined") { var deconcept = new Object(); } if (typeof deconcept.util == "undefined") { deconcept.util = new Object(); } if (typeof deconcept.SWFObjectUtil == "undefined") { deconcept.SWFObjectUtil = new Object(); } deconcept.SWFObject = function(_1, id, w, h, _5, c, _7, _8, _9, _a) { if (!document.getElementById) { return; } this.DETECT_KEY = _a ? _a : "detectflash"; this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY); this.params = new Object(); this.variables = new Object(); this.attributes = new Array(); if (_1) { this.setAttribute("swf", _1); } if (id) { this.setAttribute("id", id); } if (w) { this.setAttribute("width", w); } if (h) { this.setAttribute("height", h); } if (_5) { this.setAttribute("version", new deconcept.PlayerVersion(_5.toString().split("."))); } this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(); if (!window.opera && document.all && this.installedVer.major > 7) { deconcept.SWFObject.doPrepUnload = true; } if (c) { this.addParam("bgcolor", c); } var q = _7 ? _7 : "high"; this.addParam("quality", q); this.setAttribute("useExpressInstall", false); this.setAttribute("doExpressInstall", false); var _c = (_8) ? _8 : window.location; this.setAttribute("xiRedirectUrl", _c); this.setAttribute("redirectUrl", ""); if (_9) { this.setAttribute("redirectUrl", _9); } }; deconcept.SWFObject.prototype = { useExpressInstall: function(_d) { this.xiSWFPath = !_d ? "expressinstall.swf" : _d; this.setAttribute("useExpressInstall", true); }, setAttribute: function(_e, _f) { this.attributes[_e] = _f; }, getAttribute: function(_10) { return this.attributes[_10]; }, addParam: function(_11, _12) { this.params[_11] = _12; }, getParams: function() { return this.params; }, addVariable: function(_13, _14) { this.variables[_13] = _14; }, getVariable: function(_15) { return this.variables[_15]; }, getVariables: function() { return this.variables; }, getVariablePairs: function() { var _16 = new Array(); var key; var _18 = this.getVariables(); for (key in _18) { _16[_16.length] = key + "=" + _18[key]; } return _16; }, getSWFHTML: function() { var _19 = ""; if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); this.setAttribute("swf", this.xiSWFPath); } _19 = "<embed type=\"application/x-shockwave-flash\" src=\"" + this.getAttribute("swf") + "\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\""; _19 += " id=\"" + this.getAttribute("id") + "\" name=\"" + this.getAttribute("id") + "\" "; var _1a = this.getParams(); for (var key in _1a) { _19 += [key] + "=\"" + _1a[key] + "\" "; } var _1c = this.getVariablePairs().join("&"); if (_1c.length > 0) { _19 += "flashvars=\"" + _1c + "\""; } _19 += "/>"; } else { if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); this.setAttribute("swf", this.xiSWFPath); } _19 = "<object id=\"" + this.getAttribute("id") + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\">"; _19 += "<param name=\"movie\" value=\"" + this.getAttribute("swf") + "\" />"; var _1d = this.getParams(); for (var key in _1d) { _19 += "<param name=\"" + key + "\" value=\"" + _1d[key] + "\" />"; } var _1f = this.getVariablePairs().join("&"); if (_1f.length > 0) { _19 += "<param name=\"flashvars\" value=\"" + _1f + "\" />"; } _19 += "</object>"; } return _19; }, write: function(_20) { if (this.getAttribute("useExpressInstall")) { var _21 = new deconcept.PlayerVersion([6, 0, 65]); if (this.installedVer.versionIsValid(_21) && !this.installedVer.versionIsValid(this.getAttribute("version"))) { this.setAttribute("doExpressInstall", true); this.addVariable("MMredirectURL", escape(this.getAttribute("xiRedirectUrl"))); document.title = document.title.slice(0, 47) + " - Flash Player Installation"; this.addVariable("MMdoctitle", document.title); } } if (this.skipDetect || this.getAttribute("doExpressInstall") || this.installedVer.versionIsValid(this.getAttribute("version"))) { var n = (typeof _20 == "string") ? document.getElementById(_20) : _20; n.innerHTML = this.getSWFHTML(); return true; } else { if (this.getAttribute("redirectUrl") != "") { document.location.replace(this.getAttribute("redirectUrl")); } } return false; } }; deconcept.SWFObjectUtil.getPlayerVersion = function() { var _23 = new deconcept.PlayerVersion([0, 0, 0]); if (navigator.plugins && navigator.mimeTypes.length) { var x = navigator.plugins["Shockwave Flash"]; if (x && x.description) { _23 = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")); } } else { if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0) { var axo = 1; var _26 = 3; while (axo) { try { _26++; axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + _26); _23 = new deconcept.PlayerVersion([_26, 0, 0]); } catch (e) { axo = null; } } } else { try { var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); } catch (e) { try { var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); _23 = new deconcept.PlayerVersion([6, 0, 21]); axo.AllowScriptAccess = "always"; } catch (e) { if (_23.major == 6) { return _23; } } try { axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); } catch (e) { } } if (axo != null) { _23 = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(",")); } } } return _23; }; deconcept.PlayerVersion = function(_29) { this.major = _29[0] != null ? parseInt(_29[0]) : 0; this.minor = _29[1] != null ? parseInt(_29[1]) : 0; this.rev = _29[2] != null ? parseInt(_29[2]) : 0; }; deconcept.PlayerVersion.prototype.versionIsValid = function(fv) { if (this.major < fv.major) { return false; } if (this.major > fv.major) { return true; } if (this.minor < fv.minor) { return false; } if (this.minor > fv.minor) { return true; } if (this.rev < fv.rev) { return false; } return true; }; deconcept.util = { getRequestParameter: function(_2b) { var q = document.location.search || document.location.hash; if (_2b == null) { return q; } if (q) { var _2d = q.substring(1).split("&"); for (var i = 0; i < _2d.length; i++) { if (_2d[i].substring(0, _2d[i].indexOf("=")) == _2b) { return _2d[i].substring((_2d[i].indexOf("=") + 1)); } } } return ""; } }; deconcept.SWFObjectUtil.cleanupSWFs = function() { var _2f = document.getElementsByTagName("OBJECT"); for (var i = _2f.length - 1; i >= 0; i--) { _2f[i].style.display = "none"; for (var x in _2f[i]) { if (typeof _2f[i][x] == "function") { _2f[i][x] = function() { }; } } } }; if (deconcept.SWFObject.doPrepUnload) { if (!deconcept.unloadSet) { deconcept.SWFObjectUtil.prepUnload = function() { __flash_unloadHandler = function() { }; __flash_savedUnloadHandler = function() { }; window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs); }; window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload); deconcept.unloadSet = true; } } if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }; } var getQueryParamValue = deconcept.util.getRequestParameter; var FlashObject = deconcept.SWFObject; var SWFObject = deconcept.SWFObject;

/*
* Hash
*/
(function() { if (typeof window.Hash != 'undefined') { var _Hash = window.Hash } var Hash = window.Hash = function(args) { if (this instanceof arguments.callee) { this.init.apply(this, args && args.callee ? args : arguments) } else { return new Hash(arguments) } }; Hash.no_conflict = function() { window.Hash = _Hash; return Hash }; Hash.prototype = { init: function(copy_from) { this.empty(); if (copy_from) { this.update(copy_from) } }, get: function(key) { return this.hash[key] }, contains: function(key) { return this.get(key) !== undefined }, put: function(key, val) { if (!this.contains(key)) { this.length++ } this.hash[key] = val; return val }, remove: function(key) { delete this.hash[key]; this.length--; return this }, ensure: function(key, default_val) { var current_val = this.get(key); if (current_val === undefined) { return this.put(key, default_val) } return current_val }, lazy_ensure: function(key, default_fn) { var current_val = this.get(key); if (current_val === undefined) { return this.put(key, default_fn(key)) } return current_val }, pop: function(key) { var current_val = this.get(key); this.remove(key); return current_val }, update: function(obj) { for (var prop in obj) { if (obj.hasOwnProperty(prop)) { this.put(prop, obj[prop]) } } return this }, empty: function() { this.hash = {}; this.length = 0; return this }, keys: function() { var keys = []; for (var prop in this.hash) { keys.push(prop) } return keys }, values: function() { var values = []; for (var prop in this.hash) { values.push(this.hash[prop]) } return values }, items: function() { var items = []; for (var prop in this.hash) { items.push([prop, this.hash[prop]]) } return items }, items_obj: function() { return this.hash } } })();

/*
* jQuery history plugin
*
* Copyright (c) 2006 Taku Sano (Mikage Sawatari)
* Licensed under the MIT License:
*   http://www.opensource.org/licenses/mit-license.php
*
* Modified by Lincoln Cooper to add Safari support and only call the callback once during initialization
* for msie when no initial hash supplied.
* API rewrite by Lauris Bukðis-Haberkorns
*/
(function($) { function History() { this._curHash = ''; this._callback = function(hash) { } }; $.extend(History.prototype, { init: function(callback) { this._callback = callback; this._curHash = location.hash; if ($.browser.msie) { if (this._curHash == '') { this._curHash = '#' } $("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>'); var iframe = $("#jQuery_history")[0].contentWindow.document; iframe.open(); iframe.close(); iframe.location.hash = this._curHash } else if ($.browser.safari) { this._historyBackStack = []; this._historyBackStack.length = history.length; this._historyForwardStack = []; this._isFirst = true; this._dontCheck = false } this._callback(this._curHash.replace(/^#/, '')); setInterval(this._check, 100) }, add: function(hash) { this._historyBackStack.push(hash); this._historyForwardStack.length = 0; this._isFirst = true }, _check: function() { if ($.browser.msie) { var ihistory = $("#jQuery_history")[0]; var iframe = ihistory.contentDocument || ihistory.contentWindow.document; var current_hash = iframe.location.hash; if (current_hash != $.history._curHash) { location.hash = current_hash; $.history._curHash = current_hash; $.history._callback(current_hash.replace(/^#/, '')) } } else if ($.browser.safari) { if (!$.history._dontCheck) { var historyDelta = history.length - $.history._historyBackStack.length; if (historyDelta) { $.history._isFirst = false; if (historyDelta < 0) { for (var i = 0; i < Math.abs(historyDelta); i++) $.history._historyForwardStack.unshift($.history._historyBackStack.pop()) } else { for (var i = 0; i < historyDelta; i++) $.history._historyBackStack.push($.history._historyForwardStack.shift()) } var cachedHash = $.history._historyBackStack[$.history._historyBackStack.length - 1]; if (cachedHash != undefined) { $.history._curHash = location.hash; $.history._callback(cachedHash) } } else if ($.history._historyBackStack[$.history._historyBackStack.length - 1] == undefined && !$.history._isFirst) { if (document.URL.indexOf('#') >= 0) { $.history._callback(document.URL.split('#')[1]) } else { $.history._callback('') } $.history._isFirst = true } } } else { var current_hash = location.hash; if (current_hash != $.history._curHash) { $.history._curHash = current_hash; $.history._callback(current_hash.replace(/^#/, '')) } } }, load: function(hash) { var newhash; if ($.browser.safari) { newhash = hash } else { newhash = '#' + hash; location.hash = newhash } this._curHash = newhash; if ($.browser.msie) { var ihistory = $("#jQuery_history")[0]; var iframe = ihistory.contentWindow.document; iframe.open(); iframe.close(); iframe.location.hash = newhash; this._callback(hash) } else if ($.browser.safari) { this._dontCheck = true; this.add(hash); var fn = function() { $.history._dontCheck = false }; window.setTimeout(fn, 200); this._callback(hash); location.hash = newhash } else { this._callback(hash) } } }); $(document).ready(function() { $.history = new History() }) })(jQuery);

/*
* Defaultvalue-mod
*/
(function($) { $.fn.extend({ defaultValue: function(str) { return this.each(function() { var defaultValue = str || $(this).attr('rel'); var defaultType = $(this).attr('type') || null; var cloneId = null; var self = $(this); self.data("defaultValue", defaultValue); if (defaultType == 'password') { createClone(this); $(this).blur(function() { if ($(self).val().length <= 0) { $('#' + cloneId).show(); $(self).hide() } }) } else { $(this).click(function() { if ($(this).val() == defaultValue) { $(this).val('') } }).keypress(function() { if ($(this).val().length > 0) { setState(this) } }).blur(function() { setState(this) }).focus(function() { if ($(this).val() == defaultValue) { $(this).val('') } }); $.trim($(this).val()); setState(this) } function setState(element) { val = $.trim($(element).val()); if (val.length <= 0 || val == defaultValue) { $(element).val(defaultValue).addClass('empty') } else { $(element).removeClass('empty') } } function createClone(element) { cloneId = $(element).attr('id') + 'Clone'; if ($('#' + cloneId).length > 0) return; $("<input id='" + cloneId + "' type='text' />").attr('value', defaultValue).insertAfter(element).show().focus(function() { $(this).hide(); $(self).show(); setTimeout(function() { $(self).focus() }, 10) }).addClass($(element).attr('class') + ' empty').attr('style', $(element).attr('style')); $(self).hide() } }) } }) })(jQuery);

/**
* jQuery.ScrollTo - Easy element scrolling using jQuery.
* Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 3/9/2009
* @author Ariel Flesler
* @version 1.4.1
*
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
*/
; (function($) { var m = $.scrollTo = function(b, h, f) { $(window).scrollTo(b, h, f) }; m.defaults = { axis: 'xy', duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1 }; m.window = function(b) { return $(window).scrollable() }; $.fn.scrollable = function() { return this.map(function() { var b = this, h = !b.nodeName || $.inArray(b.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1; if (!h) return b; var f = (b.contentWindow || b).document || b.ownerDocument || b; return $.browser.safari || f.compatMode == 'BackCompat' ? f.body : f.documentElement }) }; $.fn.scrollTo = function(l, j, a) { if (typeof j == 'object') { a = j; j = 0 } if (typeof a == 'function') a = { onAfter: a }; if (l == 'max') l = 9e9; a = $.extend({}, m.defaults, a); j = j || a.speed || a.duration; a.queue = a.queue && a.axis.length > 1; if (a.queue) j /= 2; a.offset = n(a.offset); a.over = n(a.over); return this.scrollable().each(function() { var k = this, o = $(k), d = l, p, g = {}, q = o.is('html,body'); switch (typeof d) { case 'number': case 'string': if (/^([+-]=)?\d+(\.\d+)?(px)?$/.test(d)) { d = n(d); break } d = $(d, this); case 'object': if (d.is || d.style) p = (d = $(d)).offset() } $.each(a.axis.split(''), function(b, h) { var f = h == 'x' ? 'Left' : 'Top', i = f.toLowerCase(), c = 'scroll' + f, r = k[c], s = h == 'x' ? 'Width' : 'Height'; if (p) { g[c] = p[i] + (q ? 0 : r - o.offset()[i]); if (a.margin) { g[c] -= parseInt(d.css('margin' + f)) || 0; g[c] -= parseInt(d.css('border' + f + 'Width')) || 0 } g[c] += a.offset[i] || 0; if (a.over[i]) g[c] += d[s.toLowerCase()]() * a.over[i] } else g[c] = d[i]; if (/^\d+$/.test(g[c])) g[c] = g[c] <= 0 ? 0 : Math.min(g[c], u(s)); if (!b && a.queue) { if (r != g[c]) t(a.onAfterFirst); delete g[c] } }); t(a.onAfter); function t(b) { o.animate(g, j, a.easing, b && function() { b.call(this, l, a) }) }; function u(b) { var h = 'scroll' + b; if (!q) return k[h]; var f = 'client' + b, i = k.ownerDocument.documentElement, c = k.ownerDocument.body; return Math.max(i[h], c[h]) - Math.min(i[f], c[f]) } }).end() }; function n(b) { return typeof b == 'object' ? b : { top: b, left: b} } })(jQuery);

/**
*
*  URL encode / decode
*  http://www.webtoolkit.info/
*
**/
var Url = { encode: function(string) { return escape(this._utf8_encode(string)) }, decode: function(string) { return this._utf8_decode(unescape(string)) }, _utf8_encode: function(string) { string = string.replace(/\r\n/g, "\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c) } else if ((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128) } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128) } } return utftext }, _utf8_decode: function(utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while (i < utftext.length) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++ } else if ((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i + 1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2 } else { c2 = utftext.charCodeAt(i + 1); c3 = utftext.charCodeAt(i + 2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3 } } return string } }


/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.1, 11.09.2007
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([237-9n-zA-Z]|1\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(s(m){3.fn.pngFix=s(c){c=3.extend({P:\'blank.gif\'},c);8 e=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 5.5")!=-1);8 f=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 6.0")!=-1);p(3.browser.msie&&(e||f)){3(2).B("img[n$=.C]").D(s(){3(2).7(\'q\',3(2).q());3(2).7(\'r\',3(2).r());8 a=\'\';8 b=\'\';8 g=(3(2).7(\'E\'))?\'E="\'+3(2).7(\'E\')+\'" \':\'\';8 h=(3(2).7(\'F\'))?\'F="\'+3(2).7(\'F\')+\'" \':\'\';8 i=(3(2).7(\'G\'))?\'G="\'+3(2).7(\'G\')+\'" \':\'\';8 j=(3(2).7(\'H\'))?\'H="\'+3(2).7(\'H\')+\'" \':\'\';8 k=(3(2).7(\'V\'))?\'float:\'+3(2).7(\'V\')+\';\':\'\';8 d=(3(2).parent().7(\'href\'))?\'cursor:hand;\':\'\';p(2.9.v){a+=\'v:\'+2.9.v+\';\';2.9.v=\'\'}p(2.9.w){a+=\'w:\'+2.9.w+\';\';2.9.w=\'\'}p(2.9.x){a+=\'x:\'+2.9.x+\';\';2.9.x=\'\'}8 l=(2.9.cssText);b+=\'<y \'+g+h+i+j;b+=\'9="W:X;white-space:pre-line;Y:Z-10;I:transparent;\'+k+d;b+=\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;\';b+=\'J:K:L.t.M(n=\\\'\'+3(2).7(\'n\')+\'\\\', N=\\\'O\\\');\';b+=l+\'"></y>\';p(a!=\'\'){b=\'<y 9="W:X;Y:Z-10;\'+a+d+\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;">\'+b+\'</y>\'}3(2).hide();3(2).after(b)});3(2).B("*").D(s(){8 a=3(2).11(\'I-12\');p(a.A(".C")!=-1){8 b=a.13(\'url("\')[1].13(\'")\')[0];3(2).11(\'I-12\',\'none\');3(2).14(0).15.J="K:L.t.M(n=\'"+b+"\',N=\'O\')"}});3(2).B("input[n$=.C]").D(s(){8 a=3(2).7(\'n\');3(2).14(0).15.J=\'K:L.t.M(n=\\\'\'+a+\'\\\', N=\\\'O\\\');\';3(2).7(\'n\',c.P)})}return 3}})(3);',[],68,'||this|jQuery||||attr|var|style||||||||||||||src|navigator|if|width|height|function|Microsoft|appVersion|border|padding|margin|span|px|indexOf|find|png|each|id|class|title|alt|background|filter|progid|DXImageTransform|AlphaImageLoader|sizingMethod|scale|blankgif|appName|Internet|Explorer|parseInt|MSIE|align|position|relative|display|inline|block|css|image|split|get|runtimeStyle'.split('|'),0,{}))





/*
* SimpleModal 1.4.1 - jQuery Plugin
* http://www.ericmmartin.com/projects/simplemodal/
* Copyright (c) 2010 Eric Martin (http://twitter.com/ericmmartin)
* Dual licensed under the MIT and GPL licenses
* Revision: $Id: jquery.simplemodal.js 261 2010-11-05 21:16:20Z emartin24 $
*/

/**
* SimpleModal is a lightweight jQuery plugin that provides a simple
* interface to create a modal dialog.
*
* The goal of SimpleModal is to provide developers with a cross-browser
* overlay and container that will be populated with data provided to
* SimpleModal.
*
* There are two ways to call SimpleModal:
* 1) As a chained function on a jQuery object, like $('#myDiv').modal();.
* This call would place the DOM object, #myDiv, inside a modal dialog.
* Chaining requires a jQuery object. An optional options object can be
* passed as a parameter.
*
* @example $('<div>my data</div>').modal({options});
* @example $('#myDiv').modal({options});
* @example jQueryObject.modal({options});
*
* 2) As a stand-alone function, like $.modal(data). The data parameter
* is required and an optional options object can be passed as a second
* parameter. This method provides more flexibility in the types of data
* that are allowed. The data could be a DOM object, a jQuery object, HTML
* or a string.
*
* @example $.modal('<div>my data</div>', {options});
* @example $.modal('my data', {options});
* @example $.modal($('#myDiv'), {options});
* @example $.modal(jQueryObject, {options});
* @example $.modal(document.getElementById('myDiv'), {options});
*
* A SimpleModal call can contain multiple elements, but only one modal
* dialog can be created at a time. Which means that all of the matched
* elements will be displayed within the modal container.
*
* SimpleModal internally sets the CSS needed to display the modal dialog
* properly in all browsers, yet provides the developer with the flexibility
* to easily control the look and feel. The styling for SimpleModal can be
* done through external stylesheets, or through SimpleModal, using the
* overlayCss, containerCss, and dataCss options.
*
* SimpleModal has been tested in the following browsers:
* - IE 6, 7, 8, 9
* - Firefox 2, 3, 4
* - Opera 9, 10
* - Safari 3, 4, 5
* - Chrome 1, 2, 3, 4, 5, 6
*
* @name SimpleModal
* @type jQuery
* @requires jQuery v1.2.4
* @cat Plugins/Windows and Overlays
* @author Eric Martin (http://ericmmartin.com)
* @version 1.4.1
*/
; (function ($) {
    var ie6 = $.browser.msie && parseInt($.browser.version) === 6 && typeof window['XMLHttpRequest'] !== 'object',
		ie7 = $.browser.msie && parseInt($.browser.version) === 7,
		ieQuirks = null,
		w = [];

    /*
    * Create and display a modal dialog.
    *
    * @param {string, object} data A string, jQuery object or DOM object
    * @param {object} [options] An optional object containing options overrides
    */
    $.modal = function (data, options) {
        return $.modal.impl.init(data, options);
    };

    /*
    * Close the modal dialog.
    */
    $.modal.close = function () {
        $.modal.impl.close();
    };

    /*
    * Set focus on first or last visible input in the modal dialog. To focus on the last
    * element, call $.modal.focus('last'). If no input elements are found, focus is placed
    * on the data wrapper element.
    */
    $.modal.focus = function (pos) {
        $.modal.impl.focus(pos);
    };

    /*
    * Determine and set the dimensions of the modal dialog container.
    * setPosition() is called if the autoPosition option is true.
    */
    $.modal.setContainerDimensions = function () {
        $.modal.impl.setContainerDimensions();
    };

    /*
    * Re-position the modal dialog.
    */
    $.modal.setPosition = function () {
        $.modal.impl.setPosition();
    };

    /*
    * Update the modal dialog. If new dimensions are passed, they will be used to determine
    * the dimensions of the container.
    *
    * setContainerDimensions() is called, which in turn calls setPosition(), if enabled.
    * Lastly, focus() is called is the focus option is true.
    */
    $.modal.update = function (height, width) {
        $.modal.impl.update(height, width);
    };

    /*
    * Chained function to create a modal dialog.
    *
    * @param {object} [options] An optional object containing options overrides
    */
    $.fn.modal = function (options) {
        return $.modal.impl.init(this, options);
    };

    /*
    * SimpleModal default options
    *
    * appendTo:		(String:'body') The jQuery selector to append the elements to. For .NET, use 'form'.
    * focus:			(Boolean:true) Focus in the first visible, enabled element?
    * opacity:			(Number:50) The opacity value for the overlay div, from 0 - 100
    * overlayId:		(String:'simplemodal-overlay') The DOM element id for the overlay div
    * overlayCss:		(Object:{}) The CSS styling for the overlay div
    * containerId:		(String:'simplemodal-container') The DOM element id for the container div
    * containerCss:	(Object:{}) The CSS styling for the container div
    * dataId:			(String:'simplemodal-data') The DOM element id for the data div
    * dataCss:			(Object:{}) The CSS styling for the data div
    * minHeight:		(Number:null) The minimum height for the container
    * minWidth:		(Number:null) The minimum width for the container
    * maxHeight:		(Number:null) The maximum height for the container. If not specified, the window height is used.
    * maxWidth:		(Number:null) The maximum width for the container. If not specified, the window width is used.
    * autoResize:		(Boolean:false) Automatically resize the container if it exceeds the browser window dimensions?
    * autoPosition:	(Boolean:true) Automatically position the container upon creation and on window resize?
    * zIndex:			(Number: 1000) Starting z-index value
    * close:			(Boolean:true) If true, closeHTML, escClose and overClose will be used if set.
    If false, none of them will be used.
    * closeHTML:		(String:'<a class="modalCloseImg" title="Close"></a>') The HTML for the default close link.
    SimpleModal will automatically add the closeClass to this element.
    * closeClass:		(String:'simplemodal-close') The CSS class used to bind to the close event
    * escClose:		(Boolean:true) Allow Esc keypress to close the dialog?
    * overlayClose:	(Boolean:false) Allow click on overlay to close the dialog?
    * position:		(Array:null) Position of container [top, left]. Can be number of pixels or percentage
    * persist:			(Boolean:false) Persist the data across modal calls? Only used for existing
    DOM elements. If true, the data will be maintained across modal calls, if false,
    the data will be reverted to its original state.
    * modal:			(Boolean:true) User will be unable to interact with the page below the modal or tab away from the dialog.
    If false, the overlay, iframe, and certain events will be disabled allowing the user to interact
    with the page below the dialog.
    * onOpen:			(Function:null) The callback function used in place of SimpleModal's open
    * onShow:			(Function:null) The callback function used after the modal dialog has opened
    * onClose:			(Function:null) The callback function used in place of SimpleModal's close
    */
    $.modal.defaults = {
        appendTo: 'body',
        focus: true,
        opacity: 50,
        overlayId: 'simplemodal-overlay',
        overlayCss: {},
        containerId: 'simplemodal-container',
        containerCss: {},
        dataId: 'simplemodal-data',
        dataCss: {},
        minHeight: null,
        minWidth: null,
        maxHeight: null,
        maxWidth: null,
        autoResize: false,
        autoPosition: true,
        zIndex: 1000,
        close: true,
        closeHTML: '<a class="modalCloseImg" title="Close"></a>',
        closeClass: 'simplemodal-close',
        escClose: true,
        overlayClose: false,
        position: null,
        persist: false,
        modal: true,
        onOpen: null,
        onShow: null,
        onClose: null
    };

    /*
    * Main modal object
    * o = options
    */
    $.modal.impl = {
        /*
        * Contains the modal dialog elements and is the object passed
        * back to the callback (onOpen, onShow, onClose) functions
        */
        d: {},
        /*
        * Initialize the modal dialog
        */
        init: function (data, options) {
            var s = this;

            // don't allow multiple calls
            if (s.d.data) {
                return false;
            }

            // $.boxModel is undefined if checked earlier
            ieQuirks = $.browser.msie && !$.boxModel;

            // merge defaults and user options
            s.o = $.extend({}, $.modal.defaults, options);

            // keep track of z-index
            s.zIndex = s.o.zIndex;

            // set the onClose callback flag
            s.occb = false;

            // determine how to handle the data based on its type
            if (typeof data === 'object') {
                // convert DOM object to a jQuery object
                data = data instanceof jQuery ? data : $(data);
                s.d.placeholder = false;

                // if the object came from the DOM, keep track of its parent
                if (data.parent().parent().size() > 0) {
                    data.before($('<span></span>')
						.attr('id', 'simplemodal-placeholder')
						.css({ display: 'none' }));

                    s.d.placeholder = true;
                    s.display = data.css('display');

                    // persist changes? if not, make a clone of the element
                    if (!s.o.persist) {
                        s.d.orig = data.clone(true);
                    }
                }
            }
            else if (typeof data === 'string' || typeof data === 'number') {
                // just insert the data as innerHTML
                data = $('<div></div>').html(data);
            }
            else {
                // unsupported data type!
                alert('SimpleModal Error: Unsupported data type: ' + typeof data);
                return s;
            }

            // create the modal overlay, container and, if necessary, iframe
            s.create(data);
            data = null;

            // display the modal dialog
            s.open();

            // useful for adding events/manipulating data in the modal dialog
            if ($.isFunction(s.o.onShow)) {
                s.o.onShow.apply(s, [s.d]);
            }

            // don't break the chain =)
            return s;
        },
        /*
        * Create and add the modal overlay and container to the page
        */
        create: function (data) {
            var s = this;

            // get the window properties
            w = s.getDimensions();

            // add an iframe to prevent select options from bleeding through
            if (s.o.modal && ie6) {
                s.d.iframe = $('<iframe src="javascript:false;"></iframe>')
					.css($.extend(s.o.iframeCss, {
					    display: 'none',
					    opacity: 0,
					    position: 'fixed',
					    height: w[0],
					    width: w[1],
					    zIndex: s.o.zIndex,
					    top: 0,
					    left: 0
					}))
					.appendTo(s.o.appendTo);
            }

            // create the overlay
            s.d.overlay = $('<div></div>')
				.attr('id', s.o.overlayId)
				.addClass('simplemodal-overlay')
				.css($.extend(s.o.overlayCss, {
				    display: 'none',
				    opacity: s.o.opacity / 100,
				    height: s.o.modal ? w[0] : 0,
				    width: s.o.modal ? w[1] : 0,
				    position: 'fixed',
				    left: 0,
				    top: 0,
				    zIndex: s.o.zIndex + 1
				}))
				.appendTo(s.o.appendTo);

            // create the container
            s.d.container = $('<div></div>')
				.attr('id', s.o.containerId)
				.addClass('simplemodal-container')
				.css($.extend(s.o.containerCss, {
				    display: 'none',
				    position: 'fixed',
				    zIndex: s.o.zIndex + 2
				}))
				.append(s.o.close && s.o.closeHTML
					? $(s.o.closeHTML).addClass(s.o.closeClass)
					: '')
				.appendTo(s.o.appendTo);

            s.d.wrap = $('<div></div>')
				.attr('tabIndex', -1)
				.addClass('simplemodal-wrap')
				.css({ height: '100%', outline: 0, width: '100%' })
				.appendTo(s.d.container);

            // add styling and attributes to the data
            // append to body to get correct dimensions, then move to wrap
            s.d.data = data
				.attr('id', data.attr('id') || s.o.dataId)
				.addClass('simplemodal-data')
				.css($.extend(s.o.dataCss, {
				    display: 'none'
				}))
				.appendTo('body');
            data = null;

            s.setContainerDimensions();
            s.d.data.appendTo(s.d.wrap);

            // fix issues with IE
            if (ie6 || ieQuirks) {
                s.fixIE();
            }
        },
        /*
        * Bind events
        */
        bindEvents: function () {
            var s = this;

            // bind the close event to any element with the closeClass class
            $('.' + s.o.closeClass).bind('click.simplemodal', function (e) {
                e.preventDefault();
                s.close();
            });

            // bind the overlay click to the close function, if enabled
            if (s.o.modal && s.o.close && s.o.overlayClose) {
                s.d.overlay.bind('click.simplemodal', function (e) {
                    e.preventDefault();
                    s.close();
                });
            }

            // bind keydown events
            $(document).bind('keydown.simplemodal', function (e) {
                if (s.o.modal && e.keyCode === 9) { // TAB
                    s.watchTab(e);
                }
                else if ((s.o.close && s.o.escClose) && e.keyCode === 27) { // ESC
                    e.preventDefault();
                    s.close();
                }
            });

            // update window size
            $(window).bind('resize.simplemodal', function () {
                // redetermine the window width/height
                w = s.getDimensions();

                // reposition the dialog
                s.o.autoResize ? s.setContainerDimensions() : s.o.autoPosition && s.setPosition();

                if (ie6 || ieQuirks) {
                    s.fixIE();
                }
                else if (s.o.modal) {
                    // update the iframe & overlay
                    s.d.iframe && s.d.iframe.css({ height: w[0], width: w[1] });
                    s.d.overlay.css({ height: w[0], width: w[1] });
                }
            });
        },
        /*
        * Unbind events
        */
        unbindEvents: function () {
            $('.' + this.o.closeClass).unbind('click.simplemodal');
            $(document).unbind('keydown.simplemodal');
            $(window).unbind('resize.simplemodal');
            this.d.overlay.unbind('click.simplemodal');
        },
        /*
        * Fix issues in IE6 and IE7 in quirks mode
        */
        fixIE: function () {
            var s = this, p = s.o.position;

            // simulate fixed position - adapted from BlockUI
            $.each([s.d.iframe || null, !s.o.modal ? null : s.d.overlay, s.d.container], function (i, el) {
                if (el) {
                    var bch = 'document.body.clientHeight', bcw = 'document.body.clientWidth',
						bsh = 'document.body.scrollHeight', bsl = 'document.body.scrollLeft',
						bst = 'document.body.scrollTop', bsw = 'document.body.scrollWidth',
						ch = 'document.documentElement.clientHeight', cw = 'document.documentElement.clientWidth',
						sl = 'document.documentElement.scrollLeft', st = 'document.documentElement.scrollTop',
						s = el[0].style;

                    s.position = 'absolute';
                    if (i < 2) {
                        s.removeExpression('height');
                        s.removeExpression('width');
                        s.setExpression('height', '' + bsh + ' > ' + bch + ' ? ' + bsh + ' : ' + bch + ' + "px"');
                        s.setExpression('width', '' + bsw + ' > ' + bcw + ' ? ' + bsw + ' : ' + bcw + ' + "px"');
                    }
                    else {
                        var te, le;
                        if (p && p.constructor === Array) {
                            var top = p[0]
								? typeof p[0] === 'number' ? p[0].toString() : p[0].replace(/px/, '')
								: el.css('top').replace(/px/, '');
                            te = top.indexOf('%') === -1
								? top + ' + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"'
								: parseInt(top.replace(/%/, '')) + ' * ((' + ch + ' || ' + bch + ') / 100) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"';

                            if (p[1]) {
                                var left = typeof p[1] === 'number' ? p[1].toString() : p[1].replace(/px/, '');
                                le = left.indexOf('%') === -1
									? left + ' + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"'
									: parseInt(left.replace(/%/, '')) + ' * ((' + cw + ' || ' + bcw + ') / 100) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"';
                            }
                        }
                        else {
                            te = '(' + ch + ' || ' + bch + ') / 2 - (this.offsetHeight / 2) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"';
                            le = '(' + cw + ' || ' + bcw + ') / 2 - (this.offsetWidth / 2) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"';
                        }
                        s.removeExpression('top');
                        s.removeExpression('left');
                        s.setExpression('top', te);
                        s.setExpression('left', le);
                    }
                }
            });
        },
        /*
        * Place focus on the first or last visible input
        */
        focus: function (pos) {
            var s = this, p = pos && $.inArray(pos, ['first', 'last']) !== -1 ? pos : 'first';

            // focus on dialog or the first visible/enabled input element
            var input = $(':input:enabled:visible:' + p, s.d.wrap);
            setTimeout(function () {
                input.length > 0 ? input.focus() : s.d.wrap.focus();
            }, 10);
        },
        getDimensions: function () {
            var el = $(window);

            // fix a jQuery/Opera bug with determining the window height
            var h = $.browser.opera && $.browser.version > '9.5' && $.fn.jquery < '1.3'
						|| $.browser.opera && $.browser.version < '9.5' && $.fn.jquery > '1.2.6'
				? el[0].innerHeight : el.height();

            return [h, el.width()];
        },
        getVal: function (v, d) {
            return v ? (typeof v === 'number' ? v
					: v === 'auto' ? 0
					: v.indexOf('%') > 0 ? ((parseInt(v.replace(/%/, '')) / 100) * (d === 'h' ? w[0] : w[1]))
					: parseInt(v.replace(/px/, '')))
				: null;
        },
        /*
        * Update the container. Set new dimensions, if provided.
        * Focus, if enabled. Re-bind events.
        */
        update: function (height, width) {
            var s = this;

            // prevent update if dialog does not exist
            if (!s.d.data) {
                return false;
            }

            // reset orig values
            s.d.origHeight = s.getVal(height, 'h');
            s.d.origWidth = s.getVal(width, 'w');

            // hide data to prevent screen flicker
            s.d.data.hide();
            height && s.d.container.css('height', height);
            width && s.d.container.css('width', width);
            s.setContainerDimensions();
            s.d.data.show();
            s.o.focus && s.focus();

            // rebind events
            s.unbindEvents();
            s.bindEvents();
        },
        setContainerDimensions: function () {
            var s = this,
				badIE = ie6 || ie7;

            // get the dimensions for the container and data
            var ch = s.d.origHeight ? s.d.origHeight : $.browser.opera ? s.d.container.height() : s.getVal(badIE ? s.d.container[0].currentStyle['height'] : s.d.container.css('height'), 'h'),
				cw = s.d.origWidth ? s.d.origWidth : $.browser.opera ? s.d.container.width() : s.getVal(badIE ? s.d.container[0].currentStyle['width'] : s.d.container.css('width'), 'w'),
				dh = s.d.data.outerHeight(true), dw = s.d.data.outerWidth(true);

            s.d.origHeight = s.d.origHeight || ch;
            s.d.origWidth = s.d.origWidth || cw;

            // mxoh = max option height, mxow = max option width
            var mxoh = s.o.maxHeight ? s.getVal(s.o.maxHeight, 'h') : null,
				mxow = s.o.maxWidth ? s.getVal(s.o.maxWidth, 'w') : null,
				mh = mxoh && mxoh < w[0] ? mxoh : w[0],
				mw = mxow && mxow < w[1] ? mxow : w[1];

            // moh = min option height
            var moh = s.o.minHeight ? s.getVal(s.o.minHeight, 'h') : 'auto';
            if (!ch) {
                if (!dh) { ch = moh; }
                else {
                    if (dh > mh) { ch = mh; }
                    else if (s.o.minHeight && moh !== 'auto' && dh < moh) { ch = moh; }
                    else { ch = dh; }
                }
            }
            else {
                ch = s.o.autoResize && ch > mh ? mh : ch < moh ? moh : ch;
            }

            // mow = min option width
            var mow = s.o.minWidth ? s.getVal(s.o.minWidth, 'w') : 'auto';
            if (!cw) {
                if (!dw) { cw = mow; }
                else {
                    if (dw > mw) { cw = mw; }
                    else if (s.o.minWidth && mow !== 'auto' && dw < mow) { cw = mow; }
                    else { cw = dw; }
                }
            }
            else {
                cw = s.o.autoResize && cw > mw ? mw : cw < mow ? mow : cw;
            }

            s.d.container.css({ height: ch, width: cw });
            s.d.wrap.css({ overflow: (dh > ch || dw > cw) ? 'auto' : 'visible' });
            s.o.autoPosition && s.setPosition();
        },
        setPosition: function () {
            var s = this, top, left,
				hc = (w[0] / 2) - (s.d.container.outerHeight(true) / 2),
				vc = (w[1] / 2) - (s.d.container.outerWidth(true) / 2);

            if (s.o.position && Object.prototype.toString.call(s.o.position) === '[object Array]') {
                top = s.o.position[0] || hc;
                left = s.o.position[1] || vc;
            } else {
                top = hc;
                left = vc;
            }
            s.d.container.css({ left: left, top: top });
        },
        watchTab: function (e) {
            var s = this;

            if ($(e.target).parents('.simplemodal-container').length > 0) {
                // save the list of inputs
                s.inputs = $(':input:enabled:visible:first, :input:enabled:visible:last', s.d.data[0]);

                // if it's the first or last tabbable element, refocus
                if ((!e.shiftKey && e.target === s.inputs[s.inputs.length - 1]) ||
						(e.shiftKey && e.target === s.inputs[0]) ||
						s.inputs.length === 0) {
                    e.preventDefault();
                    var pos = e.shiftKey ? 'last' : 'first';
                    s.focus(pos);
                }
            }
            else {
                // might be necessary when custom onShow callback is used
                e.preventDefault();
                s.focus();
            }
        },
        /*
        * Open the modal dialog elements
        * - Note: If you use the onOpen callback, you must "show" the
        *	        overlay and container elements manually
        *         (the iframe will be handled by SimpleModal)
        */
        open: function () {
            var s = this;
            // display the iframe
            s.d.iframe && s.d.iframe.show();

            if ($.isFunction(s.o.onOpen)) {
                // execute the onOpen callback
                s.o.onOpen.apply(s, [s.d]);
            }
            else {
                // display the remaining elements
                s.d.overlay.show();
                s.d.container.show();
                s.d.data.show();
            }

            s.o.focus && s.focus();

            // bind default events
            s.bindEvents();
        },
        /*
        * Close the modal dialog
        * - Note: If you use an onClose callback, you must remove the
        *         overlay, container and iframe elements manually
        *
        * @param {boolean} external Indicates whether the call to this
        *     function was internal or external. If it was external, the
        *     onClose callback will be ignored
        */
        close: function () {
            var s = this;

            // prevent close when dialog does not exist
            if (!s.d.data) {
                return false;
            }

            // remove the default events
            s.unbindEvents();

            if ($.isFunction(s.o.onClose) && !s.occb) {
                // set the onClose callback flag
                s.occb = true;

                // execute the onClose callback
                s.o.onClose.apply(s, [s.d]);
            }
            else {
                // if the data came from the DOM, put it back
                if (s.d.placeholder) {
                    var ph = $('#simplemodal-placeholder');
                    // save changes to the data?
                    if (s.o.persist) {
                        // insert the (possibly) modified data back into the DOM
                        ph.replaceWith(s.d.data.removeClass('simplemodal-data').css('display', s.display));
                    }
                    else {
                        // remove the current and insert the original,
                        // unmodified data back into the DOM
                        s.d.data.hide().remove();
                        ph.replaceWith(s.d.orig);
                    }
                }
                else {
                    // otherwise, remove it
                    s.d.data.hide().remove();
                }

                // remove the remaining elements
                s.d.container.hide().remove();
                s.d.overlay.hide();
                s.d.iframe && s.d.iframe.hide().remove();
                setTimeout(function () {
                    // opera work-around
                    s.d.overlay.remove();

                    // reset the dialog object
                    s.d = {};
                }, 10);
            }
        }
    };
})(jQuery);


