﻿/*jquery.json.2.2*/

(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);

/*
* jQuery Autocomplete plugin 1.1
*
* Copyright (c) 2009 Jörn Zaefferer
*
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $
*/
; (function ($) {
	$.fn.extend({ autocomplete: function (urlOrData, options) { var isUrl = typeof urlOrData == "string"; options = $.extend({}, $.Autocompleter.defaults, { url: isUrl ? urlOrData : null, data: isUrl ? null : urlOrData, delay: isUrl ? $.Autocompleter.defaults.delay : 10, max: options && !options.scroll ? 10 : 150 }, options); options.highlight = options.highlight || function (value) { return value; }; options.formatMatch = options.formatMatch || options.formatItem; return this.each(function () { new $.Autocompleter(this, options); }); }, result: function (handler) { return this.bind("result", handler); }, search: function (handler) { return this.trigger("search", [handler]); }, flushCache: function () { return this.trigger("flushCache"); }, setOptions: function (options) { return this.trigger("setOptions", [options]); }, unautocomplete: function () { return this.trigger("unautocomplete"); } }); $.Autocompleter = function (input, options) { var KEY = { UP: 38, DOWN: 40, DEL: 46, TAB: 9, RETURN: 13, ESC: 27, COMMA: 188, PAGEUP: 33, PAGEDOWN: 34, BACKSPACE: 8 }; var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); var timeout; var previousValue = ""; var cache = $.Autocompleter.Cache(options); var hasFocus = 0; var lastKeyPressCode; var config = { mouseDownOnSelect: false }; var select = $.Autocompleter.Select(options, input, selectCurrent, config); var blockSubmit; $.browser.opera && $(input.form).bind("submit.autocomplete", function () { if (blockSubmit) { blockSubmit = false; return false; } }); $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function (event) { hasFocus = 1; lastKeyPressCode = event.keyCode; switch (event.keyCode) { case KEY.UP: event.preventDefault(); if (select.visible()) { select.prev(); } else { onChange(0, true); } break; case KEY.DOWN: event.preventDefault(); if (select.visible()) { select.next(); } else { onChange(0, true); } break; case KEY.PAGEUP: event.preventDefault(); if (select.visible()) { select.pageUp(); } else { onChange(0, true); } break; case KEY.PAGEDOWN: event.preventDefault(); if (select.visible()) { select.pageDown(); } else { onChange(0, true); } break; case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: case KEY.TAB: case KEY.RETURN: if (selectCurrent()) { event.preventDefault(); blockSubmit = true; return false; } break; case KEY.ESC: select.hide(); break; default: clearTimeout(timeout); timeout = setTimeout(onChange, options.delay); break; } }).focus(function () { hasFocus++; }).blur(function () { hasFocus = 0; if (!config.mouseDownOnSelect) { hideResults(); } }).click(function () { if (hasFocus++ > 1 && !select.visible()) { onChange(0, true); } }).bind("search", function () { var fn = (arguments.length > 1) ? arguments[1] : null; function findValueCallback(q, data) { var result; if (data && data.length) { for (var i = 0; i < data.length; i++) { if (data[i].result.toLowerCase() == q.toLowerCase()) { result = data[i]; break; } } } if (typeof fn == "function") fn(result); else $input.trigger("result", result && [result.data, result.value]); } $.each(trimWords($input.val()), function (i, value) { request(value, findValueCallback, findValueCallback); }); }).bind("flushCache", function () { cache.flush(); }).bind("setOptions", function () { $.extend(options, arguments[1]); if ("data" in arguments[1]) cache.populate(); }).bind("unautocomplete", function () { select.unbind(); $input.unbind(); $(input.form).unbind(".autocomplete"); }); function selectCurrent() { var selected = select.selected(); if (!selected) return false; var v = selected.result; previousValue = v; if (options.multiple) { var words = trimWords($input.val()); if (words.length > 1) { var seperator = options.multipleSeparator.length; var cursorAt = $(input).selection().start; var wordAt, progress = 0; $.each(words, function (i, word) { progress += word.length; if (cursorAt <= progress) { wordAt = i; return false; } progress += seperator; }); words[wordAt] = v; v = words.join(options.multipleSeparator); } v += options.multipleSeparator; } $input.val(v); hideResultsNow(); $input.trigger("result", [selected.data, selected.value]); return true; } function onChange(crap, skipPrevCheck) { if (lastKeyPressCode == KEY.DEL) { select.hide(); return; } var currentValue = $input.val(); if (!skipPrevCheck && currentValue == previousValue) return; previousValue = currentValue; currentValue = lastWord(currentValue); if (currentValue.length >= options.minChars) { $input.addClass(options.loadingClass); if (!options.matchCase) currentValue = currentValue.toLowerCase(); request(currentValue, receiveData, hideResultsNow); } else { stopLoading(); select.hide(); } }; function trimWords(value) { if (!value) return [""]; if (!options.multiple) return [$.trim(value)]; return $.map(value.split(options.multipleSeparator), function (word) { return $.trim(value).length ? $.trim(word) : null; }); } function lastWord(value) { if (!options.multiple) return value; var words = trimWords(value); if (words.length == 1) return words[0]; var cursorAt = $(input).selection().start; if (cursorAt == value.length) { words = trimWords(value) } else { words = trimWords(value.replace(value.substring(cursorAt), "")); } return words[words.length - 1]; } function autoFill(q, sValue) { if (options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE) { $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); $(input).selection(previousValue.length, previousValue.length + sValue.length); } }; function hideResults() { clearTimeout(timeout); timeout = setTimeout(hideResultsNow, 200); }; function hideResultsNow() { var wasVisible = select.visible(); select.hide(); clearTimeout(timeout); stopLoading(); if (options.mustMatch) { $input.search(function (result) { if (!result) { if (options.multiple) { var words = trimWords($input.val()).slice(0, -1); $input.val(words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "")); } else { $input.val(""); $input.trigger("result", null); } } }); } }; function receiveData(q, data) { if (data && data.length && hasFocus) { stopLoading(); select.display(data, q); autoFill(q, data[0].value); select.show(); } else { hideResultsNow(); } }; function request(term, success, failure) { if (!options.matchCase) term = term.toLowerCase(); var data = cache.load(term); if (data && data.length) { success(term, data); } else if ((typeof options.url == "string") && (options.url.length > 0)) { var extraParams = { timestamp: +new Date() }; $.each(options.extraParams, function (key, param) { extraParams[key] = typeof param == "function" ? param() : param; }); $.ajax({ mode: "abort", port: "autocomplete" + input.name, dataType: options.dataType, url: options.url, data: $.extend({ q: lastWord(term), limit: options.max }, extraParams), success: function (data) { var parsed = options.parse && options.parse(data) || parse(data); cache.add(term, parsed); success(term, parsed); } }); } else { select.emptyList(); failure(term); } }; function parse(data) { var parsed = []; var rows = data.split("\n"); for (var i = 0; i < rows.length; i++) { var row = $.trim(rows[i]); if (row) { row = row.split("|"); parsed[parsed.length] = { data: row, value: row[0], result: options.formatResult && options.formatResult(row, row[0]) || row[0] }; } } return parsed; }; function stopLoading() { $input.removeClass(options.loadingClass); }; }; $.Autocompleter.defaults = { inputClass: "ac_input", resultsClass: "ac_results", loadingClass: "ac_loading", minChars: 1, delay: 400, matchCase: false, matchSubset: true, matchContains: false, cacheLength: 10, max: 100, mustMatch: false, extraParams: {}, selectFirst: true, formatItem: function (row) { return row[0]; }, formatMatch: null, autoFill: false, width: 0, multiple: false, multipleSeparator: ", ", highlight: function (value, term) { return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>"); }, scroll: true, scrollHeight: 180 }; $.Autocompleter.Cache = function (options) {
		var data = {}; var length = 0; function matchSubset(s, sub) { if (!options.matchCase) s = s.toLowerCase(); var i = s.indexOf(sub); if (options.matchContains == "word") { i = s.toLowerCase().search("\\b" + sub.toLowerCase()); } if (i == -1) return false; return i == 0 || options.matchContains; }; function add(q, value) { if (length > options.cacheLength) { flush(); } if (!data[q]) { length++; } data[q] = value; } function populate() { if (!options.data) return false; var stMatchSets = {}, nullData = 0; if (!options.url) options.cacheLength = 1; stMatchSets[""] = []; for (var i = 0, ol = options.data.length; i < ol; i++) { var rawValue = options.data[i]; rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; var value = options.formatMatch(rawValue, i + 1, options.data.length); if (value === false) continue; var firstChar = value.charAt(0).toLowerCase(); if (!stMatchSets[firstChar]) stMatchSets[firstChar] = []; var row = { value: value, data: rawValue, result: options.formatResult && options.formatResult(rawValue) || value }; stMatchSets[firstChar].push(row); if (nullData++ < options.max) { stMatchSets[""].push(row); } }; $.each(stMatchSets, function (i, value) { options.cacheLength++; add(i, value); }); } setTimeout(populate, 25); function flush() { data = {}; length = 0; } return { flush: flush, add: add, populate: populate, load: function (q) {
			if (!options.cacheLength || !length) return null; if (!options.url && options.matchContains) { var csub = []; for (var k in data) { if (k.length > 0) { var c = data[k]; $.each(c, function (i, x) { if (matchSubset(x.value, q)) { csub.push(x); } }); } } return csub; } else
				if (data[q]) { return data[q]; } else
					if (options.matchSubset) { for (var i = q.length - 1; i >= options.minChars; i--) { var c = data[q.substr(0, i)]; if (c) { var csub = []; $.each(c, function (i, x) { if (matchSubset(x.value, q)) { csub[csub.length] = x; } }); return csub; } } } return null;
		} 
		};
	}; $.Autocompleter.Select = function (options, input, select, config) { var CLASSES = { ACTIVE: "ac_over" }; var listItems, active = -1, data, term = "", needsInit = true, element, list; function init() { if (!needsInit) return; element = $("<div/>").hide().addClass(options.resultsClass).css("position", "absolute").appendTo(document.body); list = $("<ul/>").appendTo(element).mouseover(function (event) { if (target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); $(target(event)).addClass(CLASSES.ACTIVE); } }).click(function (event) { $(target(event)).addClass(CLASSES.ACTIVE); select(); input.focus(); return false; }).mousedown(function () { config.mouseDownOnSelect = true; }).mouseup(function () { config.mouseDownOnSelect = false; }); if (options.width > 0) element.css("width", options.width); needsInit = false; } function target(event) { var element = event.target; while (element && element.tagName != "LI") element = element.parentNode; if (!element) return []; return element; } function moveSelect(step) { listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); movePosition(step); var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); if (options.scroll) { var offset = 0; listItems.slice(0, active).each(function () { offset += this.offsetHeight; }); if ((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); } else if (offset < list.scrollTop()) { list.scrollTop(offset); } } }; function movePosition(step) { active += step; if (active < 0) { active = listItems.size() - 1; } else if (active >= listItems.size()) { active = 0; } } function limitNumberOfItems(available) { return options.max && options.max < available ? options.max : available; } function fillList() { list.empty(); var max = limitNumberOfItems(data.length); for (var i = 0; i < max; i++) { if (!data[i]) continue; var formatted = options.formatItem(data[i].data, i + 1, max, data[i].value, term); if (formatted === false) continue; var li = $("<li/>").html(options.highlight(formatted, term)).addClass(i % 2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; $.data(li, "ac_data", data[i]); } listItems = list.find("li"); if (options.selectFirst) { listItems.slice(0, 1).addClass(CLASSES.ACTIVE); active = 0; } if ($.fn.bgiframe) list.bgiframe(); } return { display: function (d, q) { init(); data = d; term = q; fillList(); }, next: function () { moveSelect(1); }, prev: function () { moveSelect(-1); }, pageUp: function () { if (active != 0 && active - 8 < 0) { moveSelect(-active); } else { moveSelect(-8); } }, pageDown: function () { if (active != listItems.size() - 1 && active + 8 > listItems.size()) { moveSelect(listItems.size() - 1 - active); } else { moveSelect(8); } }, hide: function () { element && element.hide(); listItems && listItems.removeClass(CLASSES.ACTIVE); active = -1; }, visible: function () { return element && element.is(":visible"); }, current: function () { return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); }, show: function () { var offset = $(input).offset(); element.css({ width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(), top: offset.top + input.offsetHeight, left: offset.left }).show(); if (options.scroll) { list.scrollTop(0); list.css({ maxHeight: options.scrollHeight, overflow: 'auto' }); if ($.browser.msie && typeof document.body.style.maxHeight === "undefined") { var listHeight = 0; listItems.each(function () { listHeight += this.offsetHeight; }); var scrollbarsVisible = listHeight > options.scrollHeight; list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight); if (!scrollbarsVisible) { listItems.width(list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right"))); } } } }, selected: function () { var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); return selected && selected.length && $.data(selected[0], "ac_data"); }, emptyList: function () { list && list.empty(); }, unbind: function () { element && element.remove(); } }; }; $.fn.selection = function (start, end) { if (start !== undefined) { return this.each(function () { if (this.createTextRange) { var selRange = this.createTextRange(); if (end === undefined || start == end) { selRange.move("character", start); selRange.select(); } else { selRange.collapse(true); selRange.moveStart("character", start); selRange.moveEnd("character", end); selRange.select(); } } else if (this.setSelectionRange) { this.setSelectionRange(start, end); } else if (this.selectionStart) { this.selectionStart = start; this.selectionEnd = end; } }); } var field = this[0]; if (field.createTextRange) { var range = document.selection.createRange(), orig = field.value, teststring = "<->", textLength = range.text.length; range.text = teststring; var caretAt = field.value.indexOf(teststring); field.value = orig; this.selection(caretAt, caretAt + textLength); return { start: caretAt, end: caretAt + textLength} } else if (field.selectionStart !== undefined) { return { start: field.selectionStart, end: field.selectionEnd} } };
})(jQuery);

// ColorBox v1.3.17.2 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function (a, b, c) { function bc(b) { if (!U) { P = b, _(), y = a(P), Q = 0, K.rel !== "nofollow" && (y = a("." + g).filter(function () { var b = a.data(this, e).rel || this.rel; return b === K.rel }), Q = y.index(P), Q === -1 && (y = y.add(P), Q = y.length - 1)); if (!S) { S = T = !0, r.show(); if (K.returnFocus) try { P.blur(), a(P).one(l, function () { try { this.focus() } catch (a) { } }) } catch (c) { } q.css({ opacity: +K.opacity, cursor: K.overlayClose ? "pointer" : "auto" }).show(), K.w = Z(K.initialWidth, "x"), K.h = Z(K.initialHeight, "y"), X.position(), o && z.bind("resize." + p + " scroll." + p, function () { q.css({ width: z.width(), height: z.height(), top: z.scrollTop(), left: z.scrollLeft() }) }).trigger("resize." + p), ba(h, K.onOpen), J.add(D).hide(), I.html(K.close).show() } X.load(!0) } } function bb() { var a, b = f + "Slideshow_", c = "click." + f, d, e, g; K.slideshow && y[1] ? (d = function () { F.text(K.slideshowStop).unbind(c).bind(j, function () { if (Q < y.length - 1 || K.loop) a = setTimeout(X.next, K.slideshowSpeed) }).bind(i, function () { clearTimeout(a) }).one(c + " " + k, e), r.removeClass(b + "off").addClass(b + "on"), a = setTimeout(X.next, K.slideshowSpeed) }, e = function () { clearTimeout(a), F.text(K.slideshowStart).unbind([j, i, k, c].join(" ")).one(c, d), r.removeClass(b + "on").addClass(b + "off") }, K.slideshowAuto ? d() : e()) : r.removeClass(b + "off " + b + "on") } function ba(b, c) { c && c.call(P), a.event.trigger(b) } function _(b) { K = a.extend({}, a.data(P, e)); for (b in K) a.isFunction(K[b]) && b.substring(0, 2) !== "on" && (K[b] = K[b].call(P)); K.rel = K.rel || P.rel || "nofollow", K.href = K.href || a(P).attr("href"), K.title = K.title || P.title, typeof K.href == "string" && (K.href = a.trim(K.href)) } function $(a) { return K.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(a) } function Z(a, b) { return Math.round((/%/.test(a) ? (b === "x" ? z.width() : z.height()) / 100 : 1) * parseInt(a, 10)) } function Y(c, d, e) { e = b.createElement("div"), c && (e.id = f + c), e.style.cssText = d || ""; return a(e) } var d = { transition: "elastic", speed: 300, width: !1, initialWidth: "600", innerWidth: !1, maxWidth: !1, height: !1, initialHeight: "450", innerHeight: !1, maxHeight: !1, scalePhotos: !0, scrolling: !0, inline: !1, html: !1, iframe: !1, fastIframe: !0, photo: !1, href: !1, title: !1, rel: !1, opacity: .9, preloading: !0, current: "image {current} of {total}", previous: "上一个", next: "下一个", close: "关闭", open: !1, returnFocus: !0, loop: !0, slideshow: !1, slideshowAuto: !0, slideshowSpeed: 2500, slideshowStart: "start slideshow", slideshowStop: "stop slideshow", onOpen: !1, onLoad: !1, onComplete: !1, onCleanup: !1, onClosed: !1, overlayClose: !0, escKey: !0, arrowKey: !0, top: !1, bottom: !1, left: !1, right: !1, fixed: !1, data: !1 }, e = "colorbox", f = "cbox", g = f + "Element", h = f + "_open", i = f + "_load", j = f + "_complete", k = f + "_cleanup", l = f + "_closed", m = f + "_purge", n = a.browser.msie && !a.support.opacity, o = n && a.browser.version < 7, p = f + "_IE6", q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X; X = a.fn[e] = a[e] = function (b, c) { var f = this; b = b || {}; if (!f[0]) { if (f.selector) return f; f = a("<a/>"), b.open = !0 } c && (b.onComplete = c), f.each(function () { a.data(this, e, a.extend({}, a.data(this, e) || d, b)), a(this).addClass(g) }), (a.isFunction(b.open) && b.open.call(f) || b.open) && bc(f[0]); return f }, X.init = function () { z = a(c), r = Y().attr({ id: e, "class": n ? f + (o ? "IE6" : "IE") : "" }), q = Y("Overlay", o ? "position:absolute" : "").hide(), s = Y("Wrapper"), t = Y("Content").append(A = Y("LoadedContent", "width:0; height:0; overflow:hidden"), C = Y("LoadingOverlay").add(Y("LoadingGraphic")), D = Y("Title"), E = Y("Current"), G = Y("Next"), H = Y("Previous"), F = Y("Slideshow").bind(h, bb), I = Y("Close")), s.append(Y().append(Y("TopLeft"), u = Y("TopCenter"), Y("TopRight")), Y(!1, "clear:left").append(v = Y("MiddleLeft"), t, w = Y("MiddleRight")), Y(!1, "clear:left").append(Y("BottomLeft"), x = Y("BottomCenter"), Y("BottomRight"))).children().children().css({ "float": "left" }), B = Y(!1, "position:absolute; width:9999px; visibility:hidden; display:none"), a("body").prepend(q, r.append(s, B)), t.children().hover(function () { a(this).addClass("hover") }, function () { a(this).removeClass("hover") }).addClass("hover"), L = u.height() + x.height() + t.outerHeight(!0) - t.height(), M = v.width() + w.width() + t.outerWidth(!0) - t.width(), N = A.outerHeight(!0), O = A.outerWidth(!0), r.css({ "padding-bottom": L, "padding-right": M }).hide(), G.click(function () { X.next() }), H.click(function () { X.prev() }), I.click(function () { X.close() }), J = G.add(H).add(E).add(F), t.children().removeClass("hover"), q.click(function () { K.overlayClose && X.close() }), a(b).bind("keydown." + f, function (a) { var b = a.keyCode; S && K.escKey && b === 27 && (a.preventDefault(), X.close()), S && K.arrowKey && y[1] && (b === 37 ? (a.preventDefault(), H.click()) : b === 39 && (a.preventDefault(), G.click())) }) }, X.remove = function () { r.add(q).remove(), a("." + g).removeData(e).removeClass(g) }, X.position = function (a, c) { function g(a) { u[0].style.width = x[0].style.width = t[0].style.width = a.style.width, C[0].style.height = C[1].style.height = t[0].style.height = v[0].style.height = w[0].style.height = a.style.height } var d = 0, e = 0; z.unbind("resize." + f), r.hide(), K.fixed && !o ? r.css({ position: "fixed" }) : (d = z.scrollTop(), e = z.scrollLeft(), r.css({ position: "absolute" })), K.right !== !1 ? e += Math.max(z.width() - K.w - O - M - Z(K.right, "x"), 0) : K.left !== !1 ? e += Z(K.left, "x") : e += Math.round(Math.max(z.width() - K.w - O - M, 0) / 2), K.bottom !== !1 ? d += Math.max(b.documentElement.clientHeight - K.h - N - L - Z(K.bottom, "y"), 0) : K.top !== !1 ? d += Z(K.top, "y") : d += Math.round(Math.max(b.documentElement.clientHeight - K.h - N - L, 0) / 2), r.show(), a = r.width() === K.w + O && r.height() === K.h + N ? 0 : a || 0, s[0].style.width = s[0].style.height = "9999px", r.dequeue().animate({ width: K.w + O, height: K.h + N, top: d, left: e }, { duration: a, complete: function () { g(this), T = !1, s[0].style.width = K.w + O + M + "px", s[0].style.height = K.h + N + L + "px", c && c(), setTimeout(function () { z.bind("resize." + f, X.position) }, 1) }, step: function () { g(this) } }) }, X.resize = function (a) { if (S) { a = a || {}, a.width && (K.w = Z(a.width, "x") - O - M), a.innerWidth && (K.w = Z(a.innerWidth, "x")), A.css({ width: K.w }), a.height && (K.h = Z(a.height, "y") - N - L), a.innerHeight && (K.h = Z(a.innerHeight, "y")); if (!a.innerHeight && !a.height) { var b = A.wrapInner("<div style='overflow:auto'></div>").children(); K.h = b.height(), b.replaceWith(b.children()) } A.css({ height: K.h }), X.position(K.transition === "none" ? 0 : K.speed) } }, X.prep = function (b) { function h() { K.h = K.h || A.height(), K.h = K.mh && K.mh < K.h ? K.mh : K.h; return K.h } function g() { K.w = K.w || A.width(), K.w = K.mw && K.mw < K.w ? K.mw : K.w; return K.w } if (!!S) { var c, d = K.transition === "none" ? 0 : K.speed; A.remove(), A = Y("LoadedContent").append(b), A.hide().appendTo(B.show()).css({ width: g(), overflow: K.scrolling ? "auto" : "hidden" }).css({ height: h() }).prependTo(t), B.hide(), a(R).css({ "float": "none" }), o && a("select").not(r.find("select")).filter(function () { return this.style.visibility !== "hidden" }).css({ visibility: "hidden" }).one(k, function () { this.style.visibility = "inherit" }), c = function () { function o() { n && r[0].style.removeAttribute("filter") } var b, c, g, h, i = y.length, k, l; !S || (l = function () { clearTimeout(W), C.hide(), ba(j, K.onComplete) }, n && R && A.fadeIn(100), D.html(K.title).add(A).show(), i > 1 ? (typeof K.current == "string" && E.html(K.current.replace("{current}", Q + 1).replace("{total}", i)).show(), G[K.loop || Q < i - 1 ? "show" : "hide"]().html(K.next), H[K.loop || Q ? "show" : "hide"]().html(K.previous), b = Q ? y[Q - 1] : y[i - 1], g = Q < i - 1 ? y[Q + 1] : y[0], K.slideshow && F.show(), K.preloading && (h = a.data(g, e).href || g.href, c = a.data(b, e).href || b.href, h = a.isFunction(h) ? h.call(g) : h, c = a.isFunction(c) ? c.call(b) : c, $(h) && (a("<img/>")[0].src = h), $(c) && (a("<img/>")[0].src = c))) : J.hide(), K.iframe ? (k = a("<iframe/>").addClass(f + "Iframe")[0], K.fastIframe ? l() : a(k).one("load", l), k.name = f + +(new Date), k.src = K.href, K.scrolling || (k.scrolling = "no"), n && (k.frameBorder = 0, k.allowTransparency = "true"), a(k).appendTo(A).one(m, function () { k.src = "//about:blank" })) : l(), K.transition === "fade" ? r.fadeTo(d, 1, o) : o()) }, K.transition === "fade" ? r.fadeTo(d, 0, function () { X.position(0, c) }) : X.position(d, c) } }, X.load = function (b) { var c, d, e = X.prep; T = !0, R = !1, P = y[Q], b || _(), ba(m), ba(i, K.onLoad), K.h = K.height ? Z(K.height, "y") - N - L : K.innerHeight && Z(K.innerHeight, "y"), K.w = K.width ? Z(K.width, "x") - O - M : K.innerWidth && Z(K.innerWidth, "x"), K.mw = K.w, K.mh = K.h, K.maxWidth && (K.mw = Z(K.maxWidth, "x") - O - M, K.mw = K.w && K.w < K.mw ? K.w : K.mw), K.maxHeight && (K.mh = Z(K.maxHeight, "y") - N - L, K.mh = K.h && K.h < K.mh ? K.h : K.mh), c = K.href, W = setTimeout(function () { C.show() }, 100), K.inline ? (Y().hide().insertBefore(a(c)[0]).one(m, function () { a(this).replaceWith(A.children()) }), e(a(c))) : K.iframe ? e(" ") : K.html ? e(K.html) : $(c) ? (a(R = new Image).addClass(f + "Photo").error(function () { K.title = !1, e(Y("Error").text("This image could not be loaded")) }).load(function () { var a; R.onload = null, K.scalePhotos && (d = function () { R.height -= R.height * a, R.width -= R.width * a }, K.mw && R.width > K.mw && (a = (R.width - K.mw) / R.width, d()), K.mh && R.height > K.mh && (a = (R.height - K.mh) / R.height, d())), K.h && (R.style.marginTop = Math.max(K.h - R.height, 0) / 2 + "px"), y[1] && (Q < y.length - 1 || K.loop) && (R.style.cursor = "pointer", R.onclick = function () { X.next() }), n && (R.style.msInterpolationMode = "bicubic"), setTimeout(function () { e(R) }, 1) }), setTimeout(function () { R.src = c }, 1)) : c && B.load(c, K.data, function (b, c, d) { e(c === "error" ? Y("Error").text("Request unsuccessful: " + d.statusText) : a(this).contents()) }) }, X.next = function () { !T && y[1] && (Q < y.length - 1 || K.loop) && (Q = Q < y.length - 1 ? Q + 1 : 0, X.load()) }, X.prev = function () { !T && y[1] && (Q || K.loop) && (Q = Q ? Q - 1 : y.length - 1, X.load()) }, X.close = function () { S && !U && (U = !0, S = !1, ba(k, K.onCleanup), z.unbind("." + f + " ." + p), q.fadeTo(200, 0), r.stop().fadeTo(300, 0, function () { r.add(q).css({ opacity: 1, cursor: "auto" }).hide(), ba(m), A.remove(), setTimeout(function () { U = !1, ba(l, K.onClosed) }, 1) })) }, X.element = function () { return a(P) }, X.settings = d, V = function (a) { a.button !== 0 && typeof a.button != "undefined" || a.ctrlKey || a.shiftKey || a.altKey || (a.preventDefault(), bc(this)) }, a.fn.delegate ? a(b).delegate("." + g, "click", V) : a("." + g).live("click", V), a(X.init) })(jQuery, document, this);

//power float
(function (a) { a.fn.powerFloat = function (d) { return a(this).each(function () { var e = a.extend({}, b, d || {}); var f = function (h, g) { if (c.target && c.target.css("display") !== "none") { c.targetClear() } c.s = h; c.trigger = g }; switch (e.eventType) { case "hover": a(this).hover(function () { f(e, a(this)); var h = parseInt(e.showDelay, 10), g; if (h) { if (g) { clearTimeout(g) } g = setTimeout(function () { c.targetGet() }, h) } else { c.targetGet() } }, function () { c.flagDisplay = false; c.targetHold(); if (e.hoverHold) { setTimeout(function () { c.displayDetect() }, 200) } else { c.displayDetect() } }); if (e.hoverFollow) { a(this).mousemove(function (g) { c.cacheData.left = g.pageX; c.cacheData.top = g.pageY; c.targetGet(); return false }) } break; case "click": a(this).click(function (g) { if (c.flagDisplay && g.target === c.trigger.get(0)) { c.flagDisplay = false; c.displayDetect() } else { f(e, a(this)); c.targetGet(); if (!a(document).data("mouseupBind")) { a(document).bind("mouseup", function (i) { var h = false; a(i.target).parents().each(function () { if (c.target && a(this).attr("id") == c.target.attr("id")) { h = true } }); if (e.eventType === "click" && c.flagDisplay && i.target != c.trigger.get(0) && !h) { c.flagDisplay = false; c.displayDetect() } return false }).data("mouseupBind", true) } } }); break; case "focus": a(this).focus(function () { var g = a(this); setTimeout(function () { f(e, g); c.targetGet() }, 200) }).blur(function () { c.flagDisplay = false; setTimeout(function () { c.displayDetect() }, 190) }); break; default: f(e, a(this)); c.targetGet(); a(document).unbind("mouseup") } }) }; var c = { targetGet: function () { if (!this.trigger) { return this } var h = this.trigger.attr(this.s.targetAttr), g = this.s.target; switch (this.s.targetMode) { case "common": if (g) { var i = typeof (g); if (i === "object") { if (g.size()) { c.target = g.eq(0) } } else { if (i === "string") { if (a(g).size()) { c.target = a(g).eq(0) } } } } else { if (h && a("#" + h).size()) { c.target = a("#" + h) } } if (c.target) { c.targetShow() } else { return this } break; case "ajax": var d = g || h; this.targetProtect = false; if (/(\.jpg|\.png|\.gif|\.bmp|\.jpeg)$/i.test(d)) { if (c.cacheData[d]) { c.target = a(c.cacheData[d]); c.targetShow() } else { var f = new Image(); c.loading(); f.onload = function () { var m = f.width, q = f.height; var p = a(window).width(), s = a(window).height(); var r = m / q, o = p / s; if (r > o) { if (m > p / 2) { m = p / 2; q = m / r } } else { if (q > s / 2) { q = s / 2; m = q * r } } var n = '<img class="float_ajax_image" src="' + d + '" width="' + m + '" height = "' + q + '" />'; c.cacheData[d] = n; c.target = a(n); c.targetShow() }; f.onerror = function () { c.target = a('<div class="float_ajax_error">图片加载失败。</div>'); c.targetShow() }; f.src = d } } else { if (d) { if (c.cacheData[d]) { c.target = a('<div class="float_ajax_data">' + c.cacheData[d] + "</div>"); c.targetShow() } else { c.loading(); a.ajax({ url: d, success: function (m) { if (typeof (m) === "string") { c.target = a('<div class="float_ajax_data">' + m + "</div>"); c.targetShow(); c.cacheData[d] = m } }, error: function () { c.target = a('<div class="float_ajax_error">数据没有加载成功。</div>'); c.targetShow() } }) } } } break; case "list": var k = '<ul class="float_list_ul">', j; if (a.isArray(g) && (j = g.length)) { a.each(g, function (n, p) { var o = "", r = "", q, m; if (n === 0) { r = ' class="float_list_li_first"' } if (n === j - 1) { r = ' class="float_list_li_last"' } if (typeof (p) === "object" && (q = p.text.toString())) { if (m = (p.href || "javascript:")) { o = '<a href="' + m + '" class="float_list_a">' + q + "</a>" } else { o = q } } else { if (typeof (p) === "string" && p) { o = p } } if (o) { k += "<li" + r + ">" + o + "</li>" } }) } else { k += '<li class="float_list_null">列表无数据。</li>' } k += "</ul>"; c.target = a(k); this.targetProtect = false; c.targetShow(); break; case "remind": var l = g || h; this.targetProtect = false; if (typeof (l) === "string") { c.target = a("<span>" + l + "</span>"); c.targetShow() } break; default: var e = g || h, i = typeof (e); if (e) { if (i === "string") { if (/<.*>/.test(e)) { c.target = a("<div>" + e + "</div>"); this.targetProtect = false } else { if (a(e).size()) { c.target = a(e).eq(0); this.targetProtect = true } else { if (a("#" + e).size()) { c.target = a("#" + e).eq(0); this.targetProtect = true } else { c.target = a("<div>" + e + "</div>"); this.targetProtect = false } } } c.targetShow() } else { if (i === "object") { if (!a.isArray(e) && e.size()) { c.target = e.eq(0); this.targetProtect = true; c.targetShow() } } } } } return this }, container: function () { var d = this.s.container, e = this.s.targetMode || "mode"; if (e === "ajax" || e === "remind") { this.s.sharpAngle = true } else { this.s.sharpAngle = false } if (this.s.reverseSharp) { this.s.sharpAngle = !this.s.sharpAngle } if (e !== "common") { if (d === null) { d = "plugin" } if (d === "plugin") { if (!a("#floatBox_" + e).size()) { a('<div id="floatBox_' + e + '" class="float_' + e + '_box"></div>').appendTo(a("body")).hide() } d = a("#floatBox_" + e) } if (d && typeof (d) !== "string" && d.size()) { if (this.targetProtect) { c.target.show().css("position", "static") } c.target = d.empty().append(c.target) } } return this }, setWidth: function () { var d = this.s.width; if (d === "auto") { if (this.target.get(0).style.width) { this.target.css("width", "auto") } } else { if (d === "inherit") { this.target.width(this.trigger.width()) } else { this.target.css("width", d) } } return this }, position: function () { var h, x = 0, k = 0, m = 0, y = 0, s, o, e, E, u, q, f = this.target.data("height"), C = this.target.data("width"), r = a(window).scrollTop(), B = parseInt(this.s.offsets.x, 10) || 0, A = parseInt(this.s.offsets.y, 10) || 0, w = this.cacheData; if (!f) { f = this.target.outerHeight(); if (this.s.hoverFollow) { this.target.data("height", f) } } if (!C) { C = this.target.outerWidth(); if (this.s.hoverFollow) { this.target.data("width", C) } } h = this.trigger.offset(); x = this.trigger.outerHeight(); k = this.trigger.outerWidth(); s = h.left; o = h.top; var l = function () { if (s < 0) { s = 0 } else { if (s + x > a(window).width()) { s = a(window).width() = x } } }, i = function () { if (o < 0) { o = 0 } else { if (o + x > a(document).height()) { o = a(document).height() - x } } }; if (this.s.hoverFollow && w.left && w.top) { if (this.s.hoverFollow === "x") { s = w.left; l() } else { if (this.s.hoverFollow === "y") { o = w.top; i() } else { s = w.left; o = w.top; l(); i() } } } var g = ["4-1", "1-4", "5-7", "2-3", "2-1", "6-8", "3-4", "4-3", "8-6", "1-2", "7-5", "3-2"], v = this.s.position, d = false, j; a.each(g, function (F, G) { if (G === v) { d = true; return } }); if (!d) { v = "4-1" } var D = function (F) { var G = "bottom"; switch (F) { case "1-4": case "5-7": case "2-3": G = "top"; break; case "2-1": case "6-8": case "3-4": G = "right"; break; case "1-2": case "8-6": case "4-3": G = "left"; break; case "4-1": case "7-5": case "3-2": G = "bottom"; break } return G }; var n = function (F) { if (F === "5-7" || F === "6-8" || F === "8-6" || F === "7-5") { return true } return false }; var t = function (H) { var I = 0, F = 0, G = (c.s.sharpAngle && c.corner) ? true : false; if (H === "right") { F = s + k + C + B; if (G) { F += c.corner.width() } if (F > a(window).width()) { return false } } else { if (H === "bottom") { I = o + x + f + A; if (G) { I += c.corner.height() } if (I > r + a(window).height()) { return false } } else { if (H === "top") { I = f + A; if (G) { I += c.corner.height() } if (I > o - r) { return false } } else { if (H === "left") { F = C + B; if (G) { F += c.corner.width() } if (F > s) { return false } } } } } return true }; j = D(v); if (this.s.sharpAngle) { this.createSharp(j) } if (this.s.edgeAdjust) { if (t(j)) { (function () { if (n(v)) { return } var G = { top: { right: "2-3", left: "1-4" }, right: { top: "2-1", bottom: "3-4" }, bottom: { right: "3-2", left: "4-1" }, left: { top: "1-2", bottom: "4-3"} }; var H = G[j], F; if (H) { for (F in H) { if (!t(F)) { v = H[F] } } } })() } else { (function () { if (n(v)) { var G = { "5-7": "7-5", "7-5": "5-7", "6-8": "8-6", "8-6": "6-8" }; v = G[v] } else { var H = { top: { left: "3-2", right: "4-1" }, right: { bottom: "1-2", top: "4-3" }, bottom: { left: "2-3", right: "1-4" }, left: { bottom: "2-1", top: "3-4"} }; var I = H[j], F = []; for (name in I) { F.push(name) } if (t(F[0]) || !t(F[1])) { v = I[F[0]] } else { v = I[F[1]] } } })() } } var z = D(v), p = v.split("-")[0]; if (this.s.sharpAngle) { this.createSharp(z); m = this.corner.width(), y = this.corner.height() } if (this.s.hoverFollow) { if (this.s.hoverFollow === "x") { e = s + B; if (p === "1" || p === "8" || p === "4") { e = s - (C - k) / 2 + B } else { e = s - (C - k) + B } if (p === "1" || p === "5" || p === "2") { E = o - A - f - y; q = o - y - A - 1 } else { E = o + x + A + y; q = o + x + A + 1 } u = h.left - (m - k) / 2 } else { if (this.s.hoverFollow === "y") { if (p === "1" || p === "5" || p === "2") { E = o - (f - x) / 2 + A } else { E = o - (f - x) + A } if (p === "1" || p === "8" || p === "4") { e = s - C - B - m; u = s - m - B - 1 } else { e = s + k - B + m; u = s + k + B + 1 } q = h.top - (y - x) / 2 } else { e = s + B; E = o + A } } } else { switch (z) { case "top": E = o - A - f - y; if (p == "1") { e = s - B } else { if (p === "5") { e = s - (C - k) / 2 - B } else { e = s - (C - k) - B } } q = o - y - A - 1; u = s - (m - k) / 2; break; case "right": e = s + k + B + m; if (p == "2") { E = o + A } else { if (p === "6") { E = o - (f - x) / 2 + A } else { E = o - (f - x) + A } } u = s + k + B + 1; q = o - (y - x) / 2; break; case "bottom": E = o + x + A + y; if (p == "4") { e = s + B } else { if (p === "7") { e = s - (C - k) / 2 + B } else { e = s - (C - k) + B } } q = o + x + A + 1; u = s - (m - k) / 2; break; case "left": e = s - C - B - m; if (p == "2") { E = o - A } else { if (p === "6") { E = o - (C - k) / 2 - A } else { E = o - (f - x) - A } } u = e + m; q = o - (C - m) / 2; break } } if (y && m && this.corner) { this.corner.css({ left: u, top: q, zIndex: this.s.zIndex + 1 }) } this.target.css({ position: "absolute", left: e, top: E, zIndex: this.s.zIndex }); return this }, createSharp: function (g) { var j, k, f = "", d = ""; var i = { left: "right", right: "left", bottom: "top", top: "bottom" }, e = i[g] || "top"; if (this.target) { j = this.target.css("background-color"); if (parseInt(this.target.css("border-" + e + "-width")) > 0) { k = this.target.css("border-" + e + "-color") } if (k && k !== "transparent") { f = 'style="color:' + k + ';"' } else { f = 'style="display:none;"' } if (j && j !== "transparent") { d = 'style="color:' + j + ';"' } else { d = 'style="display:none;"' } } var h = '<div id="floatCorner_' + g + '" class="float_corner float_corner_' + g + '"><span class="corner corner_1" ' + f + '>◆</span><span class="corner corner_2" ' + d + ">◆</span></div>"; if (!a("#floatCorner_" + g).size()) { a("body").append(a(h)) } this.corner = a("#floatCorner_" + g); return this }, targetHold: function () { if (this.s.hoverHold) { var d = parseInt(this.s.hideDelay, 10) || 200; this.target.hover(function () { c.flagDisplay = true }, function () { c.flagDisplay = false; setTimeout(function () { c.displayDetect() }, d) }) } return this }, loading: function () { this.target = a('<div class="float_loading"></div>'); this.targetShow(); this.target.removeData("width").removeData("height"); return this }, displayDetect: function () { if (!this.flagDisplay) { this.targetHide() } return this }, targetShow: function () { c.cornerClear(); this.flagDisplay = true; this.container().setWidth().position(); this.target.show(); if (a.isFunction(this.s.showCall)) { this.s.showCall.call(this.trigger, this.target) } return this }, targetHide: function () { this.flagDisplay = false; this.targetClear(); this.cornerClear(); if (a.isFunction(this.s.hideCall)) { this.s.hideCall.call(this.trigger) } this.target = null; this.trigger = null; this.s = {}; this.targetProtect = false; return this }, targetClear: function () { if (this.target) { if (this.target.data("width")) { this.target.removeData("width").removeData("height") } if (this.targetProtect) { this.target.children().hide().appendTo(a("body")) } this.target.unbind().hide() } }, cornerClear: function () { if (this.corner) { this.corner.remove() } }, target: null, trigger: null, s: {}, cacheData: {}, targetProtect: false }; a.powerFloat = {}; a.powerFloat.hide = function () { c.targetHide() }; var b = { width: "auto", offsets: { x: 0, y: 0 }, zIndex: 999, eventType: "hover", showDelay: 0, hideDelay: 0, hoverHold: true, hoverFollow: false, targetMode: "common", target: null, targetAttr: "rel", container: null, reverseSharp: false, position: "4-1", edgeAdjust: true, showCall: a.noop, hideCall: a.noop} })(jQuery);

/*!
 * jQuery TextChange Plugin
 * http://www.zurb.com/playground/jquery-text-change-custom-event
 *
 * Copyright 2010, ZURB
 * Released under the MIT License
 */
 (function(a){a.event.special.textchange={setup:function(){a(this).data("lastValue",this.contentEditable==="true"?a(this).html():a(this).val());a(this).bind("keyup.textchange",a.event.special.textchange.handler);a(this).bind("cut.textchange paste.textchange input.textchange",a.event.special.textchange.delayedHandler)},teardown:function(){a(this).unbind(".textchange")},handler:function(){a.event.special.textchange.triggerIfChanged(a(this))},delayedHandler:function(){var c=a(this);setTimeout(function(){a.event.special.textchange.triggerIfChanged(c)},
 25)},triggerIfChanged:function(a){var b=a[0].contentEditable==="true"?a.html():a.val();b!==a.data("lastValue")&&(a.trigger("textchange",[a.data("lastValue")]),a.data("lastValue",b))}};a.event.special.hastext={setup:function(){a(this).bind("textchange",a.event.special.hastext.handler)},teardown:function(){a(this).unbind("textchange",a.event.special.hastext.handler)},handler:function(c,b){b===""&&b!==a(this).val()&&a(this).trigger("hastext")}};a.event.special.notext={setup:function(){a(this).bind("textchange",
 a.event.special.notext.handler)},teardown:function(){a(this).unbind("textchange",a.event.special.notext.handler)},handler:function(c,b){a(this).val()===""&&a(this).val()!==b&&a(this).trigger("notext")}}})(jQuery);

 /*jQuery timer*/

 jQuery.fn.extend({
	everyTime: function(interval, label, fn, times, belay) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, times, belay);
		});
	},
	oneTime: function(interval, label, fn) {
		return this.each(function() {
			jQuery.timer.add(this, interval, label, fn, 1);
		});
	},
	stopTime: function(label, fn) {
		return this.each(function() {
			jQuery.timer.remove(this, label, fn);
		});
	}
});

