﻿/*Easy Slider*/
(function ($) { $.fn.easySlider = function (m) { var n = { prevId: 'prevBtn', prevText: 'Previous', nextId: 'nextBtn', nextText: 'Next', controlsShow: true, controlsBefore: '', controlsAfter: '', controlsFade: true, firstId: 'firstBtn', firstText: 'First', firstShow: false, lastId: 'lastBtn', lastText: 'Last', lastShow: false, vertical: false, speed: 800, auto: false, pause: 2000, continuous: false, numeric: false, numericId: 'controls' }; var m = $.extend(n, m); this.each(function () { var f = $(this); var s = $("li", f).length; var w = $("li", f).width(); var h = $("li", f).height(); var g = true; f.width(w); f.css("overflow", "hidden"); var j = s - 1; var t = 0; $("ul", f).css('width', s * w); if (m.continuous) { $("ul", f).prepend($("ul li:last-child", f).clone().css("margin-left", "-" + w + "px")); $("ul", f).append($("ul li:nth-child(2)", f).clone()); $("ul", f).css('width', (s + 1) * w) }; if (!m.vertical) $("li", f).css('float', 'left'); if (m.controlsShow) { var k = m.controlsBefore; if (m.numeric) { k += '<ol id="' + m.numericId + '"></ol>' } else { if (m.firstShow) k += '<span id="' + m.firstId + '"><a href=\"javascript:void(0);\">' + m.firstText + '</a></span>'; k += ' <span id="' + m.prevId + '"><a href=\"javascript:void(0);\">' + m.prevText + '</a></span>'; k += ' <span id="' + m.nextId + '"><a href=\"javascript:void(0);\">' + m.nextText + '</a></span>'; if (m.lastShow) k += ' <span id="' + m.lastId + '"><a href=\"javascript:void(0);\">' + m.lastText + '</a></span>' }; k += m.controlsAfter; $(f).after(k) }; if (m.numeric) { for (var i = 0; i < s; i++) { $(document.createElement("li")).attr('id', m.numericId + (i + 1)).html('<a rel=' + i + ' href=\"javascript:void(0);\">' + (i + 1) + '</a>').appendTo($("#" + m.numericId)).click(function () { animate($("a", $(this)).attr('rel'), true) }) } } else { $("a", "#" + m.nextId).click(function () { animate("next", true) }); $("a", "#" + m.prevId).click(function () { animate("prev", true) }); $("a", "#" + m.firstId).click(function () { animate("first", true) }); $("a", "#" + m.lastId).click(function () { animate("last", true) }) }; function setCurrent(i) { i = parseInt(i) + 1; $("li", "#" + m.numericId).removeClass("current"); $("li#" + m.numericId + i).addClass("current") }; function adjust() { if (t > j) t = 0; if (t < 0) t = j; if (!m.vertical) { $("ul", f).css("margin-left", (t * w * -1)) } else { $("ul", f).css("margin-left", (t * h * -1)) } g = true; if (m.numeric) setCurrent(t) }; function animate(a, b) { if (g) { g = false; var c = t; switch (a) { case "next": t = (c >= j) ? (m.continuous ? t + 1 : j) : t + 1; break; case "prev": t = (t <= 0) ? (m.continuous ? t - 1 : 0) : t - 1; break; case "first": t = 0; break; case "last": t = j; break; default: t = a; break }; var d = Math.abs(c - t); var e = d * m.speed; if (!m.vertical) { p = (t * w * -1); $("ul", f).animate({ marginLeft: p }, { queue: false, duration: e, complete: adjust }) } else { p = (t * h * -1); $("ul", f).animate({ marginTop: p }, { queue: false, duration: e, complete: adjust }) }; if (!m.continuous && m.controlsFade) { if (t == j) { $("a", "#" + m.nextId).hide(); $("a", "#" + m.lastId).hide() } else { $("a", "#" + m.nextId).show(); $("a", "#" + m.lastId).show() }; if (t == 0) { $("a", "#" + m.prevId).hide(); $("a", "#" + m.firstId).hide() } else { $("a", "#" + m.prevId).show(); $("a", "#" + m.firstId).show() } }; if (b) clearTimeout(l); if (m.auto && a == "next" && !b) { ; l = setTimeout(function () { animate("next", false) }, d * m.speed + m.pause) } } }; var l; if (m.auto) { ; l = setTimeout(function () { animate("next", false) }, m.pause) }; if (m.numeric) setCurrent(0); if (!m.continuous && m.controlsFade) { $("a", "#" + m.prevId).hide(); $("a", "#" + m.firstId).hide() } }) } })(jQuery);

/*JSON*/
if (!this.JSON) { this.JSON = {} } (function () { function f(n) { return n < 10 ? '0' + n : n } if (typeof Date.prototype.toJSON !== 'function') { Date.prototype.toJSON = function (a) { return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z' : null }; String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function (a) { return this.valueOf() } } var e = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"': '\\"', '\\': '\\\\' }, rep; function quote(b) { escapable.lastIndex = 0; return escapable.test(b) ? '"' + b.replace(escapable, function (a) { var c = meta[a]; return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4) }) + '"' : '"' + b + '"' } function str(a, b) { var i, k, v, length, mind = gap, partial, value = b[a]; if (value && typeof value === 'object' && typeof value.toJSON === 'function') { value = value.toJSON(a) } if (typeof rep === 'function') { value = rep.call(b, a, value) } switch (typeof value) { case 'string': return quote(value); case 'number': return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': return String(value); case 'object': if (!value) { return 'null' } gap += indent; partial = []; if (Object.prototype.toString.apply(value) === '[object Array]') { length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || 'null' } v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; gap = mind; return v } if (rep && typeof rep === 'object') { length = rep.length; for (i = 0; i < length; i += 1) { k = rep[i]; if (typeof k === 'string') { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v) } } } } else { for (k in value) { if (Object.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v) } } } } v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}'; gap = mind; return v } } if (typeof JSON.stringify !== 'function') { JSON.stringify = function (a, b, c) { var i; gap = ''; indent = ''; if (typeof c === 'number') { for (i = 0; i < c; i += 1) { indent += ' ' } } else if (typeof c === 'string') { indent = c } rep = b; if (b && typeof b !== 'function' && (typeof b !== 'object' || typeof b.length !== 'number')) { throw new Error('JSON.stringify'); } return str('', { '': a }) } } if (typeof JSON.parse !== 'function') { JSON.parse = function (c, d) { var j; function walk(a, b) { var k, v, value = a[b]; if (value && typeof value === 'object') { for (k in value) { if (Object.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v } else { delete value[k] } } } } return d.call(a, b, value) } e.lastIndex = 0; if (e.test(c)) { c = c.replace(e, function (a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4) }) } if (/^[\],:{}\s]*$/.test(c.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { j = eval('(' + c + ')'); return typeof d === 'function' ? walk({ '': j }, '') : j } throw new SyntaxError('JSON.parse'); } } } ());

/*tools*/

