﻿jQuery.cookie = function (name, value, options) { if (typeof value != 'undefined') { options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); } var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } }; (function ($) {
    var ver = '2.22'; var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent); function log() { if (window.console && window.console.log) window.console.log('[cycle] ' + Array.prototype.join.call(arguments, '')); }; $.fn.cycle = function (options) {
        return this.each(function () {
            options = options || {}; if (options.constructor == String) { switch (options) { case 'stop': if (this.cycleTimeout) clearTimeout(this.cycleTimeout); this.cycleTimeout = 0; return; case 'pause': this.cyclePause = 1; return; case 'resume': this.cyclePause = 0; return; default: options = { fx: options }; }; } if (this.cycleTimeout) clearTimeout(this.cycleTimeout); this.cycleTimeout = 0; this.cyclePause = 0; var $cont = $(this); var $slides = options.slideExpr ? $(options.slideExpr, this) : $cont.children(); var els = $slides.get(); if (els.length < 2) { log('terminating; too few slides: ' + els.length); return; } var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {}); if (opts.autostop) opts.countdown = opts.autostopCount || els.length; opts.before = opts.before ? [opts.before] : []; opts.after = opts.after ? [opts.after] : []; opts.after.unshift(function () { opts.busy = 0; }); if (opts.continuous) opts.after.push(function () { go(els, opts, 0, !opts.rev); }); if (ie6 && opts.cleartype && !opts.cleartypeNoBg) clearTypeFix($slides); var cls = this.className; opts.width = parseInt((cls.match(/w:(\d+)/) || [])[1]) || opts.width; opts.height = parseInt((cls.match(/h:(\d+)/) || [])[1]) || opts.height; opts.timeout = parseInt((cls.match(/t:(\d+)/) || [])[1]) || opts.timeout; if ($cont.css('position') == 'static') $cont.css('position', 'relative'); if (opts.width) $cont.width(opts.width); if (opts.height && opts.height != 'auto') $cont.height(opts.height); if (opts.random) { opts.randomMap = []; for (var i = 0; i < els.length; i++) opts.randomMap.push(i); opts.randomMap.sort(function (a, b) { return Math.random() - 0.5; }); opts.randomIndex = 0; opts.startingSlide = opts.randomMap[0]; } else if (opts.startingSlide >= els.length) opts.startingSlide = 0; var first = opts.startingSlide || 0; $slides.css({ position: 'absolute', top: 0, left: 0 }).hide().each(function (i) { var z = first ? i >= first ? els.length - (i - first) : first - i : els.length - i; $(this).css('z-index', z) }); $(els[first]).css('opacity', 1).show(); if ($.browser.msie) els[first].style.removeAttribute('filter'); if (opts.fit && opts.width) $slides.width(opts.width); if (opts.fit && opts.height && opts.height != 'auto') $slides.height(opts.height); if (opts.pause) $cont.hover(function () { this.cyclePause = 1; }, function () { this.cyclePause = 0; }); var init = $.fn.cycle.transitions[opts.fx]; if ($.isFunction(init)) init($cont, $slides, opts); else if (opts.fx != 'custom') log('unknown transition: ' + opts.fx); $slides.each(function () { var $el = $(this); this.cycleH = (opts.fit && opts.height) ? opts.height : $el.height(); this.cycleW = (opts.fit && opts.width) ? opts.width : $el.width(); }); opts.cssBefore = opts.cssBefore || {}; opts.animIn = opts.animIn || {}; opts.animOut = opts.animOut || {}; $slides.not(':eq(' + first + ')').css(opts.cssBefore); if (opts.cssFirst) $($slides[first]).css(opts.cssFirst); if (opts.timeout) { if (opts.speed.constructor == String) opts.speed = { slow: 600, fast: 200}[opts.speed] || 400; if (!opts.sync) opts.speed = opts.speed / 2; while ((opts.timeout - opts.speed) < 250) opts.timeout += opts.speed; } if (opts.easing) opts.easeIn = opts.easeOut = opts.easing; if (!opts.speedIn) opts.speedIn = opts.speed; if (!opts.speedOut) opts.speedOut = opts.speed; opts.slideCount = els.length; opts.currSlide = first; if (opts.random) { opts.nextSlide = opts.currSlide; if (++opts.randomIndex == els.length) opts.randomIndex = 0; opts.nextSlide = opts.randomMap[opts.randomIndex]; } else
                opts.nextSlide = opts.startingSlide >= (els.length - 1) ? 0 : opts.startingSlide + 1; var e0 = $slides[first]; if (opts.before.length) opts.before[0].apply(e0, [e0, e0, opts, true]); if (opts.after.length > 1) opts.after[1].apply(e0, [e0, e0, opts, true]); if (opts.click && !opts.next) opts.next = opts.click; if (opts.next) $(opts.next).bind('click', function () { return advance(els, opts, opts.rev ? -1 : 1) }); if (opts.prev) $(opts.prev).bind('click', function () { return advance(els, opts, opts.rev ? 1 : -1) }); if (opts.pager) buildPager(els, opts); opts.addSlide = function (newSlide) { var $s = $(newSlide), s = $s[0]; if (!opts.autostopCount) opts.countdown++; els.push(s); if (opts.els) opts.els.push(s); opts.slideCount = els.length; $s.css('position', 'absolute').appendTo($cont); if (ie6 && opts.cleartype && !opts.cleartypeNoBg) clearTypeFix($s); if (opts.fit && opts.width) $s.width(opts.width); if (opts.fit && opts.height && opts.height != 'auto') $slides.height(opts.height); s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height(); s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width(); $s.css(opts.cssBefore); if (typeof opts.onAddSlide == 'function') opts.onAddSlide($s); }; if (opts.timeout || opts.continuous) this.cycleTimeout = setTimeout(function () { go(els, opts, 0, !opts.rev) }, opts.continuous ? 10 : opts.timeout + (opts.delay || 0));
        });
    }; function go(els, opts, manual, fwd) {
        if (opts.busy) return; var p = els[0].parentNode, curr = els[opts.currSlide], next = els[opts.nextSlide]; if (p.cycleTimeout === 0 && !manual) return; if (!manual && !p.cyclePause && ((opts.autostop && (--opts.countdown <= 0)) || (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) { if (opts.end) opts.end(opts); return; } if (manual || !p.cyclePause) {
            if (opts.before.length) $.each(opts.before, function (i, o) { o.apply(next, [curr, next, opts, fwd]); }); var after = function () { if ($.browser.msie && opts.cleartype) this.style.removeAttribute('filter'); $.each(opts.after, function (i, o) { o.apply(next, [curr, next, opts, fwd]); }); }; if (opts.nextSlide != opts.currSlide) {
                opts.busy = 1; if (opts.fxFn) opts.fxFn(curr, next, opts, after, fwd); else if ($.isFunction($.fn.cycle[opts.fx])) $.fn.cycle[opts.fx](curr, next, opts, after); else
                    $.fn.cycle.custom(curr, next, opts, after);
            } if (opts.random) { opts.currSlide = opts.nextSlide; if (++opts.randomIndex == els.length) opts.randomIndex = 0; opts.nextSlide = opts.randomMap[opts.randomIndex]; } else { var roll = (opts.nextSlide + 1) == els.length; opts.nextSlide = roll ? 0 : opts.nextSlide + 1; opts.currSlide = roll ? els.length - 1 : opts.nextSlide - 1; } if (opts.pager) $.fn.cycle.updateActivePagerLink(opts.pager, opts.currSlide);
        } if (opts.timeout && !opts.continuous) p.cycleTimeout = setTimeout(function () { go(els, opts, 0, !opts.rev) }, opts.timeout); else if (opts.continuous && p.cyclePause) p.cycleTimeout = setTimeout(function () { go(els, opts, 0, !opts.rev) }, 10);
    }; $.fn.cycle.updateActivePagerLink = function (pager, currSlide) { $(pager).find('a').removeClass('activeSlide').filter('a:eq(' + currSlide + ')').addClass('activeSlide'); }; function advance(els, opts, val) { var p = els[0].parentNode, timeout = p.cycleTimeout; if (timeout) { clearTimeout(timeout); p.cycleTimeout = 0; } opts.nextSlide = opts.currSlide + val; if (opts.nextSlide < 0) { if (opts.nowrap) return false; opts.nextSlide = els.length - 1; } else if (opts.nextSlide >= els.length) { if (opts.nowrap) return false; opts.nextSlide = 0; } if (opts.prevNextClick && typeof opts.prevNextClick == 'function') opts.prevNextClick(val > 0, opts.nextSlide, els[opts.nextSlide]); go(els, opts, 1, val >= 0); return false; }; function buildPager(els, opts) { var $p = $(opts.pager); $.each(els, function (i, o) { var $a = (typeof opts.pagerAnchorBuilder == 'function') ? $(opts.pagerAnchorBuilder(i, o)) : $('<a href="#">' + (i + 1) + '</a>'); if ($a.parents('body').length == 0) $a.appendTo($p); $a.bind(opts.pagerEvent, function () { opts.nextSlide = i; var p = els[0].parentNode, timeout = p.cycleTimeout; if (timeout) { clearTimeout(timeout); p.cycleTimeout = 0; } if (typeof opts.pagerClick == 'function') opts.pagerClick(opts.nextSlide, els[opts.nextSlide]); go(els, opts, 1, !opts.rev); return false; }); }); $.fn.cycle.updateActivePagerLink(opts.pager, opts.startingSlide); }; function clearTypeFix($slides) { function hex(s) { var s = parseInt(s).toString(16); return s.length < 2 ? '0' + s : s; }; function getBg(e) { for (; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) { var v = $.css(e, 'background-color'); if (v.indexOf('rgb') >= 0) { var rgb = v.match(/\d+/g); return '#' + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); } if (v && v != 'transparent') return v; } return '#ffffff'; }; $slides.each(function () { $(this).css('background-color', getBg(this)); }); }; $.fn.cycle.custom = function (curr, next, opts, cb) { var $l = $(curr), $n = $(next); $n.css(opts.cssBefore); var fn = function () { $n.animate(opts.animIn, opts.speedIn, opts.easeIn, cb) }; $l.animate(opts.animOut, opts.speedOut, opts.easeOut, function () { if (opts.cssAfter) $l.css(opts.cssAfter); if (!opts.sync) fn(); }); if (opts.sync) fn(); }; $.fn.cycle.transitions = { fade: function ($cont, $slides, opts) { $slides.not(':eq(' + opts.startingSlide + ')').css('opacity', 0); opts.before.push(function () { $(this).show() }); opts.animIn = { opacity: 1 }; opts.animOut = { opacity: 0 }; opts.cssBefore = { opacity: 0 }; opts.cssAfter = { display: 'none' }; } }; $.fn.cycle.ver = function () { return ver; }; $.fn.cycle.defaults = { fx: 'scollLeft', timeout: 4000, continuous: 0, speed: 800, speedIn: null, speedOut: null, next: null, prev: null, prevNextClick: null, pager: null, pagerClick: null, pagerEvent: 'click', pagerAnchorBuilder: null, before: null, after: null, end: null, easing: null, easeIn: null, easeOut: null, shuffle: null, animIn: null, animOut: null, cssBefore: null, cssAfter: null, fxFn: null, height: 'auto', startingSlide: 0, sync: 1, random: 0, fit: 0, pause: 1, autostop: 0, autostopCount: 0, delay: 0, slideExpr: null, cleartype: 0, nowrap: 0 };
})(jQuery); (function ($) { $.fn.cycle.transitions.scrollLeft = function ($cont, $slides, opts) { $cont.css('overflow', 'hidden'); opts.before.push(function (curr, next, opts) { $(this).show(); opts.cssBefore.left = next.offsetWidth; opts.animOut.left = 0 - curr.offsetWidth; }); opts.cssFirst = { left: 0 }; opts.animIn = { left: 0 }; }; $.fn.cycle.transitions.scrollRight = function ($cont, $slides, opts) { $cont.css('overflow', 'hidden'); opts.before.push(function (curr, next, opts) { $(this).show(); opts.cssBefore.left = 0 - next.offsetWidth; opts.animOut.left = curr.offsetWidth; }); opts.cssFirst = { left: 0 }; opts.animIn = { left: 0 }; }; $.fn.cycle.transitions.scrollHorz = function ($cont, $slides, opts) { $cont.css('overflow', 'hidden').width(); opts.before.push(function (curr, next, opts, fwd) { $(this).show(); var currW = curr.offsetWidth, nextW = next.offsetWidth; opts.cssBefore = fwd ? { left: nextW} : { left: -nextW }; opts.animIn.left = 0; opts.animOut.left = fwd ? -currW : currW; $slides.not(curr).css(opts.cssBefore); }); opts.cssFirst = { left: 0 }; opts.cssAfter = { display: 'none'} }; })(jQuery); (function ($) {
    $.toJSON = function (o) {
        if (typeof (JSON) == 'object' && JSON.stringify) return JSON.stringify(o); var type = typeof (o); if (o === null) return "null"; if (type == "undefined") return undefined; if (type == "number" || type == "boolean") return o + ""; if (type == "string") return $.quoteString(o); if (type == 'object') {
            if (typeof o.toJSON == "function") return $.toJSON(o.toJSON()); if (o.constructor === Date) { var month = o.getUTCMonth() + 1; if (month < 10) month = '0' + month; var day = o.getUTCDate(); if (day < 10) day = '0' + day; var year = o.getUTCFullYear(); var hours = o.getUTCHours(); if (hours < 10) hours = '0' + hours; var minutes = o.getUTCMinutes(); if (minutes < 10) minutes = '0' + minutes; var seconds = o.getUTCSeconds(); if (seconds < 10) seconds = '0' + seconds; var milli = o.getUTCMilliseconds(); if (milli < 100) milli = '0' + milli; if (milli < 10) milli = '0' + milli; return '"' + year + '-' + month + '-' + day + 'T' + hours + ':' + minutes + ':' + seconds + '.' + milli + 'Z"'; } if (o.constructor === Array) { var ret = []; for (var i = 0; i < o.length; i++) ret.push($.toJSON(o[i]) || "null"); return "[" + ret.join(",") + "]"; } var pairs = []; for (var k in o) {
                var name; var type = typeof k; if (type == "number") name = '"' + k + '"'; else if (type == "string") name = $.quoteString(k); else
                    continue; if (typeof o[k] == "function") continue; var val = $.toJSON(o[k]); pairs.push(name + ":" + val);
            } return "{" + pairs.join(", ") + "}";
        } 
    }; $.evalJSON = function (src) { if (typeof (JSON) == 'object' && JSON.parse) return JSON.parse(src); return eval("(" + src + ")"); }; $.secureEvalJSON = function (src) {
        if (typeof (JSON) == 'object' && JSON.parse) return JSON.parse(src); var filtered = src; filtered = filtered.replace(/\\["\\\/bfnrtu]/g, '@'); filtered = filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']'); filtered = filtered.replace(/(?:^|:|,)(?:\s*\[)+/g, ''); if (/^[\],:{}\s]*$/.test(filtered)) return eval("(" + src + ")"); else
            throw new SyntaxError("Error parsing JSON, source is not valid.");
    }; $.quoteString = function (string) { if (string.match(_escapeable)) { return '"' + string.replace(_escapeable, function (a) { var c = _meta[a]; if (typeof c === 'string') return c; c = a.charCodeAt(); return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); }) + '"'; } return '"' + string + '"'; }; var _escapeable = /["\\\x00-\x1f\x7f-\x9f]/g; var _meta = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"': '\\"', '\\': '\\\\' };
})(jQuery); (function ($) { $.fn.marquee = function (o) { o = $.extend({ speed: parseInt($(this).attr('speed')) || 30, step: parseInt($(this).attr('step')) || 1, direction: $(this).attr('direction') || 'up', pause: parseInt($(this).attr('pause')) || 1000 }, o || {}); var dIndex = jQuery.inArray(o.direction, ['right', 'down']); if (dIndex > -1) { o.direction = ['left', 'up'][dIndex]; o.step = -o.step; } var mid; var div = $(this); var divWidth = div.innerWidth(); var divHeight = div.innerHeight(); var ul = $("ul", div); var li = $("li", ul); var liSize = li.size(); var liWidth = li.width(); var liHeight = li.height(); var width = liWidth * liSize; var height = liHeight * liSize; if ((o.direction == 'left' && width > divWidth) || (o.direction == 'up' && height > divHeight)) { if (o.direction == 'left') { ul.width(2 * liSize * liWidth); if (o.step < 0) div.scrollLeft(width); } else { ul.height(2 * liSize * liHeight); if (o.step < 0) div.scrollTop(height); } ul.append(li.clone()); mid = setInterval(_marquee, o.speed); div.hover(function () { clearInterval(mid); }, function () { mid = setInterval(_marquee, o.speed); }); } function _marquee() { if (o.direction == 'left') { var l = div.scrollLeft(); if (o.step < 0) { div.scrollLeft((l <= 0 ? width : l) + o.step); } else { div.scrollLeft((l >= width ? 0 : l) + o.step); } if (l % liWidth == 0) _pause(); } else { var t = div.scrollTop(); if (o.step < 0) { div.scrollTop((t <= 0 ? height : t) + o.step); } else { div.scrollTop((t >= height ? 0 : t) + o.step); } if (t % liHeight == 0) _pause(); } } function _pause() { if (o.pause > 0) { var tempStep = o.step; o.step = 0; setTimeout(function () { o.step = tempStep; }, o.pause); } } }; })(jQuery); $(document).ready(function () { $(".marquee").each(function () { $(this).marquee(); }); }); new function (settings) {
    var $separator = settings.separator || '&'; var $spaces = settings.spaces === false ? false : true; var $suffix = settings.suffix === false ? '' : '[]'; var $prefix = settings.prefix === false ? false : true; var $hash = $prefix ? settings.hash === true ? "#" : "?" : ""; var $numbers = settings.numbers === false ? false : true; jQuery.query = new function () {
        var is = function (o, t) { return o != undefined && o !== null && (!!t ? o.constructor == t : true); }; var parse = function (path) { var m, rx = /\[([^[]*)\]/g, match = /^([^[]+)(\[.*\])?$/.exec(path), base = match[1], tokens = []; while (m = rx.exec(match[2])) tokens.push(m[1]); return [base, tokens]; }; var set = function (target, tokens, value) { var o, token = tokens.shift(); if (typeof target != 'object') target = null; if (token === "") { if (!target) target = []; if (is(target, Array)) { target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value)); } else if (is(target, Object)) { var i = 0; while (target[i++] != null); target[--i] = tokens.length == 0 ? value : set(target[i], tokens.slice(0), value); } else { target = []; target.push(tokens.length == 0 ? value : set(null, tokens.slice(0), value)); } } else if (token && token.match(/^\s*[0-9]+\s*$/)) { var index = parseInt(token, 10); if (!target) target = []; target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value); } else if (token) { var index = token.replace(/^\s*|\s*$/g, ""); if (!target) target = {}; if (is(target, Array)) { var temp = {}; for (var i = 0; i < target.length; ++i) { temp[i] = target[i]; } target = temp; } target[index] = tokens.length == 0 ? value : set(target[index], tokens.slice(0), value); } else { return value; } return target; }; var queryObject = function (a) { var self = this; self.keys = {}; if (a.queryObject) { jQuery.each(a.get(), function (key, val) { self.SET(key, val); }); } else { jQuery.each(arguments, function () { var q = "" + this; q = q.replace(/^[?#]/, ''); q = q.replace(/[;&]$/, ''); if ($spaces) q = q.replace(/[+]/g, ' '); jQuery.each(q.split(/[&;]/), function () { var key = decodeURIComponent(this.split('=')[0] || ""); var val = decodeURIComponent(this.split('=')[1] || ""); if (!key) return; if ($numbers) { if (/^[+-]?[0-9]+\.[0-9]*$/.test(val)) val = parseFloat(val); else if (/^[+-]?[0-9]+$/.test(val)) val = parseInt(val, 10); } val = (!val && val !== 0) ? true : val; if (val !== false && val !== true && typeof val != 'number') val = val; self.SET(key, val); }); }); } return self; }; queryObject.prototype = { queryObject: true, has: function (key, type) { var value = this.get(key); return is(value, type); }, GET: function (key) { if (!is(key)) return this.keys; var parsed = parse(key), base = parsed[0], tokens = parsed[1]; var target = this.keys[base]; while (target != null && tokens.length != 0) { target = target[tokens.shift()]; } return typeof target == 'number' ? target : target || ""; }, get: function (key) { var target = this.GET(key); if (is(target, Object)) return jQuery.extend(true, {}, target); else if (is(target, Array)) return target.slice(0); return target; }, SET: function (key, val) { var value = !is(val) ? null : val; var parsed = parse(key), base = parsed[0], tokens = parsed[1]; var target = this.keys[base]; this.keys[base] = set(target, tokens.slice(0), value); return this; }, set: function (key, val) { return this.copy().SET(key, val); }, REMOVE: function (key) { return this.SET(key, null).COMPACT(); }, remove: function (key) { return this.copy().REMOVE(key); }, EMPTY: function () { var self = this; jQuery.each(self.keys, function (key, value) { delete self.keys[key]; }); return self; }, load: function (url) { var hash = url.replace(/^.*?[#](.+?)(?:\?.+)?$/, "$1"); var search = url.replace(/^.*?[?](.+?)(?:#.+)?$/, "$1"); return new queryObject(url.length == search.length ? '' : search, url.length == hash.length ? '' : hash); }, empty: function () { return this.copy().EMPTY(); }, copy: function () { return new queryObject(this); }, COMPACT: function () {
            function build(orig) {
                var obj = typeof orig == "object" ? is(orig, Array) ? [] : {} : orig; if (typeof orig == 'object') {
                    function add(o, key, value) {
                        if (is(o, Array)) o.push(value); else
                            o[key] = value;
                    } jQuery.each(orig, function (key, value) { if (!is(value)) return true; add(obj, key, build(value)); });
                } return obj;
            } this.keys = build(this.keys); return this;
        }, compact: function () { return this.copy().COMPACT(); }, toString: function () {
            var i = 0, queryString = [], chunks = [], self = this; var encode = function (str) { str = str + ""; if ($spaces) str = str.replace(/ /g, "+"); return encodeURIComponent(str); }; var addFields = function (arr, key, value) { if (!is(value) || value === false) return; var o = [encode(key)]; if (value !== true) { o.push("="); o.push(encode(value)); } arr.push(o.join("")); }; var build = function (obj, base) {
                var newKey = function (key) { return !base || base == "" ? [key].join("") : [base, "[", key, "]"].join(""); }; jQuery.each(obj, function (key, value) {
                    if (typeof value == 'object') build(value, newKey(key)); else
                        addFields(chunks, newKey(key), value);
                });
            }; build(this.keys); if (chunks.length > 0) queryString.push($hash); queryString.push(chunks.join($separator)); return queryString.join("");
        } 
        }; return new queryObject(location.search, location.hash);
    };
} (jQuery.query || {}); ; (function ($) {
    if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery); return; } $.fn._fadeIn = $.fn.fadeIn; var noOp = function () { }; var mode = document.documentMode || 0; var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8); var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode; $.blockUI = function (opts) { install(window, opts); }; $.unblockUI = function (opts) { remove(window, opts); }; $.growlUI = function (title, message, timeout, onClose) { var $m = $('<div class="growlUI"></div>'); if (title) $m.append('<h1>' + title + '</h1>'); if (message) $m.append('<h2>' + message + '</h2>'); if (timeout == undefined) timeout = 3000; $.blockUI({ message: $m, fadeIn: 700, fadeOut: 1000, centerY: false, timeout: timeout, showOverlay: false, onUnblock: onClose, css: $.blockUI.defaults.growlCSS }); }; $.fn.block = function (opts) { return this.unblock({ fadeOut: 0 }).each(function () { if ($.css(this, 'position') == 'static') this.style.position = 'relative'; if ($.browser.msie) this.style.zoom = 1; install(this, opts); }); }; $.fn.unblock = function (opts) { return this.each(function () { remove(this, opts); }); }; $.blockUI.version = 2.35; $.blockUI.defaults = { message: '<h1>Please wait...</h1>', title: null, draggable: true, theme: false, css: { padding: 0, margin: 0, width: '30%', top: '40%', left: '35%', textAlign: 'center', color: '#000', border: '3px solid #aaa', backgroundColor: '#fff', cursor: 'wait' }, themedCSS: { width: '30%', top: '40%', left: '35%' }, overlayCSS: { backgroundColor: '#000', opacity: 0.6, cursor: 'wait' }, growlCSS: { width: '350px', top: '10px', left: '', right: '10px', border: 'none', padding: '5px', opacity: 0.6, cursor: 'default', color: '#fff', backgroundColor: '#000', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', 'border-radius': '10px' }, iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', forceIframe: false, baseZ: 1000, centerX: true, centerY: true, allowBodyStretch: true, bindEvents: true, constrainTabKey: true, fadeIn: 200, fadeOut: 400, timeout: 0, showOverlay: true, focusInput: true, applyPlatformOpacityRules: true, onBlock: null, onUnblock: null, quirksmodeOffsetHack: 4, blockMsgClass: 'blockMsg' }; var pageBlock = null; var pageBlockEls = []; function install(el, opts) {
        var full = (el == window); var msg = opts && opts.message !== undefined ? opts.message : undefined; opts = $.extend({}, $.blockUI.defaults, opts || {}); opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {}); var css = $.extend({}, $.blockUI.defaults.css, opts.css || {}); var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {}); msg = msg === undefined ? opts.message : msg; if (full && pageBlock) remove(window, { fadeOut: 0 }); if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) { var node = msg.jquery ? msg[0] : msg; var data = {}; $(el).data('blockUI.history', data); data.el = node; data.parent = node.parentNode; data.display = node.style.display; data.position = node.style.position; if (data.parent) data.parent.removeChild(node); } var z = opts.baseZ; var lyr1 = ($.browser.msie || opts.forceIframe) ? $('<iframe class="blockUI" style="z-index:' + (z++) + ';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="' + opts.iframeSrc + '"></iframe>') : $('<div class="blockUI" style="display:none"></div>'); var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:' + (z++) + ';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'); var lyr3, s; if (opts.theme && full) { s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:' + z + ';display:none;position:fixed">' + '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">' + (opts.title || '&nbsp;') + '</div>' + '<div class="ui-widget-content ui-dialog-content"></div>' + '</div>'; } else if (opts.theme) { s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:' + z + ';display:none;position:absolute">' + '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">' + (opts.title || '&nbsp;') + '</div>' + '<div class="ui-widget-content ui-dialog-content"></div>' + '</div>'; } else if (full) { s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:' + z + ';display:none;position:fixed"></div>'; } else { s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:' + z + ';display:none;position:absolute"></div>'; } lyr3 = $(s); if (msg) {
            if (opts.theme) { lyr3.css(themedCSS); lyr3.addClass('ui-widget-content'); } else
                lyr3.css(css);
        } if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))) lyr2.css(opts.overlayCSS); lyr2.css('position', full ? 'fixed' : 'absolute'); if ($.browser.msie || opts.forceIframe) lyr1.css('opacity', 0.0); var layers = [lyr1, lyr2, lyr3], $par = full ? $('body') : $(el); $.each(layers, function () { this.appendTo($par); }); if (opts.theme && opts.draggable && $.fn.draggable) { lyr3.draggable({ handle: '.ui-dialog-titlebar', cancel: 'li' }); } var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0); if (ie6 || expr) { if (full && opts.allowBodyStretch && $.boxModel) $('html,body').css('height', '100%'); if ((ie6 || !$.boxModel) && !full) { var t = sz(el, 'borderTopWidth'), l = sz(el, 'borderLeftWidth'); var fixT = t ? '(0 - ' + t + ')' : 0; var fixL = l ? '(0 - ' + l + ')' : 0; } $.each([lyr1, lyr2, lyr3], function (i, o) { var s = o[0].style; s.position = 'absolute'; if (i < 2) { full ? s.setExpression('height', 'Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:' + opts.quirksmodeOffsetHack + ') + "px"') : s.setExpression('height', 'this.parentNode.offsetHeight + "px"'); full ? s.setExpression('width', 'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') : s.setExpression('width', 'this.parentNode.offsetWidth + "px"'); if (fixL) s.setExpression('left', fixL); if (fixT) s.setExpression('top', fixT); } else if (opts.centerY) { if (full) s.setExpression('top', '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); s.marginTop = 0; } else if (!opts.centerY && full) { var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0; var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + ' + top + ') + "px"'; s.setExpression('top', expression); } }); } if (msg) {
            if (opts.theme) lyr3.find('.ui-widget-content').append(msg); else
                lyr3.append(msg); if (msg.jquery || msg.nodeType) $(msg).show();
        } if (($.browser.msie || opts.forceIframe) && opts.showOverlay) lyr1.show(); if (opts.fadeIn) { var cb = opts.onBlock ? opts.onBlock : noOp; var cb1 = (opts.showOverlay && !msg) ? cb : noOp; var cb2 = msg ? cb : noOp; if (opts.showOverlay) lyr2._fadeIn(opts.fadeIn, cb1); if (msg) lyr3._fadeIn(opts.fadeIn, cb2); } else { if (opts.showOverlay) lyr2.show(); if (msg) lyr3.show(); if (opts.onBlock) opts.onBlock(); } bind(1, el, opts); if (full) { pageBlock = lyr3[0]; pageBlockEls = $(':input:enabled:visible', pageBlock); if (opts.focusInput) setTimeout(focus, 20); } else
            center(lyr3[0], opts.centerX, opts.centerY); if (opts.timeout) { var to = setTimeout(function () { full ? $.unblockUI(opts) : $(el).unblock(opts); }, opts.timeout); $(el).data('blockUI.timeout', to); } 
    }; function remove(el, opts) {
        var full = (el == window); var $el = $(el); var data = $el.data('blockUI.history'); var to = $el.data('blockUI.timeout'); if (to) { clearTimeout(to); $el.removeData('blockUI.timeout'); } opts = $.extend({}, $.blockUI.defaults, opts || {}); bind(0, el, opts); var els; if (full) els = $('body').children().filter('.blockUI').add('body > .blockUI'); else
            els = $('.blockUI', el); if (full) pageBlock = pageBlockEls = null; if (opts.fadeOut) { els.fadeOut(opts.fadeOut); setTimeout(function () { reset(els, data, opts, el); }, opts.fadeOut); } else
            reset(els, data, opts, el);
    }; function reset(els, data, opts, el) { els.each(function (i, o) { if (this.parentNode) this.parentNode.removeChild(this); }); if (data && data.el) { data.el.style.display = data.display; data.el.style.position = data.position; if (data.parent) data.parent.appendChild(data.el); $(el).removeData('blockUI.history'); } if (typeof opts.onUnblock == 'function') opts.onUnblock(el, opts); }; function bind(b, el, opts) { var full = el == window, $el = $(el); if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked'))) return; if (!full) $el.data('blockUI.isBlocked', b); if (!opts.bindEvents || (b && !opts.showOverlay)) return; var events = 'mousedown mouseup keydown keypress'; b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler); }; function handler(e) { if (e.keyCode && e.keyCode == 9) { if (pageBlock && e.data.constrainTabKey) { var els = pageBlockEls; var fwd = !e.shiftKey && e.target == els[els.length - 1]; var back = e.shiftKey && e.target == els[0]; if (fwd || back) { setTimeout(function () { focus(back) }, 10); return false; } } } var opts = e.data; if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0) return true; return $(e.target).parents().children().filter('div.blockUI').length == 0; }; function focus(back) { if (!pageBlockEls) return; var e = pageBlockEls[back === true ? pageBlockEls.length - 1 : 0]; if (e) e.focus(); }; function center(el, x, y) { var p = el.parentNode, s = el.style; var l = ((p.offsetWidth - el.offsetWidth) / 2) - sz(p, 'borderLeftWidth'); var t = ((p.offsetHeight - el.offsetHeight) / 2) - sz(p, 'borderTopWidth'); if (x) s.left = l > 0 ? (l + 'px') : '0'; if (y) s.top = t > 0 ? (t + 'px') : '0'; }; function sz(el, p) { return parseInt($.css(el, p)) || 0; };
})(jQuery);