jQuery.extend({
	timer: {
		guid: 1,
		global: {},
		regex: /^([0-9]+)\s*(.*s)?$/,
		powers: {
			// Yeah this is major overkill...
			'ms': 1,
			'cs': 10,
			'ds': 100,
			's': 1000,
			'das': 10000,
			'hs': 100000,
			'ks': 1000000
		},
		timeParse: function(value) {
			if (value == undefined || value == null)
				return null;
			var result = this.regex.exec(jQuery.trim(value.toString()));
			if (result[2]) {
				var num = parseInt(result[1], 10);
				var mult = this.powers[result[2]] || 1;
				return num * mult;
			} else {
				return value;
			}
		},
		add: function(element, interval, label, fn, times, belay) {
			var counter = 0;
			
			if (jQuery.isFunction(label)) {
				if (!times) 
					times = fn;
				fn = label;
				label = interval;
			}
			
			interval = jQuery.timer.timeParse(interval);

			if (typeof interval != 'number' || isNaN(interval) || interval <= 0)
				return;

			if (times && times.constructor != Number) {
				belay = !!times;
				times = 0;
			}
			
			times = times || 0;
			belay = belay || false;
			
			if (!element.$timers) 
				element.$timers = {};
			
			if (!element.$timers[label])
				element.$timers[label] = {};
			
			fn.$timerID = fn.$timerID || this.guid++;
			
			var handler = function() {
				if (belay && this.inProgress) 
					return;
				this.inProgress = true;
				if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
					jQuery.timer.remove(element, label, fn);
				this.inProgress = false;
			};
			
			handler.$timerID = fn.$timerID;
			
			if (!element.$timers[label][fn.$timerID]) 
				element.$timers[label][fn.$timerID] = window.setInterval(handler,interval);
			
			if ( !this.global[label] )
				this.global[label] = [];
			this.global[label].push( element );
			
		},
		remove: function(element, label, fn) {
			var timers = element.$timers, ret;
			
			if ( timers ) {
				
				if (!label) {
					for ( label in timers )
						this.remove(element, label, fn);
				} else if ( timers[label] ) {
					if ( fn ) {
						if ( fn.$timerID ) {
							window.clearInterval(timers[label][fn.$timerID]);
							delete timers[label][fn.$timerID];
						}
					} else {
						for ( var fn in timers[label] ) {
							window.clearInterval(timers[label][fn]);
							delete timers[label][fn];
						}
					}
					
					for ( ret in timers[label] ) break;
					if ( !ret ) {
						ret = null;
						delete timers[label];
					}
				}
				
				for ( ret in timers ) break;
				if ( !ret ) 
					element.$timers = null;
			}
		}
	}
});