/*jqModal*/
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 } (';(4($){$.g.9=4(o){7 p={q:1n,W:\'1o\',X:\'1p\',v:\'.1q\',x:F,Y:\'\',B:F,Z:F,C:F,D:F,E:F,G:F};5 3.j(4(){2(3.8)5 H[3.8].c=$.10({},H[3.8].c,o);s++;3.8=s;H[s]={c:$.10(p,$.9.11,o),a:F,w:$(3).12(\'13\'+s),s:s};2(p.v)$(3).14(p.v)})};$.g.n=4(e){5 I(3,e,\'J\')};$.g.14=4(e){5 I(3,e,\'K\')};$.g.K=4(t){5 3.j(4(){t=t||15.16;$.9.17(3.8,t)})};$.g.J=4(t){5 3.j(4(){t=t||15.16;$.9.18(3.8,t)})};$.9={19:{},17:4(s,t){7 h=H[s],c=h.c,k=\'.\'+c.X,z=(1r(h.w.d(\'z-M\'))),z=(z>0)?z:1s,o=$(\'<1a></1a>\').d({N:\'b%\',O:\'b%\',1b:\'1t\',1u:0,1v:0,\'z-M\':z-1,1c:c.q/b});2(h.a)5 F;h.t=t;h.a=1w;h.w.d(\'z-M\',z);2(c.Z){2(!A[0])L(\'1x\');A.1d(s)}l 2(c.q>0)h.w.n(o);l o=F;h.o=(o)?o.12(c.W).1y(\'P\'):F;2(Q){$(\'R,P\').d({N:\'b%\',O:\'b%\'});2(o){o=o.d({1b:\'1z\'})[0];S(7 y T{1A:1,1B:1})o.1e.1C(y.1D(),"(1f=(U.1E.1g"+y+" || U.P.1g"+y+"))+\'1F\'")}}2(c.x){7 r=c.B||h.w,u=c.x,r=(1G r==\'1H\')?$(r,h.w):$(r),u=(u.1I(0,1)==\'@\')?$(t).1J(u.1K(1)):u;r.R(c.Y).1L(u,4(){2(c.G)c.G.1M(3,h);2(k)h.w.n($(k,h.w));e(h)})}l 2(k)h.w.n($(k,h.w));2(c.C&&h.o)h.w.1N(\'<1h 1O="1i\'+h.w[0].8+\'"></1h>\').1P(h.o);(c.D)?c.D(h):h.w.1Q();e(h);5 F},18:4(s){7 h=H[s];2(!h.a)5 F;h.a=F;2(A[0]){A.1R();2(!A[0])L(\'1S\')}2(h.c.C&&h.o)$(\'#1i\'+h.w[0].8).1T(h.w).1j();2(h.c.E)h.c.E(h);l{h.w.1U();2(h.o)h.o.1j()}5 F},11:{}};7 s=0,H=$.9.19,A=[],Q=$.1k.1V&&($.1k.1W=="6.0"),F=1l,i=$(\'<V 1X="1Y:1l;U.1Z(\\\'\\\');" 20="9"></V>\').d({1c:0}),e=4(h){2(Q)2(h.o)h.o.R(\'<p 1e="O:b%;N:b%"/>\').1m(i);l 2(!$(\'V.9\',h.w)[0])h.w.1m(i);f(h)},f=4(h){21{$(\':22:23\',h.w)[0].24()}25(1f){}},L=4(t){$()[t]("26",m)[t]("27",m)[t]("28",m)},m=4(e){7 h=H[A[A.29-1]],r=(!$(e.B).2a(\'.13\'+h.s)[0]);2(r)f(h);5!r},I=4(w,t,c){5 w.j(4(){7 s=3.8;$(t).j(4(){2(!3[c]){3[c]=[];$(3).2b(4(){S(7 i T{K:1,J:1})S(7 s T 3[i])2(H[3[i][s]])H[3[i][s]].w[i](3);5 F})}3[c].1d(s)})})}})(2c);', 62, 137, '||if|this|function|return||var|_jqm|jqm||100||css|||fn|||each|cc|else||jqmAddClose|||overlay|||||trigger||ajax||||target|toTop|onShow|onHide||onLoad||hs|jqmHide|jqmShow||index|height|width|body|ie6|html|for|in|document|iframe|overlayClass|closeClass|ajaxText|modal|extend|params|addClass|jqmID|jqmAddTrigger|window|event|open|close|hash|div|position|opacity|push|style|_|scroll|span|jqmP|remove|browser|false|prepend|50|jqmOverlay|jqmClose|jqModal|parseInt|3000|fixed|left|top|true|bind|prependTo|absolute|Top|Left|setExpression|toLowerCase|documentElement|px|typeof|string|substr|attr|substring|load|call|before|id|insertAfter|show|pop|unbind|after|hide|msie|version|src|javascript|write|class|try|input|visible|focus|catch|keypress|keydown|mousedown|length|parents|click|jQuery'.split('|'), 0, {}))
/*AutoComplete*/
//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 } (';(3($){$.1K.1p({16:3(b,c){5 d=T b=="1q";c=$.1p({},$.L.1L,{U:d?b:O,w:d?O:b,1r:d?$.L.1L.1r:10,V:c&&!c.1s?10:3i},c);c.1t=c.1t||3(a){6 a};c.1u=c.1u||c.1M;6 z.I(3(){1N $.L(z,c)})},M:3(a){6 z.W("M",a)},1a:3(a){6 z.X("1a",[a])},1O:3(){6 z.X("1O")},1P:3(a){6 z.X("1P",[a])},1Q:3(){6 z.X("1Q")}});$.L=3(h,j){5 k={2g:38,2h:40,2i:46,2j:9,2k:13,2l:27,2m:3j,2n:33,2o:34,2p:8};5 l=$(h).3k("16","3l").P(j.2q);5 m;5 n="";5 o=$.L.2r(j);5 p=0;5 r;5 s={1v:C};5 t=$.L.2s(j,h,1R,s);5 u;$.1S.2t&&$(h.2u).W("3m.16",3(){4(u){u=C;6 C}});l.W(($.1S.2t?"3n":"3o")+".16",3(a){p=1;r=a.2v;3p(a.2v){Q k.2g:a.1b();4(t.N()){t.2w()}y{Y(0,D)}R;Q k.2h:a.1b();4(t.N()){t.2x()}y{Y(0,D)}R;Q k.2n:a.1b();4(t.N()){t.2y()}y{Y(0,D)}R;Q k.2o:a.1b();4(t.N()){t.2z()}y{Y(0,D)}R;Q j.17&&$.1c(j.S)==","&&k.2m:Q k.2j:Q k.2k:4(1R()){a.1b();u=D;6 C}R;Q k.2l:t.Z();R;3q:1T(m);m=1U(Y,j.1r);R}}).2A(3(){p++}).3r(3(){p=0;4(!s.1v){2B()}}).2C(3(){4(p++>1&&!t.N()){Y(0,D)}}).W("1a",3(){5 c=(1w.7>1)?1w[1]:O;3 1V(q,a){5 b;4(a&&a.7){18(5 i=0;i<a.7;i++){4(a[i].M.J()==q.J()){b=a[i];R}}}4(T c=="3")c(b);y l.X("M",b&&[b.w,b.E])}$.I(11(l.K()),3(i,a){1W(a,1V,1V)})}).W("1O",3(){o.1d()}).W("1P",3(){$.1p(j,1w[1]);4("w"2D 1w[1])o.1e()}).W("1Q",3(){t.1x();l.1x();$(h.2u).1x(".16")});3 1R(){5 b=t.2E();4(!b)6 C;5 v=b.M;n=v;4(j.17){5 c=11(l.K());4(c.7>1){5 d=j.S.7;5 e=$(h).19().1y;5 f,1z=0;$.I(c,3(i,a){1z+=a.7;4(e<=1z){f=i;6 C}1z+=d});c[f]=v;v=c.2F(j.S)}v+=j.S}l.K(v);1f();l.X("M",[b.w,b.E]);6 D}3 Y(a,b){4(r==k.2i){t.Z();6}5 c=l.K();4(!b&&c==n)6;n=c;c=1g(c);4(c.7>=j.1X){l.P(j.1Y);4(!j.1A)c=c.J();1W(c,2G,1f)}y{1B();t.Z()}};3 11(b){4(!b)6[""];4(!j.17)6[$.1c(b)];6 $.3s(b.1Z(j.S),3(a){6 $.1c(b).7?$.1c(a):O})}3 1g(a){4(!j.17)6 a;5 b=11(a);4(b.7==1)6 b[0];5 c=$(h).19().1y;4(c==a.7){b=11(a)}y{b=11(a.20(a.2H(c),""))}6 b[b.7-1]}3 1C(q,a){4(j.1C&&(1g(l.K()).J()==q.J())&&r!=k.2p){l.K(l.K()+a.2H(1g(n).7));$(h).19(n.7,n.7+a.7)}};3 2B(){1T(m);m=1U(1f,3t)};3 1f(){5 c=t.N();t.Z();1T(m);1B();4(j.2I){l.1a(3(a){4(!a){4(j.17){5 b=11(l.K()).1h(0,-1);l.K(b.2F(j.S)+(b.7?j.S:""))}y{l.K("");l.X("M",O)}}})}};3 2G(q,a){4(a&&a.7&&p){1B();t.2J(a,q);1C(q,a[0].E);t.21()}y{1f()}};3 1W(c,d,e){4(!j.1A)c=c.J();5 f=o.2K(c);4(f&&f.7){d(c,f)}y 4((T j.U=="1q")&&(j.U.7>0)){5 g={3u:+1N 3v()};$.I(j.2L,3(a,b){g[a]=T b=="3"?b():b});$.3w({3x:"3y",3z:"16"+h.3A,2M:j.2M,U:j.U,w:$.1p({q:1g(c),3B:j.V},g),3C:3(a){5 b=j.1D&&j.1D(a)||1D(a);o.1i(c,b);d(c,b)}})}y{t.2N();e(c)}};3 1D(a){5 b=[];5 c=a.1Z("\\n");18(5 i=0;i<c.7;i++){5 d=$.1c(c[i]);4(d){d=d.1Z("|");b[b.7]={w:d,E:d[0],M:j.1E&&j.1E(d,d[0])||d[0]}}}6 b};3 1B(){l.1j(j.1Y)}};$.L.1L={2q:"3D",2O:"3E",1Y:"3F",1X:1,1r:3G,1A:C,1k:D,1F:C,1l:10,V:3H,2I:C,2L:{},22:D,1M:3(a){6 a[0]},1u:O,1C:C,F:0,17:C,S:", ",1t:3(a,b){6 a.20(1N 3I("(?![^&;]+;)(?!<[^<>]*)("+b.20(/([\\^\\$\\(\\)\\[\\]\\{\\}\\*\\.\\+\\?\\|\\\\])/2P,"\\\\$1")+")(?![^<>]*>)(?![^&;]+;)","2P"),"<2Q>$1</2Q>")},1s:D,1G:3J};$.L.2r=3(g){5 h={};5 j=0;3 1k(s,a){4(!g.1A)s=s.J();5 i=s.2R(a);4(g.1F=="3K"){i=s.J().1a("\\\\b"+a.J())}4(i==-1)6 C;6 i==0||g.1F};3 1i(q,a){4(j>g.1l){1d()}4(!h[q]){j++}h[q]=a}3 1e(){4(!g.w)6 C;5 b={},2S=0;4(!g.U)g.1l=1;b[""]=[];18(5 i=0,2T=g.w.7;i<2T;i++){5 c=g.w[i];c=(T c=="1q")?[c]:c;5 d=g.1u(c,i+1,g.w.7);4(d===C)23;5 e=d.3L(0).J();4(!b[e])b[e]=[];5 f={E:d,w:c,M:g.1E&&g.1E(c)||d};b[e].24(f);4(2S++<g.V){b[""].24(f)}};$.I(b,3(i,a){g.1l++;1i(i,a)})}1U(1e,25);3 1d(){h={};j=0}6{1d:1d,1i:1i,1e:1e,2K:3(q){4(!g.1l||!j)6 O;4(!g.U&&g.1F){5 a=[];18(5 k 2D h){4(k.7>0){5 c=h[k];$.I(c,3(i,x){4(1k(x.E,q)){a.24(x)}})}}6 a}y 4(h[q]){6 h[q]}y 4(g.1k){18(5 i=q.7-1;i>=g.1X;i--){5 c=h[q.3M(0,i)];4(c){5 a=[];$.I(c,3(i,x){4(1k(x.E,q)){a[a.7]=x}});6 a}}}6 O}}};$.L.2s=3(e,f,g,h){5 j={G:"3N"};5 k,A=-1,w,1H="",26=D,H,B;3 2U(){4(!26)6;H=$("<3O/>").Z().P(e.2O).12("3P","3Q").28(29.2V);B=$("<3R/>").28(H).3S(3(a){4(14(a).2W&&14(a).2W.3T()==\'2X\'){A=$("2a",B).1j(j.G).3U(14(a));$(14(a)).P(j.G)}}).2C(3(a){$(14(a)).P(j.G);g();f.2A();6 C}).3V(3(){h.1v=D}).3W(3(){h.1v=C});4(e.F>0)H.12("F",e.F);26=C}3 14(a){5 b=a.14;3X(b&&b.3Y!="2X")b=b.3Z;4(!b)6[];6 b}3 15(a){k.1h(A,A+1).1j(j.G);2Y(a);5 b=k.1h(A,A+1).P(j.G);4(e.1s){5 c=0;k.1h(0,A).I(3(){c+=z.1m});4((c+b[0].1m-B.1n())>B[0].41){B.1n(c+b[0].1m-B.42())}y 4(c<B.1n()){B.1n(c)}}};3 2Y(a){A+=a;4(A<0){A=k.1o()-1}y 4(A>=k.1o()){A=0}}3 2Z(a){6 e.V&&e.V<a?e.V:a}3 30(){B.31();5 a=2Z(w.7);18(5 i=0;i<a;i++){4(!w[i])23;5 b=e.1M(w[i].w,i+1,a,w[i].E,1H);4(b===C)23;5 c=$("<2a/>").43(e.1t(b,1H)).P(i%2==0?"44":"45").28(B)[0];$.w(c,"32",w[i])}k=B.47("2a");4(e.22){k.1h(0,1).P(j.G);A=0}4($.1K.35)B.35()}6{2J:3(d,q){2U();w=d;1H=q;30()},2x:3(){15(1)},2w:3(){15(-1)},2y:3(){4(A!=0&&A-8<0){15(-A)}y{15(-8)}},2z:3(){4(A!=k.1o()-1&&A+8>k.1o()){15(k.1o()-1-A)}y{15(8)}},Z:3(){H&&H.Z();k&&k.1j(j.G);A=-1},N:3(){6 H&&H.48(":N")},49:3(){6 z.N()&&(k.36("."+j.G)[0]||e.22&&k[0])},21:3(){5 a=$(f).4a();H.12({F:T e.F=="1q"||e.F>0?e.F:$(f).F(),37:a.37+f.1m,2b:a.2b}).21();4(e.1s){B.1n(0);B.12({39:e.1G,4b:\'4c\'});4($.1S.4d&&T 29.2V.4e.39==="1I"){5 b=0;k.I(3(){b+=z.1m});5 c=b>e.1G;B.12(\'4f\',c?e.1G:b);4(!c){k.F(B.F()-3a(k.12("3b-2b"))-3a(k.12("3b-4g")))}}}},2E:3(){5 a=k&&k.36("."+j.G).1j(j.G);6 a&&a.7&&$.w(a[0],"32")},2N:3(){B&&B.31()},1x:3(){H&&H.4h()}}};$.1K.19=3(b,c){4(b!==1I){6 z.I(3(){4(z.2c){5 a=z.2c();4(c===1I||b==c){a.4i("2d",b);a.3c()}y{a.4j(D);a.4k("2d",b);a.4l("2d",c);a.3c()}}y 4(z.3d){z.3d(b,c)}y 4(z.1J){z.1J=b;z.3e=c}})}5 d=z[0];4(d.2c){5 e=29.19.4m(),3f=d.E,2e="<->",2f=e.3g.7;e.3g=2e;5 f=d.E.2R(2e);d.E=3f;z.19(f,f+2f);6{1y:f,3h:f+2f}}y 4(d.1J!==1I){6{1y:d.1J,3h:d.3e}}}})(4n);', 62, 272, '|||function|if|var|return|length|||||||||||||||||||||||||data||else|this|active|list|false|true|value|width|ACTIVE|element|each|toLowerCase|val|Autocompleter|result|visible|null|addClass|case|break|multipleSeparator|typeof|url|max|bind|trigger|onChange|hide||trimWords|css||target|moveSelect|autocomplete|multiple|for|selection|search|preventDefault|trim|flush|populate|hideResultsNow|lastWord|slice|add|removeClass|matchSubset|cacheLength|offsetHeight|scrollTop|size|extend|string|delay|scroll|highlight|formatMatch|mouseDownOnSelect|arguments|unbind|start|progress|matchCase|stopLoading|autoFill|parse|formatResult|matchContains|scrollHeight|term|undefined|selectionStart|fn|defaults|formatItem|new|flushCache|setOptions|unautocomplete|selectCurrent|browser|clearTimeout|setTimeout|findValueCallback|request|minChars|loadingClass|split|replace|show|selectFirst|continue|push||needsInit||appendTo|document|li|left|createTextRange|character|teststring|textLength|UP|DOWN|DEL|TAB|RETURN|ESC|COMMA|PAGEUP|PAGEDOWN|BACKSPACE|inputClass|Cache|Select|opera|form|keyCode|prev|next|pageUp|pageDown|focus|hideResults|click|in|selected|join|receiveData|substring|mustMatch|display|load|extraParams|dataType|emptyList|resultsClass|gi|strong|indexOf|nullData|ol|init|body|nodeName|LI|movePosition|limitNumberOfItems|fillList|empty|ac_data|||bgiframe|filter|top||maxHeight|parseInt|padding|select|setSelectionRange|selectionEnd|orig|text|end|150|188|attr|off|submit|keypress|keydown|switch|default|blur|map|200|timestamp|Date|ajax|mode|abort|port|name|limit|success|ac_input|ac_results|ac_loading|400|100|RegExp|180|word|charAt|substr|ac_over|div|position|absolute|ul|mouseover|toUpperCase|index|mousedown|mouseup|while|tagName|parentNode||clientHeight|innerHeight|html|ac_even|ac_odd||find|is|current|offset|overflow|auto|msie|style|height|right|remove|move|collapse|moveStart|moveEnd|createRange|jQuery'.split('|'), 0, {}))

