﻿/// <reference path="admin.js" />
//jquery 1.4.2
(function(A, w) { function ma() { if (!c.isReady) { try { s.documentElement.doScroll("left") } catch (a) { setTimeout(ma, 1); return } c.ready() } } function Qa(a, b) { b.src ? c.ajax({ url: b.src, async: false, dataType: "script" }) : c.globalEval(b.text || b.textContent || b.innerHTML || ""); b.parentNode && b.parentNode.removeChild(b) } function X(a, b, d, f, e, j) { var i = a.length; if (typeof b === "object") { for (var o in b) X(a, o, b[o], f, e, d); return a } if (d !== w) { f = !j && f && c.isFunction(d); for (o = 0; o < i; o++) e(a[o], b, f ? d.call(a[o], o, e(a[o], b)) : d, j); return a } return i ? e(a[0], b) : w } function J() { return (new Date).getTime() } function Y() { return false } function Z() { return true } function na(a, b, d) { d[0].type = a; return c.event.handle.apply(b, d) } function oa(a) { var b, d = [], f = [], e = arguments, j, i, o, k, n, r; i = c.data(this, "events"); if (!(a.liveFired === this || !i || !i.live || a.button && a.type === "click")) { a.liveFired = this; var u = i.live.slice(0); for (k = 0; k < u.length; k++) { i = u[k]; i.origType.replace(O, "") === a.type ? f.push(i.selector) : u.splice(k--, 1) } j = c(a.target).closest(f, a.currentTarget); n = 0; for (r = j.length; n < r; n++) for (k = 0; k < u.length; k++) { i = u[k]; if (j[n].selector === i.selector) { o = j[n].elem; f = null; if (i.preType === "mouseenter" || i.preType === "mouseleave") f = c(a.relatedTarget).closest(i.selector)[0]; if (!f || f !== o) d.push({ elem: o, handleObj: i }) } } n = 0; for (r = d.length; n < r; n++) { j = d[n]; a.currentTarget = j.elem; a.data = j.handleObj.data; a.handleObj = j.handleObj; if (j.handleObj.origHandler.apply(j.elem, e) === false) { b = false; break } } return b } } function pa(a, b) { return "live." + (a && a !== "*" ? a + "." : "") + b.replace(/\./g, "`").replace(/ /g, "&") } function qa(a) { return !a || !a.parentNode || a.parentNode.nodeType === 11 } function ra(a, b) { var d = 0; b.each(function() { if (this.nodeName === (a[d] && a[d].nodeName)) { var f = c.data(a[d++]), e = c.data(this, f); if (f = f && f.events) { delete e.handle; e.events = {}; for (var j in f) for (var i in f[j]) c.event.add(this, j, f[j][i], f[j][i].data) } } }) } function sa(a, b, d) { var f, e, j; b = b && b[0] ? b[0].ownerDocument || b[0] : s; if (a.length === 1 && typeof a[0] === "string" && a[0].length < 512 && b === s && !ta.test(a[0]) && (c.support.checkClone || !ua.test(a[0]))) { e = true; if (j = c.fragments[a[0]]) if (j !== 1) f = j } if (!f) { f = b.createDocumentFragment(); c.clean(a, b, f, d) } if (e) c.fragments[a[0]] = j ? f : 1; return { fragment: f, cacheable: e} } function K(a, b) { var d = {}; c.each(va.concat.apply([], va.slice(0, b)), function() { d[this] = a }); return d } function wa(a) { return "scrollTo" in a && a.document ? a : a.nodeType === 9 ? a.defaultView || a.parentWindow : false } var c = function(a, b) { return new c.fn.init(a, b) }, Ra = A.jQuery, Sa = A.$, s = A.document, T, Ta = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/, Ua = /^.[^:#\[\.,]*$/, Va = /\S/, Wa = /^(\s|\u00A0)+|(\s|\u00A0)+$/g, Xa = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, P = navigator.userAgent, xa = false, Q = [], L, $ = Object.prototype.toString, aa = Object.prototype.hasOwnProperty, ba = Array.prototype.push, R = Array.prototype.slice, ya = Array.prototype.indexOf; c.fn = c.prototype = { init: function(a, b) { var d, f; if (!a) return this; if (a.nodeType) { this.context = this[0] = a; this.length = 1; return this } if (a === "body" && !b) { this.context = s; this[0] = s.body; this.selector = "body"; this.length = 1; return this } if (typeof a === "string") if ((d = Ta.exec(a)) && (d[1] || !b)) if (d[1]) { f = b ? b.ownerDocument || b : s; if (a = Xa.exec(a)) if (c.isPlainObject(b)) { a = [s.createElement(a[1])]; c.fn.attr.call(a, b, true) } else a = [f.createElement(a[1])]; else { a = sa([d[1]], [f]); a = (a.cacheable ? a.fragment.cloneNode(true) : a.fragment).childNodes } return c.merge(this, a) } else { if (b = s.getElementById(d[2])) { if (b.id !== d[2]) return T.find(a); this.length = 1; this[0] = b } this.context = s; this.selector = a; return this } else if (!b && /^\w+$/.test(a)) { this.selector = a; this.context = s; a = s.getElementsByTagName(a); return c.merge(this, a) } else return !b || b.jquery ? (b || T).find(a) : c(b).find(a); else if (c.isFunction(a)) return T.ready(a); if (a.selector !== w) { this.selector = a.selector; this.context = a.context } return c.makeArray(a, this) }, selector: "", jquery: "1.4.2", length: 0, size: function() { return this.length }, toArray: function() { return R.call(this, 0) }, get: function(a) { return a == null ? this.toArray() : a < 0 ? this.slice(a)[0] : this[a] }, pushStack: function(a, b, d) { var f = c(); c.isArray(a) ? ba.apply(f, a) : c.merge(f, a); f.prevObject = this; f.context = this.context; if (b === "find") f.selector = this.selector + (this.selector ? " " : "") + d; else if (b) f.selector = this.selector + "." + b + "(" + d + ")"; return f }, each: function(a, b) { return c.each(this, a, b) }, ready: function(a) { c.bindReady(); if (c.isReady) a.call(s, c); else Q && Q.push(a); return this }, eq: function(a) { return a === -1 ? this.slice(a) : this.slice(a, +a + 1) }, first: function() { return this.eq(0) }, last: function() { return this.eq(-1) }, slice: function() { return this.pushStack(R.apply(this, arguments), "slice", R.call(arguments).join(",")) }, map: function(a) { return this.pushStack(c.map(this, function(b, d) { return a.call(b, d, b) })) }, end: function() { return this.prevObject || c(null) }, push: ba, sort: [].sort, splice: [].splice }; c.fn.init.prototype = c.fn; c.extend = c.fn.extend = function() { var a = arguments[0] || {}, b = 1, d = arguments.length, f = false, e, j, i, o; if (typeof a === "boolean") { f = a; a = arguments[1] || {}; b = 2 } if (typeof a !== "object" && !c.isFunction(a)) a = {}; if (d === b) { a = this; --b } for (; b < d; b++) if ((e = arguments[b]) != null) for (j in e) { i = a[j]; o = e[j]; if (a !== o) if (f && o && (c.isPlainObject(o) || c.isArray(o))) { i = i && (c.isPlainObject(i) || c.isArray(i)) ? i : c.isArray(o) ? [] : {}; a[j] = c.extend(f, i, o) } else if (o !== w) a[j] = o } return a }; c.extend({ noConflict: function(a) { A.$ = Sa; if (a) A.jQuery = Ra; return c }, isReady: false, ready: function() { if (!c.isReady) { if (!s.body) return setTimeout(c.ready, 13); c.isReady = true; if (Q) { for (var a, b = 0; a = Q[b++]; ) a.call(s, c); Q = null } c.fn.triggerHandler && c(s).triggerHandler("ready") } }, bindReady: function() { if (!xa) { xa = true; if (s.readyState === "complete") return c.ready(); if (s.addEventListener) { s.addEventListener("DOMContentLoaded", L, false); A.addEventListener("load", c.ready, false) } else if (s.attachEvent) { s.attachEvent("onreadystatechange", L); A.attachEvent("onload", c.ready); var a = false; try { a = A.frameElement == null } catch (b) { } s.documentElement.doScroll && a && ma() } } }, isFunction: function(a) { return $.call(a) === "[object Function]" }, isArray: function(a) { return $.call(a) === "[object Array]" }, isPlainObject: function(a) { if (!a || $.call(a) !== "[object Object]" || a.nodeType || a.setInterval) return false; if (a.constructor && !aa.call(a, "constructor") && !aa.call(a.constructor.prototype, "isPrototypeOf")) return false; var b; for (b in a); return b === w || aa.call(a, b) }, isEmptyObject: function(a) { for (var b in a) return false; return true }, error: function(a) { throw a; }, parseJSON: function(a) { if (typeof a !== "string" || !a) return null; a = c.trim(a); if (/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) return A.JSON && A.JSON.parse ? A.JSON.parse(a) : (new Function("return " + a))(); else c.error("Invalid JSON: " + a) }, noop: function() { }, globalEval: function(a) { if (a && Va.test(a)) { var b = s.getElementsByTagName("head")[0] || s.documentElement, d = s.createElement("script"); d.type = "text/javascript"; if (c.support.scriptEval) d.appendChild(s.createTextNode(a)); else d.text = a; b.insertBefore(d, b.firstChild); b.removeChild(d) } }, nodeName: function(a, b) { return a.nodeName && a.nodeName.toUpperCase() === b.toUpperCase() }, each: function(a, b, d) { var f, e = 0, j = a.length, i = j === w || c.isFunction(a); if (d) if (i) for (f in a) { if (b.apply(a[f], d) === false) break } else for (; e < j; ) { if (b.apply(a[e++], d) === false) break } else if (i) for (f in a) { if (b.call(a[f], f, a[f]) === false) break } else for (d = a[0]; e < j && b.call(d, e, d) !== false; d = a[++e]); return a }, trim: function(a) { return (a || "").replace(Wa, "") }, makeArray: function(a, b) { b = b || []; if (a != null) a.length == null || typeof a === "string" || c.isFunction(a) || typeof a !== "function" && a.setInterval ? ba.call(b, a) : c.merge(b, a); return b }, inArray: function(a, b) { if (b.indexOf) return b.indexOf(a); for (var d = 0, f = b.length; d < f; d++) if (b[d] === a) return d; return -1 }, merge: function(a, b) { var d = a.length, f = 0; if (typeof b.length === "number") for (var e = b.length; f < e; f++) a[d++] = b[f]; else for (; b[f] !== w; ) a[d++] = b[f++]; a.length = d; return a }, grep: function(a, b, d) { for (var f = [], e = 0, j = a.length; e < j; e++) !d !== !b(a[e], e) && f.push(a[e]); return f }, map: function(a, b, d) { for (var f = [], e, j = 0, i = a.length; j < i; j++) { e = b(a[j], j, d); if (e != null) f[f.length] = e } return f.concat.apply([], f) }, guid: 1, proxy: function(a, b, d) { if (arguments.length === 2) if (typeof b === "string") { d = a; a = d[b]; b = w } else if (b && !c.isFunction(b)) { d = b; b = w } if (!b && a) b = function() { return a.apply(d || this, arguments) }; if (a) b.guid = a.guid = a.guid || b.guid || c.guid++; return b }, uaMatch: function(a) { a = a.toLowerCase(); a = /(webkit)[ \/]([\w.]+)/.exec(a) || /(opera)(?:.*version)?[ \/]([\w.]+)/.exec(a) || /(msie) ([\w.]+)/.exec(a) || !/compatible/.test(a) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec(a) || []; return { browser: a[1] || "", version: a[2] || "0"} }, browser: {} }); P = c.uaMatch(P); if (P.browser) { c.browser[P.browser] = true; c.browser.version = P.version } if (c.browser.webkit) c.browser.safari = true; if (ya) c.inArray = function(a, b) { return ya.call(b, a) }; T = c(s); if (s.addEventListener) L = function() { s.removeEventListener("DOMContentLoaded", L, false); c.ready() }; else if (s.attachEvent) L = function() { if (s.readyState === "complete") { s.detachEvent("onreadystatechange", L); c.ready() } }; (function() { c.support = {}; var a = s.documentElement, b = s.createElement("script"), d = s.createElement("div"), f = "script" + J(); d.style.display = "none"; d.innerHTML = "   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; var e = d.getElementsByTagName("*"), j = d.getElementsByTagName("a")[0]; if (!(!e || !e.length || !j)) { c.support = { leadingWhitespace: d.firstChild.nodeType === 3, tbody: !d.getElementsByTagName("tbody").length, htmlSerialize: !!d.getElementsByTagName("link").length, style: /red/.test(j.getAttribute("style")), hrefNormalized: j.getAttribute("href") === "/a", opacity: /^0.55$/.test(j.style.opacity), cssFloat: !!j.style.cssFloat, checkOn: d.getElementsByTagName("input")[0].value === "on", optSelected: s.createElement("select").appendChild(s.createElement("option")).selected, parentNode: d.removeChild(d.appendChild(s.createElement("div"))).parentNode === null, deleteExpando: true, checkClone: false, scriptEval: false, noCloneEvent: true, boxModel: null }; b.type = "text/javascript"; try { b.appendChild(s.createTextNode("window." + f + "=1;")) } catch (i) { } a.insertBefore(b, a.firstChild); if (A[f]) { c.support.scriptEval = true; delete A[f] } try { delete b.test } catch (o) { c.support.deleteExpando = false } a.removeChild(b); if (d.attachEvent && d.fireEvent) { d.attachEvent("onclick", function k() { c.support.noCloneEvent = false; d.detachEvent("onclick", k) }); d.cloneNode(true).fireEvent("onclick") } d = s.createElement("div"); d.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>"; a = s.createDocumentFragment(); a.appendChild(d.firstChild); c.support.checkClone = a.cloneNode(true).cloneNode(true).lastChild.checked; c(function() { var k = s.createElement("div"); k.style.width = k.style.paddingLeft = "1px"; s.body.appendChild(k); c.boxModel = c.support.boxModel = k.offsetWidth === 2; s.body.removeChild(k).style.display = "none" }); a = function(k) { var n = s.createElement("div"); k = "on" + k; var r = k in n; if (!r) { n.setAttribute(k, "return;"); r = typeof n[k] === "function" } return r }; c.support.submitBubbles = a("submit"); c.support.changeBubbles = a("change"); a = b = d = e = j = null } })(); c.props = { "for": "htmlFor", "class": "className", readonly: "readOnly", maxlength: "maxLength", cellspacing: "cellSpacing", rowspan: "rowSpan", colspan: "colSpan", tabindex: "tabIndex", usemap: "useMap", frameborder: "frameBorder" }; var G = "jQuery" + J(), Ya = 0, za = {}; c.extend({ cache: {}, expando: G, noData: { embed: true, object: true, applet: true }, data: function(a, b, d) { if (!(a.nodeName && c.noData[a.nodeName.toLowerCase()])) { a = a == A ? za : a; var f = a[G], e = c.cache; if (!f && typeof b === "string" && d === w) return null; f || (f = ++Ya); if (typeof b === "object") { a[G] = f; e[f] = c.extend(true, {}, b) } else if (!e[f]) { a[G] = f; e[f] = {} } a = e[f]; if (d !== w) a[b] = d; return typeof b === "string" ? a[b] : a } }, removeData: function(a, b) { if (!(a.nodeName && c.noData[a.nodeName.toLowerCase()])) { a = a == A ? za : a; var d = a[G], f = c.cache, e = f[d]; if (b) { if (e) { delete e[b]; c.isEmptyObject(e) && c.removeData(a) } } else { if (c.support.deleteExpando) delete a[c.expando]; else a.removeAttribute && a.removeAttribute(c.expando); delete f[d] } } } }); c.fn.extend({ data: function(a, b) { if (typeof a === "undefined" && this.length) return c.data(this[0]); else if (typeof a === "object") return this.each(function() { c.data(this, a) }); var d = a.split("."); d[1] = d[1] ? "." + d[1] : ""; if (b === w) { var f = this.triggerHandler("getData" + d[1] + "!", [d[0]]); if (f === w && this.length) f = c.data(this[0], a); return f === w && d[1] ? this.data(d[0]) : f } else return this.trigger("setData" + d[1] + "!", [d[0], b]).each(function() { c.data(this, a, b) }) }, removeData: function(a) { return this.each(function() { c.removeData(this, a) }) } }); c.extend({ queue: function(a, b, d) { if (a) { b = (b || "fx") + "queue"; var f = c.data(a, b); if (!d) return f || []; if (!f || c.isArray(d)) f = c.data(a, b, c.makeArray(d)); else f.push(d); return f } }, dequeue: function(a, b) { b = b || "fx"; var d = c.queue(a, b), f = d.shift(); if (f === "inprogress") f = d.shift(); if (f) { b === "fx" && d.unshift("inprogress"); f.call(a, function() { c.dequeue(a, b) }) } } }); c.fn.extend({ queue: function(a, b) { if (typeof a !== "string") { b = a; a = "fx" } if (b === w) return c.queue(this[0], a); return this.each(function() { var d = c.queue(this, a, b); a === "fx" && d[0] !== "inprogress" && c.dequeue(this, a) }) }, dequeue: function(a) { return this.each(function() { c.dequeue(this, a) }) }, delay: function(a, b) { a = c.fx ? c.fx.speeds[a] || a : a; b = b || "fx"; return this.queue(b, function() { var d = this; setTimeout(function() { c.dequeue(d, b) }, a) }) }, clearQueue: function(a) { return this.queue(a || "fx", []) } }); var Aa = /[\n\t]/g, ca = /\s+/, Za = /\r/g, $a = /href|src|style/, ab = /(button|input)/i, bb = /(button|input|object|select|textarea)/i, cb = /^(a|area)$/i, Ba = /radio|checkbox/; c.fn.extend({ attr: function(a, b) { return X(this, a, b, true, c.attr) }, removeAttr: function(a) { return this.each(function() { c.attr(this, a, ""); this.nodeType === 1 && this.removeAttribute(a) }) }, addClass: function(a) { if (c.isFunction(a)) return this.each(function(n) { var r = c(this); r.addClass(a.call(this, n, r.attr("class"))) }); if (a && typeof a === "string") for (var b = (a || "").split(ca), d = 0, f = this.length; d < f; d++) { var e = this[d]; if (e.nodeType === 1) if (e.className) { for (var j = " " + e.className + " ", i = e.className, o = 0, k = b.length; o < k; o++) if (j.indexOf(" " + b[o] + " ") < 0) i += " " + b[o]; e.className = c.trim(i) } else e.className = a } return this }, removeClass: function(a) { if (c.isFunction(a)) return this.each(function(k) { var n = c(this); n.removeClass(a.call(this, k, n.attr("class"))) }); if (a && typeof a === "string" || a === w) for (var b = (a || "").split(ca), d = 0, f = this.length; d < f; d++) { var e = this[d]; if (e.nodeType === 1 && e.className) if (a) { for (var j = (" " + e.className + " ").replace(Aa, " "), i = 0, o = b.length; i < o; i++) j = j.replace(" " + b[i] + " ", " "); e.className = c.trim(j) } else e.className = "" } return this }, toggleClass: function(a, b) { var d = typeof a, f = typeof b === "boolean"; if (c.isFunction(a)) return this.each(function(e) { var j = c(this); j.toggleClass(a.call(this, e, j.attr("class"), b), b) }); return this.each(function() { if (d === "string") for (var e, j = 0, i = c(this), o = b, k = a.split(ca); e = k[j++]; ) { o = f ? o : !i.hasClass(e); i[o ? "addClass" : "removeClass"](e) } else if (d === "undefined" || d === "boolean") { this.className && c.data(this, "__className__", this.className); this.className = this.className || a === false ? "" : c.data(this, "__className__") || "" } }) }, hasClass: function(a) { a = " " + a + " "; for (var b = 0, d = this.length; b < d; b++) if ((" " + this[b].className + " ").replace(Aa, " ").indexOf(a) > -1) return true; return false }, val: function(a) { if (a === w) { var b = this[0]; if (b) { if (c.nodeName(b, "option")) return (b.attributes.value || {}).specified ? b.value : b.text; if (c.nodeName(b, "select")) { var d = b.selectedIndex, f = [], e = b.options; b = b.type === "select-one"; if (d < 0) return null; var j = b ? d : 0; for (d = b ? d + 1 : e.length; j < d; j++) { var i = e[j]; if (i.selected) { a = c(i).val(); if (b) return a; f.push(a) } } return f } if (Ba.test(b.type) && !c.support.checkOn) return b.getAttribute("value") === null ? "on" : b.value; return (b.value || "").replace(Za, "") } return w } var o = c.isFunction(a); return this.each(function(k) { var n = c(this), r = a; if (this.nodeType === 1) { if (o) r = a.call(this, k, n.val()); if (typeof r === "number") r += ""; if (c.isArray(r) && Ba.test(this.type)) this.checked = c.inArray(n.val(), r) >= 0; else if (c.nodeName(this, "select")) { var u = c.makeArray(r); c("option", this).each(function() { this.selected = c.inArray(c(this).val(), u) >= 0 }); if (!u.length) this.selectedIndex = -1 } else this.value = r } }) } }); c.extend({ attrFn: { val: true, css: true, html: true, text: true, data: true, width: true, height: true, offset: true }, attr: function(a, b, d, f) { if (!a || a.nodeType === 3 || a.nodeType === 8) return w; if (f && b in c.attrFn) return c(a)[b](d); f = a.nodeType !== 1 || !c.isXMLDoc(a); var e = d !== w; b = f && c.props[b] || b; if (a.nodeType === 1) { var j = $a.test(b); if (b in a && f && !j) { if (e) { b === "type" && ab.test(a.nodeName) && a.parentNode && c.error("type property can't be changed"); a[b] = d } if (c.nodeName(a, "form") && a.getAttributeNode(b)) return a.getAttributeNode(b).nodeValue; if (b === "tabIndex") return (b = a.getAttributeNode("tabIndex")) && b.specified ? b.value : bb.test(a.nodeName) || cb.test(a.nodeName) && a.href ? 0 : w; return a[b] } if (!c.support.style && f && b === "style") { if (e) a.style.cssText = "" + d; return a.style.cssText } e && a.setAttribute(b, "" + d); a = !c.support.hrefNormalized && f && j ? a.getAttribute(b, 2) : a.getAttribute(b); return a === null ? w : a } return c.style(a, b, d) } }); var O = /\.(.*)$/, db = function(a) { return a.replace(/[^\w\s\.\|`]/g, function(b) { return "\\" + b }) }; c.event = { add: function(a, b, d, f) { if (!(a.nodeType === 3 || a.nodeType === 8)) { if (a.setInterval && a !== A && !a.frameElement) a = A; var e, j; if (d.handler) { e = d; d = e.handler } if (!d.guid) d.guid = c.guid++; if (j = c.data(a)) { var i = j.events = j.events || {}, o = j.handle; if (!o) j.handle = o = function() { return typeof c !== "undefined" && !c.event.triggered ? c.event.handle.apply(o.elem, arguments) : w }; o.elem = a; b = b.split(" "); for (var k, n = 0, r; k = b[n++]; ) { j = e ? c.extend({}, e) : { handler: d, data: f }; if (k.indexOf(".") > -1) { r = k.split("."); k = r.shift(); j.namespace = r.slice(0).sort().join(".") } else { r = []; j.namespace = "" } j.type = k; j.guid = d.guid; var u = i[k], z = c.event.special[k] || {}; if (!u) { u = i[k] = []; if (!z.setup || z.setup.call(a, f, r, o) === false) if (a.addEventListener) a.addEventListener(k, o, false); else a.attachEvent && a.attachEvent("on" + k, o) } if (z.add) { z.add.call(a, j); if (!j.handler.guid) j.handler.guid = d.guid } u.push(j); c.event.global[k] = true } a = null } } }, global: {}, remove: function(a, b, d, f) { if (!(a.nodeType === 3 || a.nodeType === 8)) { var e, j = 0, i, o, k, n, r, u, z = c.data(a), C = z && z.events; if (z && C) { if (b && b.type) { d = b.handler; b = b.type } if (!b || typeof b === "string" && b.charAt(0) === ".") { b = b || ""; for (e in C) c.event.remove(a, e + b) } else { for (b = b.split(" "); e = b[j++]; ) { n = e; i = e.indexOf(".") < 0; o = []; if (!i) { o = e.split("."); e = o.shift(); k = new RegExp("(^|\\.)" + c.map(o.slice(0).sort(), db).join("\\.(?:.*\\.)?") + "(\\.|$)") } if (r = C[e]) if (d) { n = c.event.special[e] || {}; for (B = f || 0; B < r.length; B++) { u = r[B]; if (d.guid === u.guid) { if (i || k.test(u.namespace)) { f == null && r.splice(B--, 1); n.remove && n.remove.call(a, u) } if (f != null) break } } if (r.length === 0 || f != null && r.length === 1) { if (!n.teardown || n.teardown.call(a, o) === false) Ca(a, e, z.handle); delete C[e] } } else for (var B = 0; B < r.length; B++) { u = r[B]; if (i || k.test(u.namespace)) { c.event.remove(a, n, u.handler, B); r.splice(B--, 1) } } } if (c.isEmptyObject(C)) { if (b = z.handle) b.elem = null; delete z.events; delete z.handle; c.isEmptyObject(z) && c.removeData(a) } } } } }, trigger: function(a, b, d, f) { var e = a.type || a; if (!f) { a = typeof a === "object" ? a[G] ? a : c.extend(c.Event(e), a) : c.Event(e); if (e.indexOf("!") >= 0) { a.type = e = e.slice(0, -1); a.exclusive = true } if (!d) { a.stopPropagation(); c.event.global[e] && c.each(c.cache, function() { this.events && this.events[e] && c.event.trigger(a, b, this.handle.elem) }) } if (!d || d.nodeType === 3 || d.nodeType === 8) return w; a.result = w; a.target = d; b = c.makeArray(b); b.unshift(a) } a.currentTarget = d; (f = c.data(d, "handle")) && f.apply(d, b); f = d.parentNode || d.ownerDocument; try { if (!(d && d.nodeName && c.noData[d.nodeName.toLowerCase()])) if (d["on" + e] && d["on" + e].apply(d, b) === false) a.result = false } catch (j) { } if (!a.isPropagationStopped() && f) c.event.trigger(a, b, f, true); else if (!a.isDefaultPrevented()) { f = a.target; var i, o = c.nodeName(f, "a") && e === "click", k = c.event.special[e] || {}; if ((!k._default || k._default.call(d, a) === false) && !o && !(f && f.nodeName && c.noData[f.nodeName.toLowerCase()])) { try { if (f[e]) { if (i = f["on" + e]) f["on" + e] = null; c.event.triggered = true; f[e]() } } catch (n) { } if (i) f["on" + e] = i; c.event.triggered = false } } }, handle: function(a) { var b, d, f, e; a = arguments[0] = c.event.fix(a || A.event); a.currentTarget = this; b = a.type.indexOf(".") < 0 && !a.exclusive; if (!b) { d = a.type.split("."); a.type = d.shift(); f = new RegExp("(^|\\.)" + d.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)") } e = c.data(this, "events"); d = e[a.type]; if (e && d) { d = d.slice(0); e = 0; for (var j = d.length; e < j; e++) { var i = d[e]; if (b || f.test(i.namespace)) { a.handler = i.handler; a.data = i.data; a.handleObj = i; i = i.handler.apply(this, arguments); if (i !== w) { a.result = i; if (i === false) { a.preventDefault(); a.stopPropagation() } } if (a.isImmediatePropagationStopped()) break } } } return a.result }, props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), fix: function(a) { if (a[G]) return a; var b = a; a = c.Event(b); for (var d = this.props.length, f; d; ) { f = this.props[--d]; a[f] = b[f] } if (!a.target) a.target = a.srcElement || s; if (a.target.nodeType === 3) a.target = a.target.parentNode; if (!a.relatedTarget && a.fromElement) a.relatedTarget = a.fromElement === a.target ? a.toElement : a.fromElement; if (a.pageX == null && a.clientX != null) { b = s.documentElement; d = s.body; a.pageX = a.clientX + (b && b.scrollLeft || d && d.scrollLeft || 0) - (b && b.clientLeft || d && d.clientLeft || 0); a.pageY = a.clientY + (b && b.scrollTop || d && d.scrollTop || 0) - (b && b.clientTop || d && d.clientTop || 0) } if (!a.which && (a.charCode || a.charCode === 0 ? a.charCode : a.keyCode)) a.which = a.charCode || a.keyCode; if (!a.metaKey && a.ctrlKey) a.metaKey = a.ctrlKey; if (!a.which && a.button !== w) a.which = a.button & 1 ? 1 : a.button & 2 ? 3 : a.button & 4 ? 2 : 0; return a }, guid: 1E8, proxy: c.proxy, special: { ready: { setup: c.bindReady, teardown: c.noop }, live: { add: function(a) { c.event.add(this, a.origType, c.extend({}, a, { handler: oa })) }, remove: function(a) { var b = true, d = a.origType.replace(O, ""); c.each(c.data(this, "events").live || [], function() { if (d === this.origType.replace(O, "")) return b = false }); b && c.event.remove(this, a.origType, oa) } }, beforeunload: { setup: function(a, b, d) { if (this.setInterval) this.onbeforeunload = d; return false }, teardown: function(a, b) { if (this.onbeforeunload === b) this.onbeforeunload = null } }} }; var Ca = s.removeEventListener ? function(a, b, d) { a.removeEventListener(b, d, false) } : function(a, b, d) { a.detachEvent("on" + b, d) }; c.Event = function(a) { if (!this.preventDefault) return new c.Event(a); if (a && a.type) { this.originalEvent = a; this.type = a.type } else this.type = a; this.timeStamp = J(); this[G] = true }; c.Event.prototype = { preventDefault: function() { this.isDefaultPrevented = Z; var a = this.originalEvent; if (a) { a.preventDefault && a.preventDefault(); a.returnValue = false } }, stopPropagation: function() { this.isPropagationStopped = Z; var a = this.originalEvent; if (a) { a.stopPropagation && a.stopPropagation(); a.cancelBubble = true } }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = Z; this.stopPropagation() }, isDefaultPrevented: Y, isPropagationStopped: Y, isImmediatePropagationStopped: Y }; var Da = function(a) { var b = a.relatedTarget; try { for (; b && b !== this; ) b = b.parentNode; if (b !== this) { a.type = a.data; c.event.handle.apply(this, arguments) } } catch (d) { } }, Ea = function(a) { a.type = a.data; c.event.handle.apply(this, arguments) }; c.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function(a, b) { c.event.special[a] = { setup: function(d) { c.event.add(this, b, d && d.selector ? Ea : Da, a) }, teardown: function(d) { c.event.remove(this, b, d && d.selector ? Ea : Da) } } }); if (!c.support.submitBubbles) c.event.special.submit = { setup: function() { if (this.nodeName.toLowerCase() !== "form") { c.event.add(this, "click.specialSubmit", function(a) { var b = a.target, d = b.type; if ((d === "submit" || d === "image") && c(b).closest("form").length) return na("submit", this, arguments) }); c.event.add(this, "keypress.specialSubmit", function(a) { var b = a.target, d = b.type; if ((d === "text" || d === "password") && c(b).closest("form").length && a.keyCode === 13) return na("submit", this, arguments) }) } else return false }, teardown: function() { c.event.remove(this, ".specialSubmit") } }; if (!c.support.changeBubbles) { var da = /textarea|input|select/i, ea, Fa = function(a) { var b = a.type, d = a.value; if (b === "radio" || b === "checkbox") d = a.checked; else if (b === "select-multiple") d = a.selectedIndex > -1 ? c.map(a.options, function(f) { return f.selected }).join("-") : ""; else if (a.nodeName.toLowerCase() === "select") d = a.selectedIndex; return d }, fa = function(a, b) { var d = a.target, f, e; if (!(!da.test(d.nodeName) || d.readOnly)) { f = c.data(d, "_change_data"); e = Fa(d); if (a.type !== "focusout" || d.type !== "radio") c.data(d, "_change_data", e); if (!(f === w || e === f)) if (f != null || e) { a.type = "change"; return c.event.trigger(a, b, d) } } }; c.event.special.change = { filters: { focusout: fa, click: function(a) { var b = a.target, d = b.type; if (d === "radio" || d === "checkbox" || b.nodeName.toLowerCase() === "select") return fa.call(this, a) }, keydown: function(a) { var b = a.target, d = b.type; if (a.keyCode === 13 && b.nodeName.toLowerCase() !== "textarea" || a.keyCode === 32 && (d === "checkbox" || d === "radio") || d === "select-multiple") return fa.call(this, a) }, beforeactivate: function(a) { a = a.target; c.data(a, "_change_data", Fa(a)) } }, setup: function() { if (this.type === "file") return false; for (var a in ea) c.event.add(this, a + ".specialChange", ea[a]); return da.test(this.nodeName) }, teardown: function() { c.event.remove(this, ".specialChange"); return da.test(this.nodeName) } }; ea = c.event.special.change.filters } s.addEventListener && c.each({ focus: "focusin", blur: "focusout" }, function(a, b) { function d(f) { f = c.event.fix(f); f.type = b; return c.event.handle.call(this, f) } c.event.special[b] = { setup: function() { this.addEventListener(a, d, true) }, teardown: function() { this.removeEventListener(a, d, true) } } }); c.each(["bind", "one"], function(a, b) { c.fn[b] = function(d, f, e) { if (typeof d === "object") { for (var j in d) this[b](j, f, d[j], e); return this } if (c.isFunction(f)) { e = f; f = w } var i = b === "one" ? c.proxy(e, function(k) { c(this).unbind(k, i); return e.apply(this, arguments) }) : e; if (d === "unload" && b !== "one") this.one(d, f, e); else { j = 0; for (var o = this.length; j < o; j++) c.event.add(this[j], d, i, f) } return this } }); c.fn.extend({ unbind: function(a, b) { if (typeof a === "object" && !a.preventDefault) for (var d in a) this.unbind(d, a[d]); else { d = 0; for (var f = this.length; d < f; d++) c.event.remove(this[d], a, b) } return this }, delegate: function(a, b, d, f) { return this.live(b, d, f, a) }, undelegate: function(a, b, d) { return arguments.length === 0 ? this.unbind("live") : this.die(b, null, d, a) }, trigger: function(a, b) { return this.each(function() { c.event.trigger(a, b, this) }) }, triggerHandler: function(a, b) { if (this[0]) { a = c.Event(a); a.preventDefault(); a.stopPropagation(); c.event.trigger(a, b, this[0]); return a.result } }, toggle: function(a) { for (var b = arguments, d = 1; d < b.length; ) c.proxy(a, b[d++]); return this.click(c.proxy(a, function(f) { var e = (c.data(this, "lastToggle" + a.guid) || 0) % d; c.data(this, "lastToggle" + a.guid, e + 1); f.preventDefault(); return b[e].apply(this, arguments) || false })) }, hover: function(a, b) { return this.mouseenter(a).mouseleave(b || a) } }); var Ga = { focus: "focusin", blur: "focusout", mouseenter: "mouseover", mouseleave: "mouseout" }; c.each(["live", "die"], function(a, b) { c.fn[b] = function(d, f, e, j) { var i, o = 0, k, n, r = j || this.selector, u = j ? this : c(this.context); if (c.isFunction(f)) { e = f; f = w } for (d = (d || "").split(" "); (i = d[o++]) != null; ) { j = O.exec(i); k = ""; if (j) { k = j[0]; i = i.replace(O, "") } if (i === "hover") d.push("mouseenter" + k, "mouseleave" + k); else { n = i; if (i === "focus" || i === "blur") { d.push(Ga[i] + k); i += k } else i = (Ga[i] || i) + k; b === "live" ? u.each(function() { c.event.add(this, pa(i, r), { data: f, selector: r, handler: e, origType: i, origHandler: e, preType: n }) }) : u.unbind(pa(i, r), e) } } return this } }); c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "), function(a, b) { c.fn[b] = function(d) { return d ? this.bind(b, d) : this.trigger(b) }; if (c.attrFn) c.attrFn[b] = true }); A.attachEvent && !A.addEventListener && A.attachEvent("onunload", function() { for (var a in c.cache) if (c.cache[a].handle) try { c.event.remove(c.cache[a].handle.elem) } catch (b) { } }); (function() { function a(g) { for (var h = "", l, m = 0; g[m]; m++) { l = g[m]; if (l.nodeType === 3 || l.nodeType === 4) h += l.nodeValue; else if (l.nodeType !== 8) h += a(l.childNodes) } return h } function b(g, h, l, m, q, p) { q = 0; for (var v = m.length; q < v; q++) { var t = m[q]; if (t) { t = t[g]; for (var y = false; t; ) { if (t.sizcache === l) { y = m[t.sizset]; break } if (t.nodeType === 1 && !p) { t.sizcache = l; t.sizset = q } if (t.nodeName.toLowerCase() === h) { y = t; break } t = t[g] } m[q] = y } } } function d(g, h, l, m, q, p) { q = 0; for (var v = m.length; q < v; q++) { var t = m[q]; if (t) { t = t[g]; for (var y = false; t; ) { if (t.sizcache === l) { y = m[t.sizset]; break } if (t.nodeType === 1) { if (!p) { t.sizcache = l; t.sizset = q } if (typeof h !== "string") { if (t === h) { y = true; break } } else if (k.filter(h, [t]).length > 0) { y = t; break } } t = t[g] } m[q] = y } } } var f = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, e = 0, j = Object.prototype.toString, i = false, o = true; [0, 0].sort(function() { o = false; return 0 }); var k = function(g, h, l, m) { l = l || []; var q = h = h || s; if (h.nodeType !== 1 && h.nodeType !== 9) return []; if (!g || typeof g !== "string") return l; for (var p = [], v, t, y, S, H = true, M = x(h), I = g; (f.exec(""), v = f.exec(I)) !== null; ) { I = v[3]; p.push(v[1]); if (v[2]) { S = v[3]; break } } if (p.length > 1 && r.exec(g)) if (p.length === 2 && n.relative[p[0]]) t = ga(p[0] + p[1], h); else for (t = n.relative[p[0]] ? [h] : k(p.shift(), h); p.length; ) { g = p.shift(); if (n.relative[g]) g += p.shift(); t = ga(g, t) } else { if (!m && p.length > 1 && h.nodeType === 9 && !M && n.match.ID.test(p[0]) && !n.match.ID.test(p[p.length - 1])) { v = k.find(p.shift(), h, M); h = v.expr ? k.filter(v.expr, v.set)[0] : v.set[0] } if (h) { v = m ? { expr: p.pop(), set: z(m)} : k.find(p.pop(), p.length === 1 && (p[0] === "~" || p[0] === "+") && h.parentNode ? h.parentNode : h, M); t = v.expr ? k.filter(v.expr, v.set) : v.set; if (p.length > 0) y = z(t); else H = false; for (; p.length; ) { var D = p.pop(); v = D; if (n.relative[D]) v = p.pop(); else D = ""; if (v == null) v = h; n.relative[D](y, v, M) } } else y = [] } y || (y = t); y || k.error(D || g); if (j.call(y) === "[object Array]") if (H) if (h && h.nodeType === 1) for (g = 0; y[g] != null; g++) { if (y[g] && (y[g] === true || y[g].nodeType === 1 && E(h, y[g]))) l.push(t[g]) } else for (g = 0; y[g] != null; g++) y[g] && y[g].nodeType === 1 && l.push(t[g]); else l.push.apply(l, y); else z(y, l); if (S) { k(S, q, l, m); k.uniqueSort(l) } return l }; k.uniqueSort = function(g) { if (B) { i = o; g.sort(B); if (i) for (var h = 1; h < g.length; h++) g[h] === g[h - 1] && g.splice(h--, 1) } return g }; k.matches = function(g, h) { return k(g, null, null, h) }; k.find = function(g, h, l) { var m, q; if (!g) return []; for (var p = 0, v = n.order.length; p < v; p++) { var t = n.order[p]; if (q = n.leftMatch[t].exec(g)) { var y = q[1]; q.splice(1, 1); if (y.substr(y.length - 1) !== "\\") { q[1] = (q[1] || "").replace(/\\/g, ""); m = n.find[t](q, h, l); if (m != null) { g = g.replace(n.match[t], ""); break } } } } m || (m = h.getElementsByTagName("*")); return { set: m, expr: g} }; k.filter = function(g, h, l, m) { for (var q = g, p = [], v = h, t, y, S = h && h[0] && x(h[0]); g && h.length; ) { for (var H in n.filter) if ((t = n.leftMatch[H].exec(g)) != null && t[2]) { var M = n.filter[H], I, D; D = t[1]; y = false; t.splice(1, 1); if (D.substr(D.length - 1) !== "\\") { if (v === p) p = []; if (n.preFilter[H]) if (t = n.preFilter[H](t, v, l, p, m, S)) { if (t === true) continue } else y = I = true; if (t) for (var U = 0; (D = v[U]) != null; U++) if (D) { I = M(D, t, U, v); var Ha = m ^ !!I; if (l && I != null) if (Ha) y = true; else v[U] = false; else if (Ha) { p.push(D); y = true } } if (I !== w) { l || (v = p); g = g.replace(n.match[H], ""); if (!y) return []; break } } } if (g === q) if (y == null) k.error(g); else break; q = g } return v }; k.error = function(g) { throw "Syntax error, unrecognized expression: " + g; }; var n = k.selectors = { order: ["ID", "NAME", "TAG"], match: { ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/, CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/, NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/, ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/, TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/, CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/, POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/, PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ }, leftMatch: {}, attrMap: { "class": "className", "for": "htmlFor" }, attrHandle: { href: function(g) { return g.getAttribute("href") } }, relative: { "+": function(g, h) { var l = typeof h === "string", m = l && !/\W/.test(h); l = l && !m; if (m) h = h.toLowerCase(); m = 0; for (var q = g.length, p; m < q; m++) if (p = g[m]) { for (; (p = p.previousSibling) && p.nodeType !== 1; ); g[m] = l || p && p.nodeName.toLowerCase() === h ? p || false : p === h } l && k.filter(h, g, true) }, ">": function(g, h) { var l = typeof h === "string"; if (l && !/\W/.test(h)) { h = h.toLowerCase(); for (var m = 0, q = g.length; m < q; m++) { var p = g[m]; if (p) { l = p.parentNode; g[m] = l.nodeName.toLowerCase() === h ? l : false } } } else { m = 0; for (q = g.length; m < q; m++) if (p = g[m]) g[m] = l ? p.parentNode : p.parentNode === h; l && k.filter(h, g, true) } }, "": function(g, h, l) { var m = e++, q = d; if (typeof h === "string" && !/\W/.test(h)) { var p = h = h.toLowerCase(); q = b } q("parentNode", h, m, g, p, l) }, "~": function(g, h, l) { var m = e++, q = d; if (typeof h === "string" && !/\W/.test(h)) { var p = h = h.toLowerCase(); q = b } q("previousSibling", h, m, g, p, l) } }, find: { ID: function(g, h, l) { if (typeof h.getElementById !== "undefined" && !l) return (g = h.getElementById(g[1])) ? [g] : [] }, NAME: function(g, h) { if (typeof h.getElementsByName !== "undefined") { var l = []; h = h.getElementsByName(g[1]); for (var m = 0, q = h.length; m < q; m++) h[m].getAttribute("name") === g[1] && l.push(h[m]); return l.length === 0 ? null : l } }, TAG: function(g, h) { return h.getElementsByTagName(g[1]) } }, preFilter: { CLASS: function(g, h, l, m, q, p) { g = " " + g[1].replace(/\\/g, "") + " "; if (p) return g; p = 0; for (var v; (v = h[p]) != null; p++) if (v) if (q ^ (v.className && (" " + v.className + " ").replace(/[\t\n]/g, " ").indexOf(g) >= 0)) l || m.push(v); else if (l) h[p] = false; return false }, ID: function(g) { return g[1].replace(/\\/g, "") }, TAG: function(g) { return g[1].toLowerCase() }, CHILD: function(g) { if (g[1] === "nth") { var h = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2] === "even" && "2n" || g[2] === "odd" && "2n+1" || !/\D/.test(g[2]) && "0n+" + g[2] || g[2]); g[2] = h[1] + (h[2] || 1) - 0; g[3] = h[3] - 0 } g[0] = e++; return g }, ATTR: function(g, h, l, m, q, p) { h = g[1].replace(/\\/g, ""); if (!p && n.attrMap[h]) g[1] = n.attrMap[h]; if (g[2] === "~=") g[4] = " " + g[4] + " "; return g }, PSEUDO: function(g, h, l, m, q) { if (g[1] === "not") if ((f.exec(g[3]) || "").length > 1 || /^\w/.test(g[3])) g[3] = k(g[3], null, null, h); else { g = k.filter(g[3], h, l, true ^ q); l || m.push.apply(m, g); return false } else if (n.match.POS.test(g[0]) || n.match.CHILD.test(g[0])) return true; return g }, POS: function(g) { g.unshift(true); return g } }, filters: { enabled: function(g) { return g.disabled === false && g.type !== "hidden" }, disabled: function(g) { return g.disabled === true }, checked: function(g) { return g.checked === true }, selected: function(g) { return g.selected === true }, parent: function(g) { return !!g.firstChild }, empty: function(g) { return !g.firstChild }, has: function(g, h, l) { return !!k(l[3], g).length }, header: function(g) { return /h\d/i.test(g.nodeName) }, text: function(g) { return "text" === g.type }, radio: function(g) { return "radio" === g.type }, checkbox: function(g) { return "checkbox" === g.type }, file: function(g) { return "file" === g.type }, password: function(g) { return "password" === g.type }, submit: function(g) { return "submit" === g.type }, image: function(g) { return "image" === g.type }, reset: function(g) { return "reset" === g.type }, button: function(g) { return "button" === g.type || g.nodeName.toLowerCase() === "button" }, input: function(g) { return /input|select|textarea|button/i.test(g.nodeName) } }, setFilters: { first: function(g, h) { return h === 0 }, last: function(g, h, l, m) { return h === m.length - 1 }, even: function(g, h) { return h % 2 === 0 }, odd: function(g, h) { return h % 2 === 1 }, lt: function(g, h, l) { return h < l[3] - 0 }, gt: function(g, h, l) { return h > l[3] - 0 }, nth: function(g, h, l) { return l[3] - 0 === h }, eq: function(g, h, l) { return l[3] - 0 === h } }, filter: { PSEUDO: function(g, h, l, m) { var q = h[1], p = n.filters[q]; if (p) return p(g, l, h, m); else if (q === "contains") return (g.textContent || g.innerText || a([g]) || "").indexOf(h[3]) >= 0; else if (q === "not") { h = h[3]; l = 0; for (m = h.length; l < m; l++) if (h[l] === g) return false; return true } else k.error("Syntax error, unrecognized expression: " + q) }, CHILD: function(g, h) { var l = h[1], m = g; switch (l) { case "only": case "first": for (; m = m.previousSibling; ) if (m.nodeType === 1) return false; if (l === "first") return true; m = g; case "last": for (; m = m.nextSibling; ) if (m.nodeType === 1) return false; return true; case "nth": l = h[2]; var q = h[3]; if (l === 1 && q === 0) return true; h = h[0]; var p = g.parentNode; if (p && (p.sizcache !== h || !g.nodeIndex)) { var v = 0; for (m = p.firstChild; m; m = m.nextSibling) if (m.nodeType === 1) m.nodeIndex = ++v; p.sizcache = h } g = g.nodeIndex - q; return l === 0 ? g === 0 : g % l === 0 && g / l >= 0 } }, ID: function(g, h) { return g.nodeType === 1 && g.getAttribute("id") === h }, TAG: function(g, h) { return h === "*" && g.nodeType === 1 || g.nodeName.toLowerCase() === h }, CLASS: function(g, h) { return (" " + (g.className || g.getAttribute("class")) + " ").indexOf(h) > -1 }, ATTR: function(g, h) { var l = h[1]; g = n.attrHandle[l] ? n.attrHandle[l](g) : g[l] != null ? g[l] : g.getAttribute(l); l = g + ""; var m = h[2]; h = h[4]; return g == null ? m === "!=" : m === "=" ? l === h : m === "*=" ? l.indexOf(h) >= 0 : m === "~=" ? (" " + l + " ").indexOf(h) >= 0 : !h ? l && g !== false : m === "!=" ? l !== h : m === "^=" ? l.indexOf(h) === 0 : m === "$=" ? l.substr(l.length - h.length) === h : m === "|=" ? l === h || l.substr(0, h.length + 1) === h + "-" : false }, POS: function(g, h, l, m) { var q = n.setFilters[h[2]]; if (q) return q(g, l, h, m) } } }, r = n.match.POS; for (var u in n.match) { n.match[u] = new RegExp(n.match[u].source + /(?![^\[]*\])(?![^\(]*\))/.source); n.leftMatch[u] = new RegExp(/(^(?:.|\r|\n)*?)/.source + n.match[u].source.replace(/\\(\d+)/g, function(g, h) { return "\\" + (h - 0 + 1) })) } var z = function(g, h) { g = Array.prototype.slice.call(g, 0); if (h) { h.push.apply(h, g); return h } return g }; try { Array.prototype.slice.call(s.documentElement.childNodes, 0) } catch (C) { z = function(g, h) { h = h || []; if (j.call(g) === "[object Array]") Array.prototype.push.apply(h, g); else if (typeof g.length === "number") for (var l = 0, m = g.length; l < m; l++) h.push(g[l]); else for (l = 0; g[l]; l++) h.push(g[l]); return h } } var B; if (s.documentElement.compareDocumentPosition) B = function(g, h) { if (!g.compareDocumentPosition || !h.compareDocumentPosition) { if (g == h) i = true; return g.compareDocumentPosition ? -1 : 1 } g = g.compareDocumentPosition(h) & 4 ? -1 : g === h ? 0 : 1; if (g === 0) i = true; return g }; else if ("sourceIndex" in s.documentElement) B = function(g, h) { if (!g.sourceIndex || !h.sourceIndex) { if (g == h) i = true; return g.sourceIndex ? -1 : 1 } g = g.sourceIndex - h.sourceIndex; if (g === 0) i = true; return g }; else if (s.createRange) B = function(g, h) { if (!g.ownerDocument || !h.ownerDocument) { if (g == h) i = true; return g.ownerDocument ? -1 : 1 } var l = g.ownerDocument.createRange(), m = h.ownerDocument.createRange(); l.setStart(g, 0); l.setEnd(g, 0); m.setStart(h, 0); m.setEnd(h, 0); g = l.compareBoundaryPoints(Range.START_TO_END, m); if (g === 0) i = true; return g }; (function() { var g = s.createElement("div"), h = "script" + (new Date).getTime(); g.innerHTML = "<a name='" + h + "'/>"; var l = s.documentElement; l.insertBefore(g, l.firstChild); if (s.getElementById(h)) { n.find.ID = function(m, q, p) { if (typeof q.getElementById !== "undefined" && !p) return (q = q.getElementById(m[1])) ? q.id === m[1] || typeof q.getAttributeNode !== "undefined" && q.getAttributeNode("id").nodeValue === m[1] ? [q] : w : [] }; n.filter.ID = function(m, q) { var p = typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id"); return m.nodeType === 1 && p && p.nodeValue === q } } l.removeChild(g); l = g = null })(); (function() { var g = s.createElement("div"); g.appendChild(s.createComment("")); if (g.getElementsByTagName("*").length > 0) n.find.TAG = function(h, l) { l = l.getElementsByTagName(h[1]); if (h[1] === "*") { h = []; for (var m = 0; l[m]; m++) l[m].nodeType === 1 && h.push(l[m]); l = h } return l }; g.innerHTML = "<a href='#'></a>"; if (g.firstChild && typeof g.firstChild.getAttribute !== "undefined" && g.firstChild.getAttribute("href") !== "#") n.attrHandle.href = function(h) { return h.getAttribute("href", 2) }; g = null })(); s.querySelectorAll && function() { var g = k, h = s.createElement("div"); h.innerHTML = "<p class='TEST'></p>"; if (!(h.querySelectorAll && h.querySelectorAll(".TEST").length === 0)) { k = function(m, q, p, v) { q = q || s; if (!v && q.nodeType === 9 && !x(q)) try { return z(q.querySelectorAll(m), p) } catch (t) { } return g(m, q, p, v) }; for (var l in g) k[l] = g[l]; h = null } } (); (function() { var g = s.createElement("div"); g.innerHTML = "<div class='test e'></div><div class='test'></div>"; if (!(!g.getElementsByClassName || g.getElementsByClassName("e").length === 0)) { g.lastChild.className = "e"; if (g.getElementsByClassName("e").length !== 1) { n.order.splice(1, 0, "CLASS"); n.find.CLASS = function(h, l, m) { if (typeof l.getElementsByClassName !== "undefined" && !m) return l.getElementsByClassName(h[1]) }; g = null } } })(); var E = s.compareDocumentPosition ? function(g, h) { return !!(g.compareDocumentPosition(h) & 16) } : function(g, h) { return g !== h && (g.contains ? g.contains(h) : true) }, x = function(g) { return (g = (g ? g.ownerDocument || g : 0).documentElement) ? g.nodeName !== "HTML" : false }, ga = function(g, h) { var l = [], m = "", q; for (h = h.nodeType ? [h] : h; q = n.match.PSEUDO.exec(g); ) { m += q[0]; g = g.replace(n.match.PSEUDO, "") } g = n.relative[g] ? g + "*" : g; q = 0; for (var p = h.length; q < p; q++) k(g, h[q], l); return k.filter(m, l) }; c.find = k; c.expr = k.selectors; c.expr[":"] = c.expr.filters; c.unique = k.uniqueSort; c.text = a; c.isXMLDoc = x; c.contains = E })(); var eb = /Until$/, fb = /^(?:parents|prevUntil|prevAll)/, gb = /,/; R = Array.prototype.slice; var Ia = function(a, b, d) { if (c.isFunction(b)) return c.grep(a, function(e, j) { return !!b.call(e, j, e) === d }); else if (b.nodeType) return c.grep(a, function(e) { return e === b === d }); else if (typeof b === "string") { var f = c.grep(a, function(e) { return e.nodeType === 1 }); if (Ua.test(b)) return c.filter(b, f, !d); else b = c.filter(b, f) } return c.grep(a, function(e) { return c.inArray(e, b) >= 0 === d }) }; c.fn.extend({ find: function(a) { for (var b = this.pushStack("", "find", a), d = 0, f = 0, e = this.length; f < e; f++) { d = b.length; c.find(a, this[f], b); if (f > 0) for (var j = d; j < b.length; j++) for (var i = 0; i < d; i++) if (b[i] === b[j]) { b.splice(j--, 1); break } } return b }, has: function(a) { var b = c(a); return this.filter(function() { for (var d = 0, f = b.length; d < f; d++) if (c.contains(this, b[d])) return true }) }, not: function(a) { return this.pushStack(Ia(this, a, false), "not", a) }, filter: function(a) { return this.pushStack(Ia(this, a, true), "filter", a) }, is: function(a) { return !!a && c.filter(a, this).length > 0 }, closest: function(a, b) { if (c.isArray(a)) { var d = [], f = this[0], e, j = {}, i; if (f && a.length) { e = 0; for (var o = a.length; e < o; e++) { i = a[e]; j[i] || (j[i] = c.expr.match.POS.test(i) ? c(i, b || this.context) : i) } for (; f && f.ownerDocument && f !== b; ) { for (i in j) { e = j[i]; if (e.jquery ? e.index(f) > -1 : c(f).is(e)) { d.push({ selector: i, elem: f }); delete j[i] } } f = f.parentNode } } return d } var k = c.expr.match.POS.test(a) ? c(a, b || this.context) : null; return this.map(function(n, r) { for (; r && r.ownerDocument && r !== b; ) { if (k ? k.index(r) > -1 : c(r).is(a)) return r; r = r.parentNode } return null }) }, index: function(a) { if (!a || typeof a === "string") return c.inArray(this[0], a ? c(a) : this.parent().children()); return c.inArray(a.jquery ? a[0] : a, this) }, add: function(a, b) { a = typeof a === "string" ? c(a, b || this.context) : c.makeArray(a); b = c.merge(this.get(), a); return this.pushStack(qa(a[0]) || qa(b[0]) ? b : c.unique(b)) }, andSelf: function() { return this.add(this.prevObject) } }); c.each({ parent: function(a) { return (a = a.parentNode) && a.nodeType !== 11 ? a : null }, parents: function(a) { return c.dir(a, "parentNode") }, parentsUntil: function(a, b, d) { return c.dir(a, "parentNode", d) }, next: function(a) { return c.nth(a, 2, "nextSibling") }, prev: function(a) { return c.nth(a, 2, "previousSibling") }, nextAll: function(a) { return c.dir(a, "nextSibling") }, prevAll: function(a) { return c.dir(a, "previousSibling") }, nextUntil: function(a, b, d) { return c.dir(a, "nextSibling", d) }, prevUntil: function(a, b, d) { return c.dir(a, "previousSibling", d) }, siblings: function(a) { return c.sibling(a.parentNode.firstChild, a) }, children: function(a) { return c.sibling(a.firstChild) }, contents: function(a) { return c.nodeName(a, "iframe") ? a.contentDocument || a.contentWindow.document : c.makeArray(a.childNodes) } }, function(a, b) { c.fn[a] = function(d, f) { var e = c.map(this, b, d); eb.test(a) || (f = d); if (f && typeof f === "string") e = c.filter(f, e); e = this.length > 1 ? c.unique(e) : e; if ((this.length > 1 || gb.test(f)) && fb.test(a)) e = e.reverse(); return this.pushStack(e, a, R.call(arguments).join(",")) } }); c.extend({ filter: function(a, b, d) { if (d) a = ":not(" + a + ")"; return c.find.matches(a, b) }, dir: function(a, b, d) { var f = []; for (a = a[b]; a && a.nodeType !== 9 && (d === w || a.nodeType !== 1 || !c(a).is(d)); ) { a.nodeType === 1 && f.push(a); a = a[b] } return f }, nth: function(a, b, d) { b = b || 1; for (var f = 0; a; a = a[d]) if (a.nodeType === 1 && ++f === b) break; return a }, sibling: function(a, b) { for (var d = []; a; a = a.nextSibling) a.nodeType === 1 && a !== b && d.push(a); return d } }); var Ja = / jQuery\d+="(?:\d+|null)"/g, V = /^\s+/, Ka = /(<([\w:]+)[^>]*?)\/>/g, hb = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i, La = /<([\w:]+)/, ib = /<tbody/i, jb = /<|&#?\w+;/, ta = /<script|<object|<embed|<option|<style/i, ua = /checked\s*(?:[^=]|=\s*.checked.)/i, Ma = function(a, b, d) { return hb.test(d) ? a : b + "></" + d + ">" }, F = { option: [1, "<select multiple='multiple'>", "</select>"], legend: [1, "<fieldset>", "</fieldset>"], thead: [1, "<table>", "</table>"], tr: [2, "<table><tbody>", "</tbody></table>"], td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"], area: [1, "<map>", "</map>"], _default: [0, "", ""] }; F.optgroup = F.option; F.tbody = F.tfoot = F.colgroup = F.caption = F.thead; F.th = F.td; if (!c.support.htmlSerialize) F._default = [1, "div<div>", "</div>"]; c.fn.extend({ text: function(a) { if (c.isFunction(a)) return this.each(function(b) { var d = c(this); d.text(a.call(this, b, d.text())) }); if (typeof a !== "object" && a !== w) return this.empty().append((this[0] && this[0].ownerDocument || s).createTextNode(a)); return c.text(this) }, wrapAll: function(a) { if (c.isFunction(a)) return this.each(function(d) { c(this).wrapAll(a.call(this, d)) }); if (this[0]) { var b = c(a, this[0].ownerDocument).eq(0).clone(true); this[0].parentNode && b.insertBefore(this[0]); b.map(function() { for (var d = this; d.firstChild && d.firstChild.nodeType === 1; ) d = d.firstChild; return d }).append(this) } return this }, wrapInner: function(a) { if (c.isFunction(a)) return this.each(function(b) { c(this).wrapInner(a.call(this, b)) }); return this.each(function() { var b = c(this), d = b.contents(); d.length ? d.wrapAll(a) : b.append(a) }) }, wrap: function(a) { return this.each(function() { c(this).wrapAll(a) }) }, unwrap: function() { return this.parent().each(function() { c.nodeName(this, "body") || c(this).replaceWith(this.childNodes) }).end() }, append: function() { return this.domManip(arguments, true, function(a) { this.nodeType === 1 && this.appendChild(a) }) }, prepend: function() { return this.domManip(arguments, true, function(a) { this.nodeType === 1 && this.insertBefore(a, this.firstChild) }) }, before: function() { if (this[0] && this[0].parentNode) return this.domManip(arguments, false, function(b) { this.parentNode.insertBefore(b, this) }); else if (arguments.length) { var a = c(arguments[0]); a.push.apply(a, this.toArray()); return this.pushStack(a, "before", arguments) } }, after: function() { if (this[0] && this[0].parentNode) return this.domManip(arguments, false, function(b) { this.parentNode.insertBefore(b, this.nextSibling) }); else if (arguments.length) { var a = this.pushStack(this, "after", arguments); a.push.apply(a, c(arguments[0]).toArray()); return a } }, remove: function(a, b) { for (var d = 0, f; (f = this[d]) != null; d++) if (!a || c.filter(a, [f]).length) { if (!b && f.nodeType === 1) { c.cleanData(f.getElementsByTagName("*")); c.cleanData([f]) } f.parentNode && f.parentNode.removeChild(f) } return this }, empty: function() { for (var a = 0, b; (b = this[a]) != null; a++) for (b.nodeType === 1 && c.cleanData(b.getElementsByTagName("*")); b.firstChild; ) b.removeChild(b.firstChild); return this }, clone: function(a) { var b = this.map(function() { if (!c.support.noCloneEvent && !c.isXMLDoc(this)) { var d = this.outerHTML, f = this.ownerDocument; if (!d) { d = f.createElement("div"); d.appendChild(this.cloneNode(true)); d = d.innerHTML } return c.clean([d.replace(Ja, "").replace(/=([^="'>\s]+\/)>/g, '="$1">').replace(V, "")], f)[0] } else return this.cloneNode(true) }); if (a === true) { ra(this, b); ra(this.find("*"), b.find("*")) } return b }, html: function(a) { if (a === w) return this[0] && this[0].nodeType === 1 ? this[0].innerHTML.replace(Ja, "") : null; else if (typeof a === "string" && !ta.test(a) && (c.support.leadingWhitespace || !V.test(a)) && !F[(La.exec(a) || ["", ""])[1].toLowerCase()]) { a = a.replace(Ka, Ma); try { for (var b = 0, d = this.length; b < d; b++) if (this[b].nodeType === 1) { c.cleanData(this[b].getElementsByTagName("*")); this[b].innerHTML = a } } catch (f) { this.empty().append(a) } } else c.isFunction(a) ? this.each(function(e) { var j = c(this), i = j.html(); j.empty().append(function() { return a.call(this, e, i) }) }) : this.empty().append(a); return this }, replaceWith: function(a) { if (this[0] && this[0].parentNode) { if (c.isFunction(a)) return this.each(function(b) { var d = c(this), f = d.html(); d.replaceWith(a.call(this, b, f)) }); if (typeof a !== "string") a = c(a).detach(); return this.each(function() { var b = this.nextSibling, d = this.parentNode; c(this).remove(); b ? c(b).before(a) : c(d).append(a) }) } else return this.pushStack(c(c.isFunction(a) ? a() : a), "replaceWith", a) }, detach: function(a) { return this.remove(a, true) }, domManip: function(a, b, d) { function f(u) { return c.nodeName(u, "table") ? u.getElementsByTagName("tbody")[0] || u.appendChild(u.ownerDocument.createElement("tbody")) : u } var e, j, i = a[0], o = [], k; if (!c.support.checkClone && arguments.length === 3 && typeof i === "string" && ua.test(i)) return this.each(function() { c(this).domManip(a, b, d, true) }); if (c.isFunction(i)) return this.each(function(u) { var z = c(this); a[0] = i.call(this, u, b ? z.html() : w); z.domManip(a, b, d) }); if (this[0]) { e = i && i.parentNode; e = c.support.parentNode && e && e.nodeType === 11 && e.childNodes.length === this.length ? { fragment: e} : sa(a, this, o); k = e.fragment; if (j = k.childNodes.length === 1 ? (k = k.firstChild) : k.firstChild) { b = b && c.nodeName(j, "tr"); for (var n = 0, r = this.length; n < r; n++) d.call(b ? f(this[n], j) : this[n], n > 0 || e.cacheable || this.length > 1 ? k.cloneNode(true) : k) } o.length && c.each(o, Qa) } return this } }); c.fragments = {}; c.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function(a, b) { c.fn[a] = function(d) { var f = []; d = c(d); var e = this.length === 1 && this[0].parentNode; if (e && e.nodeType === 11 && e.childNodes.length === 1 && d.length === 1) { d[b](this[0]); return this } else { e = 0; for (var j = d.length; e < j; e++) { var i = (e > 0 ? this.clone(true) : this).get(); c.fn[b].apply(c(d[e]), i); f = f.concat(i) } return this.pushStack(f, a, d.selector) } } }); c.extend({ clean: function(a, b, d, f) { b = b || s; if (typeof b.createElement === "undefined") b = b.ownerDocument || b[0] && b[0].ownerDocument || s; for (var e = [], j = 0, i; (i = a[j]) != null; j++) { if (typeof i === "number") i += ""; if (i) { if (typeof i === "string" && !jb.test(i)) i = b.createTextNode(i); else if (typeof i === "string") { i = i.replace(Ka, Ma); var o = (La.exec(i) || ["", ""])[1].toLowerCase(), k = F[o] || F._default, n = k[0], r = b.createElement("div"); for (r.innerHTML = k[1] + i + k[2]; n--; ) r = r.lastChild; if (!c.support.tbody) { n = ib.test(i); o = o === "table" && !n ? r.firstChild && r.firstChild.childNodes : k[1] === "<table>" && !n ? r.childNodes : []; for (k = o.length - 1; k >= 0; --k) c.nodeName(o[k], "tbody") && !o[k].childNodes.length && o[k].parentNode.removeChild(o[k]) } !c.support.leadingWhitespace && V.test(i) && r.insertBefore(b.createTextNode(V.exec(i)[0]), r.firstChild); i = r.childNodes } if (i.nodeType) e.push(i); else e = c.merge(e, i) } } if (d) for (j = 0; e[j]; j++) if (f && c.nodeName(e[j], "script") && (!e[j].type || e[j].type.toLowerCase() === "text/javascript")) f.push(e[j].parentNode ? e[j].parentNode.removeChild(e[j]) : e[j]); else { e[j].nodeType === 1 && e.splice.apply(e, [j + 1, 0].concat(c.makeArray(e[j].getElementsByTagName("script")))); d.appendChild(e[j]) } return e }, cleanData: function(a) { for (var b, d, f = c.cache, e = c.event.special, j = c.support.deleteExpando, i = 0, o; (o = a[i]) != null; i++) if (d = o[c.expando]) { b = f[d]; if (b.events) for (var k in b.events) e[k] ? c.event.remove(o, k) : Ca(o, k, b.handle); if (j) delete o[c.expando]; else o.removeAttribute && o.removeAttribute(c.expando); delete f[d] } } }); var kb = /z-?index|font-?weight|opacity|zoom|line-?height/i, Na = /alpha\([^)]*\)/, Oa = /opacity=([^)]*)/, ha = /float/i, ia = /-([a-z])/ig, lb = /([A-Z])/g, mb = /^-?\d+(?:px)?$/i, nb = /^-?\d/, ob = { position: "absolute", visibility: "hidden", display: "block" }, pb = ["Left", "Right"], qb = ["Top", "Bottom"], rb = s.defaultView && s.defaultView.getComputedStyle, Pa = c.support.cssFloat ? "cssFloat" : "styleFloat", ja = function(a, b) { return b.toUpperCase() }; c.fn.css = function(a, b) { return X(this, a, b, true, function(d, f, e) { if (e === w) return c.curCSS(d, f); if (typeof e === "number" && !kb.test(f)) e += "px"; c.style(d, f, e) }) }; c.extend({ style: function(a, b, d) { if (!a || a.nodeType === 3 || a.nodeType === 8) return w; if ((b === "width" || b === "height") && parseFloat(d) < 0) d = w; var f = a.style || a, e = d !== w; if (!c.support.opacity && b === "opacity") { if (e) { f.zoom = 1; b = parseInt(d, 10) + "" === "NaN" ? "" : "alpha(opacity=" + d * 100 + ")"; a = f.filter || c.curCSS(a, "filter") || ""; f.filter = Na.test(a) ? a.replace(Na, b) : b } return f.filter && f.filter.indexOf("opacity=") >= 0 ? parseFloat(Oa.exec(f.filter)[1]) / 100 + "" : "" } if (ha.test(b)) b = Pa; b = b.replace(ia, ja); if (e) f[b] = d; return f[b] }, css: function(a, b, d, f) { if (b === "width" || b === "height") { var e, j = b === "width" ? pb : qb; function i() { e = b === "width" ? a.offsetWidth : a.offsetHeight; f !== "border" && c.each(j, function() { f || (e -= parseFloat(c.curCSS(a, "padding" + this, true)) || 0); if (f === "margin") e += parseFloat(c.curCSS(a, "margin" + this, true)) || 0; else e -= parseFloat(c.curCSS(a, "border" + this + "Width", true)) || 0 }) } a.offsetWidth !== 0 ? i() : c.swap(a, ob, i); return Math.max(0, Math.round(e)) } return c.curCSS(a, b, d) }, curCSS: function(a, b, d) { var f, e = a.style; if (!c.support.opacity && b === "opacity" && a.currentStyle) { f = Oa.test(a.currentStyle.filter || "") ? parseFloat(RegExp.$1) / 100 + "" : ""; return f === "" ? "1" : f } if (ha.test(b)) b = Pa; if (!d && e && e[b]) f = e[b]; else if (rb) { if (ha.test(b)) b = "float"; b = b.replace(lb, "-$1").toLowerCase(); e = a.ownerDocument.defaultView; if (!e) return null; if (a = e.getComputedStyle(a, null)) f = a.getPropertyValue(b); if (b === "opacity" && f === "") f = "1" } else if (a.currentStyle) { d = b.replace(ia, ja); f = a.currentStyle[b] || a.currentStyle[d]; if (!mb.test(f) && nb.test(f)) { b = e.left; var j = a.runtimeStyle.left; a.runtimeStyle.left = a.currentStyle.left; e.left = d === "fontSize" ? "1em" : f || 0; f = e.pixelLeft + "px"; e.left = b; a.runtimeStyle.left = j } } return f }, swap: function(a, b, d) { var f = {}; for (var e in b) { f[e] = a.style[e]; a.style[e] = b[e] } d.call(a); for (e in b) a.style[e] = f[e] } }); if (c.expr && c.expr.filters) { c.expr.filters.hidden = function(a) { var b = a.offsetWidth, d = a.offsetHeight, f = a.nodeName.toLowerCase() === "tr"; return b === 0 && d === 0 && !f ? true : b > 0 && d > 0 && !f ? false : c.curCSS(a, "display") === "none" }; c.expr.filters.visible = function(a) { return !c.expr.filters.hidden(a) } } var sb = J(), tb = /<script(.|\s)*?\/script>/gi, ub = /select|textarea/i, vb = /color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i, N = /=\?(&|$)/, ka = /\?/, wb = /(\?|&)_=.*?(&|$)/, xb = /^(\w+:)?\/\/([^\/?#]+)/, yb = /%20/g, zb = c.fn.load; c.fn.extend({ load: function(a, b, d) { if (typeof a !== "string") return zb.call(this, a); else if (!this.length) return this; var f = a.indexOf(" "); if (f >= 0) { var e = a.slice(f, a.length); a = a.slice(0, f) } f = "GET"; if (b) if (c.isFunction(b)) { d = b; b = null } else if (typeof b === "object") { b = c.param(b, c.ajaxSettings.traditional); f = "POST" } var j = this; c.ajax({ url: a, type: f, dataType: "html", data: b, complete: function(i, o) { if (o === "success" || o === "notmodified") j.html(e ? c("<div />").append(i.responseText.replace(tb, "")).find(e) : i.responseText); d && j.each(d, [i.responseText, o, i]) } }); return this }, serialize: function() { return c.param(this.serializeArray()) }, serializeArray: function() { return this.map(function() { return this.elements ? c.makeArray(this.elements) : this }).filter(function() { return this.name && !this.disabled && (this.checked || ub.test(this.nodeName) || vb.test(this.type)) }).map(function(a, b) { a = c(this).val(); return a == null ? null : c.isArray(a) ? c.map(a, function(d) { return { name: b.name, value: d} }) : { name: b.name, value: a} }).get() } }); c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function(a, b) { c.fn[b] = function(d) { return this.bind(b, d) } }); c.extend({ get: function(a, b, d, f) { if (c.isFunction(b)) { f = f || d; d = b; b = null } return c.ajax({ type: "GET", url: a, data: b, success: d, dataType: f }) }, getScript: function(a, b) { return c.get(a, null, b, "script") }, getJSON: function(a, b, d) { return c.get(a, b, d, "json") }, post: function(a, b, d, f) { if (c.isFunction(b)) { f = f || d; d = b; b = {} } return c.ajax({ type: "POST", url: a, data: b, success: d, dataType: f }) }, ajaxSetup: function(a) { c.extend(c.ajaxSettings, a) }, ajaxSettings: { url: location.href, global: true, type: "GET", contentType: "application/x-www-form-urlencoded", processData: true, async: true, xhr: A.XMLHttpRequest && (A.location.protocol !== "file:" || !A.ActiveXObject) ? function() { return new A.XMLHttpRequest } : function() { try { return new A.ActiveXObject("Microsoft.XMLHTTP") } catch (a) { } }, accepts: { xml: "application/xml, text/xml", html: "text/html", script: "text/javascript, application/javascript", json: "application/json, text/javascript", text: "text/plain", _default: "*/*"} }, lastModified: {}, etag: {}, ajax: function(a) { function b() { e.success && e.success.call(k, o, i, x); e.global && f("ajaxSuccess", [x, e]) } function d() { e.complete && e.complete.call(k, x, i); e.global && f("ajaxComplete", [x, e]); e.global && ! --c.active && c.event.trigger("ajaxStop") } function f(q, p) { (e.context ? c(e.context) : c.event).trigger(q, p) } var e = c.extend(true, {}, c.ajaxSettings, a), j, i, o, k = a && a.context || e, n = e.type.toUpperCase(); if (e.data && e.processData && typeof e.data !== "string") e.data = c.param(e.data, e.traditional); if (e.dataType === "jsonp") { if (n === "GET") N.test(e.url) || (e.url += (ka.test(e.url) ? "&" : "?") + (e.jsonp || "callback") + "=?"); else if (!e.data || !N.test(e.data)) e.data = (e.data ? e.data + "&" : "") + (e.jsonp || "callback") + "=?"; e.dataType = "json" } if (e.dataType === "json" && (e.data && N.test(e.data) || N.test(e.url))) { j = e.jsonpCallback || "jsonp" + sb++; if (e.data) e.data = (e.data + "").replace(N, "=" + j + "$1"); e.url = e.url.replace(N, "=" + j + "$1"); e.dataType = "script"; A[j] = A[j] || function(q) { o = q; b(); d(); A[j] = w; try { delete A[j] } catch (p) { } z && z.removeChild(C) } } if (e.dataType === "script" && e.cache === null) e.cache = false; if (e.cache === false && n === "GET") { var r = J(), u = e.url.replace(wb, "$1_=" + r + "$2"); e.url = u + (u === e.url ? (ka.test(e.url) ? "&" : "?") + "_=" + r : "") } if (e.data && n === "GET") e.url += (ka.test(e.url) ? "&" : "?") + e.data; e.global && !c.active++ && c.event.trigger("ajaxStart"); r = (r = xb.exec(e.url)) && (r[1] && r[1] !== location.protocol || r[2] !== location.host); if (e.dataType === "script" && n === "GET" && r) { var z = s.getElementsByTagName("head")[0] || s.documentElement, C = s.createElement("script"); C.src = e.url; if (e.scriptCharset) C.charset = e.scriptCharset; if (!j) { var B = false; C.onload = C.onreadystatechange = function() { if (!B && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) { B = true; b(); d(); C.onload = C.onreadystatechange = null; z && C.parentNode && z.removeChild(C) } } } z.insertBefore(C, z.firstChild); return w } var E = false, x = e.xhr(); if (x) { e.username ? x.open(n, e.url, e.async, e.username, e.password) : x.open(n, e.url, e.async); try { if (e.data || a && a.contentType) x.setRequestHeader("Content-Type", e.contentType); if (e.ifModified) { c.lastModified[e.url] && x.setRequestHeader("If-Modified-Since", c.lastModified[e.url]); c.etag[e.url] && x.setRequestHeader("If-None-Match", c.etag[e.url]) } r || x.setRequestHeader("X-Requested-With", "XMLHttpRequest"); x.setRequestHeader("Accept", e.dataType && e.accepts[e.dataType] ? e.accepts[e.dataType] + ", */*" : e.accepts._default) } catch (ga) { } if (e.beforeSend && e.beforeSend.call(k, x, e) === false) { e.global && ! --c.active && c.event.trigger("ajaxStop"); x.abort(); return false } e.global && f("ajaxSend", [x, e]); var g = x.onreadystatechange = function(q) { if (!x || x.readyState === 0 || q === "abort") { E || d(); E = true; if (x) x.onreadystatechange = c.noop } else if (!E && x && (x.readyState === 4 || q === "timeout")) { E = true; x.onreadystatechange = c.noop; i = q === "timeout" ? "timeout" : !c.httpSuccess(x) ? "error" : e.ifModified && c.httpNotModified(x, e.url) ? "notmodified" : "success"; var p; if (i === "success") try { o = c.httpData(x, e.dataType, e) } catch (v) { i = "parsererror"; p = v } if (i === "success" || i === "notmodified") j || b(); else c.handleError(e, x, i, p); d(); q === "timeout" && x.abort(); if (e.async) x = null } }; try { var h = x.abort; x.abort = function() { x && h.call(x); g("abort") } } catch (l) { } e.async && e.timeout > 0 && setTimeout(function() { x && !E && g("timeout") }, e.timeout); try { x.send(n === "POST" || n === "PUT" || n === "DELETE" ? e.data : null) } catch (m) { c.handleError(e, x, null, m); d() } e.async || g(); return x } }, handleError: function(a, b, d, f) { if (a.error) a.error.call(a.context || a, b, d, f); if (a.global) (a.context ? c(a.context) : c.event).trigger("ajaxError", [b, a, f]) }, active: 0, httpSuccess: function(a) { try { return !a.status && location.protocol === "file:" || a.status >= 200 && a.status < 300 || a.status === 304 || a.status === 1223 || a.status === 0 } catch (b) { } return false }, httpNotModified: function(a, b) { var d = a.getResponseHeader("Last-Modified"), f = a.getResponseHeader("Etag"); if (d) c.lastModified[b] = d; if (f) c.etag[b] = f; return a.status === 304 || a.status === 0 }, httpData: function(a, b, d) { var f = a.getResponseHeader("content-type") || "", e = b === "xml" || !b && f.indexOf("xml") >= 0; a = e ? a.responseXML : a.responseText; e && a.documentElement.nodeName === "parsererror" && c.error("parsererror"); if (d && d.dataFilter) a = d.dataFilter(a, b); if (typeof a === "string") if (b === "json" || !b && f.indexOf("json") >= 0) a = c.parseJSON(a); else if (b === "script" || !b && f.indexOf("javascript") >= 0) c.globalEval(a); return a }, param: function(a, b) { function d(i, o) { if (c.isArray(o)) c.each(o, function(k, n) { b || /\[\]$/.test(i) ? f(i, n) : d(i + "[" + (typeof n === "object" || c.isArray(n) ? k : "") + "]", n) }); else !b && o != null && typeof o === "object" ? c.each(o, function(k, n) { d(i + "[" + k + "]", n) }) : f(i, o) } function f(i, o) { o = c.isFunction(o) ? o() : o; e[e.length] = encodeURIComponent(i) + "=" + encodeURIComponent(o) } var e = []; if (b === w) b = c.ajaxSettings.traditional; if (c.isArray(a) || a.jquery) c.each(a, function() { f(this.name, this.value) }); else for (var j in a) d(j, a[j]); return e.join("&").replace(yb, "+") } }); var la = {}, Ab = /toggle|show|hide/, Bb = /^([+-]=)?([\d+-.]+)(.*)$/, W, va = [["height", "marginTop", "marginBottom", "paddingTop", "paddingBottom"], ["width", "marginLeft", "marginRight", "paddingLeft", "paddingRight"], ["opacity"]]; c.fn.extend({ show: function(a, b) { if (a || a === 0) return this.animate(K("show", 3), a, b); else { a = 0; for (b = this.length; a < b; a++) { var d = c.data(this[a], "olddisplay"); this[a].style.display = d || ""; if (c.css(this[a], "display") === "none") { d = this[a].nodeName; var f; if (la[d]) f = la[d]; else { var e = c("<" + d + " />").appendTo("body"); f = e.css("display"); if (f === "none") f = "block"; e.remove(); la[d] = f } c.data(this[a], "olddisplay", f) } } a = 0; for (b = this.length; a < b; a++) this[a].style.display = c.data(this[a], "olddisplay") || ""; return this } }, hide: function(a, b) { if (a || a === 0) return this.animate(K("hide", 3), a, b); else { a = 0; for (b = this.length; a < b; a++) { var d = c.data(this[a], "olddisplay"); !d && d !== "none" && c.data(this[a], "olddisplay", c.css(this[a], "display")) } a = 0; for (b = this.length; a < b; a++) this[a].style.display = "none"; return this } }, _toggle: c.fn.toggle, toggle: function(a, b) { var d = typeof a === "boolean"; if (c.isFunction(a) && c.isFunction(b)) this._toggle.apply(this, arguments); else a == null || d ? this.each(function() { var f = d ? a : c(this).is(":hidden"); c(this)[f ? "show" : "hide"]() }) : this.animate(K("toggle", 3), a, b); return this }, fadeTo: function(a, b, d) { return this.filter(":hidden").css("opacity", 0).show().end().animate({ opacity: b }, a, d) }, animate: function(a, b, d, f) { var e = c.speed(b, d, f); if (c.isEmptyObject(a)) return this.each(e.complete); return this[e.queue === false ? "each" : "queue"](function() { var j = c.extend({}, e), i, o = this.nodeType === 1 && c(this).is(":hidden"), k = this; for (i in a) { var n = i.replace(ia, ja); if (i !== n) { a[n] = a[i]; delete a[i]; i = n } if (a[i] === "hide" && o || a[i] === "show" && !o) return j.complete.call(this); if ((i === "height" || i === "width") && this.style) { j.display = c.css(this, "display"); j.overflow = this.style.overflow } if (c.isArray(a[i])) { (j.specialEasing = j.specialEasing || {})[i] = a[i][1]; a[i] = a[i][0] } } if (j.overflow != null) this.style.overflow = "hidden"; j.curAnim = c.extend({}, a); c.each(a, function(r, u) { var z = new c.fx(k, j, r); if (Ab.test(u)) z[u === "toggle" ? o ? "show" : "hide" : u](a); else { var C = Bb.exec(u), B = z.cur(true) || 0; if (C) { u = parseFloat(C[2]); var E = C[3] || "px"; if (E !== "px") { k.style[r] = (u || 1) + E; B = (u || 1) / z.cur(true) * B; k.style[r] = B + E } if (C[1]) u = (C[1] === "-=" ? -1 : 1) * u + B; z.custom(B, u, E) } else z.custom(B, u, "") } }); return true }) }, stop: function(a, b) { var d = c.timers; a && this.queue([]); this.each(function() { for (var f = d.length - 1; f >= 0; f--) if (d[f].elem === this) { b && d[f](true); d.splice(f, 1) } }); b || this.dequeue(); return this } }); c.each({ slideDown: K("show", 1), slideUp: K("hide", 1), slideToggle: K("toggle", 1), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide"} }, function(a, b) { c.fn[a] = function(d, f) { return this.animate(b, d, f) } }); c.extend({ speed: function(a, b, d) { var f = a && typeof a === "object" ? a : { complete: d || !d && b || c.isFunction(a) && a, duration: a, easing: d && b || b && !c.isFunction(b) && b }; f.duration = c.fx.off ? 0 : typeof f.duration === "number" ? f.duration : c.fx.speeds[f.duration] || c.fx.speeds._default; f.old = f.complete; f.complete = function() { f.queue !== false && c(this).dequeue(); c.isFunction(f.old) && f.old.call(this) }; return f }, easing: { linear: function(a, b, d, f) { return d + f * a }, swing: function(a, b, d, f) { return (-Math.cos(a * Math.PI) / 2 + 0.5) * f + d } }, timers: [], fx: function(a, b, d) { this.options = b; this.elem = a; this.prop = d; if (!b.orig) b.orig = {} } }); c.fx.prototype = { update: function() { this.options.step && this.options.step.call(this.elem, this.now, this); (c.fx.step[this.prop] || c.fx.step._default)(this); if ((this.prop === "height" || this.prop === "width") && this.elem.style) this.elem.style.display = "block" }, cur: function(a) { if (this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null)) return this.elem[this.prop]; return (a = parseFloat(c.css(this.elem, this.prop, a))) && a > -10000 ? a : parseFloat(c.curCSS(this.elem, this.prop)) || 0 }, custom: function(a, b, d) { function f(j) { return e.step(j) } this.startTime = J(); this.start = a; this.end = b; this.unit = d || this.unit || "px"; this.now = this.start; this.pos = this.state = 0; var e = this; f.elem = this.elem; if (f() && c.timers.push(f) && !W) W = setInterval(c.fx.tick, 13) }, show: function() { this.options.orig[this.prop] = c.style(this.elem, this.prop); this.options.show = true; this.custom(this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur()); c(this.elem).show() }, hide: function() { this.options.orig[this.prop] = c.style(this.elem, this.prop); this.options.hide = true; this.custom(this.cur(), 0) }, step: function(a) { var b = J(), d = true; if (a || b >= this.options.duration + this.startTime) { this.now = this.end; this.pos = this.state = 1; this.update(); this.options.curAnim[this.prop] = true; for (var f in this.options.curAnim) if (this.options.curAnim[f] !== true) d = false; if (d) { if (this.options.display != null) { this.elem.style.overflow = this.options.overflow; a = c.data(this.elem, "olddisplay"); this.elem.style.display = a ? a : this.options.display; if (c.css(this.elem, "display") === "none") this.elem.style.display = "block" } this.options.hide && c(this.elem).hide(); if (this.options.hide || this.options.show) for (var e in this.options.curAnim) c.style(this.elem, e, this.options.orig[e]); this.options.complete.call(this.elem) } return false } else { e = b - this.startTime; this.state = e / this.options.duration; a = this.options.easing || (c.easing.swing ? "swing" : "linear"); this.pos = c.easing[this.options.specialEasing && this.options.specialEasing[this.prop] || a](this.state, e, 0, 1, this.options.duration); this.now = this.start + (this.end - this.start) * this.pos; this.update() } return true } }; c.extend(c.fx, { tick: function() { for (var a = c.timers, b = 0; b < a.length; b++) a[b]() || a.splice(b--, 1); a.length || c.fx.stop() }, stop: function() { clearInterval(W); W = null }, speeds: { slow: 600, fast: 200, _default: 400 }, step: { opacity: function(a) { c.style(a.elem, "opacity", a.now) }, _default: function(a) { if (a.elem.style && a.elem.style[a.prop] != null) a.elem.style[a.prop] = (a.prop === "width" || a.prop === "height" ? Math.max(0, a.now) : a.now) + a.unit; else a.elem[a.prop] = a.now } } }); if (c.expr && c.expr.filters) c.expr.filters.animated = function(a) { return c.grep(c.timers, function(b) { return a === b.elem }).length }; c.fn.offset = "getBoundingClientRect" in s.documentElement ? function(a) { var b = this[0]; if (a) return this.each(function(e) { c.offset.setOffset(this, a, e) }); if (!b || !b.ownerDocument) return null; if (b === b.ownerDocument.body) return c.offset.bodyOffset(b); var d = b.getBoundingClientRect(), f = b.ownerDocument; b = f.body; f = f.documentElement; return { top: d.top + (self.pageYOffset || c.support.boxModel && f.scrollTop || b.scrollTop) - (f.clientTop || b.clientTop || 0), left: d.left + (self.pageXOffset || c.support.boxModel && f.scrollLeft || b.scrollLeft) - (f.clientLeft || b.clientLeft || 0)} } : function(a) { var b = this[0]; if (a) return this.each(function(r) { c.offset.setOffset(this, a, r) }); if (!b || !b.ownerDocument) return null; if (b === b.ownerDocument.body) return c.offset.bodyOffset(b); c.offset.initialize(); var d = b.offsetParent, f = b, e = b.ownerDocument, j, i = e.documentElement, o = e.body; f = (e = e.defaultView) ? e.getComputedStyle(b, null) : b.currentStyle; for (var k = b.offsetTop, n = b.offsetLeft; (b = b.parentNode) && b !== o && b !== i; ) { if (c.offset.supportsFixedPosition && f.position === "fixed") break; j = e ? e.getComputedStyle(b, null) : b.currentStyle; k -= b.scrollTop; n -= b.scrollLeft; if (b === d) { k += b.offsetTop; n += b.offsetLeft; if (c.offset.doesNotAddBorder && !(c.offset.doesAddBorderForTableAndCells && /^t(able|d|h)$/i.test(b.nodeName))) { k += parseFloat(j.borderTopWidth) || 0; n += parseFloat(j.borderLeftWidth) || 0 } f = d; d = b.offsetParent } if (c.offset.subtractsBorderForOverflowNotVisible && j.overflow !== "visible") { k += parseFloat(j.borderTopWidth) || 0; n += parseFloat(j.borderLeftWidth) || 0 } f = j } if (f.position === "relative" || f.position === "static") { k += o.offsetTop; n += o.offsetLeft } if (c.offset.supportsFixedPosition && f.position === "fixed") { k += Math.max(i.scrollTop, o.scrollTop); n += Math.max(i.scrollLeft, o.scrollLeft) } return { top: k, left: n} }; c.offset = { initialize: function() { var a = s.body, b = s.createElement("div"), d, f, e, j = parseFloat(c.curCSS(a, "marginTop", true)) || 0; c.extend(b.style, { position: "absolute", top: 0, left: 0, margin: 0, border: 0, width: "1px", height: "1px", visibility: "hidden" }); b.innerHTML = "<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>"; a.insertBefore(b, a.firstChild); d = b.firstChild; f = d.firstChild; e = d.nextSibling.firstChild.firstChild; this.doesNotAddBorder = f.offsetTop !== 5; this.doesAddBorderForTableAndCells = e.offsetTop === 5; f.style.position = "fixed"; f.style.top = "20px"; this.supportsFixedPosition = f.offsetTop === 20 || f.offsetTop === 15; f.style.position = f.style.top = ""; d.style.overflow = "hidden"; d.style.position = "relative"; this.subtractsBorderForOverflowNotVisible = f.offsetTop === -5; this.doesNotIncludeMarginInBodyOffset = a.offsetTop !== j; a.removeChild(b); c.offset.initialize = c.noop }, bodyOffset: function(a) { var b = a.offsetTop, d = a.offsetLeft; c.offset.initialize(); if (c.offset.doesNotIncludeMarginInBodyOffset) { b += parseFloat(c.curCSS(a, "marginTop", true)) || 0; d += parseFloat(c.curCSS(a, "marginLeft", true)) || 0 } return { top: b, left: d} }, setOffset: function(a, b, d) { if (/static/.test(c.curCSS(a, "position"))) a.style.position = "relative"; var f = c(a), e = f.offset(), j = parseInt(c.curCSS(a, "top", true), 10) || 0, i = parseInt(c.curCSS(a, "left", true), 10) || 0; if (c.isFunction(b)) b = b.call(a, d, e); d = { top: b.top - e.top + j, left: b.left - e.left + i }; "using" in b ? b.using.call(a, d) : f.css(d) } }; c.fn.extend({ position: function() { if (!this[0]) return null; var a = this[0], b = this.offsetParent(), d = this.offset(), f = /^body|html$/i.test(b[0].nodeName) ? { top: 0, left: 0} : b.offset(); d.top -= parseFloat(c.curCSS(a, "marginTop", true)) || 0; d.left -= parseFloat(c.curCSS(a, "marginLeft", true)) || 0; f.top += parseFloat(c.curCSS(b[0], "borderTopWidth", true)) || 0; f.left += parseFloat(c.curCSS(b[0], "borderLeftWidth", true)) || 0; return { top: d.top - f.top, left: d.left - f.left} }, offsetParent: function() { return this.map(function() { for (var a = this.offsetParent || s.body; a && !/^body|html$/i.test(a.nodeName) && c.css(a, "position") === "static"; ) a = a.offsetParent; return a }) } }); c.each(["Left", "Top"], function(a, b) { var d = "scroll" + b; c.fn[d] = function(f) { var e = this[0], j; if (!e) return null; if (f !== w) return this.each(function() { if (j = wa(this)) j.scrollTo(!a ? f : c(j).scrollLeft(), a ? f : c(j).scrollTop()); else this[d] = f }); else return (j = wa(e)) ? "pageXOffset" in j ? j[a ? "pageYOffset" : "pageXOffset"] : c.support.boxModel && j.document.documentElement[d] || j.document.body[d] : e[d] } }); c.each(["Height", "Width"], function(a, b) { var d = b.toLowerCase(); c.fn["inner" + b] = function() { return this[0] ? c.css(this[0], d, false, "padding") : null }; c.fn["outer" + b] = function(f) { return this[0] ? c.css(this[0], d, false, f ? "margin" : "border") : null }; c.fn[d] = function(f) { var e = this[0]; if (!e) return f == null ? null : this; if (c.isFunction(f)) return this.each(function(j) { var i = c(this); i[d](f.call(this, j, i[d]())) }); return "scrollTo" in e && e.document ? e.document.compatMode === "CSS1Compat" && e.document.documentElement["client" + b] || e.document.body["client" + b] : e.nodeType === 9 ? Math.max(e.documentElement["client" + b], e.body["scroll" + b], e.documentElement["scroll" + b], e.body["offset" + b], e.documentElement["offset" + b]) : f === w ? c.css(e, d) : this.css(d, typeof f === "string" ? f : f + "px") } }); A.jQuery = A.$ = c })(window);
//toolsPath
function toolsPath() {return $("script[src$='js/admin.js']").attr("src").substring(0, $("script[src$='js/admin.js']").attr("src").lastIndexOf("js/admin.js"));}
//xhEditor 1.0.0
(function(d) { if (d.xheditor) return false; d.fn.xheditor = function(A) { var B = []; this.each(function() { if (d.nodeName(this, "TEXTAREA")) if (A === false) { if (this.xheditor) { this.xheditor.remove(); this.xheditor = null } } else if (!this.xheditor) { var C = /({.*})/.exec(d(this).attr("class")); if (C) { try { C = eval("(" + C[1] + ")") } catch (ja) { } A = d.extend({}, C, A) } C = new d.xheditor(this, A); if (C.init()) { this.xheditor = C; B.push(C) } } }); if (B.length == 0) B = false; if (B.length == 1) B = B[0]; return B }; var V = 0, qa = d.browser.version, D = d.browser.msie, ka = d.browser.mozilla, W = d.browser.safari, Oa = d.browser.opera, R = false, la = true, K, $, aa, ba, ra, S = toolsPath() + "editor/"; var Pa = { 27: "esc", 9: "tab", 32: "space", 13: "enter", 8: "backspace", 145: "scroll", 20: "capslock", 144: "numlock", 19: "pause", 45: "insert", 36: "home", 46: "del", 35: "end", 33: "pageup", 34: "pagedown", 37: "left", 38: "up", 39: "right", 40: "down", 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", 120: "f9", 121: "f10", 122: "f11", 123: "f12" }, Qa = ["#FFFFFF", "#CCCCCC", "#C0C0C0", "#999999", "#666666", "#333333", "#000000", "#FFCCCC", "#FF6666", "#FF0000", "#CC0000", "#990000", "#660000", "#330000", "#FFCC99", "#FF9966", "#FF9900", "#FF6600", "#CC6600", "#993300", "#663300", "#FFFF99", "#FFFF66", "#FFCC66", "#FFCC33", "#CC9933", "#996633", "#663333", "#FFFFCC", "#FFFF33", "#FFFF00", "#FFCC00", "#999900", "#666600", "#333300", "#99FF99", "#66FF99", "#33FF33", "#33CC00", "#009900", "#006600", "#003300", "#99FFFF", "#33FFFF", "#66CCCC", "#00CCCC", "#339999", "#336666", "#003333", "#CCFFFF", "#66FFFF", "#33CCFF", "#3366FF", "#3333FF", "#000099", "#000066", "#CCCCFF", "#9999FF", "#6666CC", "#6633FF", "#6600CC", "#333399", "#330099", "#FFCCFF", "#FF99FF", "#CC66CC", "#CC33CC", "#993399", "#663366", "#330033"], Ra = [{ n: "p", t: "\u666e\u901a\u6bb5\u843d" }, { n: "h1", t: "\u6807\u98981" }, { n: "h2", t: "\u6807\u98982" }, { n: "h3", t: "\u6807\u98983" }, { n: "h4", t: "\u6807\u98984" }, { n: "h5", t: "\u6807\u98985" }, { n: "h6", t: "\u6807\u98986" }, { n: "pre", t: "\u5df2\u7f16\u6392\u683c\u5f0f" }, { n: "address", t: "\u5730\u5740"}], Sa = [{ n: "\u5b8b\u4f53", c: "SimSun" }, { n: "\u4eff\u5b8b\u4f53", c: "FangSong_GB2312" }, { n: "\u9ed1\u4f53", c: "SimHei" }, { n: "\u6977\u4f53", c: "KaiTi_GB2312" }, { n: "\u5fae\u8f6f\u96c5\u9ed1", c: "Microsoft YaHei" }, { n: "Arial" }, { n: "Arial Narrow" }, { n: "Arial Black" }, { n: "Comic Sans MS" }, { n: "Courier New" }, { n: "System" }, { n: "Times New Roman" }, { n: "Tahoma" }, { n: "Verdana"}], M = [{ n: "xx-small", wkn: "x-small", s: "8pt", t: "\u6781\u5c0f" }, { n: "x-small", wkn: "small", s: "10pt", t: "\u7279\u5c0f" }, { n: "small", wkn: "medium", s: "12pt", t: "\u5c0f" }, { n: "medium", wkn: "large", s: "14pt", t: "\u4e2d" }, { n: "large", wkn: "x-large", s: "18pt", t: "\u5927" }, { n: "x-large", wkn: "xx-large", s: "24pt", t: "\u7279\u5927" }, { n: "xx-large", wkn: "-webkit-xxx-large", s: "36pt", t: "\u6781\u5927"}], Ta = [{ s: "\u5de6\u5bf9\u9f50", v: "justifyleft" }, { s: "\u5c45\u4e2d", v: "justifycenter" }, { s: "\u53f3\u5bf9\u9f50", v: "justifyright" }, { s: "\u4e24\u7aef\u5bf9\u9f50", v: "justifyfull"}], Ua = [{ s: "\u6570\u5b57\u5217\u8868", v: "insertOrderedList" }, { s: "\u7b26\u53f7\u5217\u8868", v: "insertUnorderedList"}], Va = { "default": { name: "\u9ed8\u8ba4", width: 25, height: 18, line: 6, list: { biggrin: "Big grin", smile: "Smile", titter: "Titter", lol: "Lol", call: "Call", victory: "Victory", shy: "Shy", handshake: "Handshake", kiss: "Kiss", sad: "Sad", cry: "Cry", huffy: "Huffy", mad: "Mad", tongue: "Tongue", sweat: "Sweat", shocked: "Shocked", time: "Time", hug: "Hug"}} }, ca = { Cut: { t: "\u526a\u5207 (Ctrl+X)" }, Copy: { t: "\u590d\u5236 (Ctrl+C)" }, Paste: { t: "\u7c98\u8d34 (Ctrl+V)" }, Pastetext: { t: "\u7c98\u8d34\u6587\u672c", h: D ? 0 : 1 }, Blocktag: { t: "\u6bb5\u843d\u6807\u7b7e", h: 1 }, Fontface: { t: "\u5b57\u4f53", h: 1 }, FontSize: { t: "\u5b57\u4f53\u5927\u5c0f", h: 1 }, Bold: { t: "\u52a0\u7c97 (Ctrl+B)", s: "Ctrl+B" }, Italic: { t: "\u659c\u4f53 (Ctrl+I)", s: "Ctrl+I" }, Underline: { t: "\u4e0b\u5212\u7ebf (Ctrl+U)", s: "Ctrl+U" }, Strikethrough: { t: "\u5220\u9664\u7ebf (Ctrl+S)", s: "Ctrl+S" }, FontColor: { t: "\u5b57\u4f53\u989c\u8272", h: 1 }, BackColor: { t: "\u80cc\u666f\u989c\u8272", h: 1 }, SelectAll: { t: "\u5168\u9009 (Ctrl+A)" }, Removeformat: { t: "\u5220\u9664\u6587\u5b57\u683c\u5f0f" }, Align: { t: "\u5bf9\u9f50", h: 1 }, List: { t: "\u5217\u8868", h: 1 }, Outdent: { t: "\u51cf\u5c11\u7f29\u8fdb (Shift+Tab)", s: "Shift+Tab" }, Indent: { t: "\u589e\u52a0\u7f29\u8fdb (Tab)", s: "Tab" }, Link: { t: "\u8d85\u94fe\u63a5 (Ctrl+K)", s: "Ctrl+K", h: 1 }, Unlink: { t: "\u53d6\u6d88\u8d85\u94fe\u63a5" }, Img: { t: "\u56fe\u7247", h: 1 }, Flash: { t: "Flash\u52a8\u753b", h: 1 }, Media: { t: "\u591a\u5a92\u4f53\u6587\u4ef6", h: 1 }, Emot: { t: "\u8868\u60c5", s: "ctrl+e", h: 1 }, Table: { t: "\u8868\u683c", h: 1 }, Source: { t: "\u6e90\u4ee3\u7801" }, Print: { t: "\u6253\u5370 (Ctrl+P)", s: "Ctrl+P" }, Fullscreen: { t: "\u5168\u5c4f\u7f16\u8f91 (Esc)", s: "Esc" }, About: { t: "\u5173\u4e8e", h: 1} }, sa = { mini: "Bold,Italic,Underline,Strikethrough,Separator,Align,List,Separator,Link,Img,About", simple: "Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,Separator,Align,List,Outdent,Indent,Separator,Link,Img,Emot,About", full: "Cut,Copy,Paste,Pastetext,Separator,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,Separator,Align,List,Outdent,Indent,Separator,Link,Unlink,Img,Flash,Media,Emot,Table,Separator,Source,Print,Fullscreen,About" }; sa.mfull = sa.full.replace(/Separator(,Align)/i, "BtnBr$1"); d.xheditor = function(A, B) { function C(a, c) { var e = typeof a; if (!c) return e != "undefined"; if (c == "array" && a.hasOwnProperty && a instanceof Array) return true; return e == c } function ja(a, c) { var e = location.protocol, h = location.hostname, o = location.port, j = location.pathname.replace(/\\/g, "/").replace(/[^\/]+$/i, ""); o = o == "" ? "80" : o; a = d.trim(a); if (e == "file:") c = "abs"; if (c != "abs") a = a.replace(new RegExp(e + "\\/\\/" + h.replace(/\./g, "\\.") + "(?::" + o + ")" + (o == "80" ? "?" : "") + "(/|$)", "i"), "/"); if (c == "rel") a = a.replace(new RegExp("^" + j.replace(/([\/\.\+\[\]\(\)])/g, "\\$1"), "i"), ""); if (c != "rel") a.match(/^((https?|file):\/\/|\/)/i) || (a = j + a); if (c == "abs") a.match(/(https?|file):\/\//i) || (a = e + "//" + location.host + a); return a } function Aa(a) { var c = Math.floor(Math.log(a) / Math.log(1024)); return (a / Math.pow(1024, Math.floor(c))).toFixed(2) + ["Byte", "KB", "MB", "GB", "TB", "PB"][c] } var b = this, N = d(A), Ba = N.closest("form"), J, O, P, ma, u, da, X, ta = false, H = false, ea = false, Ca, fa = false, Da = "", L = null, ua, ga = false, va = false, Y = null, T = null, Q = 0; this.settings = d.extend({}, { skin: "default", tools: "full", clickCancelDialog: true, linkTag: false, internalScript: false, inlineScript: false, internalStyle: true, inlineStyle: true, showBlocktag: false, forcePtag: true, upLinkExt: "zip,rar,txt", upImgExt: "jpg,jpeg,gif,png", upFlashExt: "swf", upMediaExt: "wmv,avi,wma,mp3,mid", modalWidth: 350, modalHeight: 220, modalTitle: true, defLinkText: "\u70b9\u51fb\u6253\u5f00\u94fe\u63a5", layerShadow: 3, emotMark: false, upBtnText: "\u4e0a\u4f20", wordDeepClean: true, hoverExecDelay: 100, upMultiple: true }, B); B = b.settings.plugins; var na = []; if (B) { ca = d.extend({}, ca, B); d.each(B, function(a) { na.push(a) }); na = na.join(",") } if (b.settings.tools.match(/^\s*(m?full|simple|mini)\s*$/i)) { var Ea = sa[d.trim(b.settings.tools)]; b.settings.tools = b.settings.tools.match(/m?full/i) && B ? Ea.replace("Table", "Table," + na) : Ea } b.settings.tools.match(/(^|,)\s*About\s*(,|$)/i) || (b.settings.tools += ""); b.settings.tools = b.settings.tools.split(","); S = ja(S, "abs"); var Fa = "xheCSS_" + b.settings.skin, ha = "xhe" + V + "_container", Ga = "xhe" + V + "_Tool", Ha = "xhe" + V + "_iframearea", Ia = "xhe" + V + "_iframe", wa = "xhe" + V + "_fixffcursor", Z = "", xa = S + b.settings.skin + "/", oa = Va, Ja = ja(S, "rel") + "xheditor_emot/", ya = ""; oa = d.extend({}, oa, b.settings.emots); if (fa = b.settings.showBlocktag) Z += " showBlocktag"; var pa = []; this.init = function() { d("#" + Fa).length == 0 && d("head").append('<link id="' + Fa + '" rel="stylesheet" type="text/css" href="' + xa + 'ui.css" />'); var a = b.settings.width || A.style.width || N.outerWidth(); Q = b.settings.height || A.style.height || N.outerHeight(); if (C(Q, "string")) Q = Q.replace(/[^\d]+/g, ""); if (a <= 0 || Q <= 0) { alert("\u5f53\u524dtextarea\u5904\u4e8e\u9690\u85cf\u72b6\u6001\uff0c\u8bf7\u5c06\u4e4b\u663e\u793a\u540e\u518d\u521d\u59cb\u5316xhEditor\uff0c\u6216\u8005\u76f4\u63a5\u8bbe\u7f6etextarea\u7684width\u548cheight\u6837\u5f0f"); return false } if (/^[0-9\.]+$/i.test("" + a)) a += "px"; var c = '<span class="xheGStart"/>', e, h, o = /Separator|BtnBr/i; d.each(b.settings.tools, function(g, f) { e = ca[f]; if (f.match(o)) c += '<span class="xheGEnd"/>'; if (f == "Separator") c += '<span class="xheSeparator"/>'; else if (f == "BtnBr") c += "<br />"; else { h = e.c ? e.c : "xheIcon xheBtn" + f; c += '<span><a href="javascript:void(0);" title="' + e.t + '" name="' + f + '" class="xheButton xheEnabled" tabindex="-1"><span class="' + h + '"/></a></span>'; e.s && b.addShortcuts(e.s, f) } if (f.match(o)) c += '<span class="xheGStart"/>' }); c += '<span class="xheGEnd"/><br />'; N.after(d('<input type="text" id="' + wa + '" style="position:absolute;display:none;" /><span id="' + ha + '" class="xhe_' + b.settings.skin + '" style="display:none"><table cellspacing="0" cellpadding="0" class="xheLayout" style="width:' + a + ";height:" + Q + 'px;"><tbody><tr><td id="' + Ga + '" class="xheTool" style="height:1px;"></td></tr><tr><td id="' + Ha + '" class="xheIframeArea"><iframe frameborder="0" id="' + Ia + '" src="" style="width:100%;"></iframe></td></tr></tbody></table></span>')); J = d("#" + Ga); O = d("#" + Ha); a = '<html><head><base /><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><link rel="stylesheet" href="' + xa + 'iframe.css"/>'; var j = b.settings.loadCSS; if (j) if (C(j, "array")) for (var p in j) a += '<link rel="stylesheet" href="' + j[p] + '"/>'; else a += j.match(/\s*<style(\s+[^>]*?)?>[\s\S]+?<\/style>\s*/i) ? j : '<link rel="stylesheet" href="' + j + '"/>'; a += '</head><body spellcheck="false" dir="ltr" class="editMode' + Z + '"></body></html>'; b.win = P = d("#" + Ia)[0].contentWindow; ma = d(P); try { this.doc = u = P.document; da = d(u); u.open(); u.write(a); u.close(); if (D) u.body.contentEditable = "true"; else u.designMode = "On" } catch (k) { } setTimeout(b.setOpts, 300); b.setSource(); P.setInterval = null; J.append(c).bind("mousedown contextmenu", function() { return false }); J.find(".xheButton").click(function(g) { var f = d(this); if (f.is(".xheEnabled")) { L = g; b.exec(f.attr("name")) } return false }).hover(function(g) { var f = d(this), l = b.settings.hoverExecDelay, m = T; T = null; if (l == -1 || ga || !f.is(".xheEnabled")) return false; if (m && m > 10) { ga = true; setTimeout(function() { ga = false }, 100); return false } var n = f.attr("name"); if (ca[n].h != 1) { b.hidePanel(); return false } if (va) l = 0; if (l >= 0) ua = setTimeout(function() { L = g; Y = { x: L.clientX, y: L.clientY }; b.exec(n) }, l) }, function() { Y = null; ua && clearTimeout(ua) }).mousemove(function(g) { if (Y) { var f = { x: g.clientX - Y.x, y: g.clientY - Y.y }; if (Math.abs(f.x) > 1 || Math.abs(f.y) > 1) { if (f.x > 0 && f.y > 0) { f = Math.round(Math.atan(f.y / f.x) / 0.017453293); T = T ? (T + f) / 2 : f } else T = null; Y = { x: g.clientX, y: g.clientY} } } }); K = d("#xhePanel"); $ = d("#xheShadow"); aa = d("#xheCntLine"); ra = d("#xheTempIframe"); if (K.length == 0) { K = d('<div id="xhePanel"></div>').mousedown(function(g) { g.stopPropagation() }); $ = d('<div id="xheShadow"></div>'); aa = d('<div id="xheCntLine"></div>'); d(document.body).append(K).append($).append(aa); if (D) d(document.body).append(ra = d('<iframe id="xheTempIframe" style="display:none;" />')) } d(document).mousedown(b.clickCancelPanel); da.mousedown(b.clickCancelPanel); d("#" + ha).show(); O.css("height", Q - J.outerHeight()); N.hide(); N.focus(b.focus); Ba.submit(b.saveResult).bind("reset", b.loadReset); p = d(window); p.unload(b.saveResult).bind("beforeunload", b.saveResult); p.resize(b.fixFullHeight); ma.focus(function() { b.settings.focus && b.settings.focus() }).blur(function() { b.settings.blur && b.settings.blur() }); W && ma.click(b.fixAppleSel); da.keydown(b.checkShortcuts).keypress(b.forcePtag).bind("mousedown click", function(g) { N.trigger(g.type) }); if (D) { function q(g) { g = d(g.target); var f; if (f = g.css("width")) g.css("width", "").attr("width", f.replace(/[^0-9%]+/g, "")); if (f = g.css("height")) g.css("height", "").attr("height", f.replace(/[^0-9%]+/g, "")) } da.bind("controlselect", function(g) { g = g.target; d.nodeName(g, "IMG") && d(g).unbind("resizeend", q).bind("resizeend", q) }) } d("body", da).bind("paste", b.cleanWordPaste); (p = b.settings.shortcuts) && d.each(p, function(g, f) { b.addShortcuts(g, f) }); V++; ta = true; if (b.settings.fullscreen) b.toggleFullscreen(); else b.settings.sourceMode && setTimeout(b.toggleSource, 20); return true }; this.remove = function() { b.hidePanel(); b.saveResult(); N.unbind("focus", b.focus); Ba.unbind("submit", b.saveResult).unbind("reset", b.loadReset); var a = d(window); a.unbind("unload", b.saveResult).unbind("beforeunload", b.saveResult); a.unbind("resize", b.fixFullHeight); d("#" + ha).remove(); N.show(); ta = false }; this.loadReset = function() { setTimeout(b.setSource, 10) }; this.saveResult = function() { b.getSource() }; this.cleanWordPaste = function() { if (D && !H) { var a; a = ra[0].contentWindow.document.body; a.innerHTML = ""; a.createTextRange().execCommand("Paste"); a = a.innerHTML; if (!a.match(/mso-|MsoNormal/i)) return true; if (a.indexOf("&nbsp;") == 0) a = a.substring(6); a = b.cleanHTML(a); a = b.formatXHTML(a); a = b.cleanWord(a); b.pasteHTML(a); return false } }; this.setCSS = function(a) { try { b._exec("styleWithCSS", a, true) } catch (c) { try { b._exec("useCSS", !a, true) } catch (e) { } } }; this.setOpts = function() { if (ta && !H) { b.setCSS(false); try { b._exec("enableObjectResizing", true, true) } catch (a) { } if (D) try { b._exec("BackgroundImageCache", true, true) } catch (c) { } } }; this.forcePtag = function(a) { if (H || a.which != 13 || a.shiftKey || a.ctrlKey || a.altKey) return true; a = b.getParent("p,h1,h2,h3,h4,h5,h6,pre,address,div,li"); if (a.is("li")) return true; if (b.settings.forcePtag) a.length == 0 && b._exec("formatblock", "<p>"); else { b.pasteHTML("<br />"); return false } }; this.fixFullHeight = function() { if (!ka && !W) { ea && O.height("100%").css("height", O.outerHeight() - J.outerHeight()); D && J.hide().show() } }; this.fixAppleSel = function(a) { a = a.target; if (a.tagName.match(/(img|embed)/i)) { var c = b.getSel(), e = b.getRng(); e.selectNode(a); c.removeAllRanges(); c.addRange(e) } }; this.saveBookmark = function() { H || (X = b.getRng()) }; this.loadBookmark = function() { if (!(H || !X)) { b.focus(); if (D) X.select(); else { var a = b.getSel(); a.removeAllRanges(); a.addRange(X) } X = null } }; this.focus = function() { H ? d("#sourceCode", u).focus() : ma.focus(); return false }; this.setCursorFirst = function(a) { b.focus(); P.scrollTo(0, 0); var c = b.getRng(), e = u.body, h = e, o; if (a && h.firstChild && (o = h.firstChild.tagName) && o.match(/^p|div|h[1-6]$/i)) h = e.firstChild; D ? c.moveToElementText(h) : c.setStart(h, 0); c.collapse(true); if (D) c.select(); else { a = b.getSel(); a.removeAllRanges(); a.addRange(c) } }; this.getSel = function() { return P.getSelection ? P.getSelection() : u.selection }; this.getRng = function() { var a = b.getSel(), c; try { c = a.rangeCount > 0 ? a.getRangeAt(0) : a.createRange ? a.createRange() : u.createRange() } catch (e) { } c || (c = D ? u.body.createTextRange() : u.createRange()); return c }; this.getParent = function(a) { var c = b.getRng(), e; if (D) e = c.item ? c.item(0) : c.parentElement(); else { e = c.commonAncestorContainer; if (!c.collapsed) if (c.startContainer == c.endContainer && c.startOffset - c.endOffset < 2 && c.startContainer.hasChildNodes()) e = c.startContainer.childNodes[c.startOffset] } a = a ? a : "*"; e = d(e); e.is(a) || (e = d(e).closest(a)); return e }; this.getSelect = function(a) { var c = b.getSel(), e = b.getRng(), h = true; h = !e || e.item ? false : !c || e.boundingWidth == 0 || e.collapsed; if (a == "text") return h ? "" : e.text || (c.toString ? c.toString() : ""); if (e.cloneContents) { a = d("<div></div>"); (e = e.cloneContents()) && a.append(e); e = a.html() } else e = C(e.item) ? e.item(0).outerHTML : C(e.htmlText) ? e.htmlText : e.toString(); if (h) e = ""; e = b.processHTML(e, "read"); e = b.cleanHTML(e); return e = b.formatXHTML(e) }; this.pasteHTML = function(a, c) { if (H) return false; b.focus(); a = b.processHTML(a, "write"); var e = b.getSel(), h = b.getRng(); if (c != undefined) { if (h.item) { var o = h.item(0); h = u.body.createTextRange(); h.moveToElementText(o); h.select() } h.collapse(c) } if (h.insertNode) { h.deleteContents(); a = h.createContextualFragment(a); c = a.lastChild; h.insertNode(a); h.setEndAfter(c); h.collapse(false); e.removeAllRanges(); e.addRange(h) } else { if (e.type.toLowerCase() == "control") { e.clear(); h = b.getRng() } h.pasteHTML(a) } }; this.pasteText = function(a, c) { a || (a = ""); a = b.domEncode(a); a = a.replace(/\r?\n/g, "<br />"); b.pasteHTML(a, c) }; this.appendHTML = function(a) { if (H) return false; b.focus(); a = b.processHTML(a, "write"); d(u.body).append(a) }; this.domEncode = function(a) { return a.replace(/[<>]/g, function(c) { return { "<": "&lt;", ">": "&gt;"}[c] }) }; this.setSource = function(a) { X = null; if (typeof a != "string" && a != "") a = A.value; if (H) d("#sourceCode", u).val(a); else { if (b.settings.beforeSetSource) a = b.settings.beforeSetSource(a); a = b.cleanHTML(a); a = b.formatXHTML(a); a = b.cleanWord(a); u.body.innerHTML = b.processHTML(a, "write") } }; this.processHTML = function(a, c) { if (c == "write") { function e(g, f, l, m) { m = m.split(","); if (!m[1]) { m[1] = m[0]; m[0] = "" } if (m[0] == "default") m[0] = ""; return g.replace(/\s+src\s*=\s*(["']?).*?\1(\s|$|\/|>)/i, "$2").replace(f, ' src="' + Ja + (m[0] ? m[0] : "default") + "/" + m[1] + '.gif"' + (b.settings.emotMark ? ' emot="' + (m[0] ? m[0] + "," : "") + m[1] + '" alt="' + m[1] + '"' : "")) } a = a.replace(/<img(?:\s+[^>]*?)?(\s+emot\s*=\s*(["']?)\s*(.*?)\s*\2)(?:\s+[^>]*?)?\/?>/ig, e); function h(g, f, l, m, n, i) { return g.replace(l, l + " _xhe_" + m + '="' + i + '"') } a = a.replace(/<(\w+(?:\:\w+)?)(?:\s+[^>]*?)?(\s+(src|href)\s*=\s*(["']?)\s*(.*?)\s*\4)(?:\s+[^>]*?)?\/?>/ig, h); a = a.replace(/<(\/?)del(\s+[^>]*?)?>/ig, "<$1strike$2>"); if (ka) { a = a.replace(/<(\/?)strong(\s+[^>]*?)?>/ig, "<$1b$2>"); a = a.replace(/<(\/?)em(\s+[^>]*?)?>/ig, "<$1i$2>") } else if (W) { a = a.replace(/("|;)\s*font-size\s*:\s*([a-z-]+)(;?)/ig, function(g, f, l, m) { for (var n, i = 0; i < M.length; i++) { g = M[i]; if (l == g.n) { n = g.wkn; break } } return f + "font-size:" + n + m }); a = a.replace(/<strong(\s+[^>]*?)?>/ig, '<span class="Apple-style-span" style="font-weight: bold;"$1>'); a = a.replace(/<em(\s+[^>]*?)?>/ig, '<span class="Apple-style-span" style="font-style: italic;"$1>'); a = a.replace(/<u(\s+[^>]*?)?>/ig, '<span class="Apple-style-span" style="text-decoration: underline;"$1>'); a = a.replace(/<strike(\s+[^>]*?)?>/ig, '<span class="Apple-style-span" style="text-decoration: line-through;"$1>'); a = a.replace(/<\/(strong|em|u|strike)>/ig, "</span>"); a = a.replace(/<span((?:\s+[^>]*?)?\s+style="([^"]*;)*\s*(font-family|font-size|color|background-color)\s*:\s*[^;"]+\s*;?"[^>]*)>/ig, '<span class="Apple-style-span"$1>') } else if (D) { a = a.replace(/&apos;/ig, "&#39;"); a = a.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/ig, "") } a = a.replace(/<a(\s+[^>]*?)?\/>/, "<a$1></a>"); if (!W) { function o(g, f, l, m) { f = ""; var n, i; if (n = l.match(/font-family\s*:\s*([^;"]+)/i)) f += ' face="' + n[1] + '"'; if (n = l.match(/font-size\s*:\s*([^;"]+)/i)) { n = n[1].toLowerCase(); for (var r = 0; r < M.length; r++) if (n == M[r].n || n == M[r].s) { i = r + 1; break } if (i) { f += ' size="' + i + '"'; l = l.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig, "$1") } } if (i = l.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i)) { if (n = i[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)) { i[1] = "#"; for (r = 1; r <= 3; r++) i[1] += (n[r] - 0).toString(16) } i[1] = i[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i, "#$1$1$2$2$3$3"); f += ' color="' + i[1] + '"' } l = l.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig, "$1"); if (f != "") { if (l) f += ' style="' + l + '"'; return "<font" + f + ">" + m + "</font>" } else return g } a = a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)*\s*(?:font-family|font-size|color)\s*:[^"]*)"(?: [^>]+)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig, o); a = a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)*\s*(?:font-family|font-size|color)\s*:[^"]*)"(?: [^>]+)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig, o); a = a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)*\s*(?:font-family|font-size|color)\s*:[^"]*)"(?: [^>]+)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig, o) } } else { var j = b.settings.localUrl; function p(g, f, l, m) { if (j) m = ja(m, j); return g.replace(new RegExp("\\s+" + f + "\\s*=\\s*([\"']?).*?\\1(\\s|/?>)", "ig"), " " + f + '="' + m.replace(/\$/g, "$$$$") + '"$2') } a = a.replace(/<(?:\w+(?:\:\w+)?)(?:\s+[^>]*?)?\s+_xhe_(src|href)\s*=\s*(["']?)\s*(.*?)\s*\2(?:\s+[^>]*?)?\/?>/ig, p); if (W) { a = a.replace(/("|;)\s*font-size\s*:\s*([a-z-]+)(;?)/ig, function(g, f, l, m) { for (var n, i = 0; i < M.length; i++) { g = M[i]; if (l == g.wkn) { n = g.n; break } } return f + "font-size:" + n + m }); var k = [{ r: /font-weight:\sbold/ig, t: "strong" }, { r: /font-style:\sitalic/ig, t: "em" }, { r: /text-decoration:\sunderline/ig, t: "u" }, { r: /text-decoration:\sline-through/ig, t: "strike"}]; function q(g, f, l, m, n) { f = l + m; l = ""; for (m = 0; m < k.length; m++) if (f.match(k[m].r)) { l = k[m].t; break } return l ? "<" + l + ">" + n + "</" + l + ">" : g } a = a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig, q); a = a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig, q); a = a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig, q) } a = a.replace(/(<\w+(?:\s+[^>]*?)?)\s+(?:_xhe_|_moz_|_webkit_)[^=]+?\s*=\s*(["']?).*?\2(\s|\/?>)/ig, "$1$3"); a = a.replace(/(<\w+[^>]*?)\s+class\s*=\s*(["']?)\s*(?:apple|webkit)\-.+?\s*\2(\s|\/?>)/ig, "$1$3"); a = a.replace(/<img(\s+[^>]+?)\/?>/ig, function(g, f) { f.match(/\s+alt\s*(["']?).*?\1(\s|$)/i) || (f += ' alt=""'); return "<img" + f + " />" }) } return a }; this.getSource = function(a) { var c, e = b.settings.beforeGetSource; if (H) { c = d("#sourceCode", u).val(); e || (c = c.replace(/(\t*\r?\n\t*)+/g, "")) } else { c = b.processHTML(u.body.innerHTML, "read"); c = c.replace(/^\s*(?:<(p|div)(?:\s+[^>]*?)?>)?\s*(<br(?:\s+[^>]*?)?>)*\s*(?:<\/\1>)?\s*$/i, ""); c = b.cleanHTML(c); c = b.formatXHTML(c, a); c = b.cleanWord(c); if (e) c = e(c) } return A.value = c }; this.cleanWord = function(a) { if (a.match(/mso-|MsoNormal/i)) { var c = b.settings.wordDeepClean; a = a.replace(/(<link(?:\s+[^>]*?)?)\s+href\s*=\s*(["']?)\s*file:\/\/.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig, ""); a = a.replace(/<!--[\s\S]*?--\>|<!(--)?\[[\s\S]+?\](--)?>|<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig, ""); a = a.replace(/<\/?\w+:[^>]*>/ig, ""); if (c) a = a.replace(/<\/?(span|a|img)(\s+[^>]*?)?>/ig, ""); a = a.replace(/(<\w+(?:\s+[^>]*?)?)\s+class\s*=\s*(["']?)\s*mso.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig, "$1$3"); a = a.replace(/(<\w+(?:\s+[^>]*?)?)\s+lang\s*=\s*(["']?)\s*.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig, "$1$3"); a = a.replace(/(<\w+(?:\s+[^>]*?)?)\s+align\s*=\s*(["']?)\s*left\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig, "$1$3"); a = a.replace(/<\w+(?:\s+[^>]*?)?(\s+style\s*=\s*(["']?)\s*(.*?)\s*\2)(?:\s+[^>]*?)?\s*\/?>/ig, function(e, h, o, j) { j = d.trim(j.replace(/\s*(mso-[^:]+:.+?|margin\s*:\s*0cm 0cm 0pt\s*|(text-align|font-variant|line-height)\s*:\s*.+?)(;|$)\s*/ig, "")); return e.replace(h, c ? "" : j ? ' style="' + j + '"' : "") }) } return a }; this.cleanHTML = function(a) { a = a.replace(/<!?\/?(DOCTYPE|html|body)(\s+[^>]*?)?>/ig, ""); var c; a = a.replace(/<head(?:\s+[^>]*?)?>([\s\S]*?)<\/head>/i, function(e, h) { c = h.match(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig); return "" }); if (c) a = c.join("") + a; a = a.replace(/<\??xml(:\w+)?(\s+[^>]*?)?>([\s\S]*?<\/xml>)?/ig, ""); b.settings.linkTag || (a = a.replace(/<link(\s+[^>]*?)?>/ig, "")); b.settings.internalScript || (a = a.replace(/<script(\s+[^>]*?)?>[\s\S]*?<\/script>/ig, "")); b.settings.inlineScript || (a = a.replace(/(<\w+)(\s+[^>]*?)?\s+on(?:click|dblclick|mousedown|mouseup|mousemove|mouseover|mouseout|mouseenter|mouseleave|keydown|keypress|keyup|change|select|submit|reset|blur|focus|load|unload)\s*=\s*(["']?).*?\3((?:\s+[^>]*?)?\/?>)/ig, "$1$2$4")); b.settings.internalStyle || (a = a.replace(/<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig, "")); b.settings.inlineStyle || (a = a.replace(/(<\w+)(\s+[^>]*?)?\s+(style|class)\s*=\s*(["']?).*?\3((?:\s+[^>]*?)?\/?>)/ig, "$1$2$4")); return a = a.replace(/<\/(strong|b|u|strike|em|i)>((?:\s|<br\/?>|&nbsp;)*?)<\1(\s+[^>]*?)?>/ig, "$2") }; this.formatXHTML = function(a, c) { function e(s) { var v = {}; s = s.split(","); for (var F = 0; F < s.length; F++) v[s[F]] = true; return v } function h(s) { if (s) { s = s.toLowerCase(); var v = r[s]; if (v) s = v } else s = ""; return s } function o(s, v, F) { s = h(s); if (f[s]) for (; y.last() && l[y.last()]; ) j(y.last()); m[s] && y.last() == s && j(s); (F = g[s] || !!F) || y.push(s); var I = Array(); I.push("<" + s); v.replace(x, function(Ka, ia, La, Ma, Na) { ia = ia.toLowerCase(); I.push(" " + ia + '="' + (La ? La : Ma ? Ma : Na ? Na : n[ia] ? ia : "") + '"') }); I.push((F ? " /" : "") + ">"); p(I.join(""), s, true) } function j(s) { if (s) { s = h(s); for (v = y.length - 1; v >= 0; v--) if (y[v] == s) break } else var v = 0; if (v >= 0) { for (s = y.length - 1; s >= v; s--) p("</" + y[s] + ">", y[s]); y.length = v } } function p(s, v, F) { if (c == true) { s = s.replace(/(\t*\r?\n\t*)+/g, ""); if (!s.match(/^\s*$/)) { var I = f[v], Ka = I ? v : ""; if (I) { F && E++; U == "" && E-- } else U && E++; if (Ka != U || I) k(); G.push(s); v == "br" && k(); if (I && (g[v] || !F)) E--; U = I ? v : ""; za = F } } else G.push(s) } function k() { G.push("\r\n"); if (E > 0) for (var s = E; s--; ) G.push("\t") } function q(s, v, F, I) { s = ""; if (v = F.match(/ face\s*=\s*"\s*([^"]+)\s*"/i)) s += "font-family:" + v[1] + ";"; if (v = F.match(/ size\s*=\s*"\s*(\d+)\s*"/i)) s += "font-size:" + M[(v[1] > 7 ? 7 : v[1] < 1 ? 1 : v[1]) - 1].n + ";"; if (v = F.match(/ color\s*=\s*"\s*([^"]+)\s*"/i)) s += "color:" + v[1] + ";"; if (F = F.match(/ style\s*=\s*"\s*([^"]+)\s*"/i)) s += F[1]; if (s) I = '<span style="' + s + '">' + I + "</span>"; return I } var g = e("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"), f = e("address,applet,blockquote,button,center,dd,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul"), l = e("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"), m = e("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"), n = e("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"), i = e("script,style"), r = { b: "strong", i: "em", s: "del", strike: "del" }, t = /^<\??(\w+(?:\:\w+)?)((?:\s+[\w-\:]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/, z = /^<\/(\w+(?:\:\w+)?)[^>]*>/, x = /([\w-(?:\:\w+)?]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g, w = 0, y = []; a = a; var G = Array(), E = -1, U = "body", za; for (y.last = function() { return this[this.length - 1] }; a.length > 0; ) if (!y.last() || !i[y.last()]) { w = 0; if (a.substring(0, 4) == "<!--") { w = a.indexOf("--\>"); if (w != -1) { w += 3; p(a.substring(0, w)) } } else if (a.substring(0, 2) == "</") { if (match = a.match(z)) { j(match[1]); w = match[0].length } } else if (a.charAt(0) == "<") if (match = a.match(t)) { o(match[1], match[2], match[3]); w = match[0].length } if (w == 0) { w = a.indexOf("<"); if (w == 0) w = 1; else if (w < 0) w = a.length; p(b.domEncode(a.substring(0, w))) } a = a.substring(w) } else { a = a.replace(/^([\s\S]*?)<\/(style|script)>/i, function(s, v) { p(v); return "" }); j(y.last()) } j(); a = G.join(""); G = null; a = a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig, q); a = a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig, q); a = a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig, q); a = a.replace(/^(\s*\r?\n)+|(\s*\r?\n)+$/g, ""); return a = a.replace(/(\t*\r?\n)+/g, "\r\n") }; this.toggleShowBlocktag = function(a) { if (fa !== a) { fa = !fa; a = d(u.body); if (fa) { Z += " showBlocktag"; a.addClass("showBlocktag") } else { Z = Z.replace(" showBlocktag", ""); a.removeClass("showBlocktag") } } }; this.toggleSource = function(a) { if (H !== a) { J.find("[name=Source]").toggleClass("xheEnabled").toggleClass("xheActive"); var c = u.body, e = d(c), h, o, j = "_xhe_cursor" + (new Date).getTime(); a = 0; if (H) { h = b.getSource(); e.find("#sourceCode").remove(); e.removeAttr("scroll").attr("class", "editMode" + Z); if (D) c.contentEditable = "true"; else u.designMode = "On"; if (ka) { b._exec("inserthtml", "-"); d("#" + wa).show().focus().hide() } } else { b.pasteHTML(j, true); h = b.getSource(true); a = h.indexOf(j); if (!Oa) a = h.substring(0, a).replace(/\r/g, "").length; h = h.replace(j, ""); if (D) c.contentEditable = "false"; else u.designMode = "Off"; e.attr("scroll", "no").attr("class", "sourceMode").html('<textarea id="sourceCode" wrap="soft" spellcheck="false" height="100%" />'); o = d("#sourceCode", e).blur(b.getSource)[0] } H = !H; b.setSource(h); if (H) { b.focus(); if (o.setSelectionRange) o.setSelectionRange(a, a); else { o = o.createTextRange(); o.move("character", a); o.select() } } else b.setCursorFirst(true); J.find("[name=Source]").toggleClass("xheEnabled"); J.find(".xheButton").not("[name=Source],[name=Fullscreen],[name=About]").toggleClass("xheEnabled"); setTimeout(b.setOpts, 300) } }; this.toggleFullscreen = function(a) { if (ea !== a) { a = d("#" + ha).find(".xheLayout"); var c = d("#" + ha); if (ea) { a.attr("style", Da); O.height(Q - J.outerHeight()); setTimeout(function() { d(window).scrollTop(Ca) }, 10) } else { Ca = d(window).scrollTop(); Da = a.attr("style"); a.removeAttr("style"); O.height("100%"); setTimeout(b.fixFullHeight, 100) } if (ka) { d("#" + wa).show().focus().hide(); setTimeout(b.focus, 1) } ea = !ea; c.toggleClass("xhe_Fullscreen"); d("html").toggleClass("xhe_Fullfix"); J.find("[name=Fullscreen]").toggleClass("xheActive"); setTimeout(b.setOpts, 300) } }; this.showMenu = function(a, c) { var e = d('<div class="xheMenu"></div>'), h = []; d.each(a, function(o, j) { h.push('<a href="javascript:void(0);" title="' + (j.t ? j.t : j.s) + '" v="' + j.v + '">' + j.s + "</a>") }); e.append(h.join("")); e.click(function(o) { c(d(o.target).closest("a").attr("v")); b.hidePanel(); return false }).mousedown(function() { return false }); b.showPanel(e) }; this.showColor = function(a) { var c = d('<div class="xheColor"></div>'), e = [], h = 0; d.each(Qa, function(o, j) { if (h % 7 == 0) e.push((h > 0 ? "</div>" : "") + "<div>"); e.push('<a href="javascript:void(0);" title="' + j + '" style="background:' + j + '"></a>'); h++ }); e.push("</div>"); c.append(e.join("")); c.click(function(o) { o = o.target; if (d.nodeName(o, "A")) { a(d(o).attr("title")); b.hidePanel(); return false } }).mousedown(function() { return false }); b.showPanel(c) }; this.showPastetext = function() { var a = d('<div>\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl+V)\u628a\u5185\u5bb9\u7c98\u8d34\u5230\u65b9\u6846\u91cc\uff0c\u6309 \u786e\u5b9a</div><div><textarea id="xhePastetextValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>'), c = d("#xhePastetextValue", a); d("#xheSave", a).click(function() { b.loadBookmark(); var e = c.val(); e && b.pasteText(e); b.hidePanel(); return false }); b.showDialog(a) }; this.showLink = function() { var a = d('<div>\u94fe\u63a5\u5730\u5740: <input type="text" id="xheLinkHref" value="http://" class="xheText" /></div><div>\u6253\u5f00\u65b9\u5f0f: <select id="xheLinkTarget"><option selected="selected" value="">\u9ed8\u8ba4</option><option value="_blank">\u65b0\u7a97\u53e3</option><option value="_self">\u5f53\u524d\u7a97\u53e3</option><option value="_parent">\u7236\u7a97\u53e3</option></select></div><div style="display:none">\u94fe\u63a5\u6587\u5b57: <input type="text" id="xheLinkText" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>'), c = b.getParent("a"), e = d("#xheLinkText", a), h = d("#xheLinkHref", a), o = d("#xheLinkTarget", a), j = d("#xheSave", a), p = b.getSelect(); if (c.length == 1) { h.val(b.attr(c, "href")); o.attr("value", c.attr("target")) } else p == "" && e.val(b.settings.defLinkText).closest("div").show(); b.settings.upLinkUrl && b.uploadInit(h, b.settings.upLinkUrl, b.settings.upLinkExt); j.click(function() { var k = h.val(); b.loadBookmark(); if (k == "" || c.length == 0) b._exec("unlink"); if (k != "" && k != "http://") { var q = k.split(" "), g = o.val(), f = e.val(); if (q.length > 1) { b._exec("unlink"); p = b.getSelect(); var l = '<a href="xhe_tmpurl"', m = []; if (g != "") l += ' target="' + g + '"'; l += ">xhe_tmptext</a>"; f = p != "" ? p : f ? f : k; for (var n in q) { k = q[n]; if (k != "") { k = k.split(","); g = l; g = g.replace("xhe_tmpurl", k[0]); g = g.replace("xhe_tmptext", k[1] ? k[1] : f); m.push(g) } } b.pasteHTML(m.join("&nbsp;")) } else { k = q[0].split(","); f || (f = k[0]); f = k[1] ? k[1] : p != "" ? "" : f ? f : k[0]; if (c.length == 0) { f ? b.pasteHTML('<a href="#xhe_tmpurl">' + f + "</a>") : b._exec("createlink", "#xhe_tmpurl"); c = d('a[href$="#xhe_tmpurl"]', u) } b.attr(c, "href", k[0]); g != "" ? c.attr("target", g) : c.removeAttr("target"); f && !W && c.text(f) } } b.hidePanel(); return false }); b.showDialog(a) }; this.showImg = function() { var a = d('<div>\u56fe\u7247\u6587\u4ef6: <input type="text" id="xheImgSrc" value="http://" class="xheText" /></div><div>\u66ff\u6362\u6587\u672c: <input type="text" id="xheImgAlt" /></div><div>\u5bf9\u9f50\u65b9\u5f0f: <select id="xheImgAlign"><option selected="selected" value="">\u9ed8\u8ba4</option><option value="left">\u5de6\u5bf9\u9f50</option><option value="right">\u53f3\u5bf9\u9f50</option><option value="top">\u9876\u7aef</option><option value="middle">\u5c45\u4e2d</option><option value="baseline">\u57fa\u7ebf</option><option value="bottom">\u5e95\u8fb9</option></select></div><div>\u5bbd\u5ea6\u9ad8\u5ea6: <input type="text" id="xheImgWidth" style="width:40px;" /> x <input type="text" id="xheImgHeight" style="width:40px;" /></div><div>\u8fb9\u6846\u5927\u5c0f: <input type="text" id="xheImgBorder" style="width:40px;" /></div><div>\u6c34\u5e73\u95f4\u8ddd: <input type="text" id="xheImgHspace" style="width:40px;" /> \u5782\u76f4\u95f4\u8ddd: <input type="text" id="xheImgVspace" style="width:40px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>'), c = b.getParent("img"), e = d("#xheImgSrc", a), h = d("#xheImgAlt", a), o = d("#xheImgAlign", a), j = d("#xheImgWidth", a), p = d("#xheImgHeight", a), k = d("#xheImgBorder", a), q = d("#xheImgVspace", a), g = d("#xheImgHspace", a), f = d("#xheSave", a); if (c.length == 1) { e.val(b.attr(c, "src")); h.val(c.attr("alt")); o.val(c.attr("align")); j.val(c.attr("width")); p.val(c.attr("height")); k.val(c.attr("border")); var l = c.attr("vspace"), m = c.attr("hspace"); q.val(l <= 0 ? "" : l); g.val(m <= 0 ? "" : m) } b.settings.upImgUrl && b.uploadInit(e, b.settings.upImgUrl, b.settings.upImgExt); f.click(function() { b.loadBookmark(); var n = e.val(); if (n != "" && n != "http://") { var i = n.split(" "), r = h.val(), t = o.val(), z = j.val(), x = p.val(), w = k.val(), y = q.val(), G = g.val(); if (i.length > 1) { var E = '<img src="xhe_tmpurl"', U = []; if (r != "") E += ' alt="' + r + '"'; if (t != "") E += ' align="' + t + '"'; if (z != "") E += ' width="' + z + '"'; if (x != "") E += ' height="' + x + '"'; if (w != "") E += ' border="' + w + '"'; if (y != "") E += ' vspace="' + y + '"'; if (G != "") E += ' hspace="' + G + '"'; E += " />"; for (var za in i) { n = i[za]; if (n != "") { n = n.split(","); r = E; r = r.replace("xhe_tmpurl", n[0]); if (n[1]) r = '<a href="' + n[1] + '" target="_blank">' + r + "</a>"; U.push(r) } } b.pasteHTML(U.join("&nbsp;")) } else if (i.length == 1) { n = i[0]; if (n != "") { n = n.split(","); if (c.length == 0) { b.pasteHTML('<img src="' + n[0] + '#xhe_tmpurl" />'); c = d('img[src$="#xhe_tmpurl"]', u) } b.attr(c, "src", n[0]); r != "" && c.attr("alt", r); t != "" ? c.attr("align", t) : c.removeAttr("align"); z != "" ? c.attr("width", z) : c.removeAttr("width"); x != "" ? c.attr("height", x) : c.removeAttr("height"); w != "" ? c.attr("border", w) : c.removeAttr("border"); y != "" ? c.attr("vspace", y) : c.removeAttr("vspace"); G != "" ? c.attr("hspace", G) : c.removeAttr("hspace"); if (n[1]) { i = c.parent("a"); if (i.length == 0) { c.wrap("<a></a>"); i = c.parent("a") } b.attr(i, "href", n[1]); i.attr("target", "_blank") } } } } else c.length == 1 && c.remove(); b.hidePanel(); return false }); b.showDialog(a) }; this.showEmbed = function(a, c, e, h, o, j, p) { c = d(c); var k = b.getParent('embed[type="' + e + '"],embed[classid="' + h + '"]'), q = d("#xhe" + a + "Src", c), g = d("#xhe" + a + "Width", c), f = d("#xhe" + a + "Height", c); a = d("#xheSave", c); j && b.uploadInit(q, j, p); b.showDialog(c); if (k.length == 1) { q.val(b.attr(k, "src")); g.val(k.attr("width")); f.val(k.attr("height")) } a.click(function() { b.loadBookmark(); var l = q.val(); if (l != "" && l != "http://") { var m = g.val(), n = f.val(), i = /^[0-9]+$/; i.test(m) || (m = 412); i.test(n) || (n = 300); var r = '<embed type="' + e + '" classid="' + h + '" src="xhe_tmpurl"' + o; i = l.split(" "); if (i.length > 1) { r = r + ""; var t, z = []; r += ' width="xhe_width" height="xhe_height" />'; for (var x in i) { l = i[x].split(","); t = r; t = t.replace("xhe_tmpurl", l[0]); t = t.replace("xhe_width", l[1] ? l[1] : m); t = t.replace("xhe_height", l[2] ? l[2] : n); l != "" && z.push(t) } b.pasteHTML(z.join("&nbsp;")) } else if (i.length == 1) { l = i[0].split(","); if (k.length == 0) { b.pasteHTML(r.replace("xhe_tmpurl", l[0] + "#xhe_tmpurl") + " />"); k = d('embed[src$="#xhe_tmpurl"]', u) } b.attr(k, "src", l[0]); k.attr("width", l[1] ? l[1] : m); k.attr("height", l[2] ? l[2] : n) } } else k.length == 1 && k.remove(); b.hidePanel(); return false }) }; this.showEmot = function(a) { var c = d('<div class="xheEmot"></div>'); a = a ? a : ya ? ya : "default"; var e = oa[a], h = Ja + a + "/", o = 0, j = [], p = ""; p = e.width; var k = e.height, q = e.line, g = e.count; e = e.list; if (g) for (e = 1; e <= g; e++) { o++; j.push('<a href="javascript:void(0);" style="background-image:url(' + h + e + '.gif);" emot="' + a + "," + e + '" title=' + e + ">&nbsp;</a>"); o % q == 0 && j.push("<br />") } else d.each(e, function(n, i) { o++; j.push('<a href="javascript:void(0);" style="background-image:url(' + h + n + '.gif);" emot="' + a + "," + n + '" title="' + i + '">&nbsp;</a>'); o % q == 0 && j.push("<br />") }); g = q * (p + 12); e = Math.ceil(o / q) * (k + 12); var f = g * 0.75; if (e <= f) f = ""; p = d("<style>" + (f ? ".xheEmot div{width:" + (g + 20) + "px;height:" + f + "px;}" : "") + ".xheEmot div a{width:" + p + "px;height:" + k + "px;}</style><div>" + j.join("") + "</div>").click(function(n) { n = n.target; var i = d(n); if (d.nodeName(n, "A")) { b.pasteHTML('<img emot="' + i.attr("emot") + '" alt="' + i.attr("title") + '">'); b.hidePanel(); return false } }).mousedown(function() { return false }); c.append(p); var l = 0, m = ["<ul>"]; d.each(oa, function(n, i) { l++; m.push("<li" + (a == n ? ' class="cur"' : "") + '><a href="javascript:void(0);" group="' + n + '">' + i.name + "</a></li>") }); if (l > 1) { m.push('</ul><br style="clear:both;" />'); p = d(m.join("")).click(function(n) { ya = d(n.target).attr("group"); b.exec("Emot"); return false }).mousedown(function() { return false }); c.append(p) } b.showPanel(c) }; this.showTable = function() { var a = d('<div>\u884c\u6570\u5217\u6570: <input type="text" id="xheTableRows" style="width:40px;" value="3" /> x <input type="text" id="xheTableColumns" style="width:40px;" value="2" /></div><div>\u6807\u9898\u5355\u5143: <select id="xheTableHeaders"><option selected="selected" value="">\u65e0</option><option value="row">\u7b2c\u4e00\u884c</option><option value="col">\u7b2c\u4e00\u5217</option><option value="both">\u7b2c\u4e00\u884c\u548c\u7b2c\u4e00\u5217</option></select></div><div>\u5bbd\u5ea6\u9ad8\u5ea6: <input type="text" id="xheTableWidth" style="width:40px;" value="200" /> x <input type="text" id="xheTableHeight" style="width:40px;" value="" /></div><div>\u8fb9\u6846\u5927\u5c0f: <input type="text" id="xheTableBorder" style="width:40px;" value="1" /></div><div>\u8868\u683c\u95f4\u8ddd: <input type="text" id="xheTableCellSpacing" style="width:40px;" value="1" /> \u8868\u683c\u586b\u5145: <input type="text" id="xheTableCellPadding" style="width:40px;" value="1" /></div><div>\u5bf9\u9f50\u65b9\u5f0f: <select id="xheTableAlign"><option selected="selected" value="">\u9ed8\u8ba4</option><option value="left">\u5de6\u5bf9\u9f50</option><option value="center">\u5c45\u4e2d</option><option value="right">\u53f3\u5bf9\u9f50</option></select></div><div>\u8868\u683c\u6807\u9898: <input type="text" id="xheTableCaption" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>'), c = d("#xheTableRows", a), e = d("#xheTableColumns", a), h = d("#xheTableHeaders", a), o = d("#xheTableWidth", a), j = d("#xheTableHeight", a), p = d("#xheTableBorder", a), k = d("#xheTableCellSpacing", a), q = d("#xheTableCellPadding", a), g = d("#xheTableAlign", a), f = d("#xheTableCaption", a); d("#xheSave", a).click(function() { b.loadBookmark(); var l = f.val(), m = p.val(), n = c.val(), i = e.val(), r = h.val(), t = o.val(), z = j.val(), x = k.val(), w = q.val(), y = g.val(); m = "<table" + (m != "" ? ' border="' + m + '"' : "") + (t != "" ? ' width="' + t + '"' : "") + (z != "" ? ' width="' + z + '"' : "") + (x != "" ? ' cellspacing="' + x + '"' : "") + (w != "" ? ' cellpadding="' + w + '"' : "") + (y != "" ? ' align="' + y + '"' : "") + ">"; if (l != "") m += "<caption>" + l + "</caption>"; if (r == "row" || r == "both") { m += "<tr>"; for (l = 0; l < i; l++) m += '<th scope="col">&nbsp;</th>'; m += "</tr>"; n-- } m += "<tbody>"; for (l = 0; l < n; l++) { m += "<tr>"; for (t = 0; t < i; t++) m += t == 0 && (r == "col" || r == "both") ? '<th scope="row">&nbsp;</th>' : "<td>&nbsp;</td>"; m += "</tr>" } m += "</tbody></table>"; b.pasteHTML(m); b.hidePanel(); return false }); b.showDialog(a) }; this.showAbout = function() { var a = d(''); b.showDialog(a) }; this.attr = function(a, c, e) { if (!c) return false; var h = "_xhe_" + c; e && a.attr(c, e).removeAttr(h).attr(h, e); return a.attr(h) || a.attr(c) }; this.addShortcuts = function(a, c) { a = a.toLowerCase(); if (pa[a] == undefined) pa[a] = Array(); pa[a].push(c) }; this.checkShortcuts = function(a) { if (H) return true; var c = a.which, e = Pa[c]; c = e ? e : String.fromCharCode(c).toLowerCase(); sKey = ""; sKey += a.ctrlKey ? "ctrl+" : ""; sKey += a.altKey ? "alt+" : ""; sKey += a.shiftKey ? "shift+" : ""; sKey += c; a = pa[sKey]; var h; for (h in a) { h = a[h]; if (d.isFunction(h)) { if (h.call(b) === false) return false } else { b.exec(h); return false } } }; this.uploadInit = function(a, c, e) { function h() { a.closest(".xheDialog").bind("dragenter dragover", function() { return false }).bind("drop", function(i) { i = i.originalEvent.dataTransfer; var r; if (i && (r = i.files) && r.length > 0) o(r); return false }) } function o(i) { n = []; var r, t, z = d('<div style="margin:22px 0;text-align:center;line-height:30px;">\u6587\u4ef6\u4e0a\u4f20\u4e2d\uff0c\u8bf7\u7a0d\u5019\u2026\u2026<br /></div>'), x = '<img src="' + xa + 'img/loading.gif">'; if (i.nodeType && !((t = i.files) && t[0])) { if (!j(i.value)) return; z.append(x); r = new b.html4Upload(i, c, p) } else { t || (t = i); var w = t.length; if (!l && w > 1) { alert("\u8bf7\u4e0d\u8981\u4e00\u6b21\u4e0a\u4f20\u591a\u4e2a\u6587\u4ef6"); return } for (i = 0; i < w; i++) if (!j(t[i].fileName)) return; var y = d('<div class="xheProgress"><div><span>0%</span></div></div>'); z.append(y); r = new b.html5Upload(q, t, c, p, function(G) { if (G.loaded >= 0) { var E = Math.round(G.loaded * 100 / G.total) + "%"; d("div", y).css("width", E); d("span", y).text(E + " ( " + Aa(G.loaded) + " / " + Aa(G.total) + " )") } else y.replaceWith(x) }) } R = false; b.showModal("\u6587\u4ef6\u4e0a\u4f20\u4e2d(Esc\u53d6\u6d88\u4e0a\u4f20)", z, 320, 150, function() { R = true; r.remove() }); r.start() } function j(i) { if (e == "*" || i.match(new RegExp(".(" + e.replace(/,/g, "|") + ")$", "i"))) return true; else { alert("\u4e0a\u4f20\u6587\u4ef6\u6269\u5c55\u540d\u5fc5\u9700\u4e3a: " + e); return false } } function p(i, r) { var t = Object, z = false, x = b.settings.onUpload; try { t = eval("(" + i + ")") } catch (w) { } if (t.err == undefined || t.msg == undefined) alert(c + " \u4e0a\u4f20\u63a5\u53e3\u53d1\u751f\u9519\u8bef\uff01\r\n\r\n\u8fd4\u56de\u7684\u9519\u8bef\u5185\u5bb9\u4e3a: \r\n\r\n" + i); else if (t.err) alert(t.err); else { n.push(t.msg); z = true } if (!z || r) b.removeModal(); if (r && z) { k(n); x && x(n) } return z } function k(i) { if (C(i, "string")) i = [i]; var r = false, t, z = i.length, x, w = []; for (t = 0; t < z; t++) { x = i[t]; x = C(x, "string") ? x : x.url; if (x.substr(0, 1) == "!") { r = true; x = x.substr(1) } w.push(x) } a.val(w.join(" ")); r && a.closest(".xheDialog").find("#xheSave").click() } var q = "filedata", g = d('<span class="xheUpload"><input type="text" style="visibility:hidden;" tabindex="-1" /><input type="button" value="' + b.settings.upBtnText + '" class="xheBtn" tabindex="-1" /></span>'), f = d(".xheBtn", g), l = b.settings.upMultiple; a.after(g); f.before(a); c = c.replace(/{editorRoot}/ig, S); if (c.substr(0, 1) == "!") f.click(function() { R = false; b.showIframeModal("\u4e0a\u4f20\u6587\u4ef6", c.substr(1), k, null, null, function() { R = true }) }); else { g.append('<input type="file"' + (l ? ' multiple=""' : "") + ' class="xheFile" size="13" name="' + q + '" tabindex="-1" />'); var m = d(".xheFile", g), n = []; m.change(function() { o(m[0]) }); setTimeout(h, 10) } }; this.html4Upload = function(a, c, e) { var h = "jUploadFrame" + (new Date).getTime(), o = this, j = d('<iframe name="' + h + '" class="xheHideArea" />').appendTo("body"), p = d('<form action="' + c + '" target="' + h + '" method="post" enctype="multipart/form-data" class="xheHideArea"></form>').appendTo("body"), k = d(a), q = k.clone().attr("disabled", "true"); k.before(q).appendTo(p); this.remove = function() { if (o != null) { q.before(k).remove(); j.remove(); p.remove(); o = null } }; this.onLoad = function() { e(d(j[0].contentWindow.document.body).text(), true) }; this.start = function() { p.submit(); j.load(o.onLoad) }; return this }; this.html5Upload = function(a, c, e, h, o) { function j(i, r, t, z) { k = new XMLHttpRequest; upload = k.upload; k.onreadystatechange = function() { k.readyState == 4 && t(k.responseText) }; if (upload) upload.onprogress = function(x) { z(x.loaded) }; else z(-1); k.open("POST", r); k.setRequestHeader("Content-Type", "application/octet-stream"); k.setRequestHeader("Content-Disposition", 'attachment; name="' + a + '"; filename="' + i.fileName + '"'); k.sendAsBinary ? k.sendAsBinary(i.getAsBinary()) : k.send(i) } function p(i) { o && o({ loaded: f + i, total: l }) } for (var k, q = 0, g = c.length, f = 0, l = 0, m = this, n = 0; n < g; n++) l += c[n].fileSize; this.remove = function() { if (k) { k.abort(); k = null } }; this.uploadNext = function(i) { if (i) { f += c[q - 1].fileSize; p(0) } if ((!i || i && h(i, q == g) == true) && q < g) j(c[q++], e, m.uploadNext, function(r) { p(r) }) }; this.start = function() { m.uploadNext() } }; this.showIframeModal = function(a, c, e, h, o, j) { c = d('<iframe frameborder="0" src="' + c.replace(/{editorRoot}/ig, S) + '" style="width:100%;height:100%;display:none;" /><div class="xheModalIfmWait"></div>'); var p = d(c[0]), k = d(c[1]); b.showModal(a, c, h, o, j); p.load(function() { var q = p[0].contentWindow, g = d(q.document); q.callback = function(f) { b.removeModal(); e(f) }; g.keydown(b.modalEscCheck); p.show(); k.remove() }) }; this.showModal = function(a, c, e, h, o) { if (d(".xheModal").length == 1) return false; var j, p, k, q, g; e = e ? e : b.settings.modalWidth; h = h ? h : b.settings.modalHeight; q = b.settings.layerShadow; j = d('<div class="xheModal" style="width:' + (e - 1) + "px;height:" + h + "px;margin-left:-" + Math.ceil(e / 2) + "px;" + (D && qa <= 7 ? "" : "margin-top:-" + Math.ceil(h / 2) + "px") + '">' + (b.settings.modalTitle ? '<div class="xheModalTitle"><span class="xheModalClose" title="\u5173\u95ed (Esc)"></span>' + a + "</div>" : "") + '<div class="xheModalContent"></div></div>').appendTo("body"); k = d('<div class="xheModalOverlay"></div>').appendTo("body"); if (q > 0) p = d('<div class="xheModalShadow" style="width:' + j.outerWidth() + "px;height:" + j.outerHeight() + "px;margin-left:-" + (Math.ceil(e / 2) - q - 2) + "px;" + (D && qa <= 7 ? "" : "margin-top:-" + (Math.ceil(h / 2) - q - 2) + "px") + '"></div>').appendTo("body"); d(".xheModalContent", j).css("height", h - (b.settings.modalTitle ? d(".xheModalTitle").outerHeight() : 0)).html(c); if (D && qa == 6) g = d("select:visible").css("visibility", "hidden"); this.removeModal = function() { g && g.css("visibility", "visible"); d(document).unbind("keydown", b.modalEscCheck); j.remove(); q > 0 && p.remove(); k.remove(); o && o() }; this.modalEscCheck = function(f) { if (f.which == 27) { b.removeModal(); return false } }; d(document).keydown(b.modalEscCheck); d(".xheModalClose", j).click(b.removeModal); k.show(); q > 0 && p.show(); j.show() }; this.showDialog = function(a) { var c = d('<div class="xheDialog"></div>'); a = d(a); var e = d("#xheSave", a); if (e.length == 1) { a.find("input[type=text],select").keypress(function(j) { if (j.which == 13) { e.click(); return false } }); a.find("textarea").keydown(function(j) { if (j.ctrlKey && j.which == 13) { e.click(); return false } }); e.after(' <input type="button" id="xheCancel" value="\u53d6\u6d88" />'); d("#xheCancel", a).click(b.hidePanel); if (!b.settings.clickCancelDialog) { la = false; var h = d('<div class="xheFixCancel"></div>').appendTo("body").mousedown(function() { return false }), o = O.offset(); h.css({ left: o.left, top: o.top, width: O.outerWidth(), height: O.outerHeight() }) } c.mousedown(function() { ga = true }) } c.append(a); b.showPanel(c); D || setTimeout(function() { c.find("input[type=text],textarea").filter(":visible").filter(function() { return d(this).css("visibility") != "hidden" }).eq(0).focus() }, 10) }; this.clickCancelPanel = function() { la && b.hidePanel() }; this.showPanel = function(a) { if (!L.target) return false; K.empty().append(a).css("left", -999).css("top", -999); ba = d(L.target).closest("a").addClass("xheActive"); var c = ba.offset(); a = c.left; c = c.top; c += ba.outerHeight() - 1; aa.css({ left: a + 1, top: c }).show(); if (a + K.outerWidth() > document.body.clientWidth) a -= K.outerWidth() - ba.outerWidth(); var e = b.settings.layerShadow; e > 0 && $.css({ left: a + e, top: c + e, width: K.outerWidth(), height: K.outerHeight() }).show(); K.css("left", a).css("top", c).show(); va = R = true }; this.hidePanel = function() { if (R) { ba.removeClass("xheActive"); $.hide(); aa.hide(); K.hide(); R = false; if (!la) { d(".xheFixCancel").remove(); la = true } va = ga = false; T = null } }; this.exec = function(a) { b.hidePanel(); b.focus(); b.saveBookmark(); var c = ca[a]; if (!c) return false; if (L == null) { L = {}; var e = J.find(".xheButton[name=" + a + "]"); if (e.length == 1) L.target = e } if (c.e) c.e.call(b); else { a = a.toLowerCase(); switch (a) { case "cut": try { u.execCommand(a); if (!u.queryCommandSupported(a)) throw "Error"; } catch (h) { alert("\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u526a\u5207\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl + X)\u6765\u5b8c\u6210") } break; case "copy": try { u.execCommand(a); if (!u.queryCommandSupported(a)) throw "Error"; } catch (o) { alert("\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u590d\u5236\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl + C)\u6765\u5b8c\u6210") } break; case "paste": try { u.execCommand(a); if (!u.queryCommandSupported(a)) throw "Error"; } catch (j) { alert("\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u7c98\u8d34\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl + V)\u6765\u5b8c\u6210") } break; case "pastetext": window.clipboardData ? b.pasteText(window.clipboardData.getData("Text", true)) : b.showPastetext(); break; case "blocktag": var p = []; d.each(Ra, function(g, f) { p.push({ s: "<" + f.n + ">" + f.t + "</" + f.n + ">", v: "<" + f.n + ">", t: f.t }) }); b.showMenu(p, function(g) { b._exec("formatblock", g) }); break; case "fontface": var k = []; d.each(Sa, function(g, f) { f.c = f.c ? f.c : f.n; k.push({ s: '<span style="font-family:' + f.c + '">' + f.n + "</span>", v: f.c, t: f.n }) }); b.showMenu(k, function(g) { b._exec("fontname", g) }); break; case "fontsize": var q = []; d.each(M, function(g, f) { q.push({ s: '<span style="font-size:' + f.s + ';">' + f.t + "(" + f.s + ")</span>", v: g + 1, t: f.t }) }); b.showMenu(q, function(g) { b._exec("fontsize", g) }); break; case "fontcolor": b.showColor(function(g) { b._exec("forecolor", g) }); break; case "backcolor": b.showColor(function(g) { if (D) b._exec("backcolor", g); else { b.setCSS(true); b._exec("hilitecolor", g); b.setCSS(false) } }); break; case "align": b.showMenu(Ta, function(g) { b._exec(g) }); break; case "list": b.showMenu(Ua, function(g) { b._exec(g) }); break; case "link": b.showLink(); break; case "img": b.showImg(); break; case "flash": b.showEmbed("Flash", '<div>\u52a8\u753b\u6587\u4ef6: <input type="text" id="xheFlashSrc" value="http://" class="xheText" /></div><div>\u5bbd\u5ea6\u9ad8\u5ea6: <input type="text" id="xheFlashWidth" style="width:40px;" value="480" /> x <input type="text" id="xheFlashHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>', "application/x-shockwave-flash", "clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000", ' wmode="opaque" quality="high" menu="false" play="true" loop="true"', b.settings.upFlashUrl, b.settings.upFlashExt); break; case "media": b.showEmbed("Media", '<div>\u5a92\u4f53\u6587\u4ef6: <input type="text" id="xheMediaSrc" value="http://" class="xheText" /></div><div>\u5bbd\u5ea6\u9ad8\u5ea6: <input type="text" id="xheMediaWidth" style="width:40px;" value="480" /> x <input type="text" id="xheMediaHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>', "application/x-mplayer2", "clsid:6bf52a52-394a-11d3-b153-00c04f79faa6", ' enablecontextmenu="false" autostart="false"', b.settings.upMediaUrl, b.settings.upMediaExt); break; case "emot": b.showEmot(); break; case "table": b.showTable(); break; case "source": b.toggleSource(); break; case "print": P.print(); break; case "fullscreen": b.toggleFullscreen(); break; case "about": b.showAbout(); break; default: b._exec(a); break } } L = null }; this._exec = function(a, c, e) { e || b.focus(); return c != undefined ? u.execCommand(a, false, c) : u.execCommand(a, false, null) } }; d(function() { d.fn.oldVal = d.fn.val; d.fn.val = function(A) { var B = this, C; if (A === undefined) return this[0] && (C = this[0].xheditor) ? C.getSource() : B.oldVal(A); return this.each(function() { (C = this.xheditor) ? C.setSource(A) : B.oldVal(A) }) }; d("textarea").each(function() { var A = d(this), B = A.attr("class").match(/(?:^|\s)xheditor(?:\-(m?full|simple|mini))?(?:\s|$)/i); if (B) A.xheditor(B[1] ? { tools: B[1]} : null) }) }) })(jQuery);
//ubb
function ubb2html(f) { function n(h) { return h != null && h != "" ? !isNaN(h) : false } var c = String(f), o = [], l = 0; c = c.replace(/&/ig, "&amp;"); c = c.replace(/[<>]/g, function(h) { return { "<": "&lt;", ">": "&gt;"}[h] }); c = c.replace(/\r?\n/g, "<br />"); c = c.replace(/\[code\s*(?:=\s*([^\]]+?))?\]([\s\S]*?)\[\/code\]/ig, function(h, i, a) { l++; o[l] = h; return "[\tubbcodeplace_" + l + "\t]" }); c = c.replace(/\[(\/?)(b|u|i|s|sup|sub)\]/ig, "<$1$2>"); c = c.replace(/\[color\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig, '<font color="$1">'); c = c.replace(/\[size\s*=\s*(\d+?)\s*\]/ig, '<font size="$1">'); c = c.replace(/\[font\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig, '<font face="$1">'); c = c.replace(/\[\/(color|size|font)\]/ig, "</font>"); c = c.replace(/\[back\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig, '<span style="background-color:$1;">'); c = c.replace(/\[\/back\]/ig, "</span>"); for (f = 0; f < 3; f++) c = c.replace(/\[align\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\](((?!\[align(?:\s+[^\]]+)?\])[\s\S])*?)\[\/align\]/ig, '<p align="$1">$2</p>'); c = c.replace(/\[img\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/img\]/ig, '<img src="$1" alt="" />'); c = c.replace(/\[img\s*=([^,\]]*)(?:\s*,\s*(\d*%?)\s*,\s*(\d*%?)\s*)?(?:,?\s*(\w+))?\s*\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*)?\s*\[\/img\]/ig, function(h, i, a, j, k, d) { h = '<img src="' + d + '" alt="' + i + '"'; k = k ? k : !n(a) ? a : ""; if (n(a)) h += ' width="' + a + '"'; if (n(j)) h += ' height="' + j + '"'; if (k) h += ' align="' + k + '"'; h += " />"; return h }); c = c.replace(/\[emot\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\/\]/ig, '<img emot="$1" />'); c = c.replace(/\[url\]\s*(((?!")[\s\S])*?)(?:"[\s\S]*?)?\s*\[\/url\]/ig, '<a href="$1">$1</a>'); c = c.replace(/\[url\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]\s*([\s\S]*?)\s*\[\/url\]/ig, '<a href="$1">$2</a>'); c = c.replace(/\[email\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/email\]/ig, '<a href="mailto:$1">$1</a>'); c = c.replace(/\[email\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]\s*([\s\S]+?)\s*\[\/email\]/ig, '<a href="mailto:$1">$2</a>'); c = c.replace(/\[quote\]([\s\S]*?)\[\/quote\]/ig, "<blockquote>$1</blockquote>"); c = c.replace(/\[flash\s*(?:=\s*(\d+)\s*,\s*(\d+)\s*)?\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/flash\]/ig, function(h, i, a, j) { i || (i = 480); a || (a = 400); return '<embed type="application/x-shockwave-flash" src="' + j + '" wmode="opaque" quality="high" bgcolor="#ffffff" menu="false" play="true" loop="true" width="' + i + '" height="' + a + '"/>' }); c = c.replace(/\[media\s*(?:=\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+)\s*)?)?\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/media\]/ig, function(h, i, a, j, k) { i || (i = 480); a || (a = 400); return '<embed type="application/x-mplayer2" src="' + k + '" enablecontextmenu="false" autostart="' + (j == "1" ? "true" : "false") + '" width="' + i + '" height="' + a + '"/>' }); c = c.replace(/\[table\s*(?:=\s*(\d{1,4}%?)\s*(?:,\s*([^\]"]+)(?:"[^\]]*?)?)?)?\s*\]/ig, function(h, i, a) { h = "<table"; if (i) h += ' width="' + i + '"'; if (a) h += ' bgcolor="' + a + '"'; return h + ">" }); c = c.replace(/\[tr\s*(?:=\s*([^\]"]+?)(?:"[^\]]*?)?)?\s*\]/ig, function(h, i) { return "<tr" + (i ? ' bgcolor="' + i + '"' : "") + ">" }); c = c.replace(/\[td\s*(?:=\s*(\d{1,2})\s*,\s*(\d{1,2})\s*(?:,\s*(\d{1,4}%?))?)?\s*\]/ig, function(h, i, a, j) { return "<td" + (i > 1 ? ' colspan="' + i + '"' : "") + (a > 1 ? ' rowspan="' + a + '"' : "") + (j ? ' width="' + j + '"' : "") + ">" }); c = c.replace(/\[\/(table|tr|td)\]/ig, "</$1>"); c = c.replace(/\[\*\]((?:(?!\[\*\]|\[\/list\]|\[list\s*(?:=[^\]]+)?\])[\s\S])+)/ig, "<li>$1</li>"); c = c.replace(/\[list\s*(?:=\s*([^\]"]+?)(?:"[^\]]*?)?)?\s*\]/ig, function(h, i) { h = "<ul"; if (i) h += ' type="' + i + '"'; return h + ">" }); c = c.replace(/\[\/list\]/ig, "</ul>"); for (f = 1; f <= l; f++) c = c.replace("[\tubbcodeplace_" + f + "\t]", o[f]); return c = c.replace(/(^|<\/?\w+(?:\s+[^>]*?)?>)([^<$]+)/ig, function(h, i, a) { return i + a.replace(/[\t ]/g, function(j) { return { "\t": "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", " ": "&nbsp;"}[j] }) }) } function html2ubb(f) { function n(d) { var b; if (b = d.match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)) { d = "#"; for (var e = 1; e <= 3; e++) d += (b[e] - 0).toString(16) } return d = d.replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i, "#$1$1$2$2$3$3") } var c = { "xx-small": 1, "8pt": 1, "x-small": 2, "10pt": 2, small: 3, "12pt": 3, medium: 4, "14pt": 4, large: 5, "18pt": 5, "x-large": 6, "24pt": 6, "xx-large": 7, "36pt": 7 }, o = /\s+src\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i, l = /\s+width\s*=\s*(["']?)\s*(\d+(?:\.\d+)?%?)\s*\1(\s|$)/i, h = /\s+height\s*=\s*(["']?)\s*(\d+(?:\.\d+)?%?)\s*\1(\s|$)/i, i = /(?:background|background-color|bgcolor)\s*[:=]\s*(["']?)\s*((rgb\s*\(\s*\d{1,3}%?,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\))|(#[0-9a-f]{3,6})|([a-z]{1,20}))\s*\1/i, a = String(f), j = [], k = 0; a = a.replace(/\s*\r?\n\s*/g, ""); a = a.replace(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig, ""); a = a.replace(/<!--[\s\S]*?--\>/ig, ""); a = a.replace(/<br\s*?\/?>/ig, "\r\n"); a = a.replace(/\[code\s*(=\s*([^\]]+?))?\]([\s\S]*?)\[\/code\]/ig, function(d, b, e) { k++; j[k] = d; return "[\tubbcodeplace_" + k + "\t]" }); a = a.replace(/<(\/?)(b|u|i|s)(\s+[^>]*?)?>/ig, "[$1$2]"); a = a.replace(/<(\/?)strong(\s+[^>]*?)?>/ig, "[$1b]"); a = a.replace(/<(\/?)em(\s+[^>]*?)?>/ig, "[$1i]"); a = a.replace(/<(\/?)(strike|del)(\s+[^>]*?)?>/ig, "[$1s]"); a = a.replace(/<(\/?)(sup|sub)(\s+[^>]*?)?>/ig, "[$1$2]"); for (f = 0; f < 3; f++) a = a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)*\s*(?:font-family|font-size|color|background|background-color)\s*:[^"]*)"(?: [^>]+)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig, function(d, b, e, g) { d = e.match(/(?:^|;)\s*font-family\s*:\s*([^;]+)/i); b = e.match(/(?:^|;)\s*font-size\s*:\s*([^;]+)/i); var m = e.match(/(?:^|;)\s*color\s*:\s*([^;]+)/i); e = e.match(/(?:^|;)\s*(?:background|background-color)\s*:\s*([^;]+)/i); g = g; if (d) g = "[font=" + d[1] + "]" + g + "[/font]"; if (b) if (b = c[b[1].toLowerCase()]) g = "[size=" + b + "]" + g + "[/size]"; if (m) g = "[color=" + n(m[1]) + "]" + g + "[/color]"; if (e) g = "[back=" + n(e[1]) + "]" + g + "[/back]"; return g }); for (f = 0; f < 3; f++) a = a.replace(/<(div|p)(?:\s+[^>]*?)?[\s"';]\s*(?:text-)?align\s*[=:]\s*(["']?)\s*(left|center|right)\s*\2[^>]*>(((?!<\1(\s+[^>]*?)?>)[\s\S])+?)<\/\1>/ig, "[align=$3]$4[/align]"); for (f = 0; f < 3; f++) a = a.replace(/<(center)(?:\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig, "[align=center]$2[/align]"); for (f = 0; f < 3; f++) a = a.replace(/<(p|div)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)*\s*text-align\s*:[^"]*)"(?: [^>]+)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig, function(d, b, e, g) { }); a = a.replace(/<a(?:\s+[^>]*?)?\s+href=(["'])\s*(.+?)\s*\1[^>]*>\s*([\s\S]*?)\s*<\/a>/ig, function(d, b, e, g) { if (!(e && g)) return ""; d = "url"; if (e.match(/^mailto:/i)) { d = "email"; e = e.replace(/mailto:(.+?)/i, "$1") } b = "[" + d; if (e != g) b += "=" + e; return b + "]" + g + "[/" + d + "]" }); a = a.replace(/<img(\s+[^>]*?)\/?>/ig, function(d, b) { if (d = b.match(/\s+emot\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i)) return "[emot=" + d[2] + "/]"; d = b.match(o); var e = b.match(/\s+alt\s*=\s*(["']?)\s*(.*?)\s*\1(\s|$)/i), g = b.match(l), m = b.match(h); b = b.match(/\s+align\s*=\s*(["']?)\s*(\w+)\s*\1(\s|$)/i); var p = "[img", q = ""; if (!d) return ""; q += e[2]; if (g || m) q += "," + (g ? g[2] : "") + "," + (m ? m[2] : ""); if (b) q += "," + b[2]; if (q) p += "=" + q; p += "]" + d[2] + "[/img]"; return p }); a = a.replace(/<blockquote(?:\s+[^>]*?)?>([\s\S]+?)<\/blockquote>/ig, "[quote]$1[/quote]"); a = a.replace(/<embed((?:\s+[^>]*?)?(?:\s+type\s*=\s*"\s*application\/x-shockwave-flash\s*"|\s+classid\s*=\s*"\s*clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000\s*")[^>]*?)\/>/ig, function(d, b) { d = b.match(o); var e = b.match(l); b = b.match(h); var g = "[flash"; if (!d) return ""; if (e && b) g += "=" + e[2] + "," + b[2]; g += "]" + d[2]; return g + "[/flash]" }); a = a.replace(/<embed((?:\s+[^>]*?)?(?:\s+type\s*=\s*"\s*application\/x-mplayer2\s*"|\s+classid\s*=\s*"\s*clsid:6bf52a52-394a-11d3-b153-00c04f79faa6\s*")[^>]*?)\/>/ig, function(d, b) { d = b.match(o); var e = b.match(l), g = b.match(h); b = b.match(/\s+autostart\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i); var m = "[media", p = "0"; if (!d) return ""; if (b) if (b[2] == "true") p = "1"; if (e && g) m += "=" + e[2] + "," + g[2] + "," + p; m += "]" + d[2]; return m + "[/media]" }); a = a.replace(/<table(\s+[^>]*?)?>/ig, function(d, b) { d = "[table"; if (b) { var e = b.match(l); b = b.match(i); if (e) { d += "=" + e[2]; if (b) d += "," + b[2] } } return d + "]" }); a = a.replace(/<tr(\s+[^>]*?)?>/ig, function(d, b) { d = "[tr"; if (b) if (b = b.match(i)) d += "=" + b[2]; return d + "]" }); a = a.replace(/<(?:th|td)(\s+[^>]*?)?>/ig, function(d, b) { d = "[td"; if (b) { var e = b.match(/\s+colspan\s*=\s*(["']?)\s*(\d+)\s*\1(\s|$)/i), g = b.match(/\s+rowspan\s*=\s*(["']?)\s*(\d+)\s*\1(\s|$)/i); b = b.match(l); e = e ? e[2] : 1; g = g ? g[2] : 1; if (e > 1 || g > 1 || b) d += "=" + e + "," + g; if (b) d += "," + b[2] } return d + "]" }); a = a.replace(/<\/(table|tr)>/ig, "[/$1]"); a = a.replace(/<\/(th|td)>/ig, "[/td]"); a = a.replace(/<ul(\s+[^>]*?)?>/ig, function(d, b) { var e; if (b) e = b.match(/\s+type\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i); return "[list" + (e ? "=" + e[2] : "") + "]" }); a = a.replace(/<ol(\s+[^>]*?)?>/ig, "[list=1]"); a = a.replace(/<li(\s+[^>]*?)?>/ig, "[*]"); a = a.replace(/<\/li>/ig, ""); a = a.replace(/<\/(ul|ol)>/ig, "[/list]"); a = a.replace(/<h([1-6])(\s+[^>]*?)?>/ig, function(d, b) { return "\r\n\r\n[size=" + (7 - b) + "][b]" }); a = a.replace(/<\/h[1-6]>/ig, "[/b][/size]\r\n\r\n"); a = a.replace(/<address(\s+[^>]*?)?>/ig, "\r\n[i]"); a = a.replace(/<\/address>/ig, "[i]\r\n"); for (f = 0; f < 3; f++) a = a.replace(/<(p)(?:\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig, "\r\n\r\n$2\r\n\r\n"); for (f = 0; f < 3; f++) a = a.replace(/<(div)(?:\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig, "\r\n$2\r\n"); a = a.replace(/((\s|&nbsp;)*\r?\n){3,}/g, "\r\n\r\n"); a = a.replace(/^((\s|&nbsp;)*\r?\n)+/g, ""); a = a.replace(/((\s|&nbsp;)*\r?\n)+$/g, ""); for (f = 1; f <= k; f++) a = a.replace("[\tubbcodeplace_" + f + "\t]", j[f]); a = a.replace(/<[^<>]+?>/g, ""); a = a.replace(/&lt;/ig, "<"); a = a.replace(/&gt;/ig, ">"); a = a.replace(/&nbsp;/ig, " "); return a = a.replace(/&amp;/ig, "&") };
//datepicker 1.8.2
(function($) { $.extend($.ui, { datepicker: { version: "1.8.2"} }); var PROP_NAME = 'datepicker'; var dpuuid = new Date().getTime(); function Datepicker() { this.debug = false; this._curInst = null; this._keyEvent = false; this._disabledInputs = []; this._datepickerShowing = false; this._inDialog = false; this._mainDivId = 'ui-datepicker-div'; this._inlineClass = 'ui-datepicker-inline'; this._appendClass = 'ui-datepicker-append'; this._triggerClass = 'ui-datepicker-trigger'; this._dialogClass = 'ui-datepicker-dialog'; this._disableClass = 'ui-datepicker-disabled'; this._unselectableClass = 'ui-datepicker-unselectable'; this._currentClass = 'ui-datepicker-current-day'; this._dayOverClass = 'ui-datepicker-days-cell-over'; this.regional = []; this.regional[''] = { closeText: '关闭', prevText: '上个月', nextText: '下个月', currentText: '今天', monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], monthNamesShort: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'], dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'], weekHeader: '周', dateFormat: 'yy-mm-dd', firstDay: 1, isRTL: false, showMonthAfterYear: true, yearSuffix: '年' }; this._defaults = { showOn: 'focus', showAnim: 'fadeIn', showOptions: {}, defaultDate: null, appendText: '', buttonText: '...', buttonImage: '', buttonImageOnly: false, hideIfNoPrevNext: false, navigationAsDateFormat: false, gotoCurrent: false, changeMonth: false, changeYear: false, yearRange: 'c-10:c+10', showOtherMonths: false, selectOtherMonths: false, showWeek: false, calculateWeek: this.iso8601Week, shortYearCutoff: '+10', minDate: null, maxDate: null, duration: 'fast', beforeShowDay: null, beforeShow: null, onSelect: null, onChangeMonthYear: null, onClose: null, numberOfMonths: 1, showCurrentAtPos: 0, stepMonths: 1, stepBigMonths: 12, altField: '', altFormat: '', constrainInput: true, showButtonPanel: true, autoSize: false }; $.extend(this._defaults, this.regional['']); this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>'); } $.extend(Datepicker.prototype, { markerClassName: 'hasDatepicker', log: function() { if (this.debug) console.log.apply('', arguments); }, _widgetDatepicker: function() { return this.dpDiv; }, setDefaults: function(settings) { extendRemove(this._defaults, settings || {}); return this; }, _attachDatepicker: function(target, settings) { var inlineSettings = null; for (var attrName in this._defaults) { var attrValue = target.getAttribute('date:' + attrName); if (attrValue) { inlineSettings = inlineSettings || {}; try { inlineSettings[attrName] = eval(attrValue); } catch (err) { inlineSettings[attrName] = attrValue; } } } var nodeName = target.nodeName.toLowerCase(); var inline = (nodeName == 'div' || nodeName == 'span'); if (!target.id) { this.uuid += 1; target.id = 'dp' + this.uuid; } var inst = this._newInst($(target), inline); inst.settings = $.extend({}, settings || {}, inlineSettings || {}); if (nodeName == 'input') { this._connectDatepicker(target, inst); } else if (inline) { this._inlineDatepicker(target, inst); } }, _newInst: function(target, inline) { var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1'); return { id: id, input: target, selectedDay: 0, selectedMonth: 0, selectedYear: 0, drawMonth: 0, drawYear: 0, inline: inline, dpDiv: (!inline ? this.dpDiv : $('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')) }; }, _connectDatepicker: function(target, inst) { var input = $(target); inst.append = $([]); inst.trigger = $([]); if (input.hasClass(this.markerClassName)) return; this._attachments(input, inst); input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker", function(event, key, value) { inst.settings[key] = value; }).bind("getData.datepicker", function(event, key) { return this._get(inst, key); }); this._autoSize(inst); $.data(target, PROP_NAME, inst); }, _attachments: function(input, inst) { var appendText = this._get(inst, 'appendText'); var isRTL = this._get(inst, 'isRTL'); if (inst.append) inst.append.remove(); if (appendText) { inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>'); input[isRTL ? 'before' : 'after'](inst.append); } input.unbind('focus', this._showDatepicker); if (inst.trigger) inst.trigger.remove(); var showOn = this._get(inst, 'showOn'); if (showOn == 'focus' || showOn == 'both') input.focus(this._showDatepicker); if (showOn == 'button' || showOn == 'both') { var buttonText = this._get(inst, 'buttonText'); var buttonImage = this._get(inst, 'buttonImage'); inst.trigger = $(this._get(inst, 'buttonImageOnly') ? $('<img/>').addClass(this._triggerClass).attr({ src: buttonImage, alt: buttonText, title: buttonText }) : $('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage == '' ? buttonText : $('<img/>').attr({ src: buttonImage, alt: buttonText, title: buttonText }))); input[isRTL ? 'before' : 'after'](inst.trigger); inst.trigger.click(function() { if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0]) $.datepicker._hideDatepicker(); else $.datepicker._showDatepicker(input[0]); return false; }); } }, _autoSize: function(inst) { if (this._get(inst, 'autoSize') && !inst.inline) { var date = new Date(2009, 12 - 1, 20); var dateFormat = this._get(inst, 'dateFormat'); if (dateFormat.match(/[DM]/)) { var findMax = function(names) { var max = 0; var maxI = 0; for (var i = 0; i < names.length; i++) { if (names[i].length > max) { max = names[i].length; maxI = i; } } return maxI; }; date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ? 'monthNames' : 'monthNamesShort')))); date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ? 'dayNames' : 'dayNamesShort'))) + 20 - date.getDay()); } inst.input.attr('size', this._formatDate(inst, date).length); } }, _inlineDatepicker: function(target, inst) { var divSpan = $(target); if (divSpan.hasClass(this.markerClassName)) return; divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker", function(event, key, value) { inst.settings[key] = value; }).bind("getData.datepicker", function(event, key) { return this._get(inst, key); }); $.data(target, PROP_NAME, inst); this._setDate(inst, this._getDefaultDate(inst), true); this._updateDatepicker(inst); this._updateAlternate(inst); }, _dialogDatepicker: function(input, date, onSelect, settings, pos) { var inst = this._dialogInst; if (!inst) { this.uuid += 1; var id = 'dp' + this.uuid; this._dialogInput = $('<input type="text" id="' + id + '" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>'); this._dialogInput.keydown(this._doKeyDown); $('body').append(this._dialogInput); inst = this._dialogInst = this._newInst(this._dialogInput, false); inst.settings = {}; $.data(this._dialogInput[0], PROP_NAME, inst); } extendRemove(inst.settings, settings || {}); date = (date && date.constructor == Date ? this._formatDate(inst, date) : date); this._dialogInput.val(date); this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null); if (!this._pos) { var browserWidth = document.documentElement.clientWidth; var browserHeight = document.documentElement.clientHeight; var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; var scrollY = document.documentElement.scrollTop || document.body.scrollTop; this._pos = [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY]; } this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px'); inst.settings.onSelect = onSelect; this._inDialog = true; this.dpDiv.addClass(this._dialogClass); this._showDatepicker(this._dialogInput[0]); if ($.blockUI) $.blockUI(this.dpDiv); $.data(this._dialogInput[0], PROP_NAME, inst); return this; }, _destroyDatepicker: function(target) { var $target = $(target); var inst = $.data(target, PROP_NAME); if (!$target.hasClass(this.markerClassName)) { return; } var nodeName = target.nodeName.toLowerCase(); $.removeData(target, PROP_NAME); if (nodeName == 'input') { inst.append.remove(); inst.trigger.remove(); $target.removeClass(this.markerClassName).unbind('focus', this._showDatepicker).unbind('keydown', this._doKeyDown).unbind('keypress', this._doKeyPress).unbind('keyup', this._doKeyUp); } else if (nodeName == 'div' || nodeName == 'span') $target.removeClass(this.markerClassName).empty(); }, _enableDatepicker: function(target) { var $target = $(target); var inst = $.data(target, PROP_NAME); if (!$target.hasClass(this.markerClassName)) { return; } var nodeName = target.nodeName.toLowerCase(); if (nodeName == 'input') { target.disabled = false; inst.trigger.filter('button').each(function() { this.disabled = false; }).end().filter('img').css({ opacity: '1.0', cursor: '' }); } else if (nodeName == 'div' || nodeName == 'span') { var inline = $target.children('.' + this._inlineClass); inline.children().removeClass('ui-state-disabled'); } this._disabledInputs = $.map(this._disabledInputs, function(value) { return (value == target ? null : value); }); }, _disableDatepicker: function(target) { var $target = $(target); var inst = $.data(target, PROP_NAME); if (!$target.hasClass(this.markerClassName)) { return; } var nodeName = target.nodeName.toLowerCase(); if (nodeName == 'input') { target.disabled = true; inst.trigger.filter('button').each(function() { this.disabled = true; }).end().filter('img').css({ opacity: '0.5', cursor: 'default' }); } else if (nodeName == 'div' || nodeName == 'span') { var inline = $target.children('.' + this._inlineClass); inline.children().addClass('ui-state-disabled'); } this._disabledInputs = $.map(this._disabledInputs, function(value) { return (value == target ? null : value); }); this._disabledInputs[this._disabledInputs.length] = target; }, _isDisabledDatepicker: function(target) { if (!target) { return false; } for (var i = 0; i < this._disabledInputs.length; i++) { if (this._disabledInputs[i] == target) return true; } return false; }, _getInst: function(target) { try { return $.data(target, PROP_NAME); } catch (err) { throw 'Missing instance data for this datepicker'; } }, _optionDatepicker: function(target, name, value) { var inst = this._getInst(target); if (arguments.length == 2 && typeof name == 'string') { return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) : (inst ? (name == 'all' ? $.extend({}, inst.settings) : this._get(inst, name)) : null)); } var settings = name || {}; if (typeof name == 'string') { settings = {}; settings[name] = value; } if (inst) { if (this._curInst == inst) { this._hideDatepicker(); } var date = this._getDateDatepicker(target, true); extendRemove(inst.settings, settings); this._attachments($(target), inst); this._autoSize(inst); this._setDateDatepicker(target, date); this._updateDatepicker(inst); } }, _changeDatepicker: function(target, name, value) { this._optionDatepicker(target, name, value); }, _refreshDatepicker: function(target) { var inst = this._getInst(target); if (inst) { this._updateDatepicker(inst); } }, _setDateDatepicker: function(target, date) { var inst = this._getInst(target); if (inst) { this._setDate(inst, date); this._updateDatepicker(inst); this._updateAlternate(inst); } }, _getDateDatepicker: function(target, noDefault) { var inst = this._getInst(target); if (inst && !inst.inline) this._setDateFromField(inst, noDefault); return (inst ? this._getDate(inst) : null); }, _doKeyDown: function(event) { var inst = $.datepicker._getInst(event.target); var handled = true; var isRTL = inst.dpDiv.is('.ui-datepicker-rtl'); inst._keyEvent = true; if ($.datepicker._datepickerShowing) switch (event.keyCode) { case 9: $.datepicker._hideDatepicker(); handled = false; break; case 13: var sel = $('td.' + $.datepicker._dayOverClass, inst.dpDiv).add($('td.' + $.datepicker._currentClass, inst.dpDiv)); if (sel[0]) $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]); else $.datepicker._hideDatepicker(); return false; break; case 27: $.datepicker._hideDatepicker(); break; case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ? -$.datepicker._get(inst, 'stepBigMonths') : -$.datepicker._get(inst, 'stepMonths')), 'M'); break; case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ? +$.datepicker._get(inst, 'stepBigMonths') : +$.datepicker._get(inst, 'stepMonths')), 'M'); break; case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target); handled = event.ctrlKey || event.metaKey; break; case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target); handled = event.ctrlKey || event.metaKey; break; case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D'); handled = event.ctrlKey || event.metaKey; if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? -$.datepicker._get(inst, 'stepBigMonths') : -$.datepicker._get(inst, 'stepMonths')), 'M'); break; case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D'); handled = event.ctrlKey || event.metaKey; break; case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D'); handled = event.ctrlKey || event.metaKey; if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ? +$.datepicker._get(inst, 'stepBigMonths') : +$.datepicker._get(inst, 'stepMonths')), 'M'); break; case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D'); handled = event.ctrlKey || event.metaKey; break; default: handled = false; } else if (event.keyCode == 36 && event.ctrlKey) $.datepicker._showDatepicker(this); else { handled = false; } if (handled) { event.preventDefault(); event.stopPropagation(); } }, _doKeyPress: function(event) { var inst = $.datepicker._getInst(event.target); if ($.datepicker._get(inst, 'constrainInput')) { var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')); var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode); return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1); } }, _doKeyUp: function(event) { var inst = $.datepicker._getInst(event.target); if (inst.input.val() != inst.lastVal) { try { var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), (inst.input ? inst.input.val() : null), $.datepicker._getFormatConfig(inst)); if (date) { $.datepicker._setDateFromField(inst); $.datepicker._updateAlternate(inst); $.datepicker._updateDatepicker(inst); } } catch (event) { $.datepicker.log(event); } } return true; }, _showDatepicker: function(input) { input = input.target || input; if (input.nodeName.toLowerCase() != 'input') input = $('input', input.parentNode)[0]; if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) return; var inst = $.datepicker._getInst(input); if ($.datepicker._curInst && $.datepicker._curInst != inst) { $.datepicker._curInst.dpDiv.stop(true, true); } var beforeShow = $.datepicker._get(inst, 'beforeShow'); extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {})); inst.lastVal = null; $.datepicker._lastInput = input; $.datepicker._setDateFromField(inst); if ($.datepicker._inDialog) input.value = ''; if (!$.datepicker._pos) { $.datepicker._pos = $.datepicker._findPos(input); $.datepicker._pos[1] += input.offsetHeight; } var isFixed = false; $(input).parents().each(function() { isFixed |= $(this).css('position') == 'fixed'; return !isFixed; }); if (isFixed && $.browser.opera) { $.datepicker._pos[0] -= document.documentElement.scrollLeft; $.datepicker._pos[1] -= document.documentElement.scrollTop; } var offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] }; $.datepicker._pos = null; inst.dpDiv.css({ position: 'absolute', display: 'block', top: '-1000px' }); $.datepicker._updateDatepicker(inst); offset = $.datepicker._checkOffset(inst, offset, isFixed); inst.dpDiv.css({ position: ($.datepicker._inDialog && $.blockUI ? 'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none', left: offset.left + 'px', top: offset.top + 'px' }); if (!inst.inline) { var showAnim = $.datepicker._get(inst, 'showAnim'); var duration = $.datepicker._get(inst, 'duration'); var postProcess = function() { $.datepicker._datepickerShowing = true; var borders = $.datepicker._getBorders(inst.dpDiv); inst.dpDiv.find('iframe.ui-datepicker-cover').css({ left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight() }); }; inst.dpDiv.zIndex($(input).zIndex() + 1); if ($.effects && $.effects[showAnim]) inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); else inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess); if (!showAnim || !duration) postProcess(); if (inst.input.is(':visible') && !inst.input.is(':disabled')) inst.input.focus(); $.datepicker._curInst = inst; } }, _updateDatepicker: function(inst) { var self = this; var borders = $.datepicker._getBorders(inst.dpDiv); inst.dpDiv.empty().append(this._generateHTML(inst)).find('iframe.ui-datepicker-cover').css({ left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight() }).end().find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a').bind('mouseout', function() { $(this).removeClass('ui-state-hover'); if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover'); }).bind('mouseover', function() { if (!self._isDisabledDatepicker(inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) { $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); $(this).addClass('ui-state-hover'); if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover'); if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover'); } }).end().find('.' + this._dayOverClass + ' a').trigger('mouseover').end(); var numMonths = this._getNumberOfMonths(inst); var cols = numMonths[1]; var width = 17; if (cols > 1) inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em'); else inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width(''); inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') + 'Class']('ui-datepicker-multi'); inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') + 'Class']('ui-datepicker-rtl'); if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input && inst.input.is(':visible') && !inst.input.is(':disabled')) inst.input.focus(); }, _getBorders: function(elem) { var convert = function(value) { return { thin: 1, medium: 2, thick: 3}[value] || value; }; return [parseFloat(convert(elem.css('border-left-width'))), parseFloat(convert(elem.css('border-top-width')))]; }, _checkOffset: function(inst, offset, isFixed) { var dpWidth = inst.dpDiv.outerWidth(); var dpHeight = inst.dpDiv.outerHeight(); var inputWidth = inst.input ? inst.input.outerWidth() : 0; var inputHeight = inst.input ? inst.input.outerHeight() : 0; var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft(); var viewHeight = document.documentElement.clientHeight + $(document).scrollTop(); offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0; offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0); offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(dpHeight + inputHeight) : 0); return offset; }, _findPos: function(obj) { var inst = this._getInst(obj); var isRTL = this._get(inst, 'isRTL'); while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) { obj = obj[isRTL ? 'previousSibling' : 'nextSibling']; } var position = $(obj).offset(); return [position.left, position.top]; }, _hideDatepicker: function(input) { var inst = this._curInst; if (!inst || (input && inst != $.data(input, PROP_NAME))) return; if (this._datepickerShowing) { var showAnim = this._get(inst, 'showAnim'); var duration = this._get(inst, 'duration'); var postProcess = function() { $.datepicker._tidyDialog(inst); this._curInst = null; }; if ($.effects && $.effects[showAnim]) inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); else inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' : (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess); if (!showAnim) postProcess(); var onClose = this._get(inst, 'onClose'); if (onClose) onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ''), inst]); this._datepickerShowing = false; this._lastInput = null; if (this._inDialog) { this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' }); if ($.blockUI) { $.unblockUI(); $('body').append(this.dpDiv); } } this._inDialog = false; } }, _tidyDialog: function(inst) { inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar'); }, _checkExternalClick: function(event) { if (!$.datepicker._curInst) return; var $target = $(event.target); if ($target[0].id != $.datepicker._mainDivId && $target.parents('#' + $.datepicker._mainDivId).length == 0 && !$target.hasClass($.datepicker.markerClassName) && !$target.hasClass($.datepicker._triggerClass) && $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI)) $.datepicker._hideDatepicker(); }, _adjustDate: function(id, offset, period) { var target = $(id); var inst = this._getInst(target[0]); if (this._isDisabledDatepicker(target[0])) { return; } this._adjustInstDate(inst, offset + (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), period); this._updateDatepicker(inst); }, _gotoToday: function(id) { var target = $(id); var inst = this._getInst(target[0]); if (this._get(inst, 'gotoCurrent') && inst.currentDay) { inst.selectedDay = inst.currentDay; inst.drawMonth = inst.selectedMonth = inst.currentMonth; inst.drawYear = inst.selectedYear = inst.currentYear; } else { var date = new Date(); inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear(); } this._notifyChange(inst); this._adjustDate(target); }, _selectMonthYear: function(id, select, period) { var target = $(id); var inst = this._getInst(target[0]); inst._selectingMonthYear = false; inst['selected' + (period == 'M' ? 'Month' : 'Year')] = inst['draw' + (period == 'M' ? 'Month' : 'Year')] = parseInt(select.options[select.selectedIndex].value, 10); this._notifyChange(inst); this._adjustDate(target); }, _clickMonthYear: function(id) { var target = $(id); var inst = this._getInst(target[0]); if (inst.input && inst._selectingMonthYear && !$.browser.msie) inst.input.focus(); inst._selectingMonthYear = !inst._selectingMonthYear; }, _selectDay: function(id, month, year, td) { var target = $(id); if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) { return; } var inst = this._getInst(target[0]); inst.selectedDay = inst.currentDay = $('a', td).html(); inst.selectedMonth = inst.currentMonth = month; inst.selectedYear = inst.currentYear = year; this._selectDate(id, this._formatDate(inst, inst.currentDay, inst.currentMonth, inst.currentYear)); }, _clearDate: function(id) { var target = $(id); var inst = this._getInst(target[0]); this._selectDate(target, ''); }, _selectDate: function(id, dateStr) { var target = $(id); var inst = this._getInst(target[0]); dateStr = (dateStr != null ? dateStr : this._formatDate(inst)); if (inst.input) inst.input.val(dateStr); this._updateAlternate(inst); var onSelect = this._get(inst, 'onSelect'); if (onSelect) onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); else if (inst.input) inst.input.trigger('change'); if (inst.inline) this._updateDatepicker(inst); else { this._hideDatepicker(); this._lastInput = inst.input[0]; if (typeof (inst.input[0]) != 'object') inst.input.focus(); this._lastInput = null; } }, _updateAlternate: function(inst) { var altField = this._get(inst, 'altField'); if (altField) { var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat'); var date = this._getDate(inst); var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst)); $(altField).each(function() { $(this).val(dateStr); }); } }, noWeekends: function(date) { var day = date.getDay(); return [(day > 0 && day < 6), '']; }, iso8601Week: function(date) { var checkDate = new Date(date.getTime()); checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); var time = checkDate.getTime(); checkDate.setMonth(0); checkDate.setDate(1); return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1; }, parseDate: function(format, value, settings) { if (format == null || value == null) throw 'Invalid arguments'; value = (typeof value == 'object' ? value.toString() : value + ''); if (value == '') return null; var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff; var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; var year = -1; var month = -1; var day = -1; var doy = -1; var literal = false; var lookAhead = function(match) { var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); if (matches) iFormat++; return matches; }; var getNumber = function(match) { lookAhead(match); var size = (match == '@' ? 14 : (match == '!' ? 20 : (match == 'y' ? 4 : (match == 'o' ? 3 : 2)))); var digits = new RegExp('^\\d{1,' + size + '}'); var num = value.substring(iValue).match(digits); if (!num) throw 'Missing number at position ' + iValue; iValue += num[0].length; return parseInt(num[0], 10); }; var getName = function(match, shortNames, longNames) { var names = (lookAhead(match) ? longNames : shortNames); for (var i = 0; i < names.length; i++) { if (value.substr(iValue, names[i].length) == names[i]) { iValue += names[i].length; return i + 1; } } throw 'Unknown name at position ' + iValue; }; var checkLiteral = function() { if (value.charAt(iValue) != format.charAt(iFormat)) throw 'Unexpected literal at position ' + iValue; iValue++; }; var iValue = 0; for (var iFormat = 0; iFormat < format.length; iFormat++) { if (literal) if (format.charAt(iFormat) == "'" && !lookAhead("'")) literal = false; else checkLiteral(); else switch (format.charAt(iFormat)) { case 'd': day = getNumber('d'); break; case 'D': getName('D', dayNamesShort, dayNames); break; case 'o': doy = getNumber('o'); break; case 'm': month = getNumber('m'); break; case 'M': month = getName('M', monthNamesShort, monthNames); break; case 'y': year = getNumber('y'); break; case '@': var date = new Date(getNumber('@')); year = date.getFullYear(); month = date.getMonth() + 1; day = date.getDate(); break; case '!': var date = new Date((getNumber('!') - this._ticksTo1970) / 10000); year = date.getFullYear(); month = date.getMonth() + 1; day = date.getDate(); break; case "'": if (lookAhead("'")) checkLiteral(); else literal = true; break; default: checkLiteral(); } } if (year == -1) year = new Date().getFullYear(); else if (year < 100) year += new Date().getFullYear() - new Date().getFullYear() % 100 + (year <= shortYearCutoff ? 0 : -100); if (doy > -1) { month = 1; day = doy; do { var dim = this._getDaysInMonth(year, month - 1); if (day <= dim) break; month++; day -= dim; } while (true); } var date = this._daylightSavingAdjust(new Date(year, month - 1, day)); if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) throw 'Invalid date'; return date; }, ATOM: 'yy-mm-dd', COOKIE: 'D, dd M yy', ISO_8601: 'yy-mm-dd', RFC_822: 'D, d M y', RFC_850: 'DD, dd-M-y', RFC_1036: 'D, d M y', RFC_1123: 'D, d M yy', RFC_2822: 'D, d M yy', RSS: 'D, d M y', TICKS: '!', TIMESTAMP: '@', W3C: 'yy-mm-dd', _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) + Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000), formatDate: function(format, date, settings) { if (!date) return ''; var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort; var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames; var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort; var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames; var lookAhead = function(match) { var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); if (matches) iFormat++; return matches; }; var formatNumber = function(match, value, len) { var num = '' + value; if (lookAhead(match)) while (num.length < len) num = '0' + num; return num; }; var formatName = function(match, value, shortNames, longNames) { return (lookAhead(match) ? longNames[value] : shortNames[value]); }; var output = ''; var literal = false; if (date) for (var iFormat = 0; iFormat < format.length; iFormat++) { if (literal) if (format.charAt(iFormat) == "'" && !lookAhead("'")) literal = false; else output += format.charAt(iFormat); else switch (format.charAt(iFormat)) { case 'd': output += formatNumber('d', date.getDate(), 2); break; case 'D': output += formatName('D', date.getDay(), dayNamesShort, dayNames); break; case 'o': output += formatNumber('o', (date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3); break; case 'm': output += formatNumber('m', date.getMonth() + 1, 2); break; case 'M': output += formatName('M', date.getMonth(), monthNamesShort, monthNames); break; case 'y': output += (lookAhead('y') ? date.getFullYear() : (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); break; case '@': output += date.getTime(); break; case '!': output += date.getTime() * 10000 + this._ticksTo1970; break; case "'": if (lookAhead("'")) output += "'"; else literal = true; break; default: output += format.charAt(iFormat); } } return output; }, _possibleChars: function(format) { var chars = ''; var literal = false; var lookAhead = function(match) { var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); if (matches) iFormat++; return matches; }; for (var iFormat = 0; iFormat < format.length; iFormat++) if (literal) if (format.charAt(iFormat) == "'" && !lookAhead("'")) literal = false; else chars += format.charAt(iFormat); else switch (format.charAt(iFormat)) { case 'd': case 'm': case 'y': case '@': chars += '0123456789'; break; case 'D': case 'M': return null; case "'": if (lookAhead("'")) chars += "'"; else literal = true; break; default: chars += format.charAt(iFormat); } return chars; }, _get: function(inst, name) { return inst.settings[name] !== undefined ? inst.settings[name] : this._defaults[name]; }, _setDateFromField: function(inst, noDefault) { if (inst.input.val() == inst.lastVal) { return; } var dateFormat = this._get(inst, 'dateFormat'); var dates = inst.lastVal = inst.input ? inst.input.val() : null; var date, defaultDate; date = defaultDate = this._getDefaultDate(inst); var settings = this._getFormatConfig(inst); try { date = this.parseDate(dateFormat, dates, settings) || defaultDate; } catch (event) { this.log(event); dates = (noDefault ? '' : dates); } inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear(); inst.currentDay = (dates ? date.getDate() : 0); inst.currentMonth = (dates ? date.getMonth() : 0); inst.currentYear = (dates ? date.getFullYear() : 0); this._adjustInstDate(inst); }, _getDefaultDate: function(inst) { return this._restrictMinMax(inst, this._determineDate(inst, this._get(inst, 'defaultDate'), new Date())); }, _determineDate: function(inst, date, defaultDate) { var offsetNumeric = function(offset) { var date = new Date(); date.setDate(date.getDate() + offset); return date; }; var offsetString = function(offset) { try { return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'), offset, $.datepicker._getFormatConfig(inst)); } catch (e) { } var date = (offset.toLowerCase().match(/^c/) ? $.datepicker._getDate(inst) : null) || new Date(); var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g; var matches = pattern.exec(offset); while (matches) { switch (matches[2] || 'd') { case 'd': case 'D': day += parseInt(matches[1], 10); break; case 'w': case 'W': day += parseInt(matches[1], 10) * 7; break; case 'm': case 'M': month += parseInt(matches[1], 10); day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); break; case 'y': case 'Y': year += parseInt(matches[1], 10); day = Math.min(day, $.datepicker._getDaysInMonth(year, month)); break; } matches = pattern.exec(offset); } return new Date(year, month, day); }; date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date) : (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date))); date = (date && date.toString() == 'Invalid Date' ? defaultDate : date); if (date) { date.setHours(0); date.setMinutes(0); date.setSeconds(0); date.setMilliseconds(0); } return this._daylightSavingAdjust(date); }, _daylightSavingAdjust: function(date) { if (!date) return null; date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0); return date; }, _setDate: function(inst, date, noChange) { var clear = !(date); var origMonth = inst.selectedMonth; var origYear = inst.selectedYear; date = this._restrictMinMax(inst, this._determineDate(inst, date, new Date())); inst.selectedDay = inst.currentDay = date.getDate(); inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth(); inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear(); if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange) this._notifyChange(inst); this._adjustInstDate(inst); if (inst.input) { inst.input.val(clear ? '' : this._formatDate(inst)); } }, _getDate: function(inst) { var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null : this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); return startDate; }, _generateHTML: function(inst) { var today = new Date(); today = this._daylightSavingAdjust(new Date(today.getFullYear(), today.getMonth(), today.getDate())); var isRTL = this._get(inst, 'isRTL'); var showButtonPanel = this._get(inst, 'showButtonPanel'); var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); var numMonths = this._getNumberOfMonths(inst); var showCurrentAtPos = this._get(inst, 'showCurrentAtPos'); var stepMonths = this._get(inst, 'stepMonths'); var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) : new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); var minDate = this._getMinMaxDate(inst, 'min'); var maxDate = this._getMinMaxDate(inst, 'max'); var drawMonth = inst.drawMonth - showCurrentAtPos; var drawYear = inst.drawYear; if (drawMonth < 0) { drawMonth += 12; drawYear--; } if (maxDate) { var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(), maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate())); maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw); while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) { drawMonth--; if (drawMonth < 0) { drawMonth = 11; drawYear--; } } } inst.drawMonth = drawMonth; inst.drawYear = drawYear; var prevText = this._get(inst, 'prevText'); prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText, this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst))); var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? '<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_' + dpuuid + '.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' + ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + (isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' : (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + (isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>')); var nextText = this._get(inst, 'nextText'); nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText, this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst))); var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? '<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_' + dpuuid + '.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' + ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + (isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' : (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + (isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>')); var currentText = this._get(inst, 'currentText'); var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid + '.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : ''); var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') + (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid + '.datepicker._gotoToday(\'#' + inst.id + '\');"' + '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : ''; var firstDay = parseInt(this._get(inst, 'firstDay'), 10); firstDay = (isNaN(firstDay) ? 0 : firstDay); var showWeek = this._get(inst, 'showWeek'); var dayNames = this._get(inst, 'dayNames'); var dayNamesShort = this._get(inst, 'dayNamesShort'); var dayNamesMin = this._get(inst, 'dayNamesMin'); var monthNames = this._get(inst, 'monthNames'); var monthNamesShort = this._get(inst, 'monthNamesShort'); var beforeShowDay = this._get(inst, 'beforeShowDay'); var showOtherMonths = this._get(inst, 'showOtherMonths'); var selectOtherMonths = this._get(inst, 'selectOtherMonths'); var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week; var defaultDate = this._getDefaultDate(inst); var html = ''; for (var row = 0; row < numMonths[0]; row++) { var group = ''; for (var col = 0; col < numMonths[1]; col++) { var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay)); var cornerClass = ' ui-corner-all'; var calender = ''; if (isMultiMonth) { calender += '<div class="ui-datepicker-group'; if (numMonths[1] > 1) switch (col) { case 0: calender += ' ui-datepicker-group-first'; cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break; case numMonths[1] - 1: calender += ' ui-datepicker-group-last'; cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break; default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break; } calender += '">'; } calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' + (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') + (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, row > 0 || col > 0, monthNames, monthNamesShort) + '</div><table class="ui-datepicker-calendar"><thead>' + '<tr>'; var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : ''); for (var dow = 0; dow < 7; dow++) { var day = (dow + firstDay) % 7; thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' + '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>'; } calender += thead + '</tr></thead><tbody>'; var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth) inst.selectedDay = Math.min(inst.selectedDay, daysInMonth); var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7; var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); for (var dRow = 0; dRow < numRows; dRow++) { calender += '<tr>'; var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' + this._get(inst, 'calculateWeek')(printDate) + '</td>'); for (var dow = 0; dow < 7; dow++) { var daySettings = (beforeShowDay ? beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); var otherMonth = (printDate.getMonth() != drawMonth); var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] || (minDate && printDate < minDate) || (maxDate && printDate > maxDate); tbody += '<td class="' + ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + (otherMonth ? ' ui-datepicker-other-month' : '') + ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ? ' ' + this._dayOverClass : '') + (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled' : '') + (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + (unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' + inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + (otherMonth && !showOtherMonths ? '&#xa0;' : (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' + (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') + (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + (otherMonth ? ' ui-priority-secondary' : '') + '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; printDate.setDate(printDate.getDate() + 1); printDate = this._daylightSavingAdjust(printDate); } calender += tbody + '</tr>'; } drawMonth++; if (drawMonth > 11) { drawMonth = 0; drawYear++; } calender += '</tbody></table>' + (isMultiMonth ? '</div>' + ((numMonths[0] > 0 && col == numMonths[1] - 1) ? '<div class="ui-datepicker-row-break"></div>' : '') : ''); group += calender; } html += group; } html += buttonPanel + ($.browser.msie && parseInt($.browser.version, 10) < 7 && !inst.inline ? '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : ''); inst._keyEvent = false; return html; }, _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, secondary, monthNames, monthNamesShort) { var changeMonth = this._get(inst, 'changeMonth'); var changeYear = this._get(inst, 'changeYear'); var showMonthAfterYear = this._get(inst, 'showMonthAfterYear'); var html = '<div class="ui-datepicker-title">'; var monthHtml = ''; if (secondary || !changeMonth) monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>'; else { var inMinYear = (minDate && minDate.getFullYear() == drawYear); var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear); monthHtml += '<select class="ui-datepicker-month" ' + 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' + 'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' + '>'; for (var month = 0; month < 12; month++) { if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) monthHtml += '<option value="' + month + '"' + (month == drawMonth ? ' selected="selected"' : '') + '>' + monthNamesShort[month] + '</option>'; } monthHtml += '</select>'; } if (!showMonthAfterYear) html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : ''); if (secondary || !changeYear) html += '<span class="ui-datepicker-year">' + drawYear + '</span>'; else { var years = this._get(inst, 'yearRange').split(':'); var thisYear = new Date().getFullYear(); var determineYear = function(value) { var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) : (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) : parseInt(value, 10))); return (isNaN(year) ? thisYear : year); }; var year = determineYear(years[0]); var endYear = Math.max(year, determineYear(years[1] || '')); year = (minDate ? Math.max(year, minDate.getFullYear()) : year); endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear); html += '<select class="ui-datepicker-year" ' + 'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' + 'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' + '>'; for (; year <= endYear; year++) { html += '<option value="' + year + '"' + (year == drawYear ? ' selected="selected"' : '') + '>' + year + '</option>'; } html += '</select>'; } html += this._get(inst, 'yearSuffix'); if (showMonthAfterYear) html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml; html += '</div>'; return html; }, _adjustInstDate: function(inst, offset, period) { var year = inst.drawYear + (period == 'Y' ? offset : 0); var month = inst.drawMonth + (period == 'M' ? offset : 0); var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period == 'D' ? offset : 0); var date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day))); inst.selectedDay = date.getDate(); inst.drawMonth = inst.selectedMonth = date.getMonth(); inst.drawYear = inst.selectedYear = date.getFullYear(); if (period == 'M' || period == 'Y') this._notifyChange(inst); }, _restrictMinMax: function(inst, date) { var minDate = this._getMinMaxDate(inst, 'min'); var maxDate = this._getMinMaxDate(inst, 'max'); date = (minDate && date < minDate ? minDate : date); date = (maxDate && date > maxDate ? maxDate : date); return date; }, _notifyChange: function(inst) { var onChange = this._get(inst, 'onChangeMonthYear'); if (onChange) onChange.apply((inst.input ? inst.input[0] : null), [inst.selectedYear, inst.selectedMonth + 1, inst]); }, _getNumberOfMonths: function(inst) { var numMonths = this._get(inst, 'numberOfMonths'); return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths)); }, _getMinMaxDate: function(inst, minMax) { return this._determineDate(inst, this._get(inst, minMax + 'Date'), null); }, _getDaysInMonth: function(year, month) { return 32 - new Date(year, month, 32).getDate(); }, _getFirstDayOfMonth: function(year, month) { return new Date(year, month, 1).getDay(); }, _canAdjustMonth: function(inst, offset, curYear, curMonth) { var numMonths = this._getNumberOfMonths(inst); var date = this._daylightSavingAdjust(new Date(curYear, curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1)); if (offset < 0) date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth())); return this._isInRange(inst, date); }, _isInRange: function(inst, date) { var minDate = this._getMinMaxDate(inst, 'min'); var maxDate = this._getMinMaxDate(inst, 'max'); return ((!minDate || date.getTime() >= minDate.getTime()) && (!maxDate || date.getTime() <= maxDate.getTime())); }, _getFormatConfig: function(inst) { var shortYearCutoff = this._get(inst, 'shortYearCutoff'); shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff : new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)); return { shortYearCutoff: shortYearCutoff, dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'), monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames') }; }, _formatDate: function(inst, day, month, year) { if (!day) { inst.currentDay = inst.selectedDay; inst.currentMonth = inst.selectedMonth; inst.currentYear = inst.selectedYear; } var date = (day ? (typeof day == 'object' ? day : this._daylightSavingAdjust(new Date(year, month, day))) : this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay))); return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst)); } }); function extendRemove(target, props) { $.extend(target, props); for (var name in props) if (props[name] == null || props[name] == undefined) target[name] = props[name]; return target; }; function isArray(a) { return (a && (($.browser.safari && typeof a == 'object' && a.length) || (a.constructor && a.constructor.toString().match(/\Array\(\)/)))); }; $.fn.datepicker = function(options) { if (!$.datepicker.initialized) { $(document).mousedown($.datepicker._checkExternalClick).find('body').append($.datepicker.dpDiv); $.datepicker.initialized = true; } var otherArgs = Array.prototype.slice.call(arguments, 1); if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget')) return $.datepicker['_' + options + 'Datepicker'].apply($.datepicker, [this[0]].concat(otherArgs)); if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string') return $.datepicker['_' + options + 'Datepicker'].apply($.datepicker, [this[0]].concat(otherArgs)); return this.each(function() { typeof options == 'string' ? $.datepicker['_' + options + 'Datepicker'].apply($.datepicker, [this].concat(otherArgs)) : $.datepicker._attachDatepicker(this, options); }); }; $.datepicker = new Datepicker(); $.datepicker.initialized = false; $.datepicker.uuid = new Date().getTime(); $.datepicker.version = "1.8.2"; window['DP_jQuery_' + dpuuid] = $; })(jQuery);
//core
(function($) { $.ui = $.ui || {}; if ($.ui.version) { return; } $.extend($.ui, { version: "1.8.2", plugin: { add: function(module, option, set) { var proto = $.ui[module].prototype; for (var i in set) { proto.plugins[i] = proto.plugins[i] || []; proto.plugins[i].push([option, set[i]]); } }, call: function(instance, name, args) { var set = instance.plugins[name]; if (!set || !instance.element[0].parentNode) { return; } for (var i = 0; i < set.length; i++) { if (instance.options[set[i][0]]) { set[i][1].apply(instance.element, args); } } } }, contains: function(a, b) { return document.compareDocumentPosition ? a.compareDocumentPosition(b) & 16 : a !== b && a.contains(b); }, hasScroll: function(el, a) { if ($(el).css('overflow') == 'hidden') { return false; } var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', has = false; if (el[scroll] > 0) { return true; } el[scroll] = 1; has = (el[scroll] > 0); el[scroll] = 0; return has; }, isOverAxis: function(x, reference, size) { return (x > reference) && (x < (reference + size)); }, isOver: function(y, x, top, left, height, width) { return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width); }, keyCode: { ALT: 18, BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, COMMAND: 91, COMMAND_LEFT: 91, COMMAND_RIGHT: 93, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, MENU: 93, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38, WINDOWS: 91} }); $.fn.extend({ _focus: $.fn.focus, focus: function(delay, fn) { return typeof delay === 'number' ? this.each(function() { var elem = this; setTimeout(function() { $(elem).focus(); (fn && fn.call(elem)); }, delay); }) : this._focus.apply(this, arguments); }, enableSelection: function() { return this.attr('unselectable', 'off').css('MozUserSelect', ''); }, disableSelection: function() { return this.attr('unselectable', 'on').css('MozUserSelect', 'none'); }, scrollParent: function() { var scrollParent; if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { scrollParent = this.parents().filter(function() { return (/(relative|absolute|fixed)/).test($.curCSS(this, 'position', 1)) && (/(auto|scroll)/).test($.curCSS(this, 'overflow', 1) + $.curCSS(this, 'overflow-y', 1) + $.curCSS(this, 'overflow-x', 1)); }).eq(0); } else { scrollParent = this.parents().filter(function() { return (/(auto|scroll)/).test($.curCSS(this, 'overflow', 1) + $.curCSS(this, 'overflow-y', 1) + $.curCSS(this, 'overflow-x', 1)); }).eq(0); } return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent; }, zIndex: function(zIndex) { if (zIndex !== undefined) { return this.css('zIndex', zIndex); } if (this.length) { var elem = $(this[0]), position, value; while (elem.length && elem[0] !== document) { position = elem.css('position'); if (position == 'absolute' || position == 'relative' || position == 'fixed') { value = parseInt(elem.css('zIndex')); if (!isNaN(value) && value != 0) { return value; } } elem = elem.parent(); } } return 0; } }); $.extend($.expr[':'], { data: function(elem, i, match) { return !!$.data(elem, match[3]); }, focusable: function(element) { var nodeName = element.nodeName.toLowerCase(), tabIndex = $.attr(element, 'tabindex'); return (/input|select|textarea|button|object/.test(nodeName) ? !element.disabled : 'a' == nodeName || 'area' == nodeName ? element.href || !isNaN(tabIndex) : !isNaN(tabIndex)) && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length; }, tabbable: function(element) { var tabIndex = $.attr(element, 'tabindex'); return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable'); } }); })(jQuery);
//validate
(function($) { $.extend($.fn, { validate: function(options) { if (!this.length) { options && options.debug && window.console && console.warn("nothing selected, can't validate, returning nothing"); return; } var validator = $.data(this[0], 'validator'); if (validator) { return validator; } validator = new $.validator(options, this[0]); $.data(this[0], 'validator', validator); if (validator.settings.onsubmit) { this.find("input, button").filter(".cancel").click(function() { validator.cancelSubmit = true; }); if (validator.settings.submitHandler) { this.find("input, button").filter(":submit").click(function() { validator.submitButton = this; }); } this.submit(function(event) { if (validator.settings.debug) event.preventDefault(); function handle() { if (validator.settings.submitHandler) { if (validator.submitButton) { var hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm); } validator.settings.submitHandler.call(validator, validator.currentForm); if (validator.submitButton) { hidden.remove(); } return false; } return true; } if (validator.cancelSubmit) { validator.cancelSubmit = false; return handle(); } if (validator.form()) { if (validator.pendingRequest) { validator.formSubmitted = true; return false; } return handle(); } else { validator.focusInvalid(); return false; } }); } return validator; }, valid: function() { if ($(this[0]).is('form')) { return this.validate().form(); } else { var valid = true; var validator = $(this[0].form).validate(); this.each(function() { valid &= validator.element(this); }); return valid; } }, removeAttrs: function(attributes) { var result = {}, $element = this; $.each(attributes.split(/\s/), function(index, value) { result[value] = $element.attr(value); $element.removeAttr(value); }); return result; }, rules: function(command, argument) { var element = this[0]; if (command) { var settings = $.data(element.form, 'validator').settings; var staticRules = settings.rules; var existingRules = $.validator.staticRules(element); switch (command) { case "add": $.extend(existingRules, $.validator.normalizeRule(argument)); staticRules[element.name] = existingRules; if (argument.messages) settings.messages[element.name] = $.extend(settings.messages[element.name], argument.messages); break; case "remove": if (!argument) { delete staticRules[element.name]; return existingRules; } var filtered = {}; $.each(argument.split(/\s/), function(index, method) { filtered[method] = existingRules[method]; delete existingRules[method]; }); return filtered; } } var data = $.validator.normalizeRules($.extend({}, $.validator.metadataRules(element), $.validator.classRules(element), $.validator.attributeRules(element), $.validator.staticRules(element)), element); if (data.required) { var param = data.required; delete data.required; data = $.extend({ required: param }, data); } return data; } }); $.extend($.expr[":"], { blank: function(a) { return !$.trim("" + a.value); }, filled: function(a) { return !!$.trim("" + a.value); }, unchecked: function(a) { return !a.checked; } }); $.validator = function(options, form) { this.settings = $.extend(true, {}, $.validator.defaults, options); this.currentForm = form; this.init(); }; $.validator.format = function(source, params) { if (arguments.length == 1) return function() { var args = $.makeArray(arguments); args.unshift(source); return $.validator.format.apply(this, args); }; if (arguments.length > 2 && params.constructor != Array) { params = $.makeArray(arguments).slice(1); } if (params.constructor != Array) { params = [params]; } $.each(params, function(i, n) { source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n); }); return source; }; $.extend($.validator, { defaults: { messages: {}, groups: {}, rules: {}, errorClass: "error", validClass: "valid", errorElement: "label", focusInvalid: true, errorContainer: $([]), errorLabelContainer: $([]), onsubmit: true, ignore: [], ignoreTitle: false, onfocusin: function(element) { this.lastActive = element; if (this.settings.focusCleanup && !this.blockFocusCleanup) { this.settings.unhighlight && this.settings.unhighlight.call(this, element, this.settings.errorClass, this.settings.validClass); this.errorsFor(element).hide(); } }, onfocusout: function(element) { if (!this.checkable(element) && (element.name in this.submitted || !this.optional(element))) { this.element(element); } }, onkeyup: function(element) { if (element.name in this.submitted || element == this.lastElement) { this.element(element); } }, onclick: function(element) { if (element.name in this.submitted) this.element(element); else if (element.parentNode.name in this.submitted) this.element(element.parentNode); }, highlight: function(element, errorClass, validClass) { $(element).addClass(errorClass).removeClass(validClass); }, unhighlight: function(element, errorClass, validClass) { $(element).removeClass(errorClass).addClass(validClass); } }, setDefaults: function(settings) { $.extend($.validator.defaults, settings); }, messages: { required: "必选字段", remote: "请修正字段", email: "请输入正确格式的电子邮件", url: "请输入合法的网址", date: "请输入合法的日期", dateISO: "请输入合法的日期(YYYY-MM-DD)", number: "请输入合法的的数字", digits: "只能输入整数", creditcard: "请输入合法的信用卡号", equalTo: "请再次输入相同的值", accept: "请输入拥有合法后缀名的字符串", maxlength: $.validator.format("请输入一个长度最多是 {0} 的字符串"), minlength: $.validator.format("请输入一个长度最少是 {0} 的字符串"), rangelength: $.validator.format("请输入一个长度介于 {0} 和 {1} 之间的字符串"), range: $.validator.format("请输入一个介于 {0} 和 {1} 之间的值"), max: $.validator.format("请输入一个最大为 {0} 的值"), min: $.validator.format("请输入一个最小为 {0} 的值") }, autoCreateRanges: false, prototype: { init: function() { this.labelContainer = $(this.settings.errorLabelContainer); this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm); this.containers = $(this.settings.errorContainer).add(this.settings.errorLabelContainer); this.submitted = {}; this.valueCache = {}; this.pendingRequest = 0; this.pending = {}; this.invalid = {}; this.reset(); var groups = (this.groups = {}); $.each(this.settings.groups, function(key, value) { $.each(value.split(/\s/), function(index, name) { groups[name] = key; }); }); var rules = this.settings.rules; $.each(rules, function(key, value) { rules[key] = $.validator.normalizeRule(value); }); function delegate(event) { var validator = $.data(this[0].form, "validator"), eventType = "on" + event.type.replace(/^validate/, ""); validator.settings[eventType] && validator.settings[eventType].call(validator, this[0]); } $(this.currentForm).validateDelegate(":text, :password, :file, select, textarea", "focusin focusout keyup", delegate).validateDelegate(":radio, :checkbox, select, option", "click", delegate); if (this.settings.invalidHandler) $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler); }, form: function() { this.checkForm(); $.extend(this.submitted, this.errorMap); this.invalid = $.extend({}, this.errorMap); if (!this.valid()) $(this.currentForm).triggerHandler("invalid-form", [this]); this.showErrors(); return this.valid(); }, checkForm: function() { this.prepareForm(); for (var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++) { this.check(elements[i]); } return this.valid(); }, element: function(element) { element = this.clean(element); this.lastElement = element; this.prepareElement(element); this.currentElements = $(element); var result = this.check(element); if (result) { delete this.invalid[element.name]; } else { this.invalid[element.name] = true; } if (!this.numberOfInvalids()) { this.toHide = this.toHide.add(this.containers); } this.showErrors(); return result; }, showErrors: function(errors) { if (errors) { $.extend(this.errorMap, errors); this.errorList = []; for (var name in errors) { this.errorList.push({ message: errors[name], element: this.findByName(name)[0] }); } this.successList = $.grep(this.successList, function(element) { return !(element.name in errors); }); } this.settings.showErrors ? this.settings.showErrors.call(this, this.errorMap, this.errorList) : this.defaultShowErrors(); }, resetForm: function() { if ($.fn.resetForm) $(this.currentForm).resetForm(); this.submitted = {}; this.prepareForm(); this.hideErrors(); this.elements().removeClass(this.settings.errorClass); }, numberOfInvalids: function() { return this.objectLength(this.invalid); }, objectLength: function(obj) { var count = 0; for (var i in obj) count++; return count; }, hideErrors: function() { this.addWrapper(this.toHide).hide(); }, valid: function() { return this.size() == 0; }, size: function() { return this.errorList.length; }, focusInvalid: function() { if (this.settings.focusInvalid) { try { $(this.findLastActive() || this.errorList.length && this.errorList[0].element || []).filter(":visible").focus().trigger("focusin"); } catch (e) { } } }, findLastActive: function() { var lastActive = this.lastActive; return lastActive && $.grep(this.errorList, function(n) { return n.element.name == lastActive.name; }).length == 1 && lastActive; }, elements: function() { var validator = this, rulesCache = {}; return $([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function() { !this.name && validator.settings.debug && window.console && console.error("%o has no name assigned", this); if (this.name in rulesCache || !validator.objectLength($(this).rules())) return false; rulesCache[this.name] = true; return true; }); }, clean: function(selector) { return $(selector)[0]; }, errors: function() { return $(this.settings.errorElement + "." + this.settings.errorClass, this.errorContext); }, reset: function() { this.successList = []; this.errorList = []; this.errorMap = {}; this.toShow = $([]); this.toHide = $([]); this.currentElements = $([]); }, prepareForm: function() { this.reset(); this.toHide = this.errors().add(this.containers); }, prepareElement: function(element) { this.reset(); this.toHide = this.errorsFor(element); }, check: function(element) { element = this.clean(element); if (this.checkable(element)) { element = this.findByName(element.name)[0]; } var rules = $(element).rules(); var dependencyMismatch = false; for (method in rules) { var rule = { method: method, parameters: rules[method] }; try { var result = $.validator.methods[method].call(this, element.value.replace(/\r/g, ""), element, rule.parameters); if (result == "dependency-mismatch") { dependencyMismatch = true; continue; } dependencyMismatch = false; if (result == "pending") { this.toHide = this.toHide.not(this.errorsFor(element)); return; } if (!result) { this.formatAndAdd(element, rule); return false; } } catch (e) { this.settings.debug && window.console && console.log("exception occured when checking element " + element.id + ", check the '" + rule.method + "' method", e); throw e; } } if (dependencyMismatch) return; if (this.objectLength(rules)) this.successList.push(element); return true; }, customMetaMessage: function(element, method) { if (!$.metadata) return; var meta = this.settings.meta ? $(element).metadata()[this.settings.meta] : $(element).metadata(); return meta && meta.messages && meta.messages[method]; }, customMessage: function(name, method) { var m = this.settings.messages[name]; return m && (m.constructor == String ? m : m[method]); }, findDefined: function() { for (var i = 0; i < arguments.length; i++) { if (arguments[i] !== undefined) return arguments[i]; } return undefined; }, defaultMessage: function(element, method) { return this.findDefined(this.customMessage(element.name, method), this.customMetaMessage(element, method), !this.settings.ignoreTitle && element.title || undefined, $.validator.messages[method], "<strong>Warning: No message defined for " + element.name + "</strong>"); }, formatAndAdd: function(element, rule) { var message = this.defaultMessage(element, rule.method), theregex = /\$?\{(\d+)\}/g; if (typeof message == "function") { message = message.call(this, rule.parameters, element); } else if (theregex.test(message)) { message = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters); } this.errorList.push({ message: message, element: element }); this.errorMap[element.name] = message; this.submitted[element.name] = message; }, addWrapper: function(toToggle) { if (this.settings.wrapper) toToggle = toToggle.add(toToggle.parent(this.settings.wrapper)); return toToggle; }, defaultShowErrors: function() { for (var i = 0; this.errorList[i]; i++) { var error = this.errorList[i]; this.settings.highlight && this.settings.highlight.call(this, error.element, this.settings.errorClass, this.settings.validClass); this.showLabel(error.element, error.message); } if (this.errorList.length) { this.toShow = this.toShow.add(this.containers); } if (this.settings.success) { for (var i = 0; this.successList[i]; i++) { this.showLabel(this.successList[i]); } } if (this.settings.unhighlight) { for (var i = 0, elements = this.validElements(); elements[i]; i++) { this.settings.unhighlight.call(this, elements[i], this.settings.errorClass, this.settings.validClass); } } this.toHide = this.toHide.not(this.toShow); this.hideErrors(); this.addWrapper(this.toShow).show(); }, validElements: function() { return this.currentElements.not(this.invalidElements()); }, invalidElements: function() { return $(this.errorList).map(function() { return this.element; }); }, showLabel: function(element, message) { var label = this.errorsFor(element); if (label.length) { label.removeClass().addClass(this.settings.errorClass); label.attr("generated") && label.html(message); } else { label = $("<" + this.settings.errorElement + "/>").attr({ "for": this.idOrName(element), generated: true }).addClass(this.settings.errorClass).html(message || ""); if (this.settings.wrapper) { label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent(); } if (!this.labelContainer.append(label).length) this.settings.errorPlacement ? this.settings.errorPlacement(label, $(element)) : label.insertAfter(element); } if (!message && this.settings.success) { label.text(""); typeof this.settings.success == "string" ? label.addClass(this.settings.success) : this.settings.success(label); } this.toShow = this.toShow.add(label); }, errorsFor: function(element) { var name = this.idOrName(element); return this.errors().filter(function() { return $(this).attr('for') == name; }); }, idOrName: function(element) { return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name); }, checkable: function(element) { return /radio|checkbox/i.test(element.type); }, findByName: function(name) { var form = this.currentForm; return $(document.getElementsByName(name)).map(function(index, element) { return element.form == form && element.name == name && element || null; }); }, getLength: function(value, element) { switch (element.nodeName.toLowerCase()) { case 'select': return $("option:selected", element).length; case 'input': if (this.checkable(element)) return this.findByName(element.name).filter(':checked').length; } return value.length; }, depend: function(param, element) { return this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true; }, dependTypes: { "boolean": function(param, element) { return param; }, "string": function(param, element) { return !!$(param, element.form).length; }, "function": function(param, element) { return param(element); } }, optional: function(element) { return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch"; }, startRequest: function(element) { if (!this.pending[element.name]) { this.pendingRequest++; this.pending[element.name] = true; } }, stopRequest: function(element, valid) { this.pendingRequest--; if (this.pendingRequest < 0) this.pendingRequest = 0; delete this.pending[element.name]; if (valid && this.pendingRequest == 0 && this.formSubmitted && this.form()) { $(this.currentForm).submit(); this.formSubmitted = false; } else if (!valid && this.pendingRequest == 0 && this.formSubmitted) { $(this.currentForm).triggerHandler("invalid-form", [this]); this.formSubmitted = false; } }, previousValue: function(element) { return $.data(element, "previousValue") || $.data(element, "previousValue", { old: null, valid: true, message: this.defaultMessage(element, "remote") }); } }, classRuleSettings: { required: { required: true }, email: { email: true }, url: { url: true }, date: { date: true }, dateISO: { dateISO: true }, dateDE: { dateDE: true }, number: { number: true }, numberDE: { numberDE: true }, digits: { digits: true }, creditcard: { creditcard: true} }, addClassRules: function(className, rules) { className.constructor == String ? this.classRuleSettings[className] = rules : $.extend(this.classRuleSettings, className); }, classRules: function(element) { var rules = {}; var classes = $(element).attr('class'); classes && $.each(classes.split(' '), function() { if (this in $.validator.classRuleSettings) { $.extend(rules, $.validator.classRuleSettings[this]); } }); return rules; }, attributeRules: function(element) { var rules = {}; var $element = $(element); for (method in $.validator.methods) { var value = $element.attr(method); if (value) { rules[method] = value; } } if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) { delete rules.maxlength; } return rules; }, metadataRules: function(element) { if (!$.metadata) return {}; var meta = $.data(element.form, 'validator').settings.meta; return meta ? $(element).metadata()[meta] : $(element).metadata(); }, staticRules: function(element) { var rules = {}; var validator = $.data(element.form, 'validator'); if (validator.settings.rules) { rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {}; } return rules; }, normalizeRules: function(rules, element) { $.each(rules, function(prop, val) { if (val === false) { delete rules[prop]; return; } if (val.param || val.depends) { var keepRule = true; switch (typeof val.depends) { case "string": keepRule = !!$(val.depends, element.form).length; break; case "function": keepRule = val.depends.call(element, element); break; } if (keepRule) { rules[prop] = val.param !== undefined ? val.param : true; } else { delete rules[prop]; } } }); $.each(rules, function(rule, parameter) { rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter; }); $.each(['minlength', 'maxlength', 'min', 'max'], function() { if (rules[this]) { rules[this] = Number(rules[this]); } }); $.each(['rangelength', 'range'], function() { if (rules[this]) { rules[this] = [Number(rules[this][0]), Number(rules[this][1])]; } }); if ($.validator.autoCreateRanges) { if (rules.min && rules.max) { rules.range = [rules.min, rules.max]; delete rules.min; delete rules.max; } if (rules.minlength && rules.maxlength) { rules.rangelength = [rules.minlength, rules.maxlength]; delete rules.minlength; delete rules.maxlength; } } if (rules.messages) { delete rules.messages; } return rules; }, normalizeRule: function(data) { if (typeof data == "string") { var transformed = {}; $.each(data.split(/\s/), function() { transformed[this] = true; }); data = transformed; } return data; }, addMethod: function(name, method, message) { $.validator.methods[name] = method; $.validator.messages[name] = message != undefined ? message : $.validator.messages[name]; if (method.length < 3) { $.validator.addClassRules(name, $.validator.normalizeRule(name)); } }, methods: { required: function(value, element, param) { if (!this.depend(param, element)) return "dependency-mismatch"; switch (element.nodeName.toLowerCase()) { case 'select': var val = $(element).val(); return val && val.length > 0; case 'input': if (this.checkable(element)) return this.getLength(value, element) > 0; default: return $.trim(value).length > 0; } }, remote: function(value, element, param) { if (this.optional(element)) return "dependency-mismatch"; var previous = this.previousValue(element); if (!this.settings.messages[element.name]) this.settings.messages[element.name] = {}; previous.originalMessage = this.settings.messages[element.name].remote; this.settings.messages[element.name].remote = previous.message; param = typeof param == "string" && { url: param} || param; if (previous.old !== value) { previous.old = value; var validator = this; this.startRequest(element); var data = {}; data[element.name] = value; $.ajax($.extend(true, { url: param, mode: "abort", port: "validate" + element.name, dataType: "json", data: data, success: function(response) { validator.settings.messages[element.name].remote = previous.originalMessage; var valid = response === true; if (valid) { var submitted = validator.formSubmitted; validator.prepareElement(element); validator.formSubmitted = submitted; validator.successList.push(element); validator.showErrors(); } else { var errors = {}; var message = (previous.message = response || validator.defaultMessage(element, "remote")); errors[element.name] = $.isFunction(message) ? message(value) : message; validator.showErrors(errors); } previous.valid = valid; validator.stopRequest(element, valid); } }, param)); return "pending"; } else if (this.pending[element.name]) { return "pending"; } return previous.valid; }, minlength: function(value, element, param) { return this.optional(element) || this.getLength($.trim(value), element) >= param; }, maxlength: function(value, element, param) { return this.optional(element) || this.getLength($.trim(value), element) <= param; }, rangelength: function(value, element, param) { var length = this.getLength($.trim(value), element); return this.optional(element) || (length >= param[0] && length <= param[1]); }, min: function(value, element, param) { return this.optional(element) || value >= param; }, max: function(value, element, param) { return this.optional(element) || value <= param; }, range: function(value, element, param) { return this.optional(element) || (value >= param[0] && value <= param[1]); }, email: function(value, element) { return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value); }, url: function(value, element) { return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value); }, date: function(value, element) { return this.optional(element) || /^(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$/.test(new Date(value)); }, dateISO: function(value, element) { return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value); }, number: function(value, element) { return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value); }, digits: function(value, element) { return this.optional(element) || /^\d+$/.test(value); }, creditcard: function(value, element) { if (this.optional(element)) return "dependency-mismatch"; if (/[^0-9-]+/.test(value)) return false; var nCheck = 0, nDigit = 0, bEven = false; value = value.replace(/\D/g, ""); for (var n = value.length - 1; n >= 0; n--) { var cDigit = value.charAt(n); var nDigit = parseInt(cDigit, 10); if (bEven) { if ((nDigit *= 2) > 9) nDigit -= 9; } nCheck += nDigit; bEven = !bEven; } return (nCheck % 10) == 0; }, accept: function(value, element, param) { param = typeof param == "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif"; return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i")); }, equalTo: function(value, element, param) { var target = $(param).unbind(".validate-equalTo").bind("blur.validate-equalTo", function() { $(element).valid(); }); return value == target.val(); } } }); $.format = $.validator.format; })(jQuery); ; (function($) { var ajax = $.ajax; var pendingRequests = {}; $.ajax = function(settings) { settings = $.extend(settings, $.extend({}, $.ajaxSettings, settings)); var port = settings.port; if (settings.mode == "abort") { if (pendingRequests[port]) { pendingRequests[port].abort(); } return (pendingRequests[port] = ajax.apply(this, arguments)); } return ajax.apply(this, arguments); }; })(jQuery); ; (function($) { if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) { $.each({ focus: 'focusin', blur: 'focusout' }, function(original, fix) { $.event.special[fix] = { setup: function() { this.addEventListener(original, handler, true); }, teardown: function() { this.removeEventListener(original, handler, true); }, handler: function(e) { arguments[0] = $.event.fix(e); arguments[0].type = fix; return $.event.handle.apply(this, arguments); } }; function handler(e) { e = $.event.fix(e); e.type = fix; return $.event.handle.call(this, e); } }); }; $.extend($.fn, { validateDelegate: function(delegate, type, handler) { return this.bind(type, function(event) { var target = $(event.target); if (target.is(delegate)) { return handler.apply(target, arguments); } }); } }); })(jQuery);
//metadata
(function($) { $.extend({ metadata: { defaults: { type: 'class', name: 'metadata', cre: /({.*})/, single: 'metadata' }, setType: function(type, name) { this.defaults.type = type; this.defaults.name = name; }, get: function(elem, opts) { var settings = $.extend({}, this.defaults, opts); if (!settings.single.length) settings.single = 'metadata'; var data = $.data(elem, settings.single); if (data) return data; data = "{}"; if (settings.type == "class") { var m = settings.cre.exec(elem.className); if (m) data = m[1]; } else if (settings.type == "elem") { if (!elem.getElementsByTagName) return undefined; var e = elem.getElementsByTagName(settings.name); if (e.length) data = $.trim(e[0].innerHTML); } else if (elem.getAttribute != undefined) { var attr = elem.getAttribute(settings.name); if (attr) data = attr; } if (data.indexOf('{') < 0) data = "{" + data + "}"; data = eval("(" + data + ")"); $.data(elem, settings.single, data); return data; } } }); $.fn.metadata = function(opts) { return $.metadata.get(this[0], opts); }; })(jQuery);
//cookies
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; } };
//treeview
; (function($) { $.extend($.fn, { swapClass: function(c1, c2) { var c1Elements = this.filter('.' + c1); this.filter('.' + c2).removeClass(c2).addClass(c1); c1Elements.removeClass(c1).addClass(c2); return this }, replaceClass: function(c1, c2) { return this.filter('.' + c1).removeClass(c1).addClass(c2).end() }, hoverClass: function(className) { className = className || "hover"; return this.hover(function() { $(this).addClass(className) }, function() { $(this).removeClass(className) }) }, heightToggle: function(animated, callback) { animated ? this.animate({ height: "toggle" }, animated, callback) : this.each(function() { jQuery(this)[jQuery(this).is(":hidden") ? "show" : "hide"](); if (callback) callback.apply(this, arguments) }) }, heightHide: function(animated, callback) { if (animated) { this.animate({ height: "hide" }, animated, callback) } else { this.hide(); if (callback) this.each(callback) } }, prepareBranches: function(settings) { if (!settings.prerendered) { this.filter(":last-child:not(ul)").addClass(CLASSES.last); this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide() } return this.filter(":has(>ul)") }, applyClasses: function(settings, toggler) { this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) { toggler.apply($(this).next()) }).add($("a", this)).hoverClass(); if (!settings.prerendered) { this.filter(":has(>ul:hidden)").addClass(CLASSES.expandable).replaceClass(CLASSES.last, CLASSES.lastExpandable); this.not(":has(>ul:hidden)").addClass(CLASSES.collapsable).replaceClass(CLASSES.last, CLASSES.lastCollapsable); this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea).each(function() { var classes = ""; $.each($(this).parent().attr("class").split(" "), function() { classes += this + "-hitarea " }); $(this).addClass(classes) }) } this.find("div." + CLASSES.hitarea).click(toggler) }, treeview: function(settings) { settings = $.extend({ cookieId: "treeview" }, settings); if (settings.add) { return this.trigger("add", [settings.add]) } if (settings.toggle) { var callback = settings.toggle; settings.toggle = function() { return callback.apply($(this).parent()[0], arguments) } } function treeController(tree, control) { function handler(filter) { return function() { toggler.apply($("div." + CLASSES.hitarea, tree).filter(function() { return filter ? $(this).parent("." + filter).length : true })); return false } } $("a:eq(0)", control).click(handler(CLASSES.collapsable)); $("a:eq(1)", control).click(handler(CLASSES.expandable)); $("a:eq(2)", control).click(handler()) } function toggler() { $(this).parent().find(">.hitarea").swapClass(CLASSES.collapsableHitarea, CLASSES.expandableHitarea).swapClass(CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea).end().swapClass(CLASSES.collapsable, CLASSES.expandable).swapClass(CLASSES.lastCollapsable, CLASSES.lastExpandable).find(">ul").heightToggle(settings.animated, settings.toggle); if (settings.unique) { $(this).parent().siblings().find(">.hitarea").replaceClass(CLASSES.collapsableHitarea, CLASSES.expandableHitarea).replaceClass(CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea).end().replaceClass(CLASSES.collapsable, CLASSES.expandable).replaceClass(CLASSES.lastCollapsable, CLASSES.lastExpandable).find(">ul").heightHide(settings.animated, settings.toggle) } } function serialize() { function binary(arg) { return arg ? 1 : 0 } var data = []; branches.each(function(i, e) { data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0 }); $.cookie(settings.cookieId, data.join("")) } function deserialize() { var stored = $.cookie(settings.cookieId); if (stored) { var data = stored.split(""); branches.each(function(i, e) { $(e).find(">ul")[parseInt(data[i]) ? "show" : "hide"]() }) } } this.addClass("treeview"); var branches = this.find("li").prepareBranches(settings); switch (settings.persist) { case "cookie": var toggleCallback = settings.toggle; settings.toggle = function() { serialize(); if (toggleCallback) { toggleCallback.apply(this, arguments) } }; deserialize(); break; case "location": var current = this.find("a").filter(function() { return this.href.toLowerCase() == location.href.toLowerCase() }); if (current.length) { current.addClass("selected").parents("ul, li").add(current.next()).show() } break } branches.applyClasses(settings, toggler); if (settings.control) { treeController(this, settings.control); $(settings.control).show() } return this.bind("add", function(event, branches) { $(branches).prev().removeClass(CLASSES.last).removeClass(CLASSES.lastCollapsable).removeClass(CLASSES.lastExpandable).find(">.hitarea").removeClass(CLASSES.lastCollapsableHitarea).removeClass(CLASSES.lastExpandableHitarea); $(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler) }) } }); var CLASSES = $.fn.treeview.classes = { open: "open", closed: "closed", expandable: "expandable", expandableHitarea: "expandable-hitarea", lastExpandableHitarea: "lastExpandable-hitarea", collapsable: "collapsable", collapsableHitarea: "collapsable-hitarea", lastCollapsableHitarea: "lastCollapsable-hitarea", lastCollapsable: "lastCollapsable", lastExpandable: "lastExpandable", last: "last", hitarea: "hitarea" }; $.fn.Treeview = $.fn.treeview })(jQuery);
//uploadify
if (jQuery) { (function(a) { a.extend(a.fn, { uploadify: function(b) { a(this).each(function() { settings = a.extend({ id: a(this).attr("id"), uploader: "uploadify.swf", script: "uploadify.php", expressInstall: null, folder: "", height: 30, width: 110, cancelImg: "cancel.png", wmode: "opaque", scriptAccess: "sameDomain", fileDataName: "Filedata", method: "POST", queueSizeLimit: 999, simUploadLimit: 1, queueID: false, displayData: "percentage", onInit: function() { }, onSelect: function() { }, onQueueFull: function() { }, onCheck: function() { }, onCancel: function() { }, onError: function() { }, onProgress: function() { }, onComplete: function() { }, onAllComplete: function() { } }, b); var e = location.pathname; e = e.split("/"); e.pop(); e = e.join("/") + "/"; var f = {}; f.uploadifyID = settings.id; f.pagepath = e; if (settings.buttonImg) { f.buttonImg = escape(settings.buttonImg) } if (settings.buttonText) { f.buttonText = escape(settings.buttonText) } if (settings.rollover) { f.rollover = true } f.script = settings.script; f.folder = escape(settings.folder); if (settings.scriptData) { var g = ""; for (var d in settings.scriptData) { g += "&" + d + "=" + settings.scriptData[d] } f.scriptData = escape(g.substr(1)) } f.width = settings.width; f.height = settings.height; f.wmode = settings.wmode; f.method = settings.method; f.queueSizeLimit = settings.queueSizeLimit; f.simUploadLimit = settings.simUploadLimit; if (settings.hideButton) { f.hideButton = true } if (settings.fileDesc) { f.fileDesc = settings.fileDesc } if (settings.fileExt) { f.fileExt = settings.fileExt } if (settings.multi) { f.multi = true } if (settings.auto) { f.auto = true } if (settings.sizeLimit) { f.sizeLimit = settings.sizeLimit } if (settings.checkScript) { f.checkScript = settings.checkScript } if (settings.fileDataName) { f.fileDataName = settings.fileDataName } if (settings.queueID) { f.queueID = settings.queueID } if (settings.onInit() !== false) { a(this).css("display", "none"); a(this).after('<div id="' + a(this).attr("id") + 'Uploader"></div>'); swfobject.embedSWF(settings.uploader, settings.id + "Uploader", settings.width, settings.height, "9.0.24", settings.expressInstall, f, { quality: "high", wmode: settings.wmode, allowScriptAccess: settings.scriptAccess }); if (settings.queueID == false) { a("#" + a(this).attr("id") + "Uploader").after('<div id="' + a(this).attr("id") + 'Queue" class="uploadifyQueue"></div>') } } if (typeof (settings.onOpen) == "function") { a(this).bind("uploadifyOpen", settings.onOpen) } a(this).bind("uploadifySelect", { action: settings.onSelect, queueID: settings.queueID }, function(j, h, i) { if (j.data.action(j, h, i) !== false) { var k = Math.round(i.size / 1024 * 100) * 0.01; var l = "KB"; if (k > 1000) { k = Math.round(k * 0.001 * 100) * 0.01; l = "MB" } var m = k.toString().split("."); if (m.length > 1) { k = m[0] + "." + m[1].substr(0, 2) } else { k = m[0] } if (i.name.length > 20) { fileName = i.name.substr(0, 20) + "..." } else { fileName = i.name } queue = "#" + a(this).attr("id") + "Queue"; if (j.data.queueID) { queue = "#" + j.data.queueID } a(queue).append('<div id="' + a(this).attr("id") + h + '" class="uploadifyQueueItem"><div class="cancel"><a href="javascript:jQuery(\'#' + a(this).attr("id") + "').uploadifyCancel('" + h + '\')"><img src="' + settings.cancelImg + '" border="0" /></a></div><span class="fileName">' + fileName + " (" + k + l + ')</span><span class="percentage"></span><div class="uploadifyProgress"><div id="' + a(this).attr("id") + h + 'ProgressBar" class="uploadifyProgressBar"><!--Progress Bar--></div></div></div>') } }); if (typeof (settings.onSelectOnce) == "function") { a(this).bind("uploadifySelectOnce", settings.onSelectOnce) } a(this).bind("uploadifyQueueFull", { action: settings.onQueueFull }, function(h, i) { if (h.data.action(h, i) !== false) { alert("The queue is full.  The max size is " + i + ".") } }); a(this).bind("uploadifyCheckExist", { action: settings.onCheck }, function(m, l, k, j, o) { var i = new Object(); i = k; i.folder = e + j; if (o) { for (var h in k) { var n = h } } a.post(l, i, function(r) { for (var p in r) { if (m.data.action(m, l, k, j, o) !== false) { var q = confirm("Do you want to replace the file " + r[p] + "?"); if (!q) { document.getElementById(a(m.target).attr("id") + "Uploader").cancelFileUpload(p, true, true) } } } if (o) { document.getElementById(a(m.target).attr("id") + "Uploader").startFileUpload(n, true) } else { document.getElementById(a(m.target).attr("id") + "Uploader").startFileUpload(null, true) } }, "json") }); a(this).bind("uploadifyCancel", { action: settings.onCancel }, function(l, h, k, m, j) { if (l.data.action(l, h, k, m, j) !== false) { var i = (j == true) ? 0 : 250; a("#" + a(this).attr("id") + h).fadeOut(i, function() { a(this).remove() }) } }); if (typeof (settings.onClearQueue) == "function") { a(this).bind("uploadifyClearQueue", settings.onClearQueue) } var c = []; a(this).bind("uploadifyError", { action: settings.onError }, function(l, h, k, j) { if (l.data.action(l, h, k, j) !== false) { var i = new Array(h, k, j); c.push(i); a("#" + a(this).attr("id") + h + " .percentage").text(" - " + j.type + " Error"); a("#" + a(this).attr("id") + h).addClass("uploadifyError") } }); a(this).bind("uploadifyProgress", { action: settings.onProgress, toDisplay: settings.displayData }, function(j, h, i, k) { if (j.data.action(j, h, i, k) !== false) { a("#" + a(this).attr("id") + h + "ProgressBar").css("width", k.percentage + "%"); if (j.data.toDisplay == "percentage") { displayData = " - " + k.percentage + "%" } if (j.data.toDisplay == "speed") { displayData = " - " + k.speed + "KB/s" } if (j.data.toDisplay == null) { displayData = " " } a("#" + a(this).attr("id") + h + " .percentage").text(displayData) } }); a(this).bind("uploadifyComplete", { action: settings.onComplete }, function(k, h, j, i, l) { if (k.data.action(k, h, j, unescape(i), l) !== false) { a("#" + a(this).attr("id") + h + " .percentage").text(" - Completed"); a("#" + a(this).attr("id") + h).fadeOut(250, function() { a(this).remove() }) } }); if (typeof (settings.onAllComplete) == "function") { a(this).bind("uploadifyAllComplete", { action: settings.onAllComplete }, function(h, i) { if (h.data.action(h, i) !== false) { c = [] } }) } }) }, uploadifySettings: function(f, j, c) { var g = false; a(this).each(function() { if (f == "scriptData" && j != null) { if (c) { var i = j } else { var i = a.extend(settings.scriptData, j) } var l = ""; for (var k in i) { l += "&" + k + "=" + escape(i[k]) } j = l.substr(1) } g = document.getElementById(a(this).attr("id") + "Uploader").updateSettings(f, j) }); if (j == null) { if (f == "scriptData") { var b = unescape(g).split("&"); var e = new Object(); for (var d = 0; d < b.length; d++) { var h = b[d].split("="); e[h[0]] = h[1] } g = e } return g } }, uploadifyUpload: function(b) { a(this).each(function() { document.getElementById(a(this).attr("id") + "Uploader").startFileUpload(b, false) }) }, uploadifyCancel: function(b) { a(this).each(function() { document.getElementById(a(this).attr("id") + "Uploader").cancelFileUpload(b, true, false) }) }, uploadifyClearQueue: function() { a(this).each(function() { document.getElementById(a(this).attr("id") + "Uploader").clearFileUploadQueue(false) }) } }) })(jQuery) };
//swfobject
var swfobject = function() { var D = "undefined", r = "object", S = "Shockwave Flash", W = "ShockwaveFlash.ShockwaveFlash", q = "application/x-shockwave-flash", R = "SWFObjectExprInst", x = "onreadystatechange", O = window, j = document, t = navigator, T = false, U = [h], o = [], N = [], I = [], l, Q, E, B, J = false, a = false, n, G, m = true, M = function() { var aa = typeof j.getElementById != D && typeof j.getElementsByTagName != D && typeof j.createElement != D, ah = t.userAgent.toLowerCase(), Y = t.platform.toLowerCase(), ae = Y ? /win/.test(Y) : /win/.test(ah), ac = Y ? /mac/.test(Y) : /mac/.test(ah), af = /webkit/.test(ah) ? parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, X = ! +"\v1", ag = [0, 0, 0], ab = null; if (typeof t.plugins != D && typeof t.plugins[S] == r) { ab = t.plugins[S].description; if (ab && !(typeof t.mimeTypes != D && t.mimeTypes[q] && !t.mimeTypes[q].enabledPlugin)) { T = true; X = false; ab = ab.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); ag[0] = parseInt(ab.replace(/^(.*)\..*$/, "$1"), 10); ag[1] = parseInt(ab.replace(/^.*\.(.*)\s.*$/, "$1"), 10); ag[2] = /[a-zA-Z]/.test(ab) ? parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0 } } else { if (typeof O.ActiveXObject != D) { try { var ad = new ActiveXObject(W); if (ad) { ab = ad.GetVariable("$version"); if (ab) { X = true; ab = ab.split(" ")[1].split(","); ag = [parseInt(ab[0], 10), parseInt(ab[1], 10), parseInt(ab[2], 10)] } } } catch (Z) { } } } return { w3: aa, pv: ag, wk: af, ie: X, win: ae, mac: ac} } (), k = function() { if (!M.w3) { return } if ((typeof j.readyState != D && j.readyState == "complete") || (typeof j.readyState == D && (j.getElementsByTagName("body")[0] || j.body))) { f() } if (!J) { if (typeof j.addEventListener != D) { j.addEventListener("DOMContentLoaded", f, false) } if (M.ie && M.win) { j.attachEvent(x, function() { if (j.readyState == "complete") { j.detachEvent(x, arguments.callee); f() } }); if (O == top) { (function() { if (J) { return } try { j.documentElement.doScroll("left") } catch (X) { setTimeout(arguments.callee, 0); return } f() })() } } if (M.wk) { (function() { if (J) { return } if (!/loaded|complete/.test(j.readyState)) { setTimeout(arguments.callee, 0); return } f() })() } s(f) } } (); function f() { if (J) { return } try { var Z = j.getElementsByTagName("body")[0].appendChild(C("span")); Z.parentNode.removeChild(Z) } catch (aa) { return } J = true; var X = U.length; for (var Y = 0; Y < X; Y++) { U[Y]() } } function K(X) { if (J) { X() } else { U[U.length] = X } } function s(Y) { if (typeof O.addEventListener != D) { O.addEventListener("load", Y, false) } else { if (typeof j.addEventListener != D) { j.addEventListener("load", Y, false) } else { if (typeof O.attachEvent != D) { i(O, "onload", Y) } else { if (typeof O.onload == "function") { var X = O.onload; O.onload = function() { X(); Y() } } else { O.onload = Y } } } } } function h() { if (T) { V() } else { H() } } function V() { var X = j.getElementsByTagName("body")[0]; var aa = C(r); aa.setAttribute("type", q); var Z = X.appendChild(aa); if (Z) { var Y = 0; (function() { if (typeof Z.GetVariable != D) { var ab = Z.GetVariable("$version"); if (ab) { ab = ab.split(" ")[1].split(","); M.pv = [parseInt(ab[0], 10), parseInt(ab[1], 10), parseInt(ab[2], 10)] } } else { if (Y < 10) { Y++; setTimeout(arguments.callee, 10); return } } X.removeChild(aa); Z = null; H() })() } else { H() } } function H() { var ag = o.length; if (ag > 0) { for (var af = 0; af < ag; af++) { var Y = o[af].id; var ab = o[af].callbackFn; var aa = { success: false, id: Y }; if (M.pv[0] > 0) { var ae = c(Y); if (ae) { if (F(o[af].swfVersion) && !(M.wk && M.wk < 312)) { w(Y, true); if (ab) { aa.success = true; aa.ref = z(Y); ab(aa) } } else { if (o[af].expressInstall && A()) { var ai = {}; ai.data = o[af].expressInstall; ai.width = ae.getAttribute("width") || "0"; ai.height = ae.getAttribute("height") || "0"; if (ae.getAttribute("class")) { ai.styleclass = ae.getAttribute("class") } if (ae.getAttribute("align")) { ai.align = ae.getAttribute("align") } var ah = {}; var X = ae.getElementsByTagName("param"); var ac = X.length; for (var ad = 0; ad < ac; ad++) { if (X[ad].getAttribute("name").toLowerCase() != "movie") { ah[X[ad].getAttribute("name")] = X[ad].getAttribute("value") } } P(ai, ah, Y, ab) } else { p(ae); if (ab) { ab(aa) } } } } } else { w(Y, true); if (ab) { var Z = z(Y); if (Z && typeof Z.SetVariable != D) { aa.success = true; aa.ref = Z } ab(aa) } } } } } function z(aa) { var X = null; var Y = c(aa); if (Y && Y.nodeName == "OBJECT") { if (typeof Y.SetVariable != D) { X = Y } else { var Z = Y.getElementsByTagName(r)[0]; if (Z) { X = Z } } } return X } function A() { return !a && F("6.0.65") && (M.win || M.mac) && !(M.wk && M.wk < 312) } function P(aa, ab, X, Z) { a = true; E = Z || null; B = { success: false, id: X }; var ae = c(X); if (ae) { if (ae.nodeName == "OBJECT") { l = g(ae); Q = null } else { l = ae; Q = X } aa.id = R; if (typeof aa.width == D || (!/%$/.test(aa.width) && parseInt(aa.width, 10) < 310)) { aa.width = "310" } if (typeof aa.height == D || (!/%$/.test(aa.height) && parseInt(aa.height, 10) < 137)) { aa.height = "137" } j.title = j.title.slice(0, 47) + " - Flash Player Installation"; var ad = M.ie && M.win ? "ActiveX" : "PlugIn", ac = "MMredirectURL=" + O.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + ad + "&MMdoctitle=" + j.title; if (typeof ab.flashvars != D) { ab.flashvars += "&" + ac } else { ab.flashvars = ac } if (M.ie && M.win && ae.readyState != 4) { var Y = C("div"); X += "SWFObjectNew"; Y.setAttribute("id", X); ae.parentNode.insertBefore(Y, ae); ae.style.display = "none"; (function() { if (ae.readyState == 4) { ae.parentNode.removeChild(ae) } else { setTimeout(arguments.callee, 10) } })() } u(aa, ab, X) } } function p(Y) { if (M.ie && M.win && Y.readyState != 4) { var X = C("div"); Y.parentNode.insertBefore(X, Y); X.parentNode.replaceChild(g(Y), X); Y.style.display = "none"; (function() { if (Y.readyState == 4) { Y.parentNode.removeChild(Y) } else { setTimeout(arguments.callee, 10) } })() } else { Y.parentNode.replaceChild(g(Y), Y) } } function g(ab) { var aa = C("div"); if (M.win && M.ie) { aa.innerHTML = ab.innerHTML } else { var Y = ab.getElementsByTagName(r)[0]; if (Y) { var ad = Y.childNodes; if (ad) { var X = ad.length; for (var Z = 0; Z < X; Z++) { if (!(ad[Z].nodeType == 1 && ad[Z].nodeName == "PARAM") && !(ad[Z].nodeType == 8)) { aa.appendChild(ad[Z].cloneNode(true)) } } } } } return aa } function u(ai, ag, Y) { var X, aa = c(Y); if (M.wk && M.wk < 312) { return X } if (aa) { if (typeof ai.id == D) { ai.id = Y } if (M.ie && M.win) { var ah = ""; for (var ae in ai) { if (ai[ae] != Object.prototype[ae]) { if (ae.toLowerCase() == "data") { ag.movie = ai[ae] } else { if (ae.toLowerCase() == "styleclass") { ah += ' class="' + ai[ae] + '"' } else { if (ae.toLowerCase() != "classid") { ah += " " + ae + '="' + ai[ae] + '"' } } } } } var af = ""; for (var ad in ag) { if (ag[ad] != Object.prototype[ad]) { af += '<param name="' + ad + '" value="' + ag[ad] + '" />' } } aa.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + ah + ">" + af + "</object>"; N[N.length] = ai.id; X = c(ai.id) } else { var Z = C(r); Z.setAttribute("type", q); for (var ac in ai) { if (ai[ac] != Object.prototype[ac]) { if (ac.toLowerCase() == "styleclass") { Z.setAttribute("class", ai[ac]) } else { if (ac.toLowerCase() != "classid") { Z.setAttribute(ac, ai[ac]) } } } } for (var ab in ag) { if (ag[ab] != Object.prototype[ab] && ab.toLowerCase() != "movie") { e(Z, ab, ag[ab]) } } aa.parentNode.replaceChild(Z, aa); X = Z } } return X } function e(Z, X, Y) { var aa = C("param"); aa.setAttribute("name", X); aa.setAttribute("value", Y); Z.appendChild(aa) } function y(Y) { var X = c(Y); if (X && X.nodeName == "OBJECT") { if (M.ie && M.win) { X.style.display = "none"; (function() { if (X.readyState == 4) { b(Y) } else { setTimeout(arguments.callee, 10) } })() } else { X.parentNode.removeChild(X) } } } function b(Z) { var Y = c(Z); if (Y) { for (var X in Y) { if (typeof Y[X] == "function") { Y[X] = null } } Y.parentNode.removeChild(Y) } } function c(Z) { var X = null; try { X = j.getElementById(Z) } catch (Y) { } return X } function C(X) { return j.createElement(X) } function i(Z, X, Y) { Z.attachEvent(X, Y); I[I.length] = [Z, X, Y] } function F(Z) { var Y = M.pv, X = Z.split("."); X[0] = parseInt(X[0], 10); X[1] = parseInt(X[1], 10) || 0; X[2] = parseInt(X[2], 10) || 0; return (Y[0] > X[0] || (Y[0] == X[0] && Y[1] > X[1]) || (Y[0] == X[0] && Y[1] == X[1] && Y[2] >= X[2])) ? true : false } function v(ac, Y, ad, ab) { if (M.ie && M.mac) { return } var aa = j.getElementsByTagName("head")[0]; if (!aa) { return } var X = (ad && typeof ad == "string") ? ad : "screen"; if (ab) { n = null; G = null } if (!n || G != X) { var Z = C("style"); Z.setAttribute("type", "text/css"); Z.setAttribute("media", X); n = aa.appendChild(Z); if (M.ie && M.win && typeof j.styleSheets != D && j.styleSheets.length > 0) { n = j.styleSheets[j.styleSheets.length - 1] } G = X } if (M.ie && M.win) { if (n && typeof n.addRule == r) { n.addRule(ac, Y) } } else { if (n && typeof j.createTextNode != D) { n.appendChild(j.createTextNode(ac + " {" + Y + "}")) } } } function w(Z, X) { if (!m) { return } var Y = X ? "visible" : "hidden"; if (J && c(Z)) { c(Z).style.visibility = Y } else { v("#" + Z, "visibility:" + Y) } } function L(Y) { var Z = /[\\\"<>\.;]/; var X = Z.exec(Y) != null; return X && typeof encodeURIComponent != D ? encodeURIComponent(Y) : Y } var d = function() { if (M.ie && M.win) { window.attachEvent("onunload", function() { var ac = I.length; for (var ab = 0; ab < ac; ab++) { I[ab][0].detachEvent(I[ab][1], I[ab][2]) } var Z = N.length; for (var aa = 0; aa < Z; aa++) { y(N[aa]) } for (var Y in M) { M[Y] = null } M = null; for (var X in swfobject) { swfobject[X] = null } swfobject = null }) } } (); return { registerObject: function(ab, X, aa, Z) { if (M.w3 && ab && X) { var Y = {}; Y.id = ab; Y.swfVersion = X; Y.expressInstall = aa; Y.callbackFn = Z; o[o.length] = Y; w(ab, false) } else { if (Z) { Z({ success: false, id: ab }) } } }, getObjectById: function(X) { if (M.w3) { return z(X) } }, embedSWF: function(ab, ah, ae, ag, Y, aa, Z, ad, af, ac) { var X = { success: false, id: ah }; if (M.w3 && !(M.wk && M.wk < 312) && ab && ah && ae && ag && Y) { w(ah, false); K(function() { ae += ""; ag += ""; var aj = {}; if (af && typeof af === r) { for (var al in af) { aj[al] = af[al] } } aj.data = ab; aj.width = ae; aj.height = ag; var am = {}; if (ad && typeof ad === r) { for (var ak in ad) { am[ak] = ad[ak] } } if (Z && typeof Z === r) { for (var ai in Z) { if (typeof am.flashvars != D) { am.flashvars += "&" + ai + "=" + Z[ai] } else { am.flashvars = ai + "=" + Z[ai] } } } if (F(Y)) { var an = u(aj, am, ah); if (aj.id == ah) { w(ah, true) } X.success = true; X.ref = an } else { if (aa && A()) { aj.data = aa; P(aj, am, ah, ac); return } else { w(ah, true) } } if (ac) { ac(X) } }) } else { if (ac) { ac(X) } } }, switchOffAutoHideShow: function() { m = false }, ua: M, getFlashPlayerVersion: function() { return { major: M.pv[0], minor: M.pv[1], release: M.pv[2]} }, hasFlashPlayerVersion: F, createSWF: function(Z, Y, X) { if (M.w3) { return u(Z, Y, X) } else { return undefined } }, showExpressInstall: function(Z, aa, X, Y) { if (M.w3 && A()) { P(Z, aa, X, Y) } }, removeSWF: function(X) { if (M.w3) { y(X) } }, createCSS: function(aa, Z, Y, X) { if (M.w3) { v(aa, Z, Y, X) } }, addDomLoadEvent: K, addLoadEvent: s, getQueryParamValue: function(aa) { var Z = j.location.search || j.location.hash; if (Z) { if (/\?/.test(Z)) { Z = Z.split("?")[1] } if (aa == null) { return L(Z) } var Y = Z.split("&"); for (var X = 0; X < Y.length; X++) { if (Y[X].substring(0, Y[X].indexOf("=")) == aa) { return L(Y[X].substring((Y[X].indexOf("=") + 1))) } } } return "" }, expressInstallCallback: function() { if (a) { var X = c(R); if (X && l) { X.parentNode.replaceChild(l, X); if (Q) { w(Q, true); if (M.ie && M.win) { l.style.display = "block" } } if (E) { E(B) } } a = false } } } } ();
//jcrop
(function($) { $.Jcrop = function(obj, opt) { var obj = obj, opt = opt; if (typeof (obj) !== 'object') obj = $(obj)[0]; if (typeof (opt) !== 'object') opt = {}; if (!('trackDocument' in opt)) { opt.trackDocument = $.browser.msie ? false : true; if ($.browser.msie && $.browser.version.split('.')[0] == '8') opt.trackDocument = true; } if (!('keySupport' in opt)) opt.keySupport = $.browser.msie ? false : true; var defaults = { trackDocument: false, baseClass: 'jcrop', addClass: null, bgColor: 'black', bgOpacity: .6, borderOpacity: .4, handleOpacity: .5, handlePad: 5, handleSize: 9, handleOffset: 5, edgeMargin: 14, aspectRatio: 0, keySupport: true, cornerHandles: true, sideHandles: true, drawBorders: true, dragEdges: true, boxWidth: 0, boxHeight: 0, boundary: 8, animationDelay: 20, swingSpeed: 3, allowSelect: true, allowMove: true, allowResize: true, minSelect: [0, 0], maxSize: [0, 0], minSize: [0, 0], onChange: function() { }, onSelect: function() { } }; var options = defaults; setOptions(opt); var $origimg = $(obj); var $img = $origimg.clone().removeAttr('id').css({ position: 'absolute' }); $img.width($origimg.width()); $img.height($origimg.height()); $origimg.after($img).hide(); presize($img, options.boxWidth, options.boxHeight); var boundx = $img.width(), boundy = $img.height(), $div = $('<div />').width(boundx).height(boundy).addClass(cssClass('holder')).css({ position: 'relative', backgroundColor: options.bgColor }).insertAfter($origimg).append($img); ; if (options.addClass) $div.addClass(options.addClass); var $img2 = $('<img />').attr('src', $img.attr('src')).css('position', 'absolute').width(boundx).height(boundy); var $img_holder = $('<div />').width(pct(100)).height(pct(100)).css({ zIndex: 310, position: 'absolute', overflow: 'hidden' }).append($img2); var $hdl_holder = $('<div />').width(pct(100)).height(pct(100)).css('zIndex', 320); var $sel = $('<div />').css({ position: 'absolute', zIndex: 300 }).insertBefore($img).append($img_holder, $hdl_holder); var bound = options.boundary; var $trk = newTracker().width(boundx + (bound * 2)).height(boundy + (bound * 2)).css({ position: 'absolute', top: px(-bound), left: px(-bound), zIndex: 290 }).mousedown(newSelection); var xlimit, ylimit, xmin, ymin; var xscale, yscale, enabled = true; var docOffset = getPos($img), btndown, lastcurs, dimmed, animating, shift_down; var Coords = function() { var x1 = 0, y1 = 0, x2 = 0, y2 = 0, ox, oy; function setPressed(pos) { var pos = rebound(pos); x2 = x1 = pos[0]; y2 = y1 = pos[1]; }; function setCurrent(pos) { var pos = rebound(pos); ox = pos[0] - x2; oy = pos[1] - y2; x2 = pos[0]; y2 = pos[1]; }; function getOffset() { return [ox, oy]; }; function moveOffset(offset) { var ox = offset[0], oy = offset[1]; if (0 > x1 + ox) ox -= ox + x1; if (0 > y1 + oy) oy -= oy + y1; if (boundy < y2 + oy) oy += boundy - (y2 + oy); if (boundx < x2 + ox) ox += boundx - (x2 + ox); x1 += ox; x2 += ox; y1 += oy; y2 += oy; }; function getCorner(ord) { var c = getFixed(); switch (ord) { case 'ne': return [c.x2, c.y]; case 'nw': return [c.x, c.y]; case 'se': return [c.x2, c.y2]; case 'sw': return [c.x, c.y2]; } }; function getFixed() { if (!options.aspectRatio) return getRect(); var aspect = options.aspectRatio, min_x = options.minSize[0] / xscale, min_y = options.minSize[1] / yscale, max_x = options.maxSize[0] / xscale, max_y = options.maxSize[1] / yscale, rw = x2 - x1, rh = y2 - y1, rwa = Math.abs(rw), rha = Math.abs(rh), real_ratio = rwa / rha, xx, yy; if (max_x == 0) { max_x = boundx * 10 } if (max_y == 0) { max_y = boundy * 10 } if (real_ratio < aspect) { yy = y2; w = rha * aspect; xx = rw < 0 ? x1 - w : w + x1; if (xx < 0) { xx = 0; h = Math.abs((xx - x1) / aspect); yy = rh < 0 ? y1 - h : h + y1; } else if (xx > boundx) { xx = boundx; h = Math.abs((xx - x1) / aspect); yy = rh < 0 ? y1 - h : h + y1; } } else { xx = x2; h = rwa / aspect; yy = rh < 0 ? y1 - h : y1 + h; if (yy < 0) { yy = 0; w = Math.abs((yy - y1) * aspect); xx = rw < 0 ? x1 - w : w + x1; } else if (yy > boundy) { yy = boundy; w = Math.abs(yy - y1) * aspect; xx = rw < 0 ? x1 - w : w + x1; } } if (xx > x1) { if (xx - x1 < min_x) { xx = x1 + min_x; } else if (xx - x1 > max_x) { xx = x1 + max_x; } if (yy > y1) { yy = y1 + (xx - x1) / aspect; } else { yy = y1 - (xx - x1) / aspect; } } else if (xx < x1) { if (x1 - xx < min_x) { xx = x1 - min_x } else if (x1 - xx > max_x) { xx = x1 - max_x; } if (yy > y1) { yy = y1 + (x1 - xx) / aspect; } else { yy = y1 - (x1 - xx) / aspect; } } if (xx < 0) { x1 -= xx; xx = 0; } else if (xx > boundx) { x1 -= xx - boundx; xx = boundx; } if (yy < 0) { y1 -= yy; yy = 0; } else if (yy > boundy) { y1 -= yy - boundy; yy = boundy; } return last = makeObj(flipCoords(x1, y1, xx, yy)); }; function rebound(p) { if (p[0] < 0) p[0] = 0; if (p[1] < 0) p[1] = 0; if (p[0] > boundx) p[0] = boundx; if (p[1] > boundy) p[1] = boundy; return [p[0], p[1]]; }; function flipCoords(x1, y1, x2, y2) { var xa = x1, xb = x2, ya = y1, yb = y2; if (x2 < x1) { xa = x2; xb = x1; } if (y2 < y1) { ya = y2; yb = y1; } return [Math.round(xa), Math.round(ya), Math.round(xb), Math.round(yb)]; }; function getRect() { var xsize = x2 - x1; var ysize = y2 - y1; if (xlimit && (Math.abs(xsize) > xlimit)) x2 = (xsize > 0) ? (x1 + xlimit) : (x1 - xlimit); if (ylimit && (Math.abs(ysize) > ylimit)) y2 = (ysize > 0) ? (y1 + ylimit) : (y1 - ylimit); if (ymin && (Math.abs(ysize) < ymin)) y2 = (ysize > 0) ? (y1 + ymin) : (y1 - ymin); if (xmin && (Math.abs(xsize) < xmin)) x2 = (xsize > 0) ? (x1 + xmin) : (x1 - xmin); if (x1 < 0) { x2 -= x1; x1 -= x1; } if (y1 < 0) { y2 -= y1; y1 -= y1; } if (x2 < 0) { x1 -= x2; x2 -= x2; } if (y2 < 0) { y1 -= y2; y2 -= y2; } if (x2 > boundx) { var delta = x2 - boundx; x1 -= delta; x2 -= delta; } if (y2 > boundy) { var delta = y2 - boundy; y1 -= delta; y2 -= delta; } if (x1 > boundx) { var delta = x1 - boundy; y2 -= delta; y1 -= delta; } if (y1 > boundy) { var delta = y1 - boundy; y2 -= delta; y1 -= delta; } return makeObj(flipCoords(x1, y1, x2, y2)); }; function makeObj(a) { return { x: a[0], y: a[1], x2: a[2], y2: a[3], w: a[2] - a[0], h: a[3] - a[1] }; }; return { flipCoords: flipCoords, setPressed: setPressed, setCurrent: setCurrent, getOffset: getOffset, moveOffset: moveOffset, getCorner: getCorner, getFixed: getFixed }; } (); var Selection = function() { var start, end, dragmode, awake, hdep = 370; var borders = {}; var handle = {}; var seehandles = false; var hhs = options.handleOffset; if (options.drawBorders) { borders = { top: insertBorder('hline').css('top', $.browser.msie ? px(-1) : px(0)), bottom: insertBorder('hline'), left: insertBorder('vline'), right: insertBorder('vline') }; } if (options.dragEdges) { handle.t = insertDragbar('n'); handle.b = insertDragbar('s'); handle.r = insertDragbar('e'); handle.l = insertDragbar('w'); } options.sideHandles && createHandles(['n', 's', 'e', 'w']); options.cornerHandles && createHandles(['sw', 'nw', 'ne', 'se']); function insertBorder(type) { var jq = $('<div />').css({ position: 'absolute', opacity: options.borderOpacity }).addClass(cssClass(type)); $img_holder.append(jq); return jq; }; function dragDiv(ord, zi) { var jq = $('<div />').mousedown(createDragger(ord)).css({ cursor: ord + '-resize', position: 'absolute', zIndex: zi }); $hdl_holder.append(jq); return jq; }; function insertHandle(ord) { return dragDiv(ord, hdep++).css({ top: px(-hhs + 1), left: px(-hhs + 1), opacity: options.handleOpacity }).addClass(cssClass('handle')); }; function insertDragbar(ord) { var s = options.handleSize, o = hhs, h = s, w = s, t = o, l = o; switch (ord) { case 'n': case 's': w = pct(100); break; case 'e': case 'w': h = pct(100); break; } return dragDiv(ord, hdep++).width(w).height(h).css({ top: px(-t + 1), left: px(-l + 1) }); }; function createHandles(li) { for (i in li) handle[li[i]] = insertHandle(li[i]); }; function moveHandles(c) { var midvert = Math.round((c.h / 2) - hhs), midhoriz = Math.round((c.w / 2) - hhs), north = west = -hhs + 1, east = c.w - hhs, south = c.h - hhs, x, y; 'e' in handle && handle.e.css({ top: px(midvert), left: px(east) }) && handle.w.css({ top: px(midvert) }) && handle.s.css({ top: px(south), left: px(midhoriz) }) && handle.n.css({ left: px(midhoriz) }); 'ne' in handle && handle.ne.css({ left: px(east) }) && handle.se.css({ top: px(south), left: px(east) }) && handle.sw.css({ top: px(south) }); 'b' in handle && handle.b.css({ top: px(south) }) && handle.r.css({ left: px(east) }); }; function moveto(x, y) { $img2.css({ top: px(-y), left: px(-x) }); $sel.css({ top: px(y), left: px(x) }); }; function resize(w, h) { $sel.width(w).height(h); }; function refresh() { var c = Coords.getFixed(); Coords.setPressed([c.x, c.y]); Coords.setCurrent([c.x2, c.y2]); updateVisible(); }; function updateVisible() { if (awake) return update(); }; function update() { var c = Coords.getFixed(); resize(c.w, c.h); moveto(c.x, c.y); options.drawBorders && borders['right'].css({ left: px(c.w - 1) }) && borders['bottom'].css({ top: px(c.h - 1) }); seehandles && moveHandles(c); awake || show(); options.onChange(unscale(c)); }; function show() { $sel.show(); $img.css('opacity', options.bgOpacity); awake = true; }; function release() { disableHandles(); $sel.hide(); $img.css('opacity', 1); awake = false; }; function showHandles() { if (seehandles) { moveHandles(Coords.getFixed()); $hdl_holder.show(); } }; function enableHandles() { seehandles = true; if (options.allowResize) { moveHandles(Coords.getFixed()); $hdl_holder.show(); return true; } }; function disableHandles() { seehandles = false; $hdl_holder.hide(); }; function animMode(v) { (animating = v) ? disableHandles() : enableHandles(); }; function done() { animMode(false); refresh(); }; var $track = newTracker().mousedown(createDragger('move')).css({ cursor: 'move', position: 'absolute', zIndex: 360 }); $img_holder.append($track); disableHandles(); return { updateVisible: updateVisible, update: update, release: release, refresh: refresh, setCursor: function(cursor) { $track.css('cursor', cursor); }, enableHandles: enableHandles, enableOnly: function() { seehandles = true; }, showHandles: showHandles, disableHandles: disableHandles, animMode: animMode, done: done }; } (); var Tracker = function() { var onMove = function() { }, onDone = function() { }, trackDoc = options.trackDocument; if (!trackDoc) { $trk.mousemove(trackMove).mouseup(trackUp).mouseout(trackUp); } function toFront() { $trk.css({ zIndex: 450 }); if (trackDoc) { $(document).mousemove(trackMove).mouseup(trackUp); } } function toBack() { $trk.css({ zIndex: 290 }); if (trackDoc) { $(document).unbind('mousemove', trackMove).unbind('mouseup', trackUp); } } function trackMove(e) { onMove(mouseAbs(e)); }; function trackUp(e) { e.preventDefault(); e.stopPropagation(); if (btndown) { btndown = false; onDone(mouseAbs(e)); options.onSelect(unscale(Coords.getFixed())); toBack(); onMove = function() { }; onDone = function() { }; } return false; }; function activateHandlers(move, done) { btndown = true; onMove = move; onDone = done; toFront(); return false; }; function setCursor(t) { $trk.css('cursor', t); }; $img.before($trk); return { activateHandlers: activateHandlers, setCursor: setCursor }; } (); var KeyManager = function() { var $keymgr = $('<input type="radio" />').css({ position: 'absolute', left: '-30px' }).keypress(parseKey).blur(onBlur), $keywrap = $('<div />').css({ position: 'absolute', overflow: 'hidden' }).append($keymgr); function watchKeys() { if (options.keySupport) { $keymgr.show(); $keymgr.focus(); } }; function onBlur(e) { $keymgr.hide(); }; function doNudge(e, x, y) { if (options.allowMove) { Coords.moveOffset([x, y]); Selection.updateVisible(); }; e.preventDefault(); e.stopPropagation(); }; function parseKey(e) { if (e.ctrlKey) return true; shift_down = e.shiftKey ? true : false; var nudge = shift_down ? 10 : 1; switch (e.keyCode) { case 37: doNudge(e, -nudge, 0); break; case 39: doNudge(e, nudge, 0); break; case 38: doNudge(e, 0, -nudge); break; case 40: doNudge(e, 0, nudge); break; case 27: Selection.release(); break; case 9: return true; } return nothing(e); }; if (options.keySupport) $keywrap.insertBefore($img); return { watchKeys: watchKeys }; } (); function px(n) { return '' + parseInt(n) + 'px'; }; function pct(n) { return '' + parseInt(n) + '%'; }; function cssClass(cl) { return options.baseClass + '-' + cl; }; function getPos(obj) { var pos = $(obj).offset(); return [pos.left, pos.top]; }; function mouseAbs(e) { return [(e.pageX - docOffset[0]), (e.pageY - docOffset[1])]; }; function myCursor(type) { if (type != lastcurs) { Tracker.setCursor(type); lastcurs = type; } }; function startDragMode(mode, pos) { docOffset = getPos($img); Tracker.setCursor(mode == 'move' ? mode : mode + '-resize'); if (mode == 'move') return Tracker.activateHandlers(createMover(pos), doneSelect); var fc = Coords.getFixed(); var opp = oppLockCorner(mode); var opc = Coords.getCorner(oppLockCorner(opp)); Coords.setPressed(Coords.getCorner(opp)); Coords.setCurrent(opc); Tracker.activateHandlers(dragmodeHandler(mode, fc), doneSelect); }; function dragmodeHandler(mode, f) { return function(pos) { if (!options.aspectRatio) switch (mode) { case 'e': pos[1] = f.y2; break; case 'w': pos[1] = f.y2; break; case 'n': pos[0] = f.x2; break; case 's': pos[0] = f.x2; break; } else switch (mode) { case 'e': pos[1] = f.y + 1; break; case 'w': pos[1] = f.y + 1; break; case 'n': pos[0] = f.x + 1; break; case 's': pos[0] = f.x + 1; break; } Coords.setCurrent(pos); Selection.update(); }; }; function createMover(pos) { var lloc = pos; KeyManager.watchKeys(); return function(pos) { Coords.moveOffset([pos[0] - lloc[0], pos[1] - lloc[1]]); lloc = pos; Selection.update(); }; }; function oppLockCorner(ord) { switch (ord) { case 'n': return 'sw'; case 's': return 'nw'; case 'e': return 'nw'; case 'w': return 'ne'; case 'ne': return 'sw'; case 'nw': return 'se'; case 'se': return 'nw'; case 'sw': return 'ne'; }; }; function createDragger(ord) { return function(e) { if (options.disabled) return false; if ((ord == 'move') && !options.allowMove) return false; btndown = true; startDragMode(ord, mouseAbs(e)); e.stopPropagation(); e.preventDefault(); return false; }; }; function presize($obj, w, h) { var nw = $obj.width(), nh = $obj.height(); if ((nw > w) && w > 0) { nw = w; nh = (w / $obj.width()) * $obj.height(); } if ((nh > h) && h > 0) { nh = h; nw = (h / $obj.height()) * $obj.width(); } xscale = $obj.width() / nw; yscale = $obj.height() / nh; $obj.width(nw).height(nh); }; function unscale(c) { return { x: parseInt(c.x * xscale), y: parseInt(c.y * yscale), x2: parseInt(c.x2 * xscale), y2: parseInt(c.y2 * yscale), w: parseInt(c.w * xscale), h: parseInt(c.h * yscale) }; }; function doneSelect(pos) { var c = Coords.getFixed(); if (c.w > options.minSelect[0] && c.h > options.minSelect[1]) { Selection.enableHandles(); Selection.done(); } else { Selection.release(); } Tracker.setCursor(options.allowSelect ? 'crosshair' : 'default'); }; function newSelection(e) { if (options.disabled) return false; if (!options.allowSelect) return false; btndown = true; docOffset = getPos($img); Selection.disableHandles(); myCursor('crosshair'); var pos = mouseAbs(e); Coords.setPressed(pos); Tracker.activateHandlers(selectDrag, doneSelect); KeyManager.watchKeys(); Selection.update(); e.stopPropagation(); e.preventDefault(); return false; }; function selectDrag(pos) { Coords.setCurrent(pos); Selection.update(); }; function newTracker() { var trk = $('<div></div>').addClass(cssClass('tracker')); $.browser.msie && trk.css({ opacity: 0, backgroundColor: 'white' }); return trk; }; function animateTo(a) { var x1 = a[0] / xscale, y1 = a[1] / yscale, x2 = a[2] / xscale, y2 = a[3] / yscale; if (animating) return; var animto = Coords.flipCoords(x1, y1, x2, y2); var c = Coords.getFixed(); var animat = initcr = [c.x, c.y, c.x2, c.y2]; var interv = options.animationDelay; var x = animat[0]; var y = animat[1]; var x2 = animat[2]; var y2 = animat[3]; var ix1 = animto[0] - initcr[0]; var iy1 = animto[1] - initcr[1]; var ix2 = animto[2] - initcr[2]; var iy2 = animto[3] - initcr[3]; var pcent = 0; var velocity = options.swingSpeed; Selection.animMode(true); var animator = function() { return function() { pcent += (100 - pcent) / velocity; animat[0] = x + ((pcent / 100) * ix1); animat[1] = y + ((pcent / 100) * iy1); animat[2] = x2 + ((pcent / 100) * ix2); animat[3] = y2 + ((pcent / 100) * iy2); if (pcent < 100) animateStart(); else Selection.done(); if (pcent >= 99.8) pcent = 100; setSelectRaw(animat); }; } (); function animateStart() { window.setTimeout(animator, interv); }; animateStart(); }; function setSelect(rect) { setSelectRaw([rect[0] / xscale, rect[1] / yscale, rect[2] / xscale, rect[3] / yscale]); }; function setSelectRaw(l) { Coords.setPressed([l[0], l[1]]); Coords.setCurrent([l[2], l[3]]); Selection.update(); }; function setOptions(opt) { if (typeof (opt) != 'object') opt = {}; options = $.extend(options, opt); if (typeof (options.onChange) !== 'function') options.onChange = function() { }; if (typeof (options.onSelect) !== 'function') options.onSelect = function() { }; }; function tellSelect() { return unscale(Coords.getFixed()); }; function tellScaled() { return Coords.getFixed(); }; function setOptionsNew(opt) { setOptions(opt); interfaceUpdate(); }; function disableCrop() { options.disabled = true; Selection.disableHandles(); Selection.setCursor('default'); Tracker.setCursor('default'); }; function enableCrop() { options.disabled = false; interfaceUpdate(); }; function cancelCrop() { Selection.done(); Tracker.activateHandlers(null, null); }; function destroy() { $div.remove(); $origimg.show(); }; function interfaceUpdate(alt) { options.allowResize ? alt ? Selection.enableOnly() : Selection.enableHandles() : Selection.disableHandles(); Tracker.setCursor(options.allowSelect ? 'crosshair' : 'default'); Selection.setCursor(options.allowMove ? 'move' : 'default'); $div.css('backgroundColor', options.bgColor); if ('setSelect' in options) { setSelect(opt.setSelect); Selection.done(); delete (options.setSelect); } if ('trueSize' in options) { xscale = options.trueSize[0] / boundx; yscale = options.trueSize[1] / boundy; } xlimit = options.maxSize[0] || 0; ylimit = options.maxSize[1] || 0; xmin = options.minSize[0] || 0; ymin = options.minSize[1] || 0; if ('outerImage' in options) { $img.attr('src', options.outerImage); delete (options.outerImage); } Selection.refresh(); }; $hdl_holder.hide(); interfaceUpdate(true); var api = { animateTo: animateTo, setSelect: setSelect, setOptions: setOptionsNew, tellSelect: tellSelect, tellScaled: tellScaled, disable: disableCrop, enable: enableCrop, cancel: cancelCrop, focus: KeyManager.watchKeys, getBounds: function() { return [boundx * xscale, boundy * yscale]; }, getWidgetSize: function() { return [boundx, boundy]; }, release: Selection.release, destroy: destroy }; $origimg.data('Jcrop', api); return api; }; $.fn.Jcrop = function(options) { function attachWhenDone(from) { var loadsrc = options.useImg || from.src; var img = new Image(); img.onload = function() { $.Jcrop(from, options); }; img.src = loadsrc; }; if (typeof (options) !== 'object') options = {}; this.each(function() { if ($(this).data('Jcrop')) { if (options == 'api') return $(this).data('Jcrop'); else $(this).data('Jcrop').setOptions(options); } else attachWhenDone(this); }); return this; }; })(jQuery);
//jQZoom
eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('(6($){$.30.31=6(G){I H={17:\'32\',18:2l,19:2l,1a:10,1b:0,Q:"2m",2n:1s,2o:12,2p:0.3,14:1s,1p:12,2q:\'1g\',2r:\'23\',2s:\'24\',2t:\'33\',2u:12,2v:1s,2w:\'34 35\',2x:\'1t\'};G=G||{};$.36(H,G);R 4.37(6(){I a=$(4);I d=a.1q(\'14\');$(a).1Q(\'14\');$(a).J(\'38-K\',\'1r\');$(a).J(\'39-3a\',\'1r\');I f=$(a).1q(\'3b\');I g=$("1H",4);I j=g.1q(\'14\');g.1Q(\'14\');I k=U 25(g);I l={};I m=0;I n=0;I p=1u;p=U 1R();I q=(26(d).Y>0)?d:(26(j).Y>0)?j:1u;I r=U 27();I s=U 1v(a[0].2y);I t=U 1c();I u={};I v=12;I y={};I z=1u;I A=12;I B={};I C=0;I D=12;I E=12;I F=12;k.1I();$(4).3c(6(){R 12});$(4).3d(6(e){B.x=e.1w;B.y=e.1x;k.1S();1d()},6(){k.1S();2z()});8(H.1p){2A(6(){1d()},3e)}6 1d(){8(!A){k.28();A=1s;j=g.1q(\'14\');g.1Q(\'14\');d=a.1q(\'14\');$(a).1Q(\'14\');s=U 1v(a[0].2y);8(!v||$.1e.2B){s.1I()}V{8(H.17!=\'1j\'){z=U 1J();z.1d()}t=U 1c;t.1d()}a[0].3f();R 12}};6 2z(){8(H.17==\'1K\'&&!H.1p){g.J({\'1T\':1})}8(!H.1p){A=12;v=12;$(t.5).29(\'1L\');t.Z();8($(\'P.1M\').Y>0){z.Z()}8($(\'P.2a\').Y>0){r.Z()}g.1q(\'14\',j);a.1q(\'14\',d);$().29();a.29(\'1L\');C=0;8(1y(\'.2b\').Y>0){1y(\'.2b\').Z()}}V{8(H.2o){1k(H.17){11\'1j\':s.2c();N;1l:t.1t();N}}}8(H.1p){1d()}};6 25(c){4.5=c[0];4.1I=6(){4.5.1m=c[0].1m};4.28=6(){I a=\'\';a=$(g).J(\'2C-L-W\');m=\'\';I b=\'\';b=$(g).J(\'2C-M-W\');n=\'\';8(a){1U(i=0;i<3;i++){I x=[];x=a.1n(i,1);8(1V(x)==12){m=m+\'\'+a.1n(i,1)}V{N}}}8(b){1U(i=0;i<3;i++){8(!1V(b.1n(i,1))){n=n+b.1n(i,1)}V{N}}}m=(m.Y>0)?1W(m):0;n=(n.Y>0)?1W(n):0};4.5.2D=6(){a.J({\'2E\':\'2F\',\'1h\':\'1X\'});8(a.J(\'Q\')!=\'15\'&&a.2d().J(\'Q\')){a.J({\'2E\':\'2F\',\'Q\':\'2G\',\'1h\':\'1X\'})}8(a.2d().J(\'Q\')!=\'15\'){a.2d().J(\'Q\',\'2G\')}V{}8($.1e.2B||$.1e.3g){$(g).J({Q:\'15\',L:\'2H\',M:\'2H\'})}l.w=$(4).W();l.h=$(4).1f();l.9=$(4).1i();l.9.l=$(4).1i().M;l.9.t=$(4).1i().L;l.9.r=l.w+l.9.l;l.9.b=l.h+l.9.t;a.1f(l.h);a.W(l.w);8(H.2u){k.1S();s.1I()}};R 4};25.13.1S=6(){l.9=$(g).1i();l.9.l=$(g).1i().M;l.9.t=$(g).1i().L;l.9.r=l.w+l.9.l;l.9.b=l.h+l.9.t};6 1c(){4.5=16.2e("P");$(4.5).1Y(\'X\');4.5.3h=6(){$(t.5).Z();t=U 1c();t.1d()};4.2I=6(){1k(H.17){11\'1K\':4.1z=U 1Z();4.1z.1m=k.5.1m;4.5.1N(4.1z);$(4.5).J({\'1T\':1});N;11\'1j\':4.1z=U 1Z();4.1z.1m=s.5.1m;4.5.1N(4.1z);$(4.5).J({\'1T\':1});N;1l:N}1k(H.17){11\'1j\':u.w=l.w;u.h=l.h;N;1l:u.w=(H.18)/y.x;u.h=(H.19)/y.y;N}$(4.5).J({W:u.w+\'S\',1f:u.h+\'S\',Q:\'15\',1h:\'1r\',3i:1+\'S\'});a.3j(4.5)};R 4};1c.13.1d=6(){4.2I();1k(H.17){11\'1K\':g.J({\'1T\':H.2p});(H.1p)?t.1t():t.1o(1u);a.2f(\'1L\',6(e){B.x=e.1w;B.y=e.1x;t.1o(e)});N;11\'1j\':$(4.5).J({L:0,M:0});8(H.14){r.2g()}s.2c();a.2f(\'1L\',6(e){B.x=e.1w;B.y=e.1x;s.2J(e)});N;1l:(H.1p)?t.1t():t.1o(1u);$(a).2f(\'1L\',6(e){B.x=e.1w;B.y=e.1x;t.1o(e)});N}R 4};1c.13.1o=6(e){8(e){B.x=e.1w;B.y=e.1x}8(C==0){I b=(l.w)/2-(u.w)/2;I c=(l.h)/2-(u.h)/2;$(\'P.X\').1g();8(H.2n){4.5.K.20=\'2K\'}V{4.5.K.20=\'2h\';$(\'P.X\').23()}C=1}V{I b=B.x-l.9.l-(u.w)/2;I c=B.y-l.9.t-(u.h)/2}8(2L()){b=0+n}V 8(2M()){8($.1e.1O&&$.1e.2i<7){b=l.w-u.w+n-1}V{b=l.w-u.w+n-1}}8(2N()){c=0+m}V 8(2O()){8($.1e.1O&&$.1e.2i<7){c=l.h-u.h+m-1}V{c=l.h-u.h-1+m}}b=1A(b);c=1A(c);$(\'P.X\',a).J({L:c,M:b});8(H.17==\'1K\'){$(\'P.X 1H\',a).J({\'Q\':\'15\',\'L\':-(c-m+1),\'M\':-(b-n+1)})}4.5.K.M=b+\'S\';4.5.K.L=c+\'S\';s.1o();6 2L(){R B.x-(u.w+2*1)/2-n<l.9.l}6 2M(){R B.x+(u.w+2*1)/2>l.9.r+n}6 2N(){R B.y-(u.h+2*1)/2-m<l.9.t}6 2O(){R B.y+(u.h+2*1)/2>l.9.b+m}R 4};1c.13.1t=6(){$(\'P.X\',a).J(\'1h\',\'1r\');I b=(l.w)/2-(u.w)/2;I c=(l.h)/2-(u.h)/2;4.5.K.M=b+\'S\';4.5.K.L=c+\'S\';$(\'P.X\',a).J({L:c,M:b});8(H.17==\'1K\'){$(\'P.X 1H\',a).J({\'Q\':\'15\',\'L\':-(c-m+1),\'M\':-(b-n+1)})}s.1o();8($.1e.1O){$(\'P.X\',a).1g()}V{2A(6(){$(\'P.X\').2P(\'24\')},10)}};1c.13.1P=6(){I o={};o.M=1A(4.5.K.M);o.L=1A(4.5.K.L);R o};1c.13.Z=6(){8(H.17==\'1j\'){$(\'P.X\',a).2Q(\'24\',6(){$(4).Z()})}V{$(\'P.X\',a).Z()}};1c.13.28=6(){I a=\'\';a=$(\'P.X\').J(\'3k\');1B=\'\';I b=\'\';b=$(\'P.X\').J(\'3l\');1C=\'\';8($.1e.1O){I c=a.2R(\' \');a=c[1];I c=b.2R(\' \');b=c[1]}8(a){1U(i=0;i<3;i++){I x=[];x=a.1n(i,1);8(1V(x)==12){1B=1B+\'\'+a.1n(i,1)}V{N}}}8(b){1U(i=0;i<3;i++){8(!1V(b.1n(i,1))){1C=1C+b.1n(i,1)}V{N}}}1B=(1B.Y>0)?1W(1B):0;1C=(1C.Y>0)?1W(1C):0};6 1v(a){4.2S=a;4.5=U 1Z();4.1I=6(){8(!4.5)4.5=U 1Z();4.5.K.Q=\'15\';4.5.K.1h=\'1r\';4.5.K.M=\'-3m\';4.5.K.L=\'3n\';p=U 1R();8(H.2v&&!D){p.1g();D=1s}16.2j.1N(4.5);4.5.1m=4.2S};4.5.2D=6(){4.K.1h=\'1X\';I w=O.21($(4).W());I h=O.21($(4).1f());4.K.1h=\'1r\';y.x=(w/l.w);y.y=(h/l.h);8($(\'P.1D\').Y>0){$(\'P.1D\').Z()}v=1s;8(H.17!=\'1j\'&&A){z=U 1J();z.1d()}8(A){t=U 1c();t.1d()}8($(\'P.1D\').Y>0){$(\'P.1D\').Z()}};R 4};1v.13.1o=6(){4.5.K.M=O.1E(-y.x*1A(t.1P().M)+n)+\'S\';4.5.K.L=O.1E(-y.y*1A(t.1P().L)+m)+\'S\'};1v.13.2J=6(e){4.5.K.M=O.1E(-y.x*O.T(e.1w-l.9.l))+\'S\';4.5.K.L=O.1E(-y.y*O.T(e.1x-l.9.t))+\'S\';$(\'P.X 1H\',a).J({\'Q\':\'15\',\'L\':4.5.K.L,\'M\':4.5.K.M})};1v.13.2c=6(){4.5.K.M=O.1E(-y.x*O.T((l.w)/2))+\'S\';4.5.K.L=O.1E(-y.y*O.T((l.h)/2))+\'S\';$(\'P.X 1H\',a).J({\'Q\':\'15\',\'L\':4.5.K.L,\'M\':4.5.K.M})};6 1J(){I a=1y(g).1i().M;I b=1y(g).1i().L;4.5=16.2e("P");$(4.5).1Y(\'1M\');$(4.5).J({Q:\'15\',W:O.21(H.18)+\'S\',1f:O.21(H.19)+\'S\',1h:\'1r\',2T:3o,3p:\'2h\'});1k(H.Q){11"2m":a=(a+$(g).W()+O.T(H.1a)+H.18<$(16).W())?(a+$(g).W()+O.T(H.1a)):(a-H.18-10);1F=b+H.1b+H.19;b=(1F<$(16).1f()&&1F>0)?b+H.1b:b;N;11"M":a=(l.9.l-O.T(H.1a)-H.18>0)?(l.9.l-O.T(H.1a)-H.18):(l.9.l+l.w+10);1F=l.9.t+H.1b+H.19;b=(1F<$(16).1f()&&1F>0)?l.9.t+H.1b:l.9.t;N;11"L":b=(l.9.t-O.T(H.1b)-H.19>0)?(l.9.t-O.T(H.1b)-H.19):(l.9.t+l.h+10);1G=l.9.l+H.1a+H.18;a=(1G<$(16).W()&&1G>0)?l.9.l+H.1a:l.9.l;N;11"3q":b=(l.9.b+O.T(H.1b)+H.19<$(16).1f())?(l.9.b+O.T(H.1b)):(l.9.t-H.19-10);1G=l.9.l+H.1a+H.18;a=(1G<$(16).W()&&1G>0)?l.9.l+H.1a:l.9.l;N;1l:a=(l.9.l+l.w+H.1a+H.18<$(16).W())?(l.9.l+l.w+O.T(H.1a)):(l.9.l-H.18-O.T(H.1a));b=(l.9.b+O.T(H.1b)+H.19<$(16).1f())?(l.9.b+O.T(H.1b)):(l.9.t-H.19-O.T(H.1b));N}4.5.K.M=a+\'S\';4.5.K.L=b+\'S\';R 4};1J.13.1d=6(){8(!4.5.3r)4.5.1N(s.5);8(H.14){r.2g()}16.2j.1N(4.5);1k(H.2q){11\'1g\':$(4.5).1g();N;11\'3s\':$(4.5).2P(H.2s);N;1l:$(4.5).1g();N}$(4.5).1g();8($.1e.1O&&$.1e.2i<7){4.3t=$(\'<2U 3u="2b" 3v="3w" 3x="0"  1m="#"  K="3y-3z: 2V" 3A="2V"></2U>\').J({Q:"15",M:4.5.K.M,L:4.5.K.L,2T:3B,W:(H.18+2),1f:(H.19)}).3C(4.5)};s.5.K.1h=\'1X\'};1J.13.Z=6(){1k(H.2r){11\'23\':$(\'.1M\').Z();N;11\'3D\':$(\'.1M\').2Q(H.2t);N;1l:$(\'.1M\').Z();N}};6 27(){4.5=1y(\'<P />\').1Y(\'2a\').2W(\'\'+q+\'\');4.2g=6(){8(H.17==\'1j\'){$(4.5).J({Q:\'15\',L:l.9.b+3,M:(l.9.l+1),W:l.w}).2k(\'2j\')}V{$(4.5).2k(z.5)}}};27.13.Z=6(){$(\'.2a\').Z()};6 1R(){4.5=16.2e("P");$(4.5).1Y(\'1D\');$(4.5).2W(H.2w);$(4.5).2k(a).J(\'20\',\'2h\');4.1g=6(){1k(H.2x){11\'1t\':2X=(l.h-$(4.5).1f())/2;2Y=(l.w-$(4.5).W())/2;$(4.5).J({L:2X,M:2Y});N;1l:I a=4.1P();N}$(4.5).J({Q:\'15\',20:\'2K\'})};R 4};1R.13.1P=6(){I o=1u;o=$(\'P.1D\').1i();R o}})}})(1y);6 26(a){2Z(a.22(0,1)==\' \'){a=a.22(1,a.Y)}2Z(a.22(a.Y-1,a.Y)==\' \'){a=a.22(0,a.Y-1)}R a};', 62, 226, '||||this|node|function||if|pos|||||||||||||||||||||||||||||||||||var|css|style|top|left|break|Math|div|position|return|px|abs|new|else|width|jqZoomPup|length|remove||case|false|prototype|title|absolute|document|zoomType|zoomWidth|zoomHeight|xOffset|yOffset|Lens|activate|browser|height|show|display|offset|innerzoom|switch|default|src|substr|setposition|alwaysOn|attr|none|true|center|null|Largeimage|pageX|pageY|jQuery|image|parseInt|lensbtop|lensbleft|preload|ceil|topwindow|leftwindow|img|loadimage|Stage|reverse|mousemove|jqZoomWindow|appendChild|msie|getoffset|removeAttr|Loader|setpos|opacity|for|isNaN|eval|block|addClass|Image|visibility|round|substring|hide|fast|Smallimage|trim|zoomTitle|findborder|unbind|jqZoomTitle|zoom_ieframe|setcenter|parent|createElement|bind|loadtitle|hidden|version|body|appendTo|200|right|lens|lensReset|imageOpacity|showEffect|hideEffect|fadeinSpeed|fadeoutSpeed|preloadImages|showPreload|preloadText|preloadPosition|href|deactivate|setTimeout|safari|border|onload|cursor|crosshair|relative|0px|loadlens|setinner|visible|overleft|overright|overtop|overbottom|fadeIn|fadeOut|split|url|zIndex|iframe|transparent|html|loadertop|loaderleft|while|fn|jqzoom|standard|slow|Loading|zoom|extend|each|outline|text|decoration|rel|click|hover|150|blur|opera|onerror|borderWidth|append|borderTop|borderLeft|5000px|10px|10000|overflow|bottom|firstChild|fadein|ieframe|class|name|content|frameborder|background|color|bgcolor|99|insertBefore|fadeout'.split('|'), 0, {}))
//xheditor
$(function() {
    $(".edit").xheditor({
        tools: 'Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,Removeformat,Align,List,Outdent,Indent,Link,Unlink,Table,Img,Fullscreen,Source',
        forcePtag: false,
        upImgUrl: '!{editorRoot}Upload.aspx',
        modalWidth: 800,
        modalHeight: 600,
        //beforeSetSource: ubb2html,
        //beforeGetSource: html2ubb,
        layerShadow: 0
    });
});
//datepicker
$(function() {
    $(".datepicker").datepicker();
});
//////jqzoom
////$(function() {
////    $(".zoomImg").jqzoom({
////        zoomWidth: 250,
////        zoomHeight: 250,
////        title: false,
////        showPreload: false
////    });
////});
//ajaxwebservice
$.extend({
    ajaxWebService: function(url, data, fun) {
        $.ajax({
            type: "POST",
            contentType: "application/json",
            url: url,
            data: data,
            dataType: "json",
            success: fun
        });
    }
});
//tableGrid
$(function() {
    $(".table_frame").find("tr:not(.header):not(.footer)").find("td:even").addClass("table_trLeft");
    $(".table_frame").find("tr:not(.header):not(.footer)").find("td:odd").addClass("table_trRight");
    $(".table_grid").find("tr:even:not(.header):not(.footer)").addClass("trEven");
    $(".table_grid").find("tr:odd:not(.header):not(.footer)").addClass("trOdd");
    $(".table_grid").find("tr:not(.header):not(.footer)").hover(function() { $(this).addClass("hover") }, function() { $(this).removeClass("hover") });
    $(".table_grid").find(".footer").find("a:disabled").addClass("footerA2");
    $(".table_grid").find(".footer").find("span").addClass("footerA3");
    $(".table_grid").find(".footer").find("a:not(:disabled),select").addClass("footerA1");
    $("input[type='text'],input[type='password'],select,textarea").addClass("input");
    $("select").css("padding", "1px");
    $(":text,:password,select,textarea").focus(function() {
        $(this).addClass("focus");
    }).blur(function() {
        $(this).removeClass("focus");
    });
    $(".tssc").click(function() {
        if (confirm("确定删除？")) {
            return true;
        }
        else {
            return false;
        }
    });
    $(".tshy").click(function() {
        if (confirm("确定还原数据库？")) {
            return true;
        }
        else {
            return false;
        }
    });
});
//validate
$.validator.addMethod("idcard", function(value, element) {
    var zz = /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{4}$/;
    return this.optional(element) || zz.test(value);
}, "请正确输入身份证号码");

// 手机号码验证
$.validator.addMethod("mobile", function(value, element) {
    var zz = value.length;
    return this.optional(element) || (zz == 11 && /^(((13[0-9]{1})|(15[0-9]{1}))+\d{8})$/.test(value));
}, "请正确输入手机号码");

// 电话号码验证
$.validator.addMethod("phone", function(value, element) {
    var zz = /^(\d{3,4}-?)?\d{7,9}$/g;
    return this.optional(element) || (zz.test(value));
}, "请正确输入电话号码");

// 邮政编码验证
$.validator.addMethod("zipcode", function(value, element) {
    var zz = /^[0-9]{6}$/;
    return this.optional(element) || (zz.test(value));
}, "请正确输入邮政编码");

// 价格
$.validator.addMethod("price", function(value, element) {
    var zz = /^\d+(\.\d{1,2})?$/;
    return this.optional(element) || (zz.test(value));
}, "请正确输入价格");

$(function() { $("#form1").validate(); });
//全选
function SelCheckBox() {
    $(".table_grid :checkbox").each(function(i) {
        $(this).attr("checked", "checked");
    });
}
//反选
function NoneCheckBox() {
    $(".table_grid :checkbox").each(function(i) {
        if ($(this).attr("checked")) {
            $(this).removeAttr("checked");
        } else {
            $(this).attr("checked", "checked");
        }
    });
}
//imgZoom
$(function() {
    $(".imageZoom").hover(function() {
        var left = parseFloat($(this).offset().left) + parseFloat($(this).width()) + 5;
        var top = $(this).offset().top;
        $("body").append("<img id=\"iz\" src=\"" + $(this).attr("src") + "\" style=\" position:absolute; left:" + left + "px; top:" + top + "px;\" />");
    }, function() {
        $("#iz").remove();
    });
});
//showandhide
function gridBj(obj) {
    $(".gridQx").hide();
    $(".gridBj").show();
    $(obj).parent().parent().parent().find(".gridQx").show();
    $(obj).parent().parent().parent().find(".gridBj").hide();
}
function gridQx(obj) {
    $(".gridQx").hide();
    $(".gridBj").show();
}
//showBox
function showBox(boxWhidth, boxContent) {
    $("body").append("<div id=\"box\" style=\"z-index:9999999; margin-right:50px; position:absolute; zoom: 1; top:0; left:0; padding:5px; border:6px solid #777; background:#fff; display:none; \">" + boxContent + "<div onclick=\"closeBox();\" id=\"boxClose\" style=\"position:absolute; width:16px; height:30px; background:#777; color:#fff; padding-top:8px; cursor:pointer; font-weight:bolder;\">关闭</div></div><div id=\"boxBj\" style=\" z-index:9999998; position:absolute; opacity:0.5; filter:alpha(opacity=50); -moz-opacity: 0.5; background:#ccc; width: 100%; zoom:1; top:0; left:0;\"></div>");
    $("#box").css({ "width": boxWhidth.toString() + "px" });
    updateBox();
    $("#box").show();
}
function closeBox() {
    $("#box,#boxBj").remove();
}
$(function(){
    $(window).resize(function() { updateBox2(); }).scroll(function() { updateBox2(); });
});
function updateBox() {
    $("#boxBj").css("height", parseInt(document.documentElement.scrollHeight));
    $("#boxBj").css("width", parseInt(document.documentElement.clientWidth));
    var left = parseInt(document.documentElement.clientWidth) / 2 - parseInt($("#box").width()) / 2;
    var top = parseInt(document.documentElement.scrollTop) + 15;  //parseInt(document.documentElement.scrollTop) + parseInt(document.documentElement.clientHeight) / 2 - parseInt($("#box").height()) / 2;//垂直居中
    if (left < 0) {
        left = 0;
    }
    if (top < 0) {
        top = 0;
    }
    $("#box").css({ "left": left, "top": top });
    $("#boxClose").css({ "left": parseInt($("#box").width()) + 16, "top": -6 });
}
function updateBox2() {
    $("#boxBj").css("height", parseInt(document.documentElement.scrollHeight));
    $("#boxBj").css("width", parseInt(document.documentElement.clientWidth));
}
//upload
$(function() {
    $("input[upload]").each(function() {
        $(this).hide();
        var _img = "";
        if ($.trim($(this).val()) != "") {
            _img = $(this).val().substring($(this).val().lastIndexOf('/') + 1);
        }
        $(this).before("<div id=\"div" + $(this).attr("id") + "\" style=\" margin-bottom:5px;\" >" + _img + "</div><a class=\"btA\" href=\"javascript:upLoadFile('" + $(this).attr("upload") + "','" + $(this).attr("id") + "');\">上传通道</a> ");
    });
});
function upLoadFile(type,txtSelect) {
    showBox("400", '<div style="line-height:30px; padding:5px 0px 10px 0px;"><p>1、选择要上传的文件：</p><span id="upload1"  style="color:#900;">上传通道加载中...</span><p>仅支持 ' + type + ' 格式文件</p><div id="uploadInfo"></div></div>');
    $("#upload1").uploadify({
        'uploader': toolsPath() + 'flash/uploadify2.swf',
        'cancelImg': toolsPath() + 'images/cancel.png',
        'buttonImg': toolsPath() + 'images/selectFile.png',
        'width': 74,
        'height': 12,
        'script': toolsPath() + 'Upload.ashx',
        'fileExt': type,
        'fileDesc': type,
        'sizeLimit': 1073741824, //1G
        'simUploadLimit': 10,
        'multi': false,
        'auto': true,
        'onSelect': function(a, b, c) { },
        'onComplete': function(a, b, c, d, e) {
            $(".uploadifyQueueItem").remove();
            $("#" + txtSelect).val(c.filePath);
            $("#div" + txtSelect).html(c.filePath.substring(c.filePath.lastIndexOf('/') + 1));
            $(".uploadifyQueueItem").remove();
            var _cutcontent1 = '<p>2、上传成功！ <span onclick="closeBox();" style="cursor:pointer; color:#900; text-decoration:underline; font-weight:bolder;">关闭</span></p>';
            $("#uploadInfo").html(_cutcontent1);
        }
    });
}
//cutImg
$(function() {
    $("input[cutImg]").each(function() {
        $(this).hide();
        var _img = "";
        if ($.trim($(this).val()) != "") {
            _img = "<img style=\"border:1px solid #7F9DB9;\" src=\"" + $.trim($(this).val()) + "\" />";
        }
        if ($.trim($(this).attr("cutImg").toString()) == "" || $.trim($(this).attr("cutImg").toString()) == "{}") {
            $(this).before("<div id=\"div" + $(this).attr("id") + "\" style=\" margin-bottom:5px;\" >" + _img + "</div><a class=\"btA\" href=\"javascript:cutImg('','','" + $(this).attr("id") + "','');\">图片上传通道</a> ");
        }
        else {
            $(this).before("<div id=\"div" + $(this).attr("id") + "\" style=\" margin-bottom:5px;\" >" + _img + "</div><a class=\"btA\" href=\"javascript:cutImg('" + $.trim($(this).attr("cutImg")).split(',')[0] + "','" + $.trim($(this).attr("cutImg")).split(',')[1] + "','" + $(this).attr("id") + "','');\">图片上传通道</a> ");
        }
    });
    $("input[minImg]").each(function() {
        var _minimg = $.trim($(this).attr("minImg")).split('|');
        $(_minimg).each(function() {
            var _width = this.split(',')[0];
            var _height = this.split(',')[1];
            var _select = this.split(',')[2];
            $("#" + _select).hide();
            var _img = "";
            if ($.trim($("#" + _select).val()) != "") {
                _img = "<img style=\"border:1px solid #7F9DB9;\" src=\"" + $.trim($("#" + _select).val()) + "\" />";
            } else {
                _img = "无缩略图";
            }
            $("#" + _select).before("<div id=\"div" + _select + "\" >" + _img + "</div><div>(自动生成)<div>");
        });
    });
});
function cutImg(imgWidth, imgHeight, txtSelect, returnIfarme) {
    var _toPath = "?1=1";
    if (returnIfarme != "") {
        _toPath = "?p=" + returnIfarme;
    }
    showBox("400", '<div style="line-height:30px; padding:5px 0px 10px 0px;"><p>1、选择要上传的文件：</p><span id="upload1"  style="color:#900;">上传通道加载中...</span><p>仅支持JPG、GIF、PNG、BMP图像文件</p><div id="cutImgInfo"></div></div>');
    $("#upload1").uploadify({
        'uploader': toolsPath() + 'flash/uploadify2.swf',
        'cancelImg': toolsPath() + 'images/cancel.png',
        'buttonImg': toolsPath() + 'images/selectFile.png',
        'width': 74,
        'height': 12,
        'script': toolsPath() + 'Upload.ashx' + _toPath,
        'fileExt': '*.jpg;*.jpeg;*.gif;*.png;*bmp',
        'fileDesc': '*.jpg;*.jpeg;*.gif;*.png;*bmp',
        'sizeLimit': 1073741824, //1G
        'simUploadLimit': 10,
        'multi': false,
        'auto': true,
        'onSelect': function(a, b, c) { },
        'onComplete': function(a, b, c, d, e) {
            $(".uploadifyQueueItem").remove();
            var _cutcontent1 = "<p style=\"color:#900;\">图片加载中...</p>";
            $("#cutImgInfo").html(_cutcontent1);
            showCutContent(c.filePath, imgWidth, imgHeight, txtSelect, returnIfarme);
        }
    });
}
function showCutContent(src, imgWidth, imgHeight, txtSelect, returnIfarme) {
    var imgID = new Image();
    imgID.src = src + "?" + Math.random();
    imgID.onload = function() {
        var _zjsc = 'toTpSrc(\'' + src + '\',\'' + txtSelect + '\');';
        if (returnIfarme != "") {
            _zjsc = 'toTpSrc2(\'' + src + '\',\'' + txtSelect + '\',\'' + returnIfarme + '\');';
        }
        var _cutcontent2 = '<p>2、图片剪裁：</p><p>如果是GIF动画，请点击<span onclick="' + _zjsc + '" style="cursor:pointer; color:#900; text-decoration:underline; font-weight:bolder;">直接上传</span></p><p><span onclick="toRL(\'' + src + '\',\'' + imgWidth + '\',\'' + imgHeight + '\',\'' + txtSelect + '\',\'' + returnIfarme + '\');" style=" cursor:pointer; color:#900; text-decoration:underline; font-weight:bolder;">逆时针旋转</span>&nbsp;&nbsp;<span onclick="toRR(\'' + src + '\',\'' + imgWidth + '\',\'' + imgHeight + '\',\'' + txtSelect + '\',\'' + returnIfarme + '\');" style=" cursor:pointer; color:#900; text-decoration:underline; font-weight:bolder;">顺时针旋转</span></p><p>宽度：<span id="j_w">0</span>，高度：<span id="j_h">0</span>&nbsp;&nbsp;<span id="tjtp" style="display:none; cursor:pointer; color:#900; text-decoration:underline; font-weight:bolder;">点击提交裁剪图片</span></p><img style=\"border:1px solid #7F9DB9;\" id="cutImg1" src="' + imgID.src + '" /><p>裁剪效果图：<p><div style="width:0px;height:0px;overflow:hidden;" id="preview"><img style=\"border:1px solid #7F9DB9;\" src="' + imgID.src + '" /></div>';
        $("#cutImgInfo").html(_cutcontent2);
        if ($.trim(imgWidth) != "") {
            if (parseInt($.trim(imgWidth)) > 398) {
                var w1 = parseInt($.trim(imgWidth));
                $("#box").width(parseInt(w1) + 2);
            }
            else {
                $("#box").width(400);
            }
        }
        else {
            $("#box").width(400);
        }
        updateBox();
        if ($.trim(imgWidth) != "" && $.trim(imgHeight) != "") {
            $("#cutImg1").Jcrop({
                onChange: function(c) {
                    $("#j_w").html(c.w);
                    $("#j_h").html(c.h);
                    if (parseInt(c.w) > 0 && parseInt(c.h) > 0) {
                        $("#preview").width(parseInt(imgWidth));
                        $("#preview").height(parseInt(imgHeight));
                        var rx = parseInt(imgWidth) / c.w;
                        var ry = parseInt(imgHeight) / c.h;
                        var iw = parseInt($("#cutImg1").width());
                        var ih = parseInt($("#cutImg1").height());
                        $('#preview img').css({
                            width: Math.round(rx * iw) + 'px',
                            height: Math.round(ry * ih) + 'px',
                            marginLeft: '-' + Math.round(rx * c.x) + 'px',
                            marginTop: '-' + Math.round(rx * c.y) + 'px'
                        });
                        $("#tjtp").show();
                        $("#tjtp").unbind("click");
                        $("#tjtp").click(function() {
                            tjtp(src, c.x, c.y, c.w, c.h, imgWidth, imgHeight, txtSelect, returnIfarme);
                        });
                    }
                    else {
                        $("#preview").width(0);
                        $("#preview").height(0);
                        $("#tjtp").hide();
                    }
                },
                aspectRatio: parseInt(imgWidth) / parseInt(imgHeight),
                boxWidth: parseInt($.trim(imgWidth)) > 398 ? parseInt($.trim(imgWidth)) : 398
            });
        }
        else {
            $("#cutImg1").Jcrop({
                onChange: function(c) {
                    $("#j_w").html(c.w);
                    $("#j_h").html(c.h);
                    if (parseInt(c.w) > 0 && parseInt(c.h) > 0) {
                        $("#preview").width(parseInt(c.w));
                        $("#preview").height(parseInt(c.h));
                        $('#preview img').css({
                            width: Math.round($("#cutImg1").width()) + 'px',
                            height: Math.round($("#cutImg1").height()) + 'px',
                            marginLeft: '-' + Math.round(c.x) + 'px',
                            marginTop: '-' + Math.round(c.y) + 'px'
                        });
                        $("#tjtp").show();
                        $("#tjtp").unbind("click");
                        $("#tjtp").click(function() {
                            tjtp(src, c.x, c.y, c.w, c.h, "", "", txtSelect, returnIfarme);
                        });
                        var _w2 = parseInt(c.w) > 398 ? parseInt(c.w) : 398;
                        $("#box").width(_w2 + 2);
                        updateBox();
                    }
                    else {
                        $("#preview").width(0);
                        $("#preview").height(0);
                        $("#tjtp").hide();
                    }
                },
                onSelect: function(c) {
                    updateBox();
                },
                boxWidth: 398
            });
        }
    };
}
function toRL(src, imgWidth, imgHeight, txtSelect, returnIfarme) {
    $(".uploadifyQueueItem").remove();
    var _cutcontent1 = "<p style=\"color:#900;\">图片加载中...</p>";
    $("#cutImgInfo").html(_cutcontent1);
    $.get(toolsPath() + "CutImg.ashx?t=r&a=-90&s=" + src + "&" + Math.random(), function(data) {
        if ($.trim(data) != "success") {
            alert(data);
        }
        else {
            showCutContent(src, imgWidth, imgHeight, txtSelect, returnIfarme);
        }
    });
}
function toRR(src, imgWidth, imgHeight, txtSelect, returnIfarme) {
    $(".uploadifyQueueItem").remove();
    var _cutcontent1 = "<p style=\"color:#900;\">图片加载中...</p>";
    $("#cutImgInfo").html(_cutcontent1);
    $.get(toolsPath() + "CutImg.ashx?t=r&a=90&s=" + src + "&" + Math.random(), function(data) {
        if ($.trim(data) != "success") {
            alert(data);
        }
        else {
            showCutContent(src, imgWidth, imgHeight, txtSelect, returnIfarme);
        }
    });
}
function tjtp(src, x, y, w, h, w2, h2, txtSelect, returnIfarme) {
    if (w2 != "" && h2 != "") {
        $.get(toolsPath() + "CutImg.ashx?t=g&s=" + src + "&x=" + x + "&y=" + y + "&w=" + w + "&h=" + h + "&w2=" + w2 + "&h2=" + h2 + "&" + Math.random(), function(data) {
            if ($.trim(data) != "success") {
                alert(data);
            }
            else {
                if (returnIfarme == "") {
                    toTpSrc(src, txtSelect);
                } else {
                    toTpSrc2(src, txtSelect, returnIfarme);
                }
            }
        });
    } else {
    $.get(toolsPath() + "CutImg.ashx?t=g&s=" + src + "&x=" + x + "&y=" + y + "&w=" + w + "&h=" + h + "&" + Math.random(), function(data) {
        if ($.trim(data) != "success") {
            alert(data);
        }
        else {
            if (returnIfarme == "") {
                toTpSrc(src, txtSelect);
            } else {
                toTpSrc2(src, txtSelect, returnIfarme);
            }
        }
    });
    }
}
function toTpSrc(src, txtSelect) {
    closeBox();
    $("#" + txtSelect).val(src);
    $("#div" + txtSelect).html("<img style=\"border:1px solid #7F9DB9;\" src=\"" + src + "\" />");
    $("#" + txtSelect + "[minImg]").each(function() {
        var _this = this;
        var _minimg = $.trim($(this).attr("minImg")).split('|');
        $(_minimg).each(function() {
            var _width = this.split(',')[0];
            var _height = this.split(',')[1];
            var _select = this.split(',')[2];
            if ($.trim($(_this).val()) == "") {
                $("#div" + _select).html("无缩略图");
                $("#" + _select).val("");
            } else {
                $.get(toolsPath() + "CutImg.ashx?t=t&s=" + $.trim($(_this).val()) + "&w=" + _width + "&h=" + _height + "&" + Math.random(), function(data) {
                    $("#div" + _select).html("<img style=\"border:1px solid #7F9DB9;\" src=\"" + data + "\" />");
                    $("#" + _select).val(data);
                });
            }
        });
    });
}
function toTpSrc2(src, txtSelect, returnIfarme) {
    closeBox();
    $(".xheModalClose").trigger("click");
    $(".xheText").val(src);
}