if (jQuery.browser.msie)
	jQuery(window).one("unload", function() {
		var global = jQuery.timer.global;
		for ( var label in global ) {
			var els = global[label], i = els.length;
			while ( --i )
				jQuery.timer.remove(els[i], label);
		}
	});


//////////////////////////////////////////////////////////////////////
//
(function ($) {
	$.fn.extend({
	  
		floatCheckCode: function (options) {
  
			var defaults = {};

			function _floatCheckCode(control, checkCodeUrl) {
				var id = "checkCodeConatiner_for_" + $(control).attr("id");
				var html = '<div id="' + id + '" class="float_tip_box" style="display:none;padding:2px;"><span></span>' +
				   '<img style="width:84px; height:26px;" alt="验证码" src="" /><a href="javascript:;">&nbsp;换一张&nbsp;</a></div>';
				$(html).appendTo($("body")).find("a").click(function () {
					$("#" + id + " img").attr("src", _getRandomCheckCodeUrl(checkCodeUrl));
					$(control).focus();
				});

				$(control).powerFloat({
					eventType: "focus",
					target: $("#" + id + ""),
					position: "5-7",
					reverseSharp: true,
					showCall: function () {
						var img = $("#" + id).find("img");
						if (img.attr("src") == "") {
							img.attr("src", _getRandomCheckCodeUrl(checkCodeUrl));
						}
					}
				});
			};

			function _getRandomCheckCodeUrl(checkCodeUrl) {
				var nextUrl = checkCodeUrl + "/" + Math.random();
				return nextUrl;
			};

			return this.each(function () {
				var t = $(this);
				var url = t.attr("checkCode");

				_floatCheckCode(t, url);
			});
		}
	});
})(jQuery);