/*Pagination*/
jQuery.fn.pagination = function (a, b) { b = jQuery.extend({ items_per_page: 10, num_display_entries: 10, current_page: 0, num_edge_entries: 0, link_to: "javascript:void(0)", prev_text: ".", next_text: ".", ellipse_text: "...", prev_show_always: true, next_show_always: true, callback: function () { return false; } }, b || {}); return this.each(function () { function f() { return Math.ceil(a / b.items_per_page); } function h() { var k = Math.ceil(b.num_display_entries / 2); var l = f(); var j = l - b.num_display_entries; var m = g > k ? Math.max(Math.min(g - k, j), 0) : 0; var i = g > k ? Math.min(g + k, l) : Math.min(b.num_display_entries, l); return [m, i]; } function e(j, i) { g = j; c(); var k = b.callback(j, d); if (!k) { if (i.stopPropagation) { i.stopPropagation(); } else { i.cancelBubble = true; } } return k; } function c() { d.empty(); var k = h(); var o = f(); var p = function (i) { return function (q) { return e(i, q); }; }; var n = function (i, q) { i = i < 0 ? 0 : (i < o ? i : o - 1); q = jQuery.extend({ text: i + 1, classes: "" }, q || {}); if (i == g) { var r = jQuery("<span class='current'>" + (q.text) + "</span>"); } else { var r = jQuery("<a>" + (q.text) + "</a>").bind("click", p(i)).attr("href", b.link_to.replace(/__id__/, i)); } if (q.classes) { r.addClass(q.classes); } d.append(r); }; if (b.prev_text && (g > 0 || b.prev_show_always)) { n(g - 1, { text: b.prev_text, classes: "prev" }); } if (k[0] > 0 && b.num_edge_entries > 0) { var j = Math.min(b.num_edge_entries, k[0]); for (var l = 0; l < j; l++) { n(l); } if (b.num_edge_entries < k[0] && b.ellipse_text) { jQuery("<span>" + b.ellipse_text + "</span>").appendTo(d); } } for (var l = k[0]; l < k[1]; l++) { n(l); } if (k[1] < o && b.num_edge_entries > 0) { if (o - b.num_edge_entries > k[1] && b.ellipse_text) { jQuery("<span>" + b.ellipse_text + "</span>").appendTo(d); } var m = Math.max(o - b.num_edge_entries, k[1]); for (var l = m; l < o; l++) { n(l); } } if (b.next_text && (g < o - 1 || b.next_show_always)) { n(g + 1, { text: b.next_text, classes: "next" }); } } var g = b.current_page; a = (!a || a < 0) ? 1 : a; b.items_per_page = (!b.items_per_page || b.items_per_page < 0) ? 1 : b.items_per_page; var d = jQuery(this); this.selectPage = function (i) { e(i); }; this.prevPage = function () { if (g > 0) { e(g - 1); return true; } else { return false; } }; this.nextPage = function () { if (g < f() - 1) { e(g + 1); return true; } else { return false; } }; c(); b.callback(g, this); }); };
/*Tabber*/
//function tabberObj(b) { var a; this.div = null; this.classMain = "tabber"; this.classMainLive = "tabberlive"; this.classTab = "tabbertab"; this.classTabDefault = "tabbertabdefault"; this.classNav = "tabbernav"; this.classTabHide = "tabbertabhide"; this.classNavActive = "tabberactive"; this.titleElements = ["h2", "h3", "h4", "h5", "h6"]; this.titleElementsStripHTML = true; this.removeTitle = true; this.addLinkId = false; this.linkIdFormat = "<tabberid>nav<tabnumberone>"; for (a in b) { this[a] = b[a]; } this.REclassMain = new RegExp("\\b" + this.classMain + "\\b", "gi"); this.REclassMainLive = new RegExp("\\b" + this.classMainLive + "\\b", "gi"); this.REclassTab = new RegExp("\\b" + this.classTab + "\\b", "gi"); this.REclassTabDefault = new RegExp("\\b" + this.classTabDefault + "\\b", "gi"); this.REclassTabHide = new RegExp("\\b" + this.classTabHide + "\\b", "gi"); this.tabs = new Array(); if (this.div) { this.init(this.div); this.div = null; } } tabberObj.prototype.init = function (f) { var j, d, b, l, g = 0, m, a, k, c, h; if (!document.getElementsByTagName) { return false; } if (f.id) { this.id = f.id; } this.tabs.length = 0; j = f.childNodes; for (d = 0; d < j.length; d++) { if (j[d].className && j[d].className.match(this.REclassTab)) { l = new Object(); l.div = j[d]; this.tabs[this.tabs.length] = l; if (j[d].className.match(this.REclassTabDefault)) { g = this.tabs.length - 1; } } } m = document.createElement("ul"); m.className = this.classNav; for (d = 0; d < this.tabs.length; d++) { l = this.tabs[d]; l.headingText = l.div.title; if (this.removeTitle) { l.div.title = ""; } if (!l.headingText) { for (b = 0; b < this.titleElements.length; b++) { h = l.div.getElementsByTagName(this.titleElements[b])[0]; if (h) { l.headingText = h.innerHTML; if (this.titleElementsStripHTML) { l.headingText.replace(/<br>/gi, " "); l.headingText = l.headingText.replace(/<[^>]+>/g, ""); } break; } } } if (!l.headingText) { l.headingText = d + 1; } a = document.createElement("li"); l.li = a; k = document.createElement("a"); k.appendChild(document.createTextNode(l.headingText)); k.href = "javascript:void(null);"; k.title = l.headingText; k.onclick = this.navClick; k.tabber = this; k.tabberIndex = d; if (this.addLinkId && this.linkIdFormat) { c = this.linkIdFormat; c = c.replace(/<tabberid>/gi, this.id); c = c.replace(/<tabnumberzero>/gi, d); c = c.replace(/<tabnumberone>/gi, d + 1); c = c.replace(/<tabtitle>/gi, l.headingText.replace(/[^a-zA-Z0-9\-]/gi, "")); k.id = c; } a.appendChild(k); m.appendChild(a); } f.insertBefore(m, f.firstChild); f.className = f.className.replace(this.REclassMain, this.classMainLive); this.tabShow(g); if (typeof this.onLoad == "function") { this.onLoad({ tabber: this }); } return this; }; tabberObj.prototype.navClick = function (g) { var d, b, c, f, e; b = this; if (!b.tabber) { return false; } c = b.tabber; f = b.tabberIndex; b.blur(); if (typeof c.onClick == "function") { e = { tabber: c, index: f, event: g }; if (!g) { e.event = window.event; } d = c.onClick(e); if (d === false) { return false; } } c.tabShow(f); return false; }; tabberObj.prototype.tabHideAll = function () { var a; for (a = 0; a < this.tabs.length; a++) { this.tabHide(a); } }; tabberObj.prototype.tabHide = function (a) { var b; if (!this.tabs[a]) { return false; } b = this.tabs[a].div; if (!b.className.match(this.REclassTabHide)) { b.className += " " + this.classTabHide; } this.navClearActive(a); return this; }; tabberObj.prototype.tabShow = function (a) { var b; if (!this.tabs[a]) { return false; } this.tabHideAll(); b = this.tabs[a].div; b.className = b.className.replace(this.REclassTabHide, ""); this.navSetActive(a); if (typeof this.onTabDisplay == "function") { this.onTabDisplay({ tabber: this, index: a }); } return this; }; tabberObj.prototype.navSetActive = function (a) { this.tabs[a].li.className = this.classNavActive; return this; }; tabberObj.prototype.navClearActive = function (a) { this.tabs[a].li.className = ""; return this; }; function tabberAutomatic(d) { var a, c, b; if (!d) { d = {}; } a = new tabberObj(d); c = document.getElementsByTagName("div"); for (b = 0; b < c.length; b++) { if (c[b].className && c[b].className.match(a.REclassMain)) { d.div = c[b]; c[b].tabber = new tabberObj(d); } } return this; } function tabberAutomaticOnLoad(b) { var a; if (!b) { b = {}; } a = window.onload; if (typeof window.onload != "function") { window.onload = function () { tabberAutomatic(b); }; } else { window.onload = function () { a(); tabberAutomatic(b); }; } } if (typeof tabberOptions == "undefined") { tabberAutomaticOnLoad(); } else { if (!tabberOptions.manualStartup) { tabberAutomaticOnLoad(tabberOptions); } }
/*UI CORE*/
jQuery.ui || (function (c) { var i = c.fn.remove, d = c.browser.mozilla && (parseFloat(c.browser.version) < 1.9); c.ui = { version: "1.7.2", plugin: { add: function (k, l, n) { var m = c.ui[k].prototype; for (var j in n) { m.plugins[j] = m.plugins[j] || []; m.plugins[j].push([l, n[j]]); } }, call: function (j, l, k) { var n = j.plugins[l]; if (!n || !j.element[0].parentNode) { return; } for (var m = 0; m < n.length; m++) { if (j.options[n[m][0]]) { n[m][1].apply(j.element, k); } } } }, contains: function (k, j) { return document.compareDocumentPosition ? k.compareDocumentPosition(j) & 16 : k !== j && k.contains(j); }, hasScroll: function (m, k) { if (c(m).css("overflow") == "hidden") { return false; } var j = (k && k == "left") ? "scrollLeft" : "scrollTop", l = false; if (m[j] > 0) { return true; } m[j] = 1; l = (m[j] > 0); m[j] = 0; return l; }, isOverAxis: function (k, j, l) { return (k > j) && (k < (j + l)); }, isOver: function (o, k, n, m, j, l) { return c.ui.isOverAxis(o, n, j) && c.ui.isOverAxis(k, m, l); }, keyCode: { BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, 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} }; if (d) { var f = c.attr, e = c.fn.removeAttr, h = "http://www.w3.org/2005/07/aaa", a = /^aria-/, b = /^wairole:/; c.attr = function (k, j, l) { var m = l !== undefined; return (j == "role" ? (m ? f.call(this, k, j, "wairole:" + l) : (f.apply(this, arguments) || "").replace(b, "")) : (a.test(j) ? (m ? k.setAttributeNS(h, j.replace(a, "aaa:"), l) : f.call(this, k, j.replace(a, "aaa:"))) : f.apply(this, arguments))); }; c.fn.removeAttr = function (j) { return (a.test(j) ? this.each(function () { this.removeAttributeNS(h, j.replace(a, "")); }) : e.call(this, j)); }; } c.fn.extend({ remove: function () { c("*", this).add(this).each(function () { c(this).triggerHandler("remove"); }); return i.apply(this, arguments); }, enableSelection: function () { return this.attr("unselectable", "off").css("MozUserSelect", "").unbind("selectstart.ui"); }, disableSelection: function () { return this.attr("unselectable", "on").css("MozUserSelect", "none").bind("selectstart.ui", function () { return false; }); }, scrollParent: function () { var j; if ((c.browser.msie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { j = this.parents().filter(function () { return (/(relative|absolute|fixed)/).test(c.curCSS(this, "position", 1)) && (/(auto|scroll)/).test(c.curCSS(this, "overflow", 1) + c.curCSS(this, "overflow-y", 1) + c.curCSS(this, "overflow-x", 1)); }).eq(0); } else { j = this.parents().filter(function () { return (/(auto|scroll)/).test(c.curCSS(this, "overflow", 1) + c.curCSS(this, "overflow-y", 1) + c.curCSS(this, "overflow-x", 1)); }).eq(0); } return (/fixed/).test(this.css("position")) || !j.length ? c(document) : j; } }); c.extend(c.expr[":"], { data: function (l, k, j) { return !!c.data(l, j[3]); }, focusable: function (k) { var l = k.nodeName.toLowerCase(), j = c.attr(k, "tabindex"); return (/input|select|textarea|button|object/.test(l) ? !k.disabled : "a" == l || "area" == l ? k.href || !isNaN(j) : !isNaN(j)) && !c(k)["area" == l ? "parents" : "closest"](":hidden").length; }, tabbable: function (k) { var j = c.attr(k, "tabindex"); return (isNaN(j) || j >= 0) && c(k).is(":focusable"); } }); function g(m, n, o, l) { function k(q) { var p = c[m][n][q] || []; return (typeof p == "string" ? p.split(/,?\s+/) : p); } var j = k("getter"); if (l.length == 1 && typeof l[0] == "string") { j = j.concat(k("getterSetter")); } return (c.inArray(o, j) != -1); } c.widget = function (k, j) { var l = k.split(".")[0]; k = k.split(".")[1]; c.fn[k] = function (p) { var n = (typeof p == "string"), o = Array.prototype.slice.call(arguments, 1); if (n && p.substring(0, 1) == "_") { return this; } if (n && g(l, k, p, o)) { var m = c.data(this[0], k); return (m ? m[p].apply(m, o) : undefined); } return this.each(function () { var q = c.data(this, k); (!q && !n && c.data(this, k, new c[l][k](this, p))._init()); (q && n && c.isFunction(q[p]) && q[p].apply(q, o)); }); }; c[l] = c[l] || {}; c[l][k] = function (o, n) { var m = this; this.namespace = l; this.widgetName = k; this.widgetEventPrefix = c[l][k].eventPrefix || k; this.widgetBaseClass = l + "-" + k; this.options = c.extend({}, c.widget.defaults, c[l][k].defaults, c.metadata && c.metadata.get(o)[k], n); this.element = c(o).bind("setData." + k, function (q, p, r) { if (q.target == o) { return m._setData(p, r); } }).bind("getData." + k, function (q, p) { if (q.target == o) { return m._getData(p); } }).bind("remove", function () { return m.destroy(); }); }; c[l][k].prototype = c.extend({}, c.widget.prototype, j); c[l][k].getterSetter = "option"; }; c.widget.prototype = { _init: function () { }, destroy: function () { this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").removeAttr("aria-disabled"); }, option: function (l, m) { var k = l, j = this; if (typeof l == "string") { if (m === undefined) { return this._getData(l); } k = {}; k[l] = m; } c.each(k, function (n, o) { j._setData(n, o); }); }, _getData: function (j) { return this.options[j]; }, _setData: function (j, k) { this.options[j] = k; if (j == "disabled") { this.element[k ? "addClass" : "removeClass"](this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").attr("aria-disabled", k); } }, enable: function () { this._setData("disabled", false); }, disable: function () { this._setData("disabled", true); }, _trigger: function (l, m, n) { var p = this.options[l], j = (l == this.widgetEventPrefix ? l : this.widgetEventPrefix + l); m = c.Event(m); m.type = j; if (m.originalEvent) { for (var k = c.event.props.length, o; k; ) { o = c.event.props[--k]; m[o] = m.originalEvent[o]; } } this.element.trigger(m, n); return !(c.isFunction(p) && p.call(this.element[0], m, n) === false || m.isDefaultPrevented()); } }; c.widget.defaults = { disabled: false }; c.ui.mouse = { _mouseInit: function () { var j = this; this.element.bind("mousedown." + this.widgetName, function (k) { return j._mouseDown(k); }).bind("click." + this.widgetName, function (k) { if (j._preventClickEvent) { j._preventClickEvent = false; k.stopImmediatePropagation(); return false; } }); if (c.browser.msie) { this._mouseUnselectable = this.element.attr("unselectable"); this.element.attr("unselectable", "on"); } this.started = false; }, _mouseDestroy: function () { this.element.unbind("." + this.widgetName); (c.browser.msie && this.element.attr("unselectable", this._mouseUnselectable)); }, _mouseDown: function (l) { l.originalEvent = l.originalEvent || {}; if (l.originalEvent.mouseHandled) { return; } (this._mouseStarted && this._mouseUp(l)); this._mouseDownEvent = l; var k = this, m = (l.which == 1), j = (typeof this.options.cancel == "string" ? c(l.target).parents().add(l.target).filter(this.options.cancel).length : false); if (!m || j || !this._mouseCapture(l)) { return true; } this.mouseDelayMet = !this.options.delay; if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function () { k.mouseDelayMet = true; }, this.options.delay); } if (this._mouseDistanceMet(l) && this._mouseDelayMet(l)) { this._mouseStarted = (this._mouseStart(l) !== false); if (!this._mouseStarted) { l.preventDefault(); return true; } } this._mouseMoveDelegate = function (n) { return k._mouseMove(n); }; this._mouseUpDelegate = function (n) { return k._mouseUp(n); }; c(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate); (c.browser.safari || l.preventDefault()); l.originalEvent.mouseHandled = true; return true; }, _mouseMove: function (j) { if (c.browser.msie && !j.button) { return this._mouseUp(j); } if (this._mouseStarted) { this._mouseDrag(j); return j.preventDefault(); } if (this._mouseDistanceMet(j) && this._mouseDelayMet(j)) { this._mouseStarted = (this._mouseStart(this._mouseDownEvent, j) !== false); (this._mouseStarted ? this._mouseDrag(j) : this._mouseUp(j)); } return !this._mouseStarted; }, _mouseUp: function (j) { c(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate); if (this._mouseStarted) { this._mouseStarted = false; this._preventClickEvent = (j.target == this._mouseDownEvent.target); this._mouseStop(j); } return false; }, _mouseDistanceMet: function (j) { return (Math.max(Math.abs(this._mouseDownEvent.pageX - j.pageX), Math.abs(this._mouseDownEvent.pageY - j.pageY)) >= this.options.distance); }, _mouseDelayMet: function (j) { return this.mouseDelayMet; }, _mouseStart: function (j) { }, _mouseDrag: function (j) { }, _mouseStop: function (j) { }, _mouseCapture: function (j) { return true; } }; c.ui.mouse.defaults = { cancel: null, distance: 1, delay: 0 }; })(jQuery);
/*UI Sortable*/
(function (a) { a.widget("ui.sortable", a.extend({}, a.ui.mouse, { _init: function () { var b = this.options; this.containerCache = {}; this.element.addClass("ui-sortable"); this.refresh(); this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css("float")) : false; this.offset = this.element.offset(); this._mouseInit(); }, destroy: function () { this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable"); this._mouseDestroy(); for (var b = this.items.length - 1; b >= 0; b--) { this.items[b].item.removeData("sortable-item"); } }, _mouseCapture: function (e, f) { if (this.reverting) { return false; } if (this.options.disabled || this.options.type == "static") { return false; } this._refreshItems(e); var d = null, c = this, b = a(e.target).parents().each(function () { if (a.data(this, "sortable-item") == c) { d = a(this); return false; } }); if (a.data(e.target, "sortable-item") == c) { d = a(e.target); } if (!d) { return false; } if (this.options.handle && !f) { var g = false; a(this.options.handle, d).find("*").andSelf().each(function () { if (this == e.target) { g = true; } }); if (!g) { return false; } } this.currentItem = d; this._removeCurrentsFromItems(); return true; }, _mouseStart: function (e, f, b) { var g = this.options, c = this; this.currentContainer = this; this.refreshPositions(); this.helper = this._createHelper(e); this._cacheHelperProportions(); this._cacheMargins(); this.scrollParent = this.helper.scrollParent(); this.offset = this.currentItem.offset(); this.offset = { top: this.offset.top - this.margins.top, left: this.offset.left - this.margins.left }; this.helper.css("position", "absolute"); this.cssPosition = this.helper.css("position"); a.extend(this.offset, { click: { left: e.pageX - this.offset.left, top: e.pageY - this.offset.top }, parent: this._getParentOffset(), relative: this._getRelativeOffset() }); this.originalPosition = this._generatePosition(e); this.originalPageX = e.pageX; this.originalPageY = e.pageY; if (g.cursorAt) { this._adjustOffsetFromHelper(g.cursorAt); } this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }; if (this.helper[0] != this.currentItem[0]) { this.currentItem.hide(); } this._createPlaceholder(); if (g.containment) { this._setContainment(); } if (g.cursor) { if (a("body").css("cursor")) { this._storedCursor = a("body").css("cursor"); } a("body").css("cursor", g.cursor); } if (g.opacity) { if (this.helper.css("opacity")) { this._storedOpacity = this.helper.css("opacity"); } this.helper.css("opacity", g.opacity); } if (g.zIndex) { if (this.helper.css("zIndex")) { this._storedZIndex = this.helper.css("zIndex"); } this.helper.css("zIndex", g.zIndex); } if (this.scrollParent[0] != document && this.scrollParent[0].tagName != "HTML") { this.overflowOffset = this.scrollParent.offset(); } this._trigger("start", e, this._uiHash()); if (!this._preserveHelperProportions) { this._cacheHelperProportions(); } if (!b) { for (var d = this.containers.length - 1; d >= 0; d--) { this.containers[d]._trigger("activate", e, c._uiHash(this)); } } if (a.ui.ddmanager) { a.ui.ddmanager.current = this; } if (a.ui.ddmanager && !g.dropBehaviour) { a.ui.ddmanager.prepareOffsets(this, e); } this.dragging = true; this.helper.addClass("ui-sortable-helper"); this._mouseDrag(e); return true; }, _mouseDrag: function (f) { this.position = this._generatePosition(f); this.positionAbs = this._convertPositionTo("absolute"); if (!this.lastPositionAbs) { this.lastPositionAbs = this.positionAbs; } if (this.options.scroll) { var g = this.options, b = false; if (this.scrollParent[0] != document && this.scrollParent[0].tagName != "HTML") { if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - f.pageY < g.scrollSensitivity) { this.scrollParent[0].scrollTop = b = this.scrollParent[0].scrollTop + g.scrollSpeed; } else { if (f.pageY - this.overflowOffset.top < g.scrollSensitivity) { this.scrollParent[0].scrollTop = b = this.scrollParent[0].scrollTop - g.scrollSpeed; } } if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - f.pageX < g.scrollSensitivity) { this.scrollParent[0].scrollLeft = b = this.scrollParent[0].scrollLeft + g.scrollSpeed; } else { if (f.pageX - this.overflowOffset.left < g.scrollSensitivity) { this.scrollParent[0].scrollLeft = b = this.scrollParent[0].scrollLeft - g.scrollSpeed; } } } else { if (f.pageY - a(document).scrollTop() < g.scrollSensitivity) { b = a(document).scrollTop(a(document).scrollTop() - g.scrollSpeed); } else { if (a(window).height() - (f.pageY - a(document).scrollTop()) < g.scrollSensitivity) { b = a(document).scrollTop(a(document).scrollTop() + g.scrollSpeed); } } if (f.pageX - a(document).scrollLeft() < g.scrollSensitivity) { b = a(document).scrollLeft(a(document).scrollLeft() - g.scrollSpeed); } else { if (a(window).width() - (f.pageX - a(document).scrollLeft()) < g.scrollSensitivity) { b = a(document).scrollLeft(a(document).scrollLeft() + g.scrollSpeed); } } } if (b !== false && a.ui.ddmanager && !g.dropBehaviour) { a.ui.ddmanager.prepareOffsets(this, f); } } this.positionAbs = this._convertPositionTo("absolute"); if (!this.options.axis || this.options.axis != "y") { this.helper[0].style.left = this.position.left + "px"; } if (!this.options.axis || this.options.axis != "x") { this.helper[0].style.top = this.position.top + "px"; } for (var d = this.items.length - 1; d >= 0; d--) { var e = this.items[d], c = e.item[0], h = this._intersectsWithPointer(e); if (!h) { continue; } if (c != this.currentItem[0] && this.placeholder[h == 1 ? "next" : "prev"]()[0] != c && !a.ui.contains(this.placeholder[0], c) && (this.options.type == "semi-dynamic" ? !a.ui.contains(this.element[0], c) : true)) { this.direction = h == 1 ? "down" : "up"; if (this.options.tolerance == "pointer" || this._intersectsWithSides(e)) { this._rearrange(f, e); } else { break; } this._trigger("change", f, this._uiHash()); break; } } this._contactContainers(f); if (a.ui.ddmanager) { a.ui.ddmanager.drag(this, f); } this._trigger("sort", f, this._uiHash()); this.lastPositionAbs = this.positionAbs; return false; }, _mouseStop: function (c, d) { if (!c) { return; } if (a.ui.ddmanager && !this.options.dropBehaviour) { a.ui.ddmanager.drop(this, c); } if (this.options.revert) { var b = this; var e = b.placeholder.offset(); b.reverting = true; a(this.helper).animate({ left: e.left - this.offset.parent.left - b.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), top: e.top - this.offset.parent.top - b.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop) }, parseInt(this.options.revert, 10) || 500, function () { b._clear(c); }); } else { this._clear(c, d); } return false; }, cancel: function () { var b = this; if (this.dragging) { this._mouseUp(); if (this.options.helper == "original") { this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); } else { this.currentItem.show(); } for (var c = this.containers.length - 1; c >= 0; c--) { this.containers[c]._trigger("deactivate", null, b._uiHash(this)); if (this.containers[c].containerCache.over) { this.containers[c]._trigger("out", null, b._uiHash(this)); this.containers[c].containerCache.over = 0; } } } if (this.placeholder[0].parentNode) { this.placeholder[0].parentNode.removeChild(this.placeholder[0]); } if (this.options.helper != "original" && this.helper && this.helper[0].parentNode) { this.helper.remove(); } a.extend(this, { helper: null, dragging: false, reverting: false, _noFinalSort: null }); if (this.domPosition.prev) { a(this.domPosition.prev).after(this.currentItem); } else { a(this.domPosition.parent).prepend(this.currentItem); } return true; }, serialize: function (d) { var b = this._getItemsAsjQuery(d && d.connected); var c = []; d = d || {}; a(b).each(function () { var e = (a(d.item || this).attr(d.attribute || "id") || "").match(d.expression || (/(.+)[-=_](.+)/)); if (e) { c.push((d.key || e[1] + "[]") + "=" + (d.key && d.expression ? e[1] : e[2])); } }); return c.join("&"); }, toArray: function (d) { var b = this._getItemsAsjQuery(d && d.connected); var c = []; d = d || {}; b.each(function () { c.push(a(d.item || this).attr(d.attribute || "id") || ""); }); return c; }, _intersectsWith: function (m) { var e = this.positionAbs.left, d = e + this.helperProportions.width, k = this.positionAbs.top, j = k + this.helperProportions.height; var f = m.left, c = f + m.width, n = m.top, i = n + m.height; var o = this.offset.click.top, h = this.offset.click.left; var g = (k + o) > n && (k + o) < i && (e + h) > f && (e + h) < c; if (this.options.tolerance == "pointer" || this.options.forcePointerForContainers || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? "width" : "height"] > m[this.floating ? "width" : "height"])) { return g; } else { return (f < e + (this.helperProportions.width / 2) && d - (this.helperProportions.width / 2) < c && n < k + (this.helperProportions.height / 2) && j - (this.helperProportions.height / 2) < i); } }, _intersectsWithPointer: function (d) { var e = a.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, d.top, d.height), c = a.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, d.left, d.width), g = e && c, b = this._getDragVerticalDirection(), f = this._getDragHorizontalDirection(); if (!g) { return false; } return this.floating ? (((f && f == "right") || b == "down") ? 2 : 1) : (b && (b == "down" ? 2 : 1)); }, _intersectsWithSides: function (e) { var c = a.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, e.top + (e.height / 2), e.height), d = a.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, e.left + (e.width / 2), e.width), b = this._getDragVerticalDirection(), f = this._getDragHorizontalDirection(); if (this.floating && f) { return ((f == "right" && d) || (f == "left" && !d)); } else { return b && ((b == "down" && c) || (b == "up" && !c)); } }, _getDragVerticalDirection: function () { var b = this.positionAbs.top - this.lastPositionAbs.top; return b != 0 && (b > 0 ? "down" : "up"); }, _getDragHorizontalDirection: function () { var b = this.positionAbs.left - this.lastPositionAbs.left; return b != 0 && (b > 0 ? "right" : "left"); }, refresh: function (b) { this._refreshItems(b); this.refreshPositions(); }, _connectWith: function () { var b = this.options; return b.connectWith.constructor == String ? [b.connectWith] : b.connectWith; }, _getItemsAsjQuery: function (b) { var l = this; var g = []; var e = []; var h = this._connectWith(); if (h && b) { for (var d = h.length - 1; d >= 0; d--) { var k = a(h[d]); for (var c = k.length - 1; c >= 0; c--) { var f = a.data(k[c], "sortable"); if (f && f != this && !f.options.disabled) { e.push([a.isFunction(f.options.items) ? f.options.items.call(f.element) : a(f.options.items, f.element).not(".ui-sortable-helper"), f]); } } } } e.push([a.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : a(this.options.items, this.element).not(".ui-sortable-helper"), this]); for (var d = e.length - 1; d >= 0; d--) { e[d][0].each(function () { g.push(this); }); } return a(g); }, _removeCurrentsFromItems: function () { var d = this.currentItem.find(":data(sortable-item)"); for (var c = 0; c < this.items.length; c++) { for (var b = 0; b < d.length; b++) { if (d[b] == this.items[c].item[0]) { this.items.splice(c, 1); } } } }, _refreshItems: function (b) { this.items = []; this.containers = [this]; var h = this.items; var p = this; var f = [[a.isFunction(this.options.items) ? this.options.items.call(this.element[0], b, { item: this.currentItem }) : a(this.options.items, this.element), this]]; var l = this._connectWith(); if (l) { for (var e = l.length - 1; e >= 0; e--) { var m = a(l[e]); for (var d = m.length - 1; d >= 0; d--) { var g = a.data(m[d], "sortable"); if (g && g != this && !g.options.disabled) { f.push([a.isFunction(g.options.items) ? g.options.items.call(g.element[0], b, { item: this.currentItem }) : a(g.options.items, g.element), g]); this.containers.push(g); } } } } for (var e = f.length - 1; e >= 0; e--) { var k = f[e][1]; var c = f[e][0]; for (var d = 0, n = c.length; d < n; d++) { var o = a(c[d]); o.data("sortable-item", k); h.push({ item: o, instance: k, width: 0, height: 0, left: 0, top: 0 }); } } }, refreshPositions: function (b) { if (this.offsetParent && this.helper) { this.offset.parent = this._getParentOffset(); } for (var d = this.items.length - 1; d >= 0; d--) { var e = this.items[d]; if (e.instance != this.currentContainer && this.currentContainer && e.item[0] != this.currentItem[0]) { continue; } var c = this.options.toleranceElement ? a(this.options.toleranceElement, e.item) : e.item; if (!b) { e.width = c.outerWidth(); e.height = c.outerHeight(); } var f = c.offset(); e.left = f.left; e.top = f.top; } if (this.options.custom && this.options.custom.refreshContainers) { this.options.custom.refreshContainers.call(this); } else { for (var d = this.containers.length - 1; d >= 0; d--) { var f = this.containers[d].element.offset(); this.containers[d].containerCache.left = f.left; this.containers[d].containerCache.top = f.top; this.containers[d].containerCache.width = this.containers[d].element.outerWidth(); this.containers[d].containerCache.height = this.containers[d].element.outerHeight(); } } }, _createPlaceholder: function (d) { var b = d || this, e = b.options; if (!e.placeholder || e.placeholder.constructor == String) { var c = e.placeholder; e.placeholder = { element: function () { var f = a(document.createElement(b.currentItem[0].nodeName)).addClass(c || b.currentItem[0].className + " ui-sortable-placeholder").removeClass("ui-sortable-helper")[0]; if (!c) { f.style.visibility = "hidden"; } return f; }, update: function (f, g) { if (c && !e.forcePlaceholderSize) { return; } if (!g.height()) { g.height(b.currentItem.innerHeight() - parseInt(b.currentItem.css("paddingTop") || 0, 10) - parseInt(b.currentItem.css("paddingBottom") || 0, 10)); } if (!g.width()) { g.width(b.currentItem.innerWidth() - parseInt(b.currentItem.css("paddingLeft") || 0, 10) - parseInt(b.currentItem.css("paddingRight") || 0, 10)); } } }; } b.placeholder = a(e.placeholder.element.call(b.element, b.currentItem)); b.currentItem.after(b.placeholder); e.placeholder.update(b, b.placeholder); }, _contactContainers: function (d) { for (var c = this.containers.length - 1; c >= 0; c--) { if (this._intersectsWith(this.containers[c].containerCache)) { if (!this.containers[c].containerCache.over) { if (this.currentContainer != this.containers[c]) { var h = 10000; var g = null; var e = this.positionAbs[this.containers[c].floating ? "left" : "top"]; for (var b = this.items.length - 1; b >= 0; b--) { if (!a.ui.contains(this.containers[c].element[0], this.items[b].item[0])) { continue; } var f = this.items[b][this.containers[c].floating ? "left" : "top"]; if (Math.abs(f - e) < h) { h = Math.abs(f - e); g = this.items[b]; } } if (!g && !this.options.dropOnEmpty) { continue; } this.currentContainer = this.containers[c]; g ? this._rearrange(d, g, null, true) : this._rearrange(d, null, this.containers[c].element, true); this._trigger("change", d, this._uiHash()); this.containers[c]._trigger("change", d, this._uiHash(this)); this.options.placeholder.update(this.currentContainer, this.placeholder); } this.containers[c]._trigger("over", d, this._uiHash(this)); this.containers[c].containerCache.over = 1; } } else { if (this.containers[c].containerCache.over) { this.containers[c]._trigger("out", d, this._uiHash(this)); this.containers[c].containerCache.over = 0; } } } }, _createHelper: function (c) { var d = this.options; var b = a.isFunction(d.helper) ? a(d.helper.apply(this.element[0], [c, this.currentItem])) : (d.helper == "clone" ? this.currentItem.clone() : this.currentItem); if (!b.parents("body").length) { a(d.appendTo != "parent" ? d.appendTo : this.currentItem[0].parentNode)[0].appendChild(b[0]); } if (b[0] == this.currentItem[0]) { this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }; } if (b[0].style.width == "" || d.forceHelperSize) { b.width(this.currentItem.width()); } if (b[0].style.height == "" || d.forceHelperSize) { b.height(this.currentItem.height()); } return b; }, _adjustOffsetFromHelper: function (b) { if (b.left != undefined) { this.offset.click.left = b.left + this.margins.left; } if (b.right != undefined) { this.offset.click.left = this.helperProportions.width - b.right + this.margins.left; } if (b.top != undefined) { this.offset.click.top = b.top + this.margins.top; } if (b.bottom != undefined) { this.offset.click.top = this.helperProportions.height - b.bottom + this.margins.top; } }, _getParentOffset: function () { this.offsetParent = this.helper.offsetParent(); var b = this.offsetParent.offset(); if (this.cssPosition == "absolute" && this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) { b.left += this.scrollParent.scrollLeft(); b.top += this.scrollParent.scrollTop(); } if ((this.offsetParent[0] == document.body) || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == "html" && a.browser.msie)) { b = { top: 0, left: 0 }; } return { top: b.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), left: b.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) }; }, _getRelativeOffset: function () { if (this.cssPosition == "relative") { var b = this.currentItem.position(); return { top: b.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(), left: b.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft() }; } else { return { top: 0, left: 0 }; } }, _cacheMargins: function () { this.margins = { left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0), top: (parseInt(this.currentItem.css("marginTop"), 10) || 0) }; }, _cacheHelperProportions: function () { this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() }; }, _setContainment: function () { var e = this.options; if (e.containment == "parent") { e.containment = this.helper[0].parentNode; } if (e.containment == "document" || e.containment == "window") { this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, a(e.containment == "document" ? document : window).width() - this.helperProportions.width - this.margins.left, (a(e.containment == "document" ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top]; } if (!(/^(document|window|parent)$/).test(e.containment)) { var c = a(e.containment)[0]; var d = a(e.containment).offset(); var b = (a(c).css("overflow") != "hidden"); this.containment = [d.left + (parseInt(a(c).css("borderLeftWidth"), 10) || 0) + (parseInt(a(c).css("paddingLeft"), 10) || 0) - this.margins.left, d.top + (parseInt(a(c).css("borderTopWidth"), 10) || 0) + (parseInt(a(c).css("paddingTop"), 10) || 0) - this.margins.top, d.left + (b ? Math.max(c.scrollWidth, c.offsetWidth) : c.offsetWidth) - (parseInt(a(c).css("borderLeftWidth"), 10) || 0) - (parseInt(a(c).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, d.top + (b ? Math.max(c.scrollHeight, c.offsetHeight) : c.offsetHeight) - (parseInt(a(c).css("borderTopWidth"), 10) || 0) - (parseInt(a(c).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top]; } }, _convertPositionTo: function (f, h) { if (!h) { h = this.position; } var c = f == "absolute" ? 1 : -1; var e = this.options, b = this.cssPosition == "absolute" && !(this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, g = (/(html|body)/i).test(b[0].tagName); return { top: (h.top + this.offset.relative.top * c + this.offset.parent.top * c - (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollTop() : (g ? 0 : b.scrollTop())) * c)), left: (h.left + this.offset.relative.left * c + this.offset.parent.left * c - (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollLeft() : g ? 0 : b.scrollLeft()) * c)) }; }, _generatePosition: function (e) { var h = this.options, b = this.cssPosition == "absolute" && !(this.scrollParent[0] != document && a.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, i = (/(html|body)/i).test(b[0].tagName); if (this.cssPosition == "relative" && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { this.offset.relative = this._getRelativeOffset(); } var d = e.pageX; var c = e.pageY; if (this.originalPosition) { if (this.containment) { if (e.pageX - this.offset.click.left < this.containment[0]) { d = this.containment[0] + this.offset.click.left; } if (e.pageY - this.offset.click.top < this.containment[1]) { c = this.containment[1] + this.offset.click.top; } if (e.pageX - this.offset.click.left > this.containment[2]) { d = this.containment[2] + this.offset.click.left; } if (e.pageY - this.offset.click.top > this.containment[3]) { c = this.containment[3] + this.offset.click.top; } } if (h.grid) { var g = this.originalPageY + Math.round((c - this.originalPageY) / h.grid[1]) * h.grid[1]; c = this.containment ? (!(g - this.offset.click.top < this.containment[1] || g - this.offset.click.top > this.containment[3]) ? g : (!(g - this.offset.click.top < this.containment[1]) ? g - h.grid[1] : g + h.grid[1])) : g; var f = this.originalPageX + Math.round((d - this.originalPageX) / h.grid[0]) * h.grid[0]; d = this.containment ? (!(f - this.offset.click.left < this.containment[0] || f - this.offset.click.left > this.containment[2]) ? f : (!(f - this.offset.click.left < this.containment[0]) ? f - h.grid[0] : f + h.grid[0])) : f; } } return { top: (c - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollTop() : (i ? 0 : b.scrollTop())))), left: (d - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + (a.browser.safari && this.cssPosition == "fixed" ? 0 : (this.cssPosition == "fixed" ? -this.scrollParent.scrollLeft() : i ? 0 : b.scrollLeft()))) }; }, _rearrange: function (g, f, c, e) { c ? c[0].appendChild(this.placeholder[0]) : f.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == "down" ? f.item[0] : f.item[0].nextSibling)); this.counter = this.counter ? ++this.counter : 1; var d = this, b = this.counter; window.setTimeout(function () { if (b == d.counter) { d.refreshPositions(!e); } }, 0); }, _clear: function (d, e) { this.reverting = false; var f = [], b = this; if (!this._noFinalSort && this.currentItem[0].parentNode) { this.placeholder.before(this.currentItem); } this._noFinalSort = null; if (this.helper[0] == this.currentItem[0]) { for (var c in this._storedCSS) { if (this._storedCSS[c] == "auto" || this._storedCSS[c] == "static") { this._storedCSS[c] = ""; } } this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); } else { this.currentItem.show(); } if (this.fromOutside && !e) { f.push(function (g) { this._trigger("receive", g, this._uiHash(this.fromOutside)); }); } if ((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !e) { f.push(function (g) { this._trigger("update", g, this._uiHash()); }); } if (!a.ui.contains(this.element[0], this.currentItem[0])) { if (!e) { f.push(function (g) { this._trigger("remove", g, this._uiHash()); }); } for (var c = this.containers.length - 1; c >= 0; c--) { if (a.ui.contains(this.containers[c].element[0], this.currentItem[0]) && !e) { f.push((function (g) { return function (h) { g._trigger("receive", h, this._uiHash(this)); }; }).call(this, this.containers[c])); f.push((function (g) { return function (h) { g._trigger("update", h, this._uiHash(this)); }; }).call(this, this.containers[c])); } } } for (var c = this.containers.length - 1; c >= 0; c--) { if (!e) { f.push((function (g) { return function (h) { g._trigger("deactivate", h, this._uiHash(this)); }; }).call(this, this.containers[c])); } if (this.containers[c].containerCache.over) { f.push((function (g) { return function (h) { g._trigger("out", h, this._uiHash(this)); }; }).call(this, this.containers[c])); this.containers[c].containerCache.over = 0; } } if (this._storedCursor) { a("body").css("cursor", this._storedCursor); } if (this._storedOpacity) { this.helper.css("opacity", this._storedOpacity); } if (this._storedZIndex) { this.helper.css("zIndex", this._storedZIndex == "auto" ? "" : this._storedZIndex); } this.dragging = false; if (this.cancelHelperRemoval) { if (!e) { this._trigger("beforeStop", d, this._uiHash()); for (var c = 0; c < f.length; c++) { f[c].call(this, d); } this._trigger("stop", d, this._uiHash()); } return false; } if (!e) { this._trigger("beforeStop", d, this._uiHash()); } this.placeholder[0].parentNode.removeChild(this.placeholder[0]); if (this.helper[0] != this.currentItem[0]) { this.helper.remove(); } this.helper = null; if (!e) { for (var c = 0; c < f.length; c++) { f[c].call(this, d); } this._trigger("stop", d, this._uiHash()); } this.fromOutside = false; return true; }, _trigger: function () { if (a.widget.prototype._trigger.apply(this, arguments) === false) { this.cancel(); } }, _uiHash: function (c) { var b = c || this; return { helper: b.helper, placeholder: b.placeholder || a([]), position: b.position, absolutePosition: b.positionAbs, offset: b.positionAbs, item: b.currentItem, sender: c ? c.element : null }; } })); a.extend(a.ui.sortable, { getter: "serialize toArray", version: "1.7.2", eventPrefix: "sort", defaults: { appendTo: "parent", axis: false, cancel: ":input,option", connectWith: false, containment: false, cursor: "auto", cursorAt: false, delay: 0, distance: 1, dropOnEmpty: true, forcePlaceholderSize: false, forceHelperSize: false, grid: false, handle: false, helper: "original", items: "> *", opacity: false, placeholder: false, revert: false, scroll: true, scrollSensitivity: 20, scrollSpeed: 20, scope: "default", tolerance: "intersect", zIndex: 1000} }); })(jQuery);
/*UI Star*/
(function (a) { a.widget("ui.stars", { _init: function () { var f = this, c = this.options, b = 0; c.isSelect = c.inputType == "select"; this.$form = a(this.element).closest("form"); this.$selec = c.isSelect ? a("select", this.element) : null; this.$rboxs = c.isSelect ? a("option", this.$selec) : a(":radio", this.element); this.$stars = this.$rboxs.map(function (j) { var i = { value: this.value, title: (c.isSelect ? this.text : this.title) || this.value, isDefault: (c.isSelect && this.defaultSelected) || this.defaultChecked }; if (j == 0) { c.split = typeof c.split != "number" ? 0 : c.split; c.val2id = []; c.id2val = []; c.id2title = []; c.name = c.isSelect ? f.$selec.get(0).name : this.name; c.disabled = c.disabled || (c.isSelect ? a(f.$selec).attr("disabled") : a(this).attr("disabled")); } if (i.value == c.cancelValue) { c.cancelTitle = i.title; return null; } c.val2id[i.value] = b; c.id2val[b] = i.value; c.id2title[b] = i.title; if (i.isDefault) { c.checked = b; c.value = c.defaultValue = i.value; c.title = i.title; } var k = a("<div/>").addClass(c.starClass); var h = a("<a/>").attr("title", c.showTitles ? i.title : "").text(i.value); if (c.split) { var l = (b % c.split); var g = Math.floor(c.starWidth / c.split); k.width(g); h.css("margin-left", "-" + (l * g) + "px"); } b++; return k.append(h).get(0); }); c.items = b; c.isSelect ? this.$selec.remove() : this.$rboxs.remove(); this.$cancel = a("<div/>").addClass(c.cancelClass).append(a("<a/>").attr("title", c.showTitles ? c.cancelTitle : "").text(c.cancelValue)); c.cancelShow &= !c.disabled && !c.oneVoteOnly; c.cancelShow && this.element.append(this.$cancel); this.element.append(this.$stars); if (c.checked === undefined) { c.checked = -1; c.value = c.defaultValue = c.cancelValue; c.title = ""; } this.$value = a('<input type="hidden" name="' + c.name + '" value="' + c.value + '" />'); this.element.append(this.$value); this.$stars.bind("click.stars", function (g) { if (!c.forceSelect && c.disabled) { return false; } var h = f.$stars.index(this); c.checked = h; c.value = c.id2val[h]; c.title = c.id2title[h]; f.$value.attr({ disabled: c.disabled ? "disabled" : "", value: c.value }); e(h, false); f._disableCancel(); !c.forceSelect && f.callback(g, "star"); }).bind("mouseover.stars", function () { if (c.disabled) { return false; } var g = f.$stars.index(this); e(g, true); }).bind("mouseout.stars", function () { if (c.disabled) { return false; } e(f.options.checked, false); }); this.$cancel.bind("click.stars", function (g) { if (!c.forceSelect && (c.disabled || c.value == c.cancelValue)) { return false; } c.checked = -1; c.value = c.cancelValue; c.title = ""; f.$value.val(c.value).attr({ disabled: "disabled" }); d(); f._disableCancel(); !c.forceSelect && f.callback(g, "cancel"); }).bind("mouseover.stars", function () { if (f._disableCancel()) { return false; } f.$cancel.addClass(c.cancelHoverClass); d(); f._showCap(c.cancelTitle); }).bind("mouseout.stars", function () { if (f._disableCancel()) { return false; } f.$cancel.removeClass(c.cancelHoverClass); f.$stars.triggerHandler("mouseout.stars"); }); this.$form.bind("reset.stars", function () { !c.disabled && f.select(c.defaultValue); }); a(window).unload(function () { f.$cancel.unbind(".stars"); f.$stars.unbind(".stars"); f.$form.unbind(".stars"); f.$selec = f.$rboxs = f.$stars = f.$value = f.$cancel = f.$form = null; }); function e(j, h) { if (j != -1) { var g = h ? c.starHoverClass : c.starOnClass; var i = h ? c.starOnClass : c.starHoverClass; f.$stars.eq(j).prevAll("." + c.starClass).andSelf().removeClass(i).addClass(g); f.$stars.eq(j).nextAll("." + c.starClass).removeClass(c.starHoverClass + " " + c.starOnClass); f._showCap(c.id2title[j]); } else { d(); } } function d() { f.$stars.removeClass(c.starOnClass + " " + c.starHoverClass); f._showCap(""); } this.select(c.value); c.disabled && this.disable(); }, _disableCancel: function () { var b = this.options, c = b.disabled || b.oneVoteOnly || (b.value == b.cancelValue); if (c) { this.$cancel.removeClass(b.cancelHoverClass).addClass(b.cancelDisabledClass); } else { this.$cancel.removeClass(b.cancelDisabledClass); } this.$cancel.css("opacity", c ? 0.5 : 1); return c; }, _disableAll: function () { var b = this.options; this._disableCancel(); if (b.disabled) { this.$stars.filter("div").addClass(b.starDisabledClass); } else { this.$stars.filter("div").removeClass(b.starDisabledClass); } }, _showCap: function (c) { var b = this.options; if (b.captionEl) { b.captionEl.text(c); } }, value: function () { return this.options.value; }, select: function (b) { var c = this.options, d = (b == c.cancelValue) ? this.$cancel : this.$stars.eq(c.val2id[b]); c.forceSelect = true; d.triggerHandler("click.stars"); c.forceSelect = false; }, selectID: function (b) { var c = this.options, d = (b == -1) ? this.$cancel : this.$stars.eq(b); c.forceSelect = true; d.triggerHandler("click.stars"); c.forceSelect = false; }, enable: function () { this.options.disabled = false; this._disableAll(); }, disable: function () { this.options.disabled = true; this._disableAll(); }, destroy: function () { this.options.isSelect ? this.$selec.appendTo(this.element) : this.$rboxs.appendTo(this.element); this.$form.unbind(".stars"); this.$cancel.unbind(".stars").remove(); this.$stars.unbind(".stars").remove(); this.$value.remove(); this.element.unbind(".stars").removeData("stars"); }, callback: function (c, d) { var b = this.options; b.callback && b.callback(this, d, b.value, c); b.oneVoteOnly && !b.disabled && this.disable(); } }); a.extend(a.ui.stars, { version: "2.1.1", getter: "value", defaults: { inputType: "radio", split: 0, disabled: false, cancelTitle: "Cancel Rating", cancelValue: 0, cancelShow: true, oneVoteOnly: false, showTitles: false, captionEl: null, callback: null, starWidth: 16, cancelClass: "ui-stars-cancel", starClass: "ui-stars-star", starOnClass: "ui-stars-star-on", starHoverClass: "ui-stars-star-hover", starDisabledClass: "ui-stars-star-disabled", cancelHoverClass: "ui-stars-cancel-hover", cancelDisabledClass: "ui-stars-cancel-disabled"} }); })(jQuery);
/*jQuery form*/
(function (b) { b.fn.ajaxSubmit = function (s) { if (!this.length) { a("ajaxSubmit: skipping submit process - no element selected"); return this; } if (typeof s == "function") { s = { success: s }; } var e = b.trim(this.attr("action")); if (e) { e = (e.match(/^([^#]+)/) || [])[1]; } e = e || window.location.href || ""; s = b.extend({ url: e, type: this.attr("method") || "GET" }, s || {}); var u = {}; this.trigger("form-pre-serialize", [this, s, u]); if (u.veto) { a("ajaxSubmit: submit vetoed via form-pre-serialize trigger"); return this; } if (s.beforeSerialize && s.beforeSerialize(this, s) === false) { a("ajaxSubmit: submit aborted via beforeSerialize callback"); return this; } var m = this.formToArray(s.semantic); if (s.data) { s.extraData = s.data; for (var f in s.data) { if (s.data[f] instanceof Array) { for (var g in s.data[f]) { m.push({ name: f, value: s.data[f][g] }); } } else { m.push({ name: f, value: s.data[f] }); } } } if (s.beforeSubmit && s.beforeSubmit(m, this, s) === false) { a("ajaxSubmit: submit aborted via beforeSubmit callback"); return this; } this.trigger("form-submit-validate", [m, this, s, u]); if (u.veto) { a("ajaxSubmit: submit vetoed via form-submit-validate trigger"); return this; } var d = b.param(m); if (s.type.toUpperCase() == "GET") { s.url += (s.url.indexOf("?") >= 0 ? "&" : "?") + d; s.data = null; } else { s.data = d; } var t = this, l = []; if (s.resetForm) { l.push(function () { t.resetForm(); }); } if (s.clearForm) { l.push(function () { t.clearForm(); }); } if (!s.dataType && s.target) { var p = s.success || function () { }; l.push(function (j) { b(s.target).html(j).each(p, arguments); }); } else { if (s.success) { l.push(s.success); } } s.success = function (q, k) { for (var n = 0, j = l.length; n < j; n++) { l[n].apply(s, [q, k, t]); } }; var c = b("input:file", this).fieldValue(); var r = false; for (var i = 0; i < c.length; i++) { if (c[i]) { r = true; } } var h = false; if (s.iframe || r || h) { if (s.closeKeepAlive) { b.get(s.closeKeepAlive, o); } else { o(); } } else { b.ajax(s); } this.trigger("form-submit-notify", [this, s]); return this; function o() { var w = t[0]; if (b(":input[name=submit]", w).length) { alert('Error: Form elements must not be named "submit".'); return; } var q = b.extend({}, b.ajaxSettings, s); var G = b.extend(true, {}, b.extend(true, {}, b.ajaxSettings), q); var v = "jqFormIO" + (new Date().getTime()); var C = b('<iframe id="' + v + '" name="' + v + '" src="about:blank" />'); var E = C[0]; C.css({ position: "absolute", top: "-1000px", left: "-1000px" }); var F = { aborted: 0, responseText: null, responseXML: null, status: 0, statusText: "n/a", getAllResponseHeaders: function () { }, getResponseHeader: function () { }, setRequestHeader: function () { }, abort: function () { this.aborted = 1; C.attr("src", "about:blank"); } }; var D = q.global; if (D && !b.active++) { b.event.trigger("ajaxStart"); } if (D) { b.event.trigger("ajaxSend", [F, q]); } if (G.beforeSend && G.beforeSend(F, G) === false) { G.global && b.active--; return; } if (F.aborted) { return; } var k = 0; var y = 0; var j = w.clk; if (j) { var x = j.name; if (x && !j.disabled) { s.extraData = s.extraData || {}; s.extraData[x] = j.value; if (j.type == "image") { s.extraData[name + ".x"] = w.clk_x; s.extraData[name + ".y"] = w.clk_y; } } } setTimeout(function () { var J = t.attr("target"), H = t.attr("action"); w.setAttribute("target", v); if (w.getAttribute("method") != "POST") { w.setAttribute("method", "POST"); } if (w.getAttribute("action") != q.url) { w.setAttribute("action", q.url); } if (!s.skipEncodingOverride) { t.attr({ encoding: "multipart/form-data", enctype: "multipart/form-data" }); } if (q.timeout) { setTimeout(function () { y = true; z(); }, q.timeout); } var I = []; try { if (s.extraData) { for (var K in s.extraData) { I.push(b('<input type="hidden" name="' + K + '" value="' + s.extraData[K] + '" />').appendTo(w)[0]); } } C.appendTo("body"); E.attachEvent ? E.attachEvent("onload", z) : E.addEventListener("load", z, false); w.submit(); } finally { w.setAttribute("action", H); J ? w.setAttribute("target", J) : t.removeAttr("target"); b(I).remove(); } }, 10); var A = 0; function z() { if (k++) { return; } E.detachEvent ? E.detachEvent("onload", z) : E.removeEventListener("load", z, false); var H = true; try { if (y) { throw "timeout"; } var I, K; K = E.contentWindow ? E.contentWindow.document : E.contentDocument ? E.contentDocument : E.document; if ((K.body == null || K.body.innerHTML == "") && !A) { A = 1; k--; setTimeout(z, 100); return; } F.responseText = K.body ? K.body.innerHTML : null; F.responseXML = K.XMLDocument ? K.XMLDocument : K; F.getResponseHeader = function (M) { var L = { "content-type": q.dataType }; return L[M]; }; if (q.dataType == "json" || q.dataType == "script") { var n = K.getElementsByTagName("textarea")[0]; F.responseText = n ? n.value : F.responseText; } else { if (q.dataType == "xml" && !F.responseXML && F.responseText != null) { F.responseXML = B(F.responseText); } } I = b.httpData(F, q.dataType); } catch (J) { H = false; b.handleError(q, F, "error", J); } if (H) { q.success(I, "success"); if (D) { b.event.trigger("ajaxSuccess", [F, q]); } } if (D) { b.event.trigger("ajaxComplete", [F, q]); } if (D && ! --b.active) { b.event.trigger("ajaxStop"); } if (q.complete) { q.complete(F, H ? "success" : "error"); } setTimeout(function () { C.remove(); F.responseXML = null; }, 100); } function B(n, H) { if (window.ActiveXObject) { H = new ActiveXObject("Microsoft.XMLDOM"); H.async = "false"; H.loadXML(n); } else { H = (new DOMParser()).parseFromString(n, "text/xml"); } return (H && H.documentElement && H.documentElement.tagName != "parsererror") ? H : null; } } }; b.fn.ajaxForm = function (c) { return this.ajaxFormUnbind().bind("submit.form-plugin", function () { b(this).ajaxSubmit(c); return false; }).each(function () { b(":submit,input:image", this).bind("click.form-plugin", function (f) { var d = this.form; d.clk = this; if (this.type == "image") { if (f.offsetX != undefined) { d.clk_x = f.offsetX; d.clk_y = f.offsetY; } else { if (typeof b.fn.offset == "function") { var g = b(this).offset(); d.clk_x = f.pageX - g.left; d.clk_y = f.pageY - g.top; } else { d.clk_x = f.pageX - this.offsetLeft; d.clk_y = f.pageY - this.offsetTop; } } } setTimeout(function () { d.clk = d.clk_x = d.clk_y = null; }, 10); }); }); }; b.fn.ajaxFormUnbind = function () { this.unbind("submit.form-plugin"); return this.each(function () { b(":submit,input:image", this).unbind("click.form-plugin"); }); }; b.fn.formToArray = function (q) { var p = []; if (this.length == 0) { return p; } var d = this[0]; var h = q ? d.getElementsByTagName("*") : d.elements; if (!h) { return p; } for (var k = 0, m = h.length; k < m; k++) { var e = h[k]; var f = e.name; if (!f) { continue; } if (q && d.clk && e.type == "image") { if (!e.disabled && d.clk == e) { p.push({ name: f, value: b(e).val() }); p.push({ name: f + ".x", value: d.clk_x }, { name: f + ".y", value: d.clk_y }); } continue; } var r = b.fieldValue(e, true); if (r && r.constructor == Array) { for (var g = 0, c = r.length; g < c; g++) { p.push({ name: f, value: r[g] }); } } else { if (r !== null && typeof r != "undefined") { p.push({ name: f, value: r }); } } } if (!q && d.clk) { var l = b(d.clk), o = l[0], f = o.name; if (f && !o.disabled && o.type == "image") { p.push({ name: f, value: l.val() }); p.push({ name: f + ".x", value: d.clk_x }, { name: f + ".y", value: d.clk_y }); } } return p; }; b.fn.formSerialize = function (c) { return b.param(this.formToArray(c)); }; b.fn.fieldSerialize = function (d) { var c = []; this.each(function () { var h = this.name; if (!h) { return; } var f = b.fieldValue(this, d); if (f && f.constructor == Array) { for (var g = 0, e = f.length; g < e; g++) { c.push({ name: h, value: f[g] }); } } else { if (f !== null && typeof f != "undefined") { c.push({ name: this.name, value: f }); } } }); return b.param(c); }; b.fn.fieldValue = function (h) { for (var g = [], e = 0, c = this.length; e < c; e++) { var f = this[e]; var d = b.fieldValue(f, h); if (d === null || typeof d == "undefined" || (d.constructor == Array && !d.length)) { continue; } d.constructor == Array ? b.merge(g, d) : g.push(d); } return g; }; b.fieldValue = function (c, j) { var e = c.name, p = c.type, q = c.tagName.toLowerCase(); if (typeof j == "undefined") { j = true; } if (j && (!e || c.disabled || p == "reset" || p == "button" || (p == "checkbox" || p == "radio") && !c.checked || (p == "submit" || p == "image") && c.form && c.form.clk != c || q == "select" && c.selectedIndex == -1)) { return null; } if (q == "select") { var k = c.selectedIndex; if (k < 0) { return null; } var m = [], d = c.options; var g = (p == "select-one"); var l = (g ? k + 1 : d.length); for (var f = (g ? k : 0); f < l; f++) { var h = d[f]; if (h.selected) { var o = h.value; if (!o) { o = (h.attributes && h.attributes.value && !(h.attributes.value.specified)) ? h.text : h.value; } if (g) { return o; } m.push(o); } } return m; } return c.value; }; b.fn.clearForm = function () { return this.each(function () { b("input,select,textarea", this).clearFields(); }); }; b.fn.clearFields = b.fn.clearInputs = function () { return this.each(function () { var d = this.type, c = this.tagName.toLowerCase(); if (d == "text" || d == "password" || c == "textarea") { this.value = ""; } else { if (d == "checkbox" || d == "radio") { this.checked = false; } else { if (c == "select") { this.selectedIndex = -1; } } } }); }; b.fn.resetForm = function () { return this.each(function () { if (typeof this.reset == "function" || (typeof this.reset == "object" && !this.reset.nodeType)) { this.reset(); } }); }; b.fn.enable = function (c) { if (c == undefined) { c = true; } return this.each(function () { this.disabled = !c; }); }; b.fn.selected = function (c) { if (c == undefined) { c = true; } return this.each(function () { var d = this.type; if (d == "checkbox" || d == "radio") { this.checked = c; } else { if (this.tagName.toLowerCase() == "option") { var e = b(this).parent("select"); if (c && e[0] && e[0].type == "select-one") { e.find("option").selected(false); } this.selected = c; } } }); }; function a() { if (b.fn.ajaxSubmit.debug && window.console && window.console.log) { window.console.log("[jquery.form] " + Array.prototype.join.call(arguments, "")); } } })(jQuery);
/*tip*/
(function (b) { function a(e, d) { var c = this; e = jQuery(e); var f = jQuery(document.createElement("div")).addClass(d.baseClass).addClass((d.fixed) ? d.fixedClass : "").addClass((d.persistent) ? d.persistentClass : "").html(d.content).appendTo(e); if (!d.hidden) { f.show(); } else { f.hide(); } if (!d.persistent) { e.hover(function (g) { c.show(g); }, function () { c.hide(); }); if (!d.fixed) { e.mousemove(function (g) { if (f.css("display") !== "none") { c.updatePos(g); } }); } } else { e.click(function (g) { if (g.target === e.get(0)) { if (f.css("display") !== "none") { c.hide(); } else { c.show(); } } }); jQuery(window).mousedown(function (h) { if (f.css("display") !== "none") { var g = (d.focus) ? jQuery(h.target).parents(".tooltip").andSelf().filter(function () { return this === f.get(0); }).length : 0; if (g === 0) { c.hide(); } } }); } jQuery.extend(c, { getVersion: function () { return [1, 2, 0]; }, getParent: function () { return e; }, getTooltip: function () { return f; }, getPos: function () { return f.offset(); }, setPos: function (i, h) { var g = e.offset(); if (typeof i == "string") { i = parseInt(i) + g.left; } if (typeof h == "string") { h = parseInt(h) + g.top; } f.css({ left: i, top: h }); return c; }, show: function (g) { d.onBeforeShow.call(c); c.updatePos((d.fixed) ? null : g); switch (d.showEffect) { case "fade": f.fadeIn(d.showTime); break; case "slide": f.slideDown(d.showTime, c.updatePos); break; case "custom": d.showCustom.call(f, d.showTime); break; default: case "none": f.show(); break; } f.addClass(d.activeClass); d.onShow.call(c); return c; }, hide: function () { d.onBeforeHide.call(c); switch (d.hideEffect) { case "fade": f.fadeOut(d.hideTime); break; case "slide": f.slideUp(d.hideTime); break; case "custom": d.hideCustom.call(f, d.hideTime); break; default: case "none": f.hide(); break; } f.removeClass(d.activeClass); d.onHide.call(c); return c; }, update: function (g) { f.html(g); d.content = g; return c; }, load: function (g, h) { d.beforeContentLoad.call(c); f.load(g, h, function () { d.onContentLoad.call(c); }); return c; }, boundryCheck: function (l, j) { var i = l + f.outerWidth(); var h = j + f.outerHeight(); var g = jQuery(window).width() + jQuery(window).scrollLeft(); var k = jQuery(window).height() + jQuery(window).scrollTop(); return [(i >= g), (h >= k)]; }, updatePos: function (i) { var n = f.outerWidth(); var p = f.outerHeight(); if (!i && d.fixed) { if (d.position.constructor == Array) { h = parseInt(d.position[0]); g = parseInt(d.position[1]); } else { if (jQuery(d.position).attr("nodeType") === 1) { var m = jQuery(d.position).offset(); h = m.left; g = m.top; } else { var o = e.offset(); var l = e.outerWidth(); var j = e.outerHeight(); switch (d.position) { case "top": var h = o.left - (n / 2) + (l / 2); var g = o.top - p; break; case "bottom": var h = o.left - (n / 2) + (l / 2); var g = o.top + j; break; case "left": var h = o.left - n; var g = o.top - (p / 2) + (j / 2); break; case "right": var h = o.left + l; var g = o.top - (p / 2) + (j / 2); break; default: case "default": var h = (l / 2) + o.left + 20; var g = o.top; break; } } } } else { var h = i.pageX; var g = i.pageY; } if (typeof d.position != "object") { h = h + d.offset[0]; g = g + d.offset[1]; if (d.boundryCheck) { var k = c.boundryCheck(h, g); if (k[0]) { h = h - (n / 2) - (2 * d.offset[0]); } if (k[1]) { g = g - (p / 2) - (2 * d.offset[1]); } } } else { if (typeof d.position[0] == "string") { h = String(h); } if (typeof d.position[1] == "string") { g = String(g); } } c.setPos(h, g); return c; } }); } jQuery.fn.simpletip = function (c) { var d = jQuery(this).eq(typeof c == "number" ? c : 0).data("simpletip"); if (d) { return d; } var e = { content: "A simple tooltip", persistent: false, focus: false, hidden: true, position: "default", offset: [0, 0], boundryCheck: true, fixed: true, showEffect: "fade", showTime: 150, showCustom: null, hideEffect: "fade", hideTime: 150, hideCustom: null, baseClass: "tooltip", activeClass: "active", fixedClass: "fixed", persistentClass: "persistent", focusClass: "focus", onBeforeShow: function () { }, onShow: function () { }, onBeforeHide: function () { }, onHide: function () { }, beforeContentLoad: function () { }, onContentLoad: function () { } }; jQuery.extend(e, c); this.each(function () { var f = new a(jQuery(this), e); jQuery(this).data("simpletip", f); }); return this; }; })();
/*tipsy*/
(function ($) { $.fn.tipsy = function (g) { g = $.extend({}, $.fn.tipsy.defaults, g); return this.each(function () { var f = $.fn.tipsy.elementOptions(this, g); $(this).hover(function () { $.data(this, 'cancel.tipsy', true); var a = $.data(this, 'active.tipsy'); if (!a) { a = $('<div class="tipsy"><div class="tipsy-inner"/></div>'); a.css({ position: 'absolute', zIndex: 100000 }); $.data(this, 'active.tipsy', a) } if ($(this).attr('title') || typeof ($(this).attr('original-title')) != 'string') { $(this).attr('original-title', $(this).attr('title') || '').removeAttr('title') } var b; if (typeof f.title == 'string') { b = $(this).attr(f.title == 'title' ? 'original-title' : f.title) } else if (typeof f.title == 'function') { b = f.title.call(this) } a.find('.tipsy-inner')[f.html ? 'html' : 'text'](b || f.fallback); var c = $.extend({}, $(this).offset(), { width: this.offsetWidth, height: this.offsetHeight }); a.get(0).className = 'tipsy'; a.remove().css({ top: 0, left: 0, visibility: 'hidden', display: 'block' }).appendTo(document.body); var d = a[0].offsetWidth, actualHeight = a[0].offsetHeight; var e = (typeof f.gravity == 'function') ? f.gravity.call(this) : f.gravity; switch (e.charAt(0)) { case 'n': a.css({ top: c.top + c.height, left: c.left + c.width / 2 - d / 2 }).addClass('tipsy-north'); break; case 's': a.css({ top: c.top - actualHeight, left: c.left + c.width / 2 - d / 2 }).addClass('tipsy-south'); break; case 'e': a.css({ top: c.top + c.height / 2 - actualHeight / 2, left: c.left - d }).addClass('tipsy-east'); break; case 'w': a.css({ top: c.top + c.height / 2 - actualHeight / 2, left: c.left + c.width }).addClass('tipsy-west'); break } if (f.fade) { a.css({ opacity: 0, display: 'block', visibility: 'visible' }).animate({ opacity: 0.8 }) } else { a.css({ visibility: 'visible' }) } }, function () { $.data(this, 'cancel.tipsy', false); var b = this; setTimeout(function () { if ($.data(this, 'cancel.tipsy')) return; var a = $.data(b, 'active.tipsy'); if (f.fade) { a.stop().fadeOut(function () { $(this).remove() }) } else { a.remove() } }, 100) }) }) }; $.fn.tipsy.elementOptions = function (a, b) { return $.metadata ? $.extend({}, b, $(a).metadata()) : b }; $.fn.tipsy.defaults = { fade: false, fallback: '', gravity: 'n', html: false, title: 'title' }; $.fn.tipsy.autoNS = function () { return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n' }; $.fn.tipsy.autoWE = function () { return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w' } })(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({}, $.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: "This field is required.", remote: "Please fix this field.", email: "Please enter a valid email address.", url: "Please enter a valid URL.", date: "Please enter a valid date.", dateISO: "Please enter a valid date (ISO).", number: "Please enter a valid number.", digits: "Please enter only digits.", creditcard: "Please enter a valid credit card number.", equalTo: "Please enter the same value again.", accept: "Please enter a value with a valid extension.", maxlength: $.validator.format("Please enter no more than {0} characters."), minlength: $.validator.format("Please enter at least {0} characters."), rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."), range: $.validator.format("Please enter a value between {0} and {1}."), max: $.validator.format("Please enter a value less than or equal to {0}."), min: $.validator.format("Please enter a value greater than or equal to {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"); validator.settings["on" + event.type] && validator.settings["on" + event.type].call(validator, this[0]); } $(this.currentForm).delegate("focusin focusout keyup", ":text, :password, :file, select, textarea", delegate).delegate("click", ":radio, :checkbox, select, option", 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(); } 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) || !/Invalid|NaN/.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 ($) { $.each({ focus: 'focusin', blur: 'focusout' }, function (original, fix) { $.event.special[fix] = { setup: function () { if ($.browser.msie) return false; this.addEventListener(original, $.event.special[fix].handler, true); }, teardown: function () { if ($.browser.msie) return false; this.removeEventListener(original, $.event.special[fix].handler, true); }, handler: function (e) { arguments[0] = $.event.fix(e); arguments[0].type = fix; return $.event.handle.apply(this, arguments); } }; }); $.extend($.fn, { delegate: function (type, delegate, handler) { return this.bind(type, function (event) { var target = $(event.target); if (target.is(delegate)) { return handler.apply(target, arguments); } }); }, triggerEvent: function (type, target) { return this.triggerHandler(type, [$.event.fix({ type: type, target: target })]); } }) })(jQuery);

/*UI Blocker*/
; (function ($) { if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) { alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery); return } $.fn._fadeIn = $.fn.fadeIn; var B = function () { }; var C = document.documentMode || 0; var D = $.browser.msie && (($.browser.version < 8 && !C) || C < 8); var E = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !C; $.blockUI = function (a) { install(window, a) }; $.unblockUI = function (a) { remove(window, a) }; $.growlUI = function (a, b, c, d) { var e = $('<div class="growlUI"></div>'); if (a) e.append('<h1>' + a + '</h1>'); if (b) e.append('<h2>' + b + '</h2>'); if (c == undefined) c = 3000; $.blockUI({ message: e, fadeIn: 700, fadeOut: 1000, centerY: false, timeout: c, showOverlay: false, onUnblock: d, css: $.blockUI.defaults.growlCSS }) }; $.fn.block = function (a) { return this.unblock({ fadeOut: 0 }).each(function () { if ($.css(this, 'position') == 'static') this.style.position = 'relative'; if ($.browser.msie) this.style.zoom = 1; install(this, a) }) }; $.fn.unblock = function (a) { return this.each(function () { remove(this, a) }) }; $.blockUI.version = 2.33; $.blockUI.defaults = { message: '<h1>Please wait...</h1>', title: null, draggable: true, theme: false, css: { padding: 0, margin: 0, width: '30%', top: '40%', left: '35%', textAlign: 'center', color: '#000', border: '3px solid #aaa', backgroundColor: '#fff', cursor: 'wait' }, themedCSS: { width: '30%', top: '40%', left: '35%' }, overlayCSS: { backgroundColor: '#000', opacity: 0.6, cursor: 'wait' }, growlCSS: { width: '350px', top: '10px', left: '', right: '10px', border: 'none', padding: '5px', opacity: 0.6, cursor: 'default', color: '#fff', backgroundColor: '#000', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', 'border-radius': '10px' }, iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank', forceIframe: false, baseZ: 1000, centerX: true, centerY: true, allowBodyStretch: true, bindEvents: true, constrainTabKey: true, fadeIn: 200, fadeOut: 400, timeout: 0, showOverlay: true, focusInput: true, applyPlatformOpacityRules: true, onBlock: null, onUnblock: null, quirksmodeOffsetHack: 4 }; var F = null; var G = []; function install(c, d) { var e = (c == window); var f = d && d.message !== undefined ? d.message : undefined; d = $.extend({}, $.blockUI.defaults, d || {}); d.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, d.overlayCSS || {}); var g = $.extend({}, $.blockUI.defaults.css, d.css || {}); var h = $.extend({}, $.blockUI.defaults.themedCSS, d.themedCSS || {}); f = f === undefined ? d.message : f; if (e && F) remove(window, { fadeOut: 0 }); if (f && typeof f != 'string' && (f.parentNode || f.jquery)) { var j = f.jquery ? f[0] : f; var k = {}; $(c).data('blockUI.history', k); k.el = j; k.parent = j.parentNode; k.display = j.style.display; k.position = j.style.position; if (k.parent) k.parent.removeChild(j) } var z = d.baseZ; var m = ($.browser.msie || d.forceIframe) ? $('<iframe class="blockUI" style="z-index:' + (z++) + ';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="' + d.iframeSrc + '"></iframe>') : $('<div class="blockUI" style="display:none"></div>'); var n = $('<div class="blockUI blockOverlay" style="z-index:' + (z++) + ';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'); var p, s; if (d.theme && e) { s = '<div class="blockUI blockMsg blockPage ui-dialog ui-widget ui-corner-all" style="z-index:' + z + ';display:none;position:fixed">' + '<div class="ui-widget-header ui-dialog-titlebar blockTitle">' + (d.title || '&nbsp;') + '</div>' + '<div class="ui-widget-content ui-dialog-content"></div>' + '</div>' } else if (d.theme) { s = '<div class="blockUI blockMsg blockElement ui-dialog ui-widget ui-corner-all" style="z-index:' + z + ';display:none;position:absolute">' + '<div class="ui-widget-header ui-dialog-titlebar blockTitle">' + (d.title || '&nbsp;') + '</div>' + '<div class="ui-widget-content ui-dialog-content"></div>' + '</div>' } else if (e) { s = '<div class="blockUI blockMsg blockPage" style="z-index:' + z + ';display:none;position:fixed"></div>' } else { s = '<div class="blockUI blockMsg blockElement" style="z-index:' + z + ';display:none;position:absolute"></div>' } p = $(s); if (f) { if (d.theme) { p.css(h); p.addClass('ui-widget-content') } else p.css(g) } if (!d.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))) n.css(d.overlayCSS); n.css('position', e ? 'fixed' : 'absolute'); if ($.browser.msie || d.forceIframe) m.css('opacity', 0.0); var q = [m, n, p], $par = e ? $('body') : $(c); $.each(q, function () { this.appendTo($par) }); if (d.theme && d.draggable && $.fn.draggable) { p.draggable({ handle: '.ui-dialog-titlebar', cancel: 'li' }) } var r = D && (!$.boxModel || $('object,embed', e ? null : c).length > 0); if (E || r) { if (e && d.allowBodyStretch && $.boxModel) $('html,body').css('height', '100%'); if ((E || !$.boxModel) && !e) { var t = sz(c, 'borderTopWidth'), l = sz(c, 'borderLeftWidth'); var u = t ? '(0 - ' + t + ')' : 0; var v = l ? '(0 - ' + l + ')' : 0 } $.each([m, n, p], function (i, o) { var s = o[0].style; s.position = 'absolute'; if (i < 2) { e ? s.setExpression('height', 'Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:' + d.quirksmodeOffsetHack + ') + "px"') : s.setExpression('height', 'this.parentNode.offsetHeight + "px"'); e ? s.setExpression('width', 'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"') : s.setExpression('width', 'this.parentNode.offsetWidth + "px"'); if (v) s.setExpression('left', v); if (u) s.setExpression('top', u) } else if (d.centerY) { if (e) s.setExpression('top', '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'); s.marginTop = 0 } else if (!d.centerY && e) { var a = (d.css && d.css.top) ? parseInt(d.css.top) : 0; var b = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + ' + a + ') + "px"'; s.setExpression('top', b) } }) } if (f) { if (d.theme) p.find('.ui-widget-content').append(f); else p.append(f); if (f.jquery || f.nodeType) $(f).show() } if (($.browser.msie || d.forceIframe) && d.showOverlay) m.show(); if (d.fadeIn) { var w = d.onBlock ? d.onBlock : B; var x = (d.showOverlay && !f) ? w : B; var y = f ? w : B; if (d.showOverlay) n._fadeIn(d.fadeIn, x); if (f) p._fadeIn(d.fadeIn, y) } else { if (d.showOverlay) n.show(); if (f) p.show(); if (d.onBlock) d.onBlock() } bind(1, c, d); if (e) { F = p[0]; G = $(':input:enabled:visible', F); if (d.focusInput) setTimeout(focus, 20) } else center(p[0], d.centerX, d.centerY); if (d.timeout) { var A = setTimeout(function () { e ? $.unblockUI(d) : $(c).unblock(d) }, d.timeout); $(c).data('blockUI.timeout', A) } }; function remove(a, b) { var c = (a == window); var d = $(a); var e = d.data('blockUI.history'); var f = d.data('blockUI.timeout'); if (f) { clearTimeout(f); d.removeData('blockUI.timeout') } b = $.extend({}, $.blockUI.defaults, b || {}); bind(0, a, b); var g; if (c) g = $('body').children().filter('.blockUI').add('body > .blockUI'); else g = $('.blockUI', a); if (c) F = G = null; if (b.fadeOut) { g.fadeOut(b.fadeOut); setTimeout(function () { reset(g, e, b, a) }, b.fadeOut) } else reset(g, e, b, a) }; function reset(a, b, c, d) { a.each(function (i, o) { if (this.parentNode) this.parentNode.removeChild(this) }); if (b && b.el) { b.el.style.display = b.display; b.el.style.position = b.position; if (b.parent) b.parent.appendChild(b.el); $(d).removeData('blockUI.history') } if (typeof c.onUnblock == 'function') c.onUnblock(d, c) }; function bind(b, a, c) { var d = a == window, $el = $(a); if (!b && (d && !F || !d && !$el.data('blockUI.isBlocked'))) return; if (!d) $el.data('blockUI.isBlocked', b); if (!c.bindEvents || (b && !c.showOverlay)) return; var e = 'mousedown mouseup keydown keypress'; b ? $(document).bind(e, c, handler) : $(document).unbind(e, handler) }; function handler(e) { if (e.keyCode && e.keyCode == 9) { if (F && e.data.constrainTabKey) { var a = G; var b = !e.shiftKey && e.target == a[a.length - 1]; var c = e.shiftKey && e.target == a[0]; if (b || c) { setTimeout(function () { focus(c) }, 10); return false } } } if ($(e.target).parents('div.blockMsg').length > 0) return true; return $(e.target).parents().children().filter('div.blockUI').length == 0 }; function focus(a) { if (!G) return; var e = G[a === true ? G.length - 1 : 0]; if (e) e.focus() }; function center(a, x, y) { var p = a.parentNode, s = a.style; var l = ((p.offsetWidth - a.offsetWidth) / 2) - sz(p, 'borderLeftWidth'); var t = ((p.offsetHeight - a.offsetHeight) / 2) - sz(p, 'borderTopWidth'); if (x) s.left = l > 0 ? (l + 'px') : '0'; if (y) s.top = t > 0 ? (t + 'px') : '0' }; function sz(a, p) { return parseInt($.css(a, p)) || 0 } })(jQuery);



/*JScale*/
jQuery.jScale = { getnewSize: function (b, d) { var c = (b == "w") ? "h" : "w"; if (typeof d == "undefined" || d == null) { var a = this.ndimensions[c] * this.odimensions[b] / this.odimensions[c] } else { var a = (/%/.test(d)) ? parseInt(d) / 100 * this.odimensions[b] : parseInt(d) } this.ndimensions[b] = Math.round(a) }, getnewDimensions: function (f, d, c, h) { var e = f('<img src="' + d.src + '" style="position:absolute; top:0; left:0; visibility:hidden" />').prependTo("body"); this.odimensions = { w: e.width(), h: e.height() }; var a = (this.odimensions.w > this.odimensions.h) ? ["w", "h"] : ["h", "w"]; this.ndimensions = {}; if (typeof c.ls != "undefined") { c[a[0]] = c.ls; c[a[1]] = null } var g = (c.w) ? ["w", "h"] : (c.h) ? ["h", "w"] : []; if (g.length > 0) { this.getnewSize(g[0], c[g[0]]); this.getnewSize(g[1], c[g[1]]); var b = h || function () { }; if (c.speed > 0) { f(d).animate({ width: this.ndimensions.w + "px", height: this.ndimensions.h + "px" }, c.speed, b) } else { f(d).css({ width: this.ndimensions.w + "px", height: this.ndimensions.h + "px" }); b.call(d) } } e.remove() } }; jQuery.fn.jScale = function (a, b) { return this.each(function () { var c = this; if (typeof a == "undefined" || c.tagName != "IMG") { return true } if (c.complete) { jQuery.jScale.getnewDimensions(jQuery, c, a, b) } else { $(this).bind("load", function () { jQuery.jScale.getnewDimensions(jQuery, c, a, b) }) } }) };

/*Crop*/

(function ($) { var abs = Math.abs, max = Math.max, min = Math.min, round = Math.round; function div() { return $('<div/>') } $.imgAreaSelect = function (img, options) { var $img = $(img), imgLoaded, $box = div(), $area = div(), $border = div().add(div()).add(div()).add(div()), $outer = div().add(div()).add(div()).add(div()), $handles = $([]), $areaOpera, left, top, imgOfs = { left: 0, top: 0 }, imgWidth, imgHeight, $parent, parOfs = { left: 0, top: 0 }, zIndex = 0, position = 'absolute', startX, startY, scaleX, scaleY, resizeMargin = 10, resize, minWidth, minHeight, maxWidth, maxHeight, aspectRatio, shown, x1, y1, x2, y2, selection = { x1: 0, y1: 0, x2: 0, y2: 0, width: 0, height: 0 }, docElem = document.documentElement, $p, d, i, o, w, h, adjusted; function viewX(x) { return x + imgOfs.left - parOfs.left } function viewY(y) { return y + imgOfs.top - parOfs.top } function selX(x) { return x - imgOfs.left + parOfs.left } function selY(y) { return y - imgOfs.top + parOfs.top } function evX(event) { return event.pageX - parOfs.left } function evY(event) { return event.pageY - parOfs.top } function getSelection(noScale) { var sx = noScale || scaleX, sy = noScale || scaleY; return { x1: round(selection.x1 * sx), y1: round(selection.y1 * sy), x2: round(selection.x2 * sx), y2: round(selection.y2 * sy), width: round(selection.x2 * sx) - round(selection.x1 * sx), height: round(selection.y2 * sy) - round(selection.y1 * sy)} } function setSelection(x1, y1, x2, y2, noScale) { var sx = noScale || scaleX, sy = noScale || scaleY; selection = { x1: round(x1 / sx || 0), y1: round(y1 / sy || 0), x2: round(x2 / sx || 0), y2: round(y2 / sy || 0) }; selection.width = selection.x2 - selection.x1; selection.height = selection.y2 - selection.y1 } function adjust() { if (!$img.width()) return; imgOfs = { left: round($img.offset().left), top: round($img.offset().top) }; imgWidth = $img.innerWidth(); imgHeight = $img.innerHeight(); imgOfs.top += ($img.outerHeight() - imgHeight) >> 1; imgOfs.left += ($img.outerWidth() - imgWidth) >> 1; minWidth = options.minWidth || 0; minHeight = options.minHeight || 0; maxWidth = min(options.maxWidth || 1 << 24, imgWidth); maxHeight = min(options.maxHeight || 1 << 24, imgHeight); if ($().jquery == '1.3.2' && position == 'fixed' && !docElem['getBoundingClientRect']) { imgOfs.top += max(document.body.scrollTop, docElem.scrollTop); imgOfs.left += max(document.body.scrollLeft, docElem.scrollLeft) } parOfs = $.inArray($parent.css('position'), ['absolute', 'relative']) + 1 ? { left: round($parent.offset().left) - $parent.scrollLeft(), top: round($parent.offset().top) - $parent.scrollTop()} : position == 'fixed' ? { left: $(document).scrollLeft(), top: $(document).scrollTop()} : { left: 0, top: 0 }; left = viewX(0); top = viewY(0); if (selection.x2 > imgWidth || selection.y2 > imgHeight) doResize() } function update(resetKeyPress) { if (!shown) return; $box.css({ left: viewX(selection.x1), top: viewY(selection.y1) }).add($area).width(w = selection.width).height(h = selection.height); $area.add($border).add($handles).css({ left: 0, top: 0 }); $border.width(max(w - $border.outerWidth() + $border.innerWidth(), 0)).height(max(h - $border.outerHeight() + $border.innerHeight(), 0)); $($outer[0]).css({ left: left, top: top, width: selection.x1, height: imgHeight }); $($outer[1]).css({ left: left + selection.x1, top: top, width: w, height: selection.y1 }); $($outer[2]).css({ left: left + selection.x2, top: top, width: imgWidth - selection.x2, height: imgHeight }); $($outer[3]).css({ left: left + selection.x1, top: top + selection.y2, width: w, height: imgHeight - selection.y2 }); w -= $handles.outerWidth(); h -= $handles.outerHeight(); switch ($handles.length) { case 8: $($handles[4]).css({ left: w >> 1 }); $($handles[5]).css({ left: w, top: h >> 1 }); $($handles[6]).css({ left: w >> 1, top: h }); $($handles[7]).css({ top: h >> 1 }); case 4: $handles.slice(1, 3).css({ left: w }); $handles.slice(2, 4).css({ top: h }) } if (resetKeyPress !== false) { if ($.imgAreaSelect.keyPress != docKeyPress) $(document).unbind($.imgAreaSelect.keyPress, $.imgAreaSelect.onKeyPress); if (options.keys) $(document)[$.imgAreaSelect.keyPress]($.imgAreaSelect.onKeyPress = docKeyPress) } if ($.browser.msie && $border.outerWidth() - $border.innerWidth() == 2) { $border.css('margin', 0); setTimeout(function () { $border.css('margin', 'auto') }, 0) } } function doUpdate(resetKeyPress) { adjust(); update(resetKeyPress); x1 = viewX(selection.x1); y1 = viewY(selection.y1); x2 = viewX(selection.x2); y2 = viewY(selection.y2) } function hide($elem, fn) { options.fadeSpeed ? $elem.fadeOut(options.fadeSpeed, fn) : $elem.hide() } function areaMouseMove(event) { var x = selX(evX(event)) - selection.x1, y = selY(evY(event)) - selection.y1; if (!adjusted) { adjust(); adjusted = true; $box.one('mouseout', function () { adjusted = false }) } resize = ''; if (options.resizable) { if (y <= options.resizeMargin) resize = 'n'; else if (y >= selection.height - options.resizeMargin) resize = 's'; if (x <= options.resizeMargin) resize += 'w'; else if (x >= selection.width - options.resizeMargin) resize += 'e' } $box.css('cursor', resize ? resize + '-resize' : options.movable ? 'move' : ''); if ($areaOpera) $areaOpera.toggle() } function docMouseUp(event) { $('body').css('cursor', ''); if (options.autoHide || selection.width * selection.height == 0) hide($box.add($outer), function () { $(this).hide() }); $(document).unbind('mousemove', selectingMouseMove); $box.mousemove(areaMouseMove); options.onSelectEnd(img, getSelection()) } function areaMouseDown(event) { if (event.which != 1) return false; adjust(); if (resize) { $('body').css('cursor', resize + '-resize'); x1 = viewX(selection[/w/.test(resize) ? 'x2' : 'x1']); y1 = viewY(selection[/n/.test(resize) ? 'y2' : 'y1']); $(document).mousemove(selectingMouseMove).one('mouseup', docMouseUp); $box.unbind('mousemove', areaMouseMove) } else if (options.movable) { startX = left + selection.x1 - evX(event); startY = top + selection.y1 - evY(event); $box.unbind('mousemove', areaMouseMove); $(document).mousemove(movingMouseMove).one('mouseup', function () { options.onSelectEnd(img, getSelection()); $(document).unbind('mousemove', movingMouseMove); $box.mousemove(areaMouseMove) }) } else $img.mousedown(event); return false } function fixAspectRatio(xFirst) { if (aspectRatio) if (xFirst) { x2 = max(left, min(left + imgWidth, x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1))); y2 = round(max(top, min(top + imgHeight, y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1)))); x2 = round(x2) } else { y2 = max(top, min(top + imgHeight, y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1))); x2 = round(max(left, min(left + imgWidth, x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1)))); y2 = round(y2) } } function doResize() { x1 = min(x1, left + imgWidth); y1 = min(y1, top + imgHeight); if (abs(x2 - x1) < minWidth) { x2 = x1 - minWidth * (x2 < x1 || -1); if (x2 < left) x1 = left + minWidth; else if (x2 > left + imgWidth) x1 = left + imgWidth - minWidth } if (abs(y2 - y1) < minHeight) { y2 = y1 - minHeight * (y2 < y1 || -1); if (y2 < top) y1 = top + minHeight; else if (y2 > top + imgHeight) y1 = top + imgHeight - minHeight } x2 = max(left, min(x2, left + imgWidth)); y2 = max(top, min(y2, top + imgHeight)); fixAspectRatio(abs(x2 - x1) < abs(y2 - y1) * aspectRatio); if (abs(x2 - x1) > maxWidth) { x2 = x1 - maxWidth * (x2 < x1 || -1); fixAspectRatio() } if (abs(y2 - y1) > maxHeight) { y2 = y1 - maxHeight * (y2 < y1 || -1); fixAspectRatio(true) } selection = { x1: selX(min(x1, x2)), x2: selX(max(x1, x2)), y1: selY(min(y1, y2)), y2: selY(max(y1, y2)), width: abs(x2 - x1), height: abs(y2 - y1) }; update(); options.onSelectChange(img, getSelection()) } function selectingMouseMove(event) { x2 = resize == '' || /w|e/.test(resize) || aspectRatio ? evX(event) : viewX(selection.x2); y2 = resize == '' || /n|s/.test(resize) || aspectRatio ? evY(event) : viewY(selection.y2); doResize(); return false } function doMove(newX1, newY1) { x2 = (x1 = newX1) + selection.width; y2 = (y1 = newY1) + selection.height; $.extend(selection, { x1: selX(x1), y1: selY(y1), x2: selX(x2), y2: selY(y2) }); update(); options.onSelectChange(img, getSelection()) } function movingMouseMove(event) { x1 = max(left, min(startX + evX(event), left + imgWidth - selection.width)); y1 = max(top, min(startY + evY(event), top + imgHeight - selection.height)); doMove(x1, y1); event.preventDefault(); return false } function startSelection() { $(document).unbind('mousemove', startSelection); adjust(); x2 = x1; y2 = y1; doResize(); resize = ''; if ($outer.is(':not(:visible)')) $box.add($outer).hide().fadeIn(options.fadeSpeed || 0); shown = true; $(document).unbind('mouseup', cancelSelection).mousemove(selectingMouseMove).one('mouseup', docMouseUp); $box.unbind('mousemove', areaMouseMove); options.onSelectStart(img, getSelection()) } function cancelSelection() { $(document).unbind('mousemove', startSelection).unbind('mouseup', cancelSelection); hide($box.add($outer)); setSelection(selX(x1), selY(y1), selX(x1), selY(y1)); options.onSelectChange(img, getSelection()); options.onSelectEnd(img, getSelection()) } function imgMouseDown(event) { if (event.which != 1 || $outer.is(':animated')) return false; adjust(); startX = x1 = evX(event); startY = y1 = evY(event); $(document).mousemove(startSelection).mouseup(cancelSelection); return false } function windowResize() { doUpdate(false) } function imgLoad() { imgLoaded = true; setOptions(options = $.extend({ classPrefix: 'imgareaselect', movable: true, parent: 'body', resizable: true, resizeMargin: 10, onInit: function () { }, onSelectStart: function () { }, onSelectChange: function () { }, onSelectEnd: function () { } }, options)); $box.add($outer).css({ visibility: '' }); if (options.show) { shown = true; adjust(); update(); $box.add($outer).hide().fadeIn(options.fadeSpeed || 0) } setTimeout(function () { options.onInit(img, getSelection()) }, 0) } var docKeyPress = function (event) { var k = options.keys, d, t, key = event.keyCode; d = !isNaN(k.alt) && (event.altKey || event.originalEvent.altKey) ? k.alt : !isNaN(k.ctrl) && event.ctrlKey ? k.ctrl : !isNaN(k.shift) && event.shiftKey ? k.shift : !isNaN(k.arrows) ? k.arrows : 10; if (k.arrows == 'resize' || (k.shift == 'resize' && event.shiftKey) || (k.ctrl == 'resize' && event.ctrlKey) || (k.alt == 'resize' && (event.altKey || event.originalEvent.altKey))) { switch (key) { case 37: d = -d; case 39: t = max(x1, x2); x1 = min(x1, x2); x2 = max(t + d, x1); fixAspectRatio(); break; case 38: d = -d; case 40: t = max(y1, y2); y1 = min(y1, y2); y2 = max(t + d, y1); fixAspectRatio(true); break; default: return } doResize() } else { x1 = min(x1, x2); y1 = min(y1, y2); switch (key) { case 37: doMove(max(x1 - d, left), y1); break; case 38: doMove(x1, max(y1 - d, top)); break; case 39: doMove(x1 + min(d, imgWidth - selX(x2)), y1); break; case 40: doMove(x1, y1 + min(d, imgHeight - selY(y2))); break; default: return } } return false }; function styleOptions($elem, props) { for (option in props) if (options[option] !== undefined) $elem.css(props[option], options[option]) } function setOptions(newOptions) { if (newOptions.parent) ($parent = $(newOptions.parent)).append($box.add($outer)); $.extend(options, newOptions); adjust(); if (newOptions.handles != null) { $handles.remove(); $handles = $([]); i = newOptions.handles ? newOptions.handles == 'corners' ? 4 : 8 : 0; while (i--) $handles = $handles.add(div()); $handles.addClass(options.classPrefix + '-handle').css({ position: 'absolute', fontSize: 0, zIndex: zIndex + 1 || 1 }); if (!parseInt($handles.css('width')) >= 0) $handles.width(5).height(5); if (o = options.borderWidth) $handles.css({ borderWidth: o, borderStyle: 'solid' }); styleOptions($handles, { borderColor1: 'border-color', borderColor2: 'background-color', borderOpacity: 'opacity' }) } scaleX = options.imageWidth / imgWidth || 1; scaleY = options.imageHeight / imgHeight || 1; if (newOptions.x1 != null) { setSelection(newOptions.x1, newOptions.y1, newOptions.x2, newOptions.y2); newOptions.show = !newOptions.hide } if (newOptions.keys) options.keys = $.extend({ shift: 1, ctrl: 'resize' }, newOptions.keys); $outer.addClass(options.classPrefix + '-outer'); $area.addClass(options.classPrefix + '-selection'); for (i = 0; i++ < 4; ) $($border[i - 1]).addClass(options.classPrefix + '-border' + i); styleOptions($area, { selectionColor: 'background-color', selectionOpacity: 'opacity' }); styleOptions($border, { borderOpacity: 'opacity', borderWidth: 'border-width' }); styleOptions($outer, { outerColor: 'background-color', outerOpacity: 'opacity' }); if (o = options.borderColor1) $($border[0]).css({ borderStyle: 'solid', borderColor: o }); if (o = options.borderColor2) $($border[1]).css({ borderStyle: 'dashed', borderColor: o }); $box.append($area.add($border).add($areaOpera).add($handles)); if ($.browser.msie) { if (o = $outer.css('filter').match(/opacity=([0-9]+)/)) $outer.css('opacity', o[1] / 100); if (o = $border.css('filter').match(/opacity=([0-9]+)/)) $border.css('opacity', o[1] / 100) } if (newOptions.hide) hide($box.add($outer)); else if (newOptions.show && imgLoaded) { shown = true; $box.add($outer).fadeIn(options.fadeSpeed || 0); doUpdate() } aspectRatio = (d = (options.aspectRatio || '').split(/:/))[0] / d[1]; $img.add($outer).unbind('mousedown', imgMouseDown); if (options.disable || options.enable === false) { $box.unbind('mousemove', areaMouseMove).unbind('mousedown', areaMouseDown); $(window).unbind('resize', windowResize) } else { if (options.enable || options.disable === false) { if (options.resizable || options.movable) $box.mousemove(areaMouseMove).mousedown(areaMouseDown); $(window).resize(windowResize) } if (!options.persistent) $img.add($outer).mousedown(imgMouseDown) } options.enable = options.disable = undefined } this.remove = function () { setOptions({ disable: true }); $box.add($outer).remove() }; this.getOptions = function () { return options }; this.setOptions = setOptions; this.getSelection = getSelection; this.setSelection = setSelection; this.update = doUpdate; $p = $img; while ($p.length) { zIndex = max(zIndex, !isNaN($p.css('z-index')) ? $p.css('z-index') : zIndex); if ($p.css('position') == 'fixed') position = 'fixed'; $p = $p.parent(':not(body)') } zIndex = options.zIndex || zIndex; if ($.browser.msie) $img.attr('unselectable', 'on'); $.imgAreaSelect.keyPress = $.browser.msie || $.browser.safari ? 'keydown' : 'keypress'; if ($.browser.opera) $areaOpera = div().css({ width: '100%', height: '100%', position: 'absolute', zIndex: zIndex + 2 || 2 }); $box.add($outer).css({ visibility: 'hidden', position: position, overflow: 'hidden', zIndex: zIndex || '0' }); $box.css({ zIndex: zIndex + 2 || 2 }); $area.add($border).css({ position: 'absolute', fontSize: 0 }); img.complete || img.readyState == 'complete' || !$img.is('img') ? imgLoad() : $img.one('load', imgLoad); if ($.browser.msie && $.browser.version >= 9) img.src = img.src }; $.fn.imgAreaSelect = function (options) { options = options || {}; this.each(function () { if ($(this).data('imgAreaSelect')) { if (options.remove) { $(this).data('imgAreaSelect').remove(); $(this).removeData('imgAreaSelect') } else $(this).data('imgAreaSelect').setOptions(options) } else if (!options.remove) { if (options.enable === undefined && options.disable === undefined) options.enable = true; $(this).data('imgAreaSelect', new $.imgAreaSelect(this, options)) } }); if (options.instance) return $(this).data('imgAreaSelect'); return this } })(jQuery);