(function ($) {
	$.fn.extend({

		dialogLink: function (options) { 
			var defaults = {};

			return this.each(function () {
				var tWidth = $(this).attr("dialogWidth") || "50%";
				var tHeight = $(this).attr("dialogHeight") || "50%";
				
				$(this).click(function(){
					var linkUrl = $(this).attr("href");
					linkUrl += (linkUrl.indexOf("?") >=0 ? '&' : '?') + "seed=" + Math.random();
					$.colorbox({
						href: linkUrl,
						opacity: 0.3,
						width : tWidth,
						height: tHeight,
						maxWidth: "95%",
						maxHeight: "95%"
					});
					return false;
				});
			});
		}
	});
})(jQuery);

(function ($) {
	$.fn.extend({

		colorButton: function (btnColor) {

			var defaults = {};

			return this.each(function () {
				var text = $(this).text();
				$(this).addClass("Color_Button");
				var html = "<div class='"+btnColor+"_Button LeftSpan' /><div class='"+btnColor+"_Button BodySpan'>"+text+"</div><div class='"+btnColor+"_Button RightSpan' />";
				$(this).html(html);
			});
		}
	});
})(jQuery);

(function ($) {
	$.fn.extend({

		tab: function () {

			var defaults = {};

			return this.each(function () {
				$(this).find("a").each(function(){
					var link = $(this);
					link.wrap("<div class='tabPage'></div>");
					var className = link.hasClass("selectedTab") ? "selectedPage" :"normalPage" ;

					link.parent().addClass(className);
					link.hover(function(){
							$(this).parent().removeClass("normalPage").removeClass("selectedPage").addClass("activePage");
						},function(){
							$(this).parent().removeClass("activePage");
							var className = link.hasClass("selectedTab") ? "selectedPage" :"normalPage" ;
							$(this).parent().addClass(className);
						});

				});
				$("<div class='clear'></div>").insertAfter($(this));
			});
		}
	});
})(jQuery);

(function ($) {
	$.fn.extend({

		searchBusStop: function (url, stopIdField, josnField) {

			var defaults = {};

			return this.each(function () {
			   $(this).autocomplete(url, {
					minChars: 2,
					dataType:'json',
					cacheLength:0,
					width:200,
					delay:500,
					selectFirst: true,
					max: 50,
					formatItem: function(item) {
						return '<span style="float:left;font-size:14px">'+item.StopName +'</span><span style="float:right;color:gray;font-size:10px;">'+item.Province+item.City+'</span>';
					},
			
					parse: function(data) {
						return $.map(data, function(row) {
							return {
								data: row,
								value: row.StopId,
								result: row.StopName 
							};
						});
					}
				})
				.result(function(event, item) {
					$(stopIdField).val(item.StopId);
					$(josnField).val($.toJSON(item));
					$(this).attr("last_value", item.StopName);
				});

				$(this).bind('textchange', function (event, previousText){	
					if ($(this).attr("last_value", item.StopName) != $(this).val().trim())
					{				
						$(stopIdField).val(-1);
						$(josnField).val("");	
					}				
				});
			});
		}
	});
})(jQuery);

(function ($) {
	$.fn.extend({

		expireLink: function (expriedAction, expiredAttributeName) {

			var options = 
			{
				action : expriedAction || "hide" ,
				expiredAttribute : expiredAttributeName || "data-timeout"
			};
			
			function onTimeout(link)
			{
				if (options.action == "hide")
				{
					$(link).hide();
				}
				else if (options.action == "disabled")
				{
					$(link).get(0).disabled = true;
				}
				else if (options.action == "alert")
				{
					$(link).bind("click", function(){ alert("操作已过期"); return false; } );
				}
				else
				{
					$(link).hide();
				}
			};

			return this.each(function () {
				var timeoutSeconds = parseInt($(this).attr(options.expiredAttribute));
				timeoutSeconds = timeoutSeconds > 0 ? timeoutSeconds : 0.1;
				var link = $(this);
				
				$(this).oneTime(timeoutSeconds+"s", "expried", function(){ onTimeout($(this)); } );
				
			});
		}
	});
})(jQuery);

(function ($) {
	$.fn.extend({

		countDownClock: function (onTimeout, onAlert, secondsAttr, alertValueAttr, alertClassAttr, expiredMsgAttr) {

			var options = 
			{
				secondsAttribute : secondsAttr || "data-seconds" ,
				alertValueAttribute: alertValueAttr || "data-alert-value",
				alertClassAttribute : alertClassAttr || "data-alert-class",
				expiredMessageAttribute : expiredMsgAttr || "data-expired-message"
			};
			
			function onExpired(item)
			{
				var theItem = $(item)
				var msg = theItem.attr(options.expiredMessageAttribute);
				if ( msg != "" )
				{
					theItem.text(msg);
				}
			};

			return this.each(function () {
				var me = $(this);
				me.attr("data-start-time", new Date().toString());
				var seconds = me.attr(options.secondsAttribute);
				seconds = seconds > 0 ? seconds : 1;
				var alertValue = me.attr(options.alertValueAttribute);
				var alertClass = me.attr(options.alertClassAttribute); 
				var expiredMsg = me.attr(options.expiredMessageAttribute); 
				/*
				everyTime: function(interval, label, fn, times, belay) {
				*/
				me.everyTime(1000, "countDownClock", function(){
					var now = new Date();
					var secondsLeft = seconds - parseInt(( now - Date.parse(me.attr("data-start-time")) ) /1000 ) ;

					me.attr(options.secondsAttribute, secondsLeft);
					if (secondsLeft <= 0 && expiredMsg !="")
					{
						if (me.text() != expiredMsg)
						{
							me.text(expiredMsg);
							if ($.isFunction(onTimeout)) onTimeout(me);
							if (!me.hasClass(alertClass)) me.addClass(alertClass);
						}
						return;
					}

					if (secondsLeft <= alertValue)
					{
						if (!me.hasClass(alertClass))
						{
							me.addClass(alertClass);
							if ($.isFunction(onAlert)) onAlert(me);   
						}                   
					}
					var txt = "剩余 " + parseInt(secondsLeft/60) + "分" + parseInt(secondsLeft%60) + "秒";
					me.text(txt);

				}, seconds );
				
			});
		}
	});
})(jQuery);



/*------------------ validation ----------------------------------------*/
//--身份证号码验证-支持新的带x身份证

function checkIdcard(idcard) {
    var Errors =
    [        
        { code: 0, msg: "验证通过!" },
        { code: 1, msg: "身份证号码位数不对!" },
        { code: 2, msg: "身份证号码出生日期超出范围或含有非法字符!" },
        { code: 3, msg: "身份证号码校验错误!" },
        { code: 4, msg: "身份证地区非法!" }
    ];

    var area = { 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江", 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏", 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门", 91: "国外" }
    var idcard, Y, JYM;
    var S, M;
    var idcard_array = new Array();
    idcard_array = idcard.split("");
    //地区检验 
    if (area[parseInt(idcard.substr(0, 2))] == null) return Errors[4];
    //身份号码位数及格式检验 
    switch (idcard.length) {
        /*case 15:
            if ((parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0 || ((parseInt(idcard.substr(6, 2)) + 1900) % 100 == 0 && (parseInt(idcard.substr(6, 2)) + 1900) % 4 == 0)) {
                ereg = /^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$/; //测试出生日期的合法性 
            } else {
                ereg = /^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$/; //测试出生日期的合法性 
            }
            if (ereg.test(idcard)) return Errors[0];
            else return Errors[2];
            break;*/
        case 18:
            //18位身份号码检测 
            //出生日期的合法性检查  
            //闰年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9])) 
            //平年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8])) 
            if (parseInt(idcard.substr(6, 4)) % 4 == 0 || (parseInt(idcard.substr(6, 4)) % 100 == 0 && parseInt(idcard.substr(6, 4)) % 4 == 0)) {
                ereg = /^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9Xx]$/; //闰年出生日期的合法性正则表达式 
            } else {
                ereg = /^[1-9][0-9]{5}(19|20)[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9Xx]$/; //平年出生日期的合法性正则表达式 
            }
            if (ereg.test(idcard)) {//测试出生日期的合法性 
                //计算校验位 
                S = (parseInt(idcard_array[0]) + parseInt(idcard_array[10])) * 7
                    + (parseInt(idcard_array[1]) + parseInt(idcard_array[11])) * 9
                    + (parseInt(idcard_array[2]) + parseInt(idcard_array[12])) * 10
                    + (parseInt(idcard_array[3]) + parseInt(idcard_array[13])) * 5
                    + (parseInt(idcard_array[4]) + parseInt(idcard_array[14])) * 8
                    + (parseInt(idcard_array[5]) + parseInt(idcard_array[15])) * 4
                    + (parseInt(idcard_array[6]) + parseInt(idcard_array[16])) * 2
                    + parseInt(idcard_array[7]) * 1
                    + parseInt(idcard_array[8]) * 6
                    + parseInt(idcard_array[9]) * 3;
                Y = S % 11;
                M = "F";
                JYM = "10X98765432";
                M = JYM.substr(Y, 1); //判断校验位 
                if (M == idcard_array[17]) return Errors[0]; //检测ID的校验位 
                else return Errors[3];
            }
            else return Errors[2];
            break;
        default:
            return Errors[1];
            break;
    }
}


jQuery.validator.unobtrusive.adapters.add("credential", ["typefield"], function (options) {
    options.rules["credential"] = options.params;
    options.messages['credential'] = options.message;
});

jQuery.validator.addMethod("credential", function (value, element, param) {
    var type = $("#" + param.typefield).find("option:selected").attr("value");

    if (type == "Identity") {
        var ret = checkIdcard(value);
        return ret.code == 0;
    }
    //没验证其他类型证件 
    return true;
});

/*
jQuery.validator.unobtrusive.adapters.add("mustChecked", ["other"], function (options) {
	//do nothing
});

jQuery.validator.addMethod("mustChecked", function (value, element, param) {
	alert($(element).attr("checked"));
	return $(element).attr("checked");

});
*/
