/*
 * jQuery 1.2.6 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
 * $Rev: 5685 $
 */
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}('(H(){J w=1b.4M,3m$=1b.$;J D=1b.4M=1b.$=H(a,b){I 2B D.17.5j(a,b)};J u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/,62=/^.[^:#\\[\\.]*$/,12;D.17=D.44={5j:H(d,b){d=d||S;G(d.16){7[0]=d;7.K=1;I 7}G(1j d=="23"){J c=u.2D(d);G(c&&(c[1]||!b)){G(c[1])d=D.4h([c[1]],b);N{J a=S.61(c[3]);G(a){G(a.2v!=c[3])I D().2q(d);I D(a)}d=[]}}N I D(b).2q(d)}N G(D.1D(d))I D(S)[D.17.27?"27":"43"](d);I 7.6Y(D.2d(d))},5w:"1.2.6",8G:H(){I 7.K},K:0,3p:H(a){I a==12?D.2d(7):7[a]},2I:H(b){J a=D(b);a.5n=7;I a},6Y:H(a){7.K=0;2p.44.1p.1w(7,a);I 7},P:H(a,b){I D.P(7,a,b)},5i:H(b){J a=-1;I D.2L(b&&b.5w?b[0]:b,7)},1K:H(c,a,b){J d=c;G(c.1q==56)G(a===12)I 7[0]&&D[b||"1K"](7[0],c);N{d={};d[c]=a}I 7.P(H(i){R(c 1n d)D.1K(b?7.V:7,c,D.1i(7,d[c],b,i,c))})},1g:H(b,a){G((b==\'2h\'||b==\'1Z\')&&3d(a)<0)a=12;I 7.1K(b,a,"2a")},1r:H(b){G(1j b!="49"&&b!=U)I 7.4E().3v((7[0]&&7[0].2z||S).5F(b));J a="";D.P(b||7,H(){D.P(7.3t,H(){G(7.16!=8)a+=7.16!=1?7.76:D.17.1r([7])})});I a},5z:H(b){G(7[0])D(b,7[0].2z).5y().39(7[0]).2l(H(){J a=7;1B(a.1x)a=a.1x;I a}).3v(7);I 7},8Y:H(a){I 7.P(H(){D(7).6Q().5z(a)})},8R:H(a){I 7.P(H(){D(7).5z(a)})},3v:H(){I 7.3W(19,M,Q,H(a){G(7.16==1)7.3U(a)})},6F:H(){I 7.3W(19,M,M,H(a){G(7.16==1)7.39(a,7.1x)})},6E:H(){I 7.3W(19,Q,Q,H(a){7.1d.39(a,7)})},5q:H(){I 7.3W(19,Q,M,H(a){7.1d.39(a,7.2H)})},3l:H(){I 7.5n||D([])},2q:H(b){J c=D.2l(7,H(a){I D.2q(b,a)});I 7.2I(/[^+>] [^+>]/.11(b)||b.1h("..")>-1?D.4r(c):c)},5y:H(e){J f=7.2l(H(){G(D.14.1f&&!D.4n(7)){J a=7.6o(M),5h=S.3h("1v");5h.3U(a);I D.4h([5h.4H])[0]}N I 7.6o(M)});J d=f.2q("*").5c().P(H(){G(7[E]!=12)7[E]=U});G(e===M)7.2q("*").5c().P(H(i){G(7.16==3)I;J c=D.L(7,"3w");R(J a 1n c)R(J b 1n c[a])D.W.1e(d[i],a,c[a][b],c[a][b].L)});I f},1E:H(b){I 7.2I(D.1D(b)&&D.3C(7,H(a,i){I b.1k(a,i)})||D.3g(b,7))},4Y:H(b){G(b.1q==56)G(62.11(b))I 7.2I(D.3g(b,7,M));N b=D.3g(b,7);J a=b.K&&b[b.K-1]!==12&&!b.16;I 7.1E(H(){I a?D.2L(7,b)<0:7!=b})},1e:H(a){I 7.2I(D.4r(D.2R(7.3p(),1j a==\'23\'?D(a):D.2d(a))))},3F:H(a){I!!a&&D.3g(a,7).K>0},7T:H(a){I 7.3F("."+a)},6e:H(b){G(b==12){G(7.K){J c=7[0];G(D.Y(c,"2A")){J e=c.64,63=[],15=c.15,2V=c.O=="2A-2V";G(e<0)I U;R(J i=2V?e:0,2f=2V?e+1:15.K;i<2f;i++){J d=15[i];G(d.2W){b=D.14.1f&&!d.at.2x.an?d.1r:d.2x;G(2V)I b;63.1p(b)}}I 63}N I(7[0].2x||"").1o(/\\r/g,"")}I 12}G(b.1q==4L)b+=\'\';I 7.P(H(){G(7.16!=1)I;G(b.1q==2p&&/5O|5L/.11(7.O))7.4J=(D.2L(7.2x,b)>=0||D.2L(7.34,b)>=0);N G(D.Y(7,"2A")){J a=D.2d(b);D("9R",7).P(H(){7.2W=(D.2L(7.2x,a)>=0||D.2L(7.1r,a)>=0)});G(!a.K)7.64=-1}N 7.2x=b})},2K:H(a){I a==12?(7[0]?7[0].4H:U):7.4E().3v(a)},7b:H(a){I 7.5q(a).21()},79:H(i){I 7.3s(i,i+1)},3s:H(){I 7.2I(2p.44.3s.1w(7,19))},2l:H(b){I 7.2I(D.2l(7,H(a,i){I b.1k(a,i,a)}))},5c:H(){I 7.1e(7.5n)},L:H(d,b){J a=d.1R(".");a[1]=a[1]?"."+a[1]:"";G(b===12){J c=7.5C("9z"+a[1]+"!",[a[0]]);G(c===12&&7.K)c=D.L(7[0],d);I c===12&&a[1]?7.L(a[0]):c}N I 7.1P("9u"+a[1]+"!",[a[0],b]).P(H(){D.L(7,d,b)})},3b:H(a){I 7.P(H(){D.3b(7,a)})},3W:H(g,f,h,d){J e=7.K>1,3x;I 7.P(H(){G(!3x){3x=D.4h(g,7.2z);G(h)3x.9o()}J b=7;G(f&&D.Y(7,"1T")&&D.Y(3x[0],"4F"))b=7.3H("22")[0]||7.3U(7.2z.3h("22"));J c=D([]);D.P(3x,H(){J a=e?D(7).5y(M)[0]:7;G(D.Y(a,"1m"))c=c.1e(a);N{G(a.16==1)c=c.1e(D("1m",a).21());d.1k(b,a)}});c.P(6T)})}};D.17.5j.44=D.17;H 6T(i,a){G(a.4d)D.3Y({1a:a.4d,31:Q,1O:"1m"});N D.5u(a.1r||a.6O||a.4H||"");G(a.1d)a.1d.37(a)}H 1z(){I+2B 8J}D.1l=D.17.1l=H(){J b=19[0]||{},i=1,K=19.K,4x=Q,15;G(b.1q==8I){4x=b;b=19[1]||{};i=2}G(1j b!="49"&&1j b!="H")b={};G(K==i){b=7;--i}R(;i<K;i++)G((15=19[i])!=U)R(J c 1n 15){J a=b[c],2w=15[c];G(b===2w)6M;G(4x&&2w&&1j 2w=="49"&&!2w.16)b[c]=D.1l(4x,a||(2w.K!=U?[]:{}),2w);N G(2w!==12)b[c]=2w}I b};J E="4M"+1z(),6K=0,5r={},6G=/z-?5i|8B-?8A|1y|6B|8v-?1Z/i,3P=S.3P||{};D.1l({8u:H(a){1b.$=3m$;G(a)1b.4M=w;I D},1D:H(a){I!!a&&1j a!="23"&&!a.Y&&a.1q!=2p&&/^[\\s[]?H/.11(a+"")},4n:H(a){I a.1C&&!a.1c||a.2j&&a.2z&&!a.2z.1c},5u:H(a){a=D.3k(a);G(a){J b=S.3H("6w")[0]||S.1C,1m=S.3h("1m");1m.O="1r/4t";G(D.14.1f)1m.1r=a;N 1m.3U(S.5F(a));b.39(1m,b.1x);b.37(1m)}},Y:H(b,a){I b.Y&&b.Y.2r()==a.2r()},1Y:{},L:H(c,d,b){c=c==1b?5r:c;J a=c[E];G(!a)a=c[E]=++6K;G(d&&!D.1Y[a])D.1Y[a]={};G(b!==12)D.1Y[a][d]=b;I d?D.1Y[a][d]:a},3b:H(c,b){c=c==1b?5r:c;J a=c[E];G(b){G(D.1Y[a]){2U D.1Y[a][b];b="";R(b 1n D.1Y[a])1X;G(!b)D.3b(c)}}N{1U{2U c[E]}1V(e){G(c.5l)c.5l(E)}2U D.1Y[a]}},P:H(d,a,c){J e,i=0,K=d.K;G(c){G(K==12){R(e 1n d)G(a.1w(d[e],c)===Q)1X}N R(;i<K;)G(a.1w(d[i++],c)===Q)1X}N{G(K==12){R(e 1n d)G(a.1k(d[e],e,d[e])===Q)1X}N R(J b=d[0];i<K&&a.1k(b,i,b)!==Q;b=d[++i]){}}I d},1i:H(b,a,c,i,d){G(D.1D(a))a=a.1k(b,i);I a&&a.1q==4L&&c=="2a"&&!6G.11(d)?a+"2X":a},1F:{1e:H(c,b){D.P((b||"").1R(/\\s+/),H(i,a){G(c.16==1&&!D.1F.3T(c.1F,a))c.1F+=(c.1F?" ":"")+a})},21:H(c,b){G(c.16==1)c.1F=b!=12?D.3C(c.1F.1R(/\\s+/),H(a){I!D.1F.3T(b,a)}).6s(" "):""},3T:H(b,a){I D.2L(a,(b.1F||b).6r().1R(/\\s+/))>-1}},6q:H(b,c,a){J e={};R(J d 1n c){e[d]=b.V[d];b.V[d]=c[d]}a.1k(b);R(J d 1n c)b.V[d]=e[d]},1g:H(d,e,c){G(e=="2h"||e=="1Z"){J b,3X={30:"5x",5g:"1G",18:"3I"},35=e=="2h"?["5e","6k"]:["5G","6i"];H 5b(){b=e=="2h"?d.8f:d.8c;J a=0,2C=0;D.P(35,H(){a+=3d(D.2a(d,"57"+7,M))||0;2C+=3d(D.2a(d,"2C"+7+"4b",M))||0});b-=29.83(a+2C)}G(D(d).3F(":4j"))5b();N D.6q(d,3X,5b);I 29.2f(0,b)}I D.2a(d,e,c)},2a:H(f,l,k){J e,V=f.V;H 3E(b){G(!D.14.2k)I Q;J a=3P.54(b,U);I!a||a.52("3E")==""}G(l=="1y"&&D.14.1f){e=D.1K(V,"1y");I e==""?"1":e}G(D.14.2G&&l=="18"){J d=V.50;V.50="0 7Y 7W";V.50=d}G(l.1I(/4i/i))l=y;G(!k&&V&&V[l])e=V[l];N G(3P.54){G(l.1I(/4i/i))l="4i";l=l.1o(/([A-Z])/g,"-$1").3y();J c=3P.54(f,U);G(c&&!3E(f))e=c.52(l);N{J g=[],2E=[],a=f,i=0;R(;a&&3E(a);a=a.1d)2E.6h(a);R(;i<2E.K;i++)G(3E(2E[i])){g[i]=2E[i].V.18;2E[i].V.18="3I"}e=l=="18"&&g[2E.K-1]!=U?"2F":(c&&c.52(l))||"";R(i=0;i<g.K;i++)G(g[i]!=U)2E[i].V.18=g[i]}G(l=="1y"&&e=="")e="1"}N G(f.4g){J h=l.1o(/\\-(\\w)/g,H(a,b){I b.2r()});e=f.4g[l]||f.4g[h];G(!/^\\d+(2X)?$/i.11(e)&&/^\\d/.11(e)){J j=V.1A,66=f.65.1A;f.65.1A=f.4g.1A;V.1A=e||0;e=V.aM+"2X";V.1A=j;f.65.1A=66}}I e},4h:H(l,h){J k=[];h=h||S;G(1j h.3h==\'12\')h=h.2z||h[0]&&h[0].2z||S;D.P(l,H(i,d){G(!d)I;G(d.1q==4L)d+=\'\';G(1j d=="23"){d=d.1o(/(<(\\w+)[^>]*?)\\/>/g,H(b,a,c){I c.1I(/^(aK|4f|7E|aG|4T|7A|aB|3n|az|ay|av)$/i)?b:a+"></"+c+">"});J f=D.3k(d).3y(),1v=h.3h("1v");J e=!f.1h("<au")&&[1,"<2A 7w=\'7w\'>","</2A>"]||!f.1h("<ar")&&[1,"<7v>","</7v>"]||f.1I(/^<(aq|22|am|ak|ai)/)&&[1,"<1T>","</1T>"]||!f.1h("<4F")&&[2,"<1T><22>","</22></1T>"]||(!f.1h("<af")||!f.1h("<ad"))&&[3,"<1T><22><4F>","</4F></22></1T>"]||!f.1h("<7E")&&[2,"<1T><22></22><7q>","</7q></1T>"]||D.14.1f&&[1,"1v<1v>","</1v>"]||[0,"",""];1v.4H=e[1]+d+e[2];1B(e[0]--)1v=1v.5T;G(D.14.1f){J g=!f.1h("<1T")&&f.1h("<22")<0?1v.1x&&1v.1x.3t:e[1]=="<1T>"&&f.1h("<22")<0?1v.3t:[];R(J j=g.K-1;j>=0;--j)G(D.Y(g[j],"22")&&!g[j].3t.K)g[j].1d.37(g[j]);G(/^\\s/.11(d))1v.39(h.5F(d.1I(/^\\s*/)[0]),1v.1x)}d=D.2d(1v.3t)}G(d.K===0&&(!D.Y(d,"3V")&&!D.Y(d,"2A")))I;G(d[0]==12||D.Y(d,"3V")||d.15)k.1p(d);N k=D.2R(k,d)});I k},1K:H(d,f,c){G(!d||d.16==3||d.16==8)I 12;J e=!D.4n(d),40=c!==12,1f=D.14.1f;f=e&&D.3X[f]||f;G(d.2j){J g=/5Q|4d|V/.11(f);G(f=="2W"&&D.14.2k)d.1d.64;G(f 1n d&&e&&!g){G(40){G(f=="O"&&D.Y(d,"4T")&&d.1d)7p"O a3 a1\'t 9V 9U";d[f]=c}G(D.Y(d,"3V")&&d.7i(f))I d.7i(f).76;I d[f]}G(1f&&e&&f=="V")I D.1K(d.V,"9T",c);G(40)d.9Q(f,""+c);J h=1f&&e&&g?d.4G(f,2):d.4G(f);I h===U?12:h}G(1f&&f=="1y"){G(40){d.6B=1;d.1E=(d.1E||"").1o(/7f\\([^)]*\\)/,"")+(3r(c)+\'\'=="9L"?"":"7f(1y="+c*7a+")")}I d.1E&&d.1E.1h("1y=")>=0?(3d(d.1E.1I(/1y=([^)]*)/)[1])/7a)+\'\':""}f=f.1o(/-([a-z])/9H,H(a,b){I b.2r()});G(40)d[f]=c;I d[f]},3k:H(a){I(a||"").1o(/^\\s+|\\s+$/g,"")},2d:H(b){J a=[];G(b!=U){J i=b.K;G(i==U||b.1R||b.4I||b.1k)a[0]=b;N 1B(i)a[--i]=b[i]}I a},2L:H(b,a){R(J i=0,K=a.K;i<K;i++)G(a[i]===b)I i;I-1},2R:H(a,b){J i=0,T,2S=a.K;G(D.14.1f){1B(T=b[i++])G(T.16!=8)a[2S++]=T}N 1B(T=b[i++])a[2S++]=T;I a},4r:H(a){J c=[],2o={};1U{R(J i=0,K=a.K;i<K;i++){J b=D.L(a[i]);G(!2o[b]){2o[b]=M;c.1p(a[i])}}}1V(e){c=a}I c},3C:H(c,a,d){J b=[];R(J i=0,K=c.K;i<K;i++)G(!d!=!a(c[i],i))b.1p(c[i]);I b},2l:H(d,a){J c=[];R(J i=0,K=d.K;i<K;i++){J b=a(d[i],i);G(b!=U)c[c.K]=b}I c.7d.1w([],c)}});J v=9B.9A.3y();D.14={5B:(v.1I(/.+(?:9y|9x|9w|9v)[\\/: ]([\\d.]+)/)||[])[1],2k:/75/.11(v),2G:/2G/.11(v),1f:/1f/.11(v)&&!/2G/.11(v),42:/42/.11(v)&&!/(9s|75)/.11(v)};J y=D.14.1f?"7o":"72";D.1l({71:!D.14.1f||S.70=="6Z",3X:{"R":"9n","9k":"1F","4i":y,72:y,7o:y,9h:"9f",9e:"9d",9b:"99"}});D.P({6W:H(a){I a.1d},97:H(a){I D.4S(a,"1d")},95:H(a){I D.3a(a,2,"2H")},91:H(a){I D.3a(a,2,"4l")},8Z:H(a){I D.4S(a,"2H")},8X:H(a){I D.4S(a,"4l")},8W:H(a){I D.5v(a.1d.1x,a)},8V:H(a){I D.5v(a.1x)},6Q:H(a){I D.Y(a,"8U")?a.8T||a.8S.S:D.2d(a.3t)}},H(c,d){D.17[c]=H(b){J a=D.2l(7,d);G(b&&1j b=="23")a=D.3g(b,a);I 7.2I(D.4r(a))}});D.P({6P:"3v",8Q:"6F",39:"6E",8P:"5q",8O:"7b"},H(c,b){D.17[c]=H(){J a=19;I 7.P(H(){R(J i=0,K=a.K;i<K;i++)D(a[i])[b](7)})}});D.P({8N:H(a){D.1K(7,a,"");G(7.16==1)7.5l(a)},8M:H(a){D.1F.1e(7,a)},8L:H(a){D.1F.21(7,a)},8K:H(a){D.1F[D.1F.3T(7,a)?"21":"1e"](7,a)},21:H(a){G(!a||D.1E(a,[7]).r.K){D("*",7).1e(7).P(H(){D.W.21(7);D.3b(7)});G(7.1d)7.1d.37(7)}},4E:H(){D(">*",7).21();1B(7.1x)7.37(7.1x)}},H(a,b){D.17[a]=H(){I 7.P(b,19)}});D.P(["6N","4b"],H(i,c){J b=c.3y();D.17[b]=H(a){I 7[0]==1b?D.14.2G&&S.1c["5t"+c]||D.14.2k&&1b["5s"+c]||S.70=="6Z"&&S.1C["5t"+c]||S.1c["5t"+c]:7[0]==S?29.2f(29.2f(S.1c["4y"+c],S.1C["4y"+c]),29.2f(S.1c["2i"+c],S.1C["2i"+c])):a==12?(7.K?D.1g(7[0],b):U):7.1g(b,a.1q==56?a:a+"2X")}});H 25(a,b){I a[0]&&3r(D.2a(a[0],b,M),10)||0}J C=D.14.2k&&3r(D.14.5B)<8H?"(?:[\\\\w*3m-]|\\\\\\\\.)":"(?:[\\\\w\\8F-\\8E*3m-]|\\\\\\\\.)",6L=2B 4v("^>\\\\s*("+C+"+)"),6J=2B 4v("^("+C+"+)(#)("+C+"+)"),6I=2B 4v("^([#.]?)("+C+"*)");D.1l({6H:{"":H(a,i,m){I m[2]=="*"||D.Y(a,m[2])},"#":H(a,i,m){I a.4G("2v")==m[2]},":":{8D:H(a,i,m){I i<m[3]-0},8C:H(a,i,m){I i>m[3]-0},3a:H(a,i,m){I m[3]-0==i},79:H(a,i,m){I m[3]-0==i},3o:H(a,i){I i==0},3S:H(a,i,m,r){I i==r.K-1},6D:H(a,i){I i%2==0},6C:H(a,i){I i%2},"3o-4u":H(a){I a.1d.3H("*")[0]==a},"3S-4u":H(a){I D.3a(a.1d.5T,1,"4l")==a},"8z-4u":H(a){I!D.3a(a.1d.5T,2,"4l")},6W:H(a){I a.1x},4E:H(a){I!a.1x},8y:H(a,i,m){I(a.6O||a.8x||D(a).1r()||"").1h(m[3])>=0},4j:H(a){I"1G"!=a.O&&D.1g(a,"18")!="2F"&&D.1g(a,"5g")!="1G"},1G:H(a){I"1G"==a.O||D.1g(a,"18")=="2F"||D.1g(a,"5g")=="1G"},8w:H(a){I!a.3R},3R:H(a){I a.3R},4J:H(a){I a.4J},2W:H(a){I a.2W||D.1K(a,"2W")},1r:H(a){I"1r"==a.O},5O:H(a){I"5O"==a.O},5L:H(a){I"5L"==a.O},5p:H(a){I"5p"==a.O},3Q:H(a){I"3Q"==a.O},5o:H(a){I"5o"==a.O},6A:H(a){I"6A"==a.O},6z:H(a){I"6z"==a.O},2s:H(a){I"2s"==a.O||D.Y(a,"2s")},4T:H(a){I/4T|2A|6y|2s/i.11(a.Y)},3T:H(a,i,m){I D.2q(m[3],a).K},8t:H(a){I/h\\d/i.11(a.Y)},8s:H(a){I D.3C(D.3O,H(b){I a==b.T}).K}}},6x:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,2B 4v("^([:.#]*)("+C+"+)")],3g:H(a,c,b){J d,1t=[];1B(a&&a!=d){d=a;J f=D.1E(a,c,b);a=f.t.1o(/^\\s*,\\s*/,"");1t=b?c=f.r:D.2R(1t,f.r)}I 1t},2q:H(t,o){G(1j t!="23")I[t];G(o&&o.16!=1&&o.16!=9)I[];o=o||S;J d=[o],2o=[],3S,Y;1B(t&&3S!=t){J r=[];3S=t;t=D.3k(t);J l=Q,3j=6L,m=3j.2D(t);G(m){Y=m[1].2r();R(J i=0;d[i];i++)R(J c=d[i].1x;c;c=c.2H)G(c.16==1&&(Y=="*"||c.Y.2r()==Y))r.1p(c);d=r;t=t.1o(3j,"");G(t.1h(" ")==0)6M;l=M}N{3j=/^([>+~])\\s*(\\w*)/i;G((m=3j.2D(t))!=U){r=[];J k={};Y=m[2].2r();m=m[1];R(J j=0,3i=d.K;j<3i;j++){J n=m=="~"||m=="+"?d[j].2H:d[j].1x;R(;n;n=n.2H)G(n.16==1){J g=D.L(n);G(m=="~"&&k[g])1X;G(!Y||n.Y.2r()==Y){G(m=="~")k[g]=M;r.1p(n)}G(m=="+")1X}}d=r;t=D.3k(t.1o(3j,""));l=M}}G(t&&!l){G(!t.1h(",")){G(o==d[0])d.4s();2o=D.2R(2o,d);r=d=[o];t=" "+t.6v(1,t.K)}N{J h=6J;J m=h.2D(t);G(m){m=[0,m[2],m[3],m[1]]}N{h=6I;m=h.2D(t)}m[2]=m[2].1o(/\\\\/g,"");J f=d[d.K-1];G(m[1]=="#"&&f&&f.61&&!D.4n(f)){J p=f.61(m[2]);G((D.14.1f||D.14.2G)&&p&&1j p.2v=="23"&&p.2v!=m[2])p=D(\'[@2v="\'+m[2]+\'"]\',f)[0];d=r=p&&(!m[3]||D.Y(p,m[3]))?[p]:[]}N{R(J i=0;d[i];i++){J a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];G(a=="*"&&d[i].Y.3y()=="49")a="3n";r=D.2R(r,d[i].3H(a))}G(m[1]==".")r=D.5m(r,m[2]);G(m[1]=="#"){J e=[];R(J i=0;r[i];i++)G(r[i].4G("2v")==m[2]){e=[r[i]];1X}r=e}d=r}t=t.1o(h,"")}}G(t){J b=D.1E(t,r);d=r=b.r;t=D.3k(b.t)}}G(t)d=[];G(d&&o==d[0])d.4s();2o=D.2R(2o,d);I 2o},5m:H(r,m,a){m=" "+m+" ";J c=[];R(J i=0;r[i];i++){J b=(" "+r[i].1F+" ").1h(m)>=0;G(!a&&b||a&&!b)c.1p(r[i])}I c},1E:H(t,r,h){J d;1B(t&&t!=d){d=t;J p=D.6x,m;R(J i=0;p[i];i++){m=p[i].2D(t);G(m){t=t.8r(m[0].K);m[2]=m[2].1o(/\\\\/g,"");1X}}G(!m)1X;G(m[1]==":"&&m[2]=="4Y")r=62.11(m[3])?D.1E(m[3],r,M).r:D(r).4Y(m[3]);N G(m[1]==".")r=D.5m(r,m[2],h);N G(m[1]=="["){J g=[],O=m[3];R(J i=0,3i=r.K;i<3i;i++){J a=r[i],z=a[D.3X[m[2]]||m[2]];G(z==U||/5Q|4d|2W/.11(m[2]))z=D.1K(a,m[2])||\'\';G((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1h(m[5])||O=="$="&&z.6v(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1h(m[5])>=0)^h)g.1p(a)}r=g}N G(m[1]==":"&&m[2]=="3a-4u"){J e={},g=[],11=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.2D(m[3]=="6D"&&"2n"||m[3]=="6C"&&"2n+1"||!/\\D/.11(m[3])&&"8q+"+m[3]||m[3]),3o=(11[1]+(11[2]||1))-0,d=11[3]-0;R(J i=0,3i=r.K;i<3i;i++){J j=r[i],1d=j.1d,2v=D.L(1d);G(!e[2v]){J c=1;R(J n=1d.1x;n;n=n.2H)G(n.16==1)n.4q=c++;e[2v]=M}J b=Q;G(3o==0){G(j.4q==d)b=M}N G((j.4q-d)%3o==0&&(j.4q-d)/3o>=0)b=M;G(b^h)g.1p(j)}r=g}N{J f=D.6H[m[1]];G(1j f=="49")f=f[m[2]];G(1j f=="23")f=6u("Q||H(a,i){I "+f+";}");r=D.3C(r,H(a,i){I f(a,i,m,r)},h)}}I{r:r,t:t}},4S:H(b,c){J a=[],1t=b[c];1B(1t&&1t!=S){G(1t.16==1)a.1p(1t);1t=1t[c]}I a},3a:H(a,e,c,b){e=e||1;J d=0;R(;a;a=a[c])G(a.16==1&&++d==e)1X;I a},5v:H(n,a){J r=[];R(;n;n=n.2H){G(n.16==1&&n!=a)r.1p(n)}I r}});D.W={1e:H(f,i,g,e){G(f.16==3||f.16==8)I;G(D.14.1f&&f.4I)f=1b;G(!g.24)g.24=7.24++;G(e!=12){J h=g;g=7.3M(h,H(){I h.1w(7,19)});g.L=e}J j=D.L(f,"3w")||D.L(f,"3w",{}),1H=D.L(f,"1H")||D.L(f,"1H",H(){G(1j D!="12"&&!D.W.5k)I D.W.1H.1w(19.3L.T,19)});1H.T=f;D.P(i.1R(/\\s+/),H(c,b){J a=b.1R(".");b=a[0];g.O=a[1];J d=j[b];G(!d){d=j[b]={};G(!D.W.2t[b]||D.W.2t[b].4p.1k(f)===Q){G(f.3K)f.3K(b,1H,Q);N G(f.6t)f.6t("4o"+b,1H)}}d[g.24]=g;D.W.26[b]=M});f=U},24:1,26:{},21:H(e,h,f){G(e.16==3||e.16==8)I;J i=D.L(e,"3w"),1L,5i;G(i){G(h==12||(1j h=="23"&&h.8p(0)=="."))R(J g 1n i)7.21(e,g+(h||""));N{G(h.O){f=h.2y;h=h.O}D.P(h.1R(/\\s+/),H(b,a){J c=a.1R(".");a=c[0];G(i[a]){G(f)2U i[a][f.24];N R(f 1n i[a])G(!c[1]||i[a][f].O==c[1])2U i[a][f];R(1L 1n i[a])1X;G(!1L){G(!D.W.2t[a]||D.W.2t[a].4A.1k(e)===Q){G(e.6p)e.6p(a,D.L(e,"1H"),Q);N G(e.6n)e.6n("4o"+a,D.L(e,"1H"))}1L=U;2U i[a]}}})}R(1L 1n i)1X;G(!1L){J d=D.L(e,"1H");G(d)d.T=U;D.3b(e,"3w");D.3b(e,"1H")}}},1P:H(h,c,f,g,i){c=D.2d(c);G(h.1h("!")>=0){h=h.3s(0,-1);J a=M}G(!f){G(7.26[h])D("*").1e([1b,S]).1P(h,c)}N{G(f.16==3||f.16==8)I 12;J b,1L,17=D.1D(f[h]||U),W=!c[0]||!c[0].32;G(W){c.6h({O:h,2J:f,32:H(){},3J:H(){},4C:1z()});c[0][E]=M}c[0].O=h;G(a)c[0].6m=M;J d=D.L(f,"1H");G(d)b=d.1w(f,c);G((!17||(D.Y(f,\'a\')&&h=="4V"))&&f["4o"+h]&&f["4o"+h].1w(f,c)===Q)b=Q;G(W)c.4s();G(i&&D.1D(i)){1L=i.1w(f,b==U?c:c.7d(b));G(1L!==12)b=1L}G(17&&g!==Q&&b!==Q&&!(D.Y(f,\'a\')&&h=="4V")){7.5k=M;1U{f[h]()}1V(e){}}7.5k=Q}I b},1H:H(b){J a,1L,38,5f,4m;b=19[0]=D.W.6l(b||1b.W);38=b.O.1R(".");b.O=38[0];38=38[1];5f=!38&&!b.6m;4m=(D.L(7,"3w")||{})[b.O];R(J j 1n 4m){J c=4m[j];G(5f||c.O==38){b.2y=c;b.L=c.L;1L=c.1w(7,19);G(a!==Q)a=1L;G(1L===Q){b.32();b.3J()}}}I a},6l:H(b){G(b[E]==M)I b;J d=b;b={8o:d};J c="8n 8m 8l 8k 2s 8j 47 5d 6j 5E 8i L 8h 8g 4K 2y 5a 59 8e 8b 58 6f 8a 88 4k 87 86 84 6d 2J 4C 6c O 82 81 35".1R(" ");R(J i=c.K;i;i--)b[c[i]]=d[c[i]];b[E]=M;b.32=H(){G(d.32)d.32();d.80=Q};b.3J=H(){G(d.3J)d.3J();d.7Z=M};b.4C=b.4C||1z();G(!b.2J)b.2J=b.6d||S;G(b.2J.16==3)b.2J=b.2J.1d;G(!b.4k&&b.4K)b.4k=b.4K==b.2J?b.6c:b.4K;G(b.58==U&&b.5d!=U){J a=S.1C,1c=S.1c;b.58=b.5d+(a&&a.2e||1c&&1c.2e||0)-(a.6b||0);b.6f=b.6j+(a&&a.2c||1c&&1c.2c||0)-(a.6a||0)}G(!b.35&&((b.47||b.47===0)?b.47:b.5a))b.35=b.47||b.5a;G(!b.59&&b.5E)b.59=b.5E;G(!b.35&&b.2s)b.35=(b.2s&1?1:(b.2s&2?3:(b.2s&4?2:0)));I b},3M:H(a,b){b.24=a.24=a.24||b.24||7.24++;I b},2t:{27:{4p:H(){55();I},4A:H(){I}},3D:{4p:H(){G(D.14.1f)I Q;D(7).2O("53",D.W.2t.3D.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("53",D.W.2t.3D.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3D";I D.W.1H.1w(7,19)}},3N:{4p:H(){G(D.14.1f)I Q;D(7).2O("51",D.W.2t.3N.2y);I M},4A:H(){G(D.14.1f)I Q;D(7).4e("51",D.W.2t.3N.2y);I M},2y:H(a){G(F(a,7))I M;a.O="3N";I D.W.1H.1w(7,19)}}}};D.17.1l({2O:H(c,a,b){I c=="4X"?7.2V(c,a,b):7.P(H(){D.W.1e(7,c,b||a,b&&a)})},2V:H(d,b,c){J e=D.W.3M(c||b,H(a){D(7).4e(a,e);I(c||b).1w(7,19)});I 7.P(H(){D.W.1e(7,d,e,c&&b)})},4e:H(a,b){I 7.P(H(){D.W.21(7,a,b)})},1P:H(c,a,b){I 7.P(H(){D.W.1P(c,a,7,M,b)})},5C:H(c,a,b){I 7[0]&&D.W.1P(c,a,7[0],Q,b)},2m:H(b){J c=19,i=1;1B(i<c.K)D.W.3M(b,c[i++]);I 7.4V(D.W.3M(b,H(a){7.4Z=(7.4Z||0)%i;a.32();I c[7.4Z++].1w(7,19)||Q}))},7X:H(a,b){I 7.2O(\'3D\',a).2O(\'3N\',b)},27:H(a){55();G(D.2Q)a.1k(S,D);N D.3A.1p(H(){I a.1k(7,D)});I 7}});D.1l({2Q:Q,3A:[],27:H(){G(!D.2Q){D.2Q=M;G(D.3A){D.P(D.3A,H(){7.1k(S)});D.3A=U}D(S).5C("27")}}});J x=Q;H 55(){G(x)I;x=M;G(S.3K&&!D.14.2G)S.3K("69",D.27,Q);G(D.14.1f&&1b==1S)(H(){G(D.2Q)I;1U{S.1C.7V("1A")}1V(3e){3B(19.3L,0);I}D.27()})();G(D.14.2G)S.3K("69",H(){G(D.2Q)I;R(J i=0;i<S.4W.K;i++)G(S.4W[i].3R){3B(19.3L,0);I}D.27()},Q);G(D.14.2k){J a;(H(){G(D.2Q)I;G(S.3f!="68"&&S.3f!="1J"){3B(19.3L,0);I}G(a===12)a=D("V, 7A[7U=7S]").K;G(S.4W.K!=a){3B(19.3L,0);I}D.27()})()}D.W.1e(1b,"43",D.27)}D.P(("7R,7Q,43,85,4y,4X,4V,7P,"+"7O,7N,89,53,51,7M,2A,"+"5o,7L,7K,8d,3e").1R(","),H(i,b){D.17[b]=H(a){I a?7.2O(b,a):7.1P(b)}});J F=H(a,c){J b=a.4k;1B(b&&b!=c)1U{b=b.1d}1V(3e){b=c}I b==c};D(1b).2O("4X",H(){D("*").1e(S).4e()});D.17.1l({67:D.17.43,43:H(g,d,c){G(1j g!=\'23\')I 7.67(g);J e=g.1h(" ");G(e>=0){J i=g.3s(e,g.K);g=g.3s(0,e)}c=c||H(){};J f="2P";G(d)G(D.1D(d)){c=d;d=U}N{d=D.3n(d);f="6g"}J h=7;D.3Y({1a:g,O:f,1O:"2K",L:d,1J:H(a,b){G(b=="1W"||b=="7J")h.2K(i?D("<1v/>").3v(a.4U.1o(/<1m(.|\\s)*?\\/1m>/g,"")).2q(i):a.4U);h.P(c,[a.4U,b,a])}});I 7},aL:H(){I D.3n(7.7I())},7I:H(){I 7.2l(H(){I D.Y(7,"3V")?D.2d(7.aH):7}).1E(H(){I 7.34&&!7.3R&&(7.4J||/2A|6y/i.11(7.Y)||/1r|1G|3Q/i.11(7.O))}).2l(H(i,c){J b=D(7).6e();I b==U?U:b.1q==2p?D.2l(b,H(a,i){I{34:c.34,2x:a}}):{34:c.34,2x:b}}).3p()}});D.P("7H,7G,7F,7D,7C,7B".1R(","),H(i,o){D.17[o]=H(f){I 7.2O(o,f)}});J B=1z();D.1l({3p:H(d,b,a,c){G(D.1D(b)){a=b;b=U}I D.3Y({O:"2P",1a:d,L:b,1W:a,1O:c})},aE:H(b,a){I D.3p(b,U,a,"1m")},aD:H(c,b,a){I D.3p(c,b,a,"3z")},aC:H(d,b,a,c){G(D.1D(b)){a=b;b={}}I D.3Y({O:"6g",1a:d,L:b,1W:a,1O:c})},aA:H(a){D.1l(D.60,a)},60:{1a:5Z.5Q,26:M,O:"2P",2T:0,7z:"4R/x-ax-3V-aw",7x:M,31:M,L:U,5Y:U,3Q:U,4Q:{2N:"4R/2N, 1r/2N",2K:"1r/2K",1m:"1r/4t, 4R/4t",3z:"4R/3z, 1r/4t",1r:"1r/as",4w:"*/*"}},4z:{},3Y:H(s){s=D.1l(M,s,D.1l(M,{},D.60,s));J g,2Z=/=\\?(&|$)/g,1u,L,O=s.O.2r();G(s.L&&s.7x&&1j s.L!="23")s.L=D.3n(s.L);G(s.1O=="4P"){G(O=="2P"){G(!s.1a.1I(2Z))s.1a+=(s.1a.1I(/\\?/)?"&":"?")+(s.4P||"7u")+"=?"}N G(!s.L||!s.L.1I(2Z))s.L=(s.L?s.L+"&":"")+(s.4P||"7u")+"=?";s.1O="3z"}G(s.1O=="3z"&&(s.L&&s.L.1I(2Z)||s.1a.1I(2Z))){g="4P"+B++;G(s.L)s.L=(s.L+"").1o(2Z,"="+g+"$1");s.1a=s.1a.1o(2Z,"="+g+"$1");s.1O="1m";1b[g]=H(a){L=a;1W();1J();1b[g]=12;1U{2U 1b[g]}1V(e){}G(i)i.37(h)}}G(s.1O=="1m"&&s.1Y==U)s.1Y=Q;G(s.1Y===Q&&O=="2P"){J j=1z();J k=s.1a.1o(/(\\?|&)3m=.*?(&|$)/,"$ap="+j+"$2");s.1a=k+((k==s.1a)?(s.1a.1I(/\\?/)?"&":"?")+"3m="+j:"")}G(s.L&&O=="2P"){s.1a+=(s.1a.1I(/\\?/)?"&":"?")+s.L;s.L=U}G(s.26&&!D.4O++)D.W.1P("7H");J n=/^(?:\\w+:)?\\/\\/([^\\/?#]+)/;G(s.1O=="1m"&&O=="2P"&&n.11(s.1a)&&n.2D(s.1a)[1]!=5Z.al){J i=S.3H("6w")[0];J h=S.3h("1m");h.4d=s.1a;G(s.7t)h.aj=s.7t;G(!g){J l=Q;h.ah=h.ag=H(){G(!l&&(!7.3f||7.3f=="68"||7.3f=="1J")){l=M;1W();1J();i.37(h)}}}i.3U(h);I 12}J m=Q;J c=1b.7s?2B 7s("ae.ac"):2B 7r();G(s.5Y)c.6R(O,s.1a,s.31,s.5Y,s.3Q);N c.6R(O,s.1a,s.31);1U{G(s.L)c.4B("ab-aa",s.7z);G(s.5S)c.4B("a9-5R-a8",D.4z[s.1a]||"a7, a6 a5 a4 5N:5N:5N a2");c.4B("X-9Z-9Y","7r");c.4B("9W",s.1O&&s.4Q[s.1O]?s.4Q[s.1O]+", */*":s.4Q.4w)}1V(e){}G(s.7m&&s.7m(c,s)===Q){s.26&&D.4O--;c.7l();I Q}G(s.26)D.W.1P("7B",[c,s]);J d=H(a){G(!m&&c&&(c.3f==4||a=="2T")){m=M;G(f){7k(f);f=U}1u=a=="2T"&&"2T"||!D.7j(c)&&"3e"||s.5S&&D.7h(c,s.1a)&&"7J"||"1W";G(1u=="1W"){1U{L=D.6X(c,s.1O,s.9S)}1V(e){1u="5J"}}G(1u=="1W"){J b;1U{b=c.5I("7g-5R")}1V(e){}G(s.5S&&b)D.4z[s.1a]=b;G(!g)1W()}N D.5H(s,c,1u);1J();G(s.31)c=U}};G(s.31){J f=4I(d,13);G(s.2T>0)3B(H(){G(c){c.7l();G(!m)d("2T")}},s.2T)}1U{c.9P(s.L)}1V(e){D.5H(s,c,U,e)}G(!s.31)d();H 1W(){G(s.1W)s.1W(L,1u);G(s.26)D.W.1P("7C",[c,s])}H 1J(){G(s.1J)s.1J(c,1u);G(s.26)D.W.1P("7F",[c,s]);G(s.26&&!--D.4O)D.W.1P("7G")}I c},5H:H(s,a,b,e){G(s.3e)s.3e(a,b,e);G(s.26)D.W.1P("7D",[a,s,e])},4O:0,7j:H(a){1U{I!a.1u&&5Z.9O=="5p:"||(a.1u>=7e&&a.1u<9N)||a.1u==7c||a.1u==9K||D.14.2k&&a.1u==12}1V(e){}I Q},7h:H(a,c){1U{J b=a.5I("7g-5R");I a.1u==7c||b==D.4z[c]||D.14.2k&&a.1u==12}1V(e){}I Q},6X:H(a,c,b){J d=a.5I("9J-O"),2N=c=="2N"||!c&&d&&d.1h("2N")>=0,L=2N?a.9I:a.4U;G(2N&&L.1C.2j=="5J")7p"5J";G(b)L=b(L,c);G(c=="1m")D.5u(L);G(c=="3z")L=6u("("+L+")");I L},3n:H(a){J s=[];G(a.1q==2p||a.5w)D.P(a,H(){s.1p(3u(7.34)+"="+3u(7.2x))});N R(J j 1n a)G(a[j]&&a[j].1q==2p)D.P(a[j],H(){s.1p(3u(j)+"="+3u(7))});N s.1p(3u(j)+"="+3u(D.1D(a[j])?a[j]():a[j]));I s.6s("&").1o(/%20/g,"+")}});D.17.1l({1N:H(c,b){I c?7.2g({1Z:"1N",2h:"1N",1y:"1N"},c,b):7.1E(":1G").P(H(){7.V.18=7.5D||"";G(D.1g(7,"18")=="2F"){J a=D("<"+7.2j+" />").6P("1c");7.V.18=a.1g("18");G(7.V.18=="2F")7.V.18="3I";a.21()}}).3l()},1M:H(b,a){I b?7.2g({1Z:"1M",2h:"1M",1y:"1M"},b,a):7.1E(":4j").P(H(){7.5D=7.5D||D.1g(7,"18");7.V.18="2F"}).3l()},78:D.17.2m,2m:H(a,b){I D.1D(a)&&D.1D(b)?7.78.1w(7,19):a?7.2g({1Z:"2m",2h:"2m",1y:"2m"},a,b):7.P(H(){D(7)[D(7).3F(":1G")?"1N":"1M"]()})},9G:H(b,a){I 7.2g({1Z:"1N"},b,a)},9F:H(b,a){I 7.2g({1Z:"1M"},b,a)},9E:H(b,a){I 7.2g({1Z:"2m"},b,a)},9D:H(b,a){I 7.2g({1y:"1N"},b,a)},9M:H(b,a){I 7.2g({1y:"1M"},b,a)},9C:H(c,a,b){I 7.2g({1y:a},c,b)},2g:H(k,j,i,g){J h=D.77(j,i,g);I 7[h.36===Q?"P":"36"](H(){G(7.16!=1)I Q;J f=D.1l({},h),p,1G=D(7).3F(":1G"),46=7;R(p 1n k){G(k[p]=="1M"&&1G||k[p]=="1N"&&!1G)I f.1J.1k(7);G(p=="1Z"||p=="2h"){f.18=D.1g(7,"18");f.33=7.V.33}}G(f.33!=U)7.V.33="1G";f.45=D.1l({},k);D.P(k,H(c,a){J e=2B D.28(46,f,c);G(/2m|1N|1M/.11(a))e[a=="2m"?1G?"1N":"1M":a](k);N{J b=a.6r().1I(/^([+-]=)?([\\d+-.]+)(.*)$/),2b=e.1t(M)||0;G(b){J d=3d(b[2]),2M=b[3]||"2X";G(2M!="2X"){46.V[c]=(d||1)+2M;2b=((d||1)/e.1t(M))*2b;46.V[c]=2b+2M}G(b[1])d=((b[1]=="-="?-1:1)*d)+2b;e.3G(2b,d,2M)}N e.3G(2b,a,"")}});I M})},36:H(a,b){G(D.1D(a)||(a&&a.1q==2p)){b=a;a="28"}G(!a||(1j a=="23"&&!b))I A(7[0],a);I 7.P(H(){G(b.1q==2p)A(7,a,b);N{A(7,a).1p(b);G(A(7,a).K==1)b.1k(7)}})},9X:H(b,c){J a=D.3O;G(b)7.36([]);7.P(H(){R(J i=a.K-1;i>=0;i--)G(a[i].T==7){G(c)a[i](M);a.7n(i,1)}});G(!c)7.5A();I 7}});J A=H(b,c,a){G(b){c=c||"28";J q=D.L(b,c+"36");G(!q||a)q=D.L(b,c+"36",D.2d(a))}I q};D.17.5A=H(a){a=a||"28";I 7.P(H(){J q=A(7,a);q.4s();G(q.K)q[0].1k(7)})};D.1l({77:H(b,a,c){J d=b&&b.1q==a0?b:{1J:c||!c&&a||D.1D(b)&&b,2u:b,41:c&&a||a&&a.1q!=9t&&a};d.2u=(d.2u&&d.2u.1q==4L?d.2u:D.28.5K[d.2u])||D.28.5K.74;d.5M=d.1J;d.1J=H(){G(d.36!==Q)D(7).5A();G(D.1D(d.5M))d.5M.1k(7)};I d},41:{73:H(p,n,b,a){I b+a*p},5P:H(p,n,b,a){I((-29.9r(p*29.9q)/2)+0.5)*a+b}},3O:[],48:U,28:H(b,c,a){7.15=c;7.T=b;7.1i=a;G(!c.3Z)c.3Z={}}});D.28.44={4D:H(){G(7.15.2Y)7.15.2Y.1k(7.T,7.1z,7);(D.28.2Y[7.1i]||D.28.2Y.4w)(7);G(7.1i=="1Z"||7.1i=="2h")7.T.V.18="3I"},1t:H(a){G(7.T[7.1i]!=U&&7.T.V[7.1i]==U)I 7.T[7.1i];J r=3d(D.1g(7.T,7.1i,a));I r&&r>-9p?r:3d(D.2a(7.T,7.1i))||0},3G:H(c,b,d){7.5V=1z();7.2b=c;7.3l=b;7.2M=d||7.2M||"2X";7.1z=7.2b;7.2S=7.4N=0;7.4D();J e=7;H t(a){I e.2Y(a)}t.T=7.T;D.3O.1p(t);G(D.48==U){D.48=4I(H(){J a=D.3O;R(J i=0;i<a.K;i++)G(!a[i]())a.7n(i--,1);G(!a.K){7k(D.48);D.48=U}},13)}},1N:H(){7.15.3Z[7.1i]=D.1K(7.T.V,7.1i);7.15.1N=M;7.3G(0,7.1t());G(7.1i=="2h"||7.1i=="1Z")7.T.V[7.1i]="9m";D(7.T).1N()},1M:H(){7.15.3Z[7.1i]=D.1K(7.T.V,7.1i);7.15.1M=M;7.3G(7.1t(),0)},2Y:H(a){J t=1z();G(a||t>7.15.2u+7.5V){7.1z=7.3l;7.2S=7.4N=1;7.4D();7.15.45[7.1i]=M;J b=M;R(J i 1n 7.15.45)G(7.15.45[i]!==M)b=Q;G(b){G(7.15.18!=U){7.T.V.33=7.15.33;7.T.V.18=7.15.18;G(D.1g(7.T,"18")=="2F")7.T.V.18="3I"}G(7.15.1M)7.T.V.18="2F";G(7.15.1M||7.15.1N)R(J p 1n 7.15.45)D.1K(7.T.V,p,7.15.3Z[p])}G(b)7.15.1J.1k(7.T);I Q}N{J n=t-7.5V;7.4N=n/7.15.2u;7.2S=D.41[7.15.41||(D.41.5P?"5P":"73")](7.4N,n,0,1,7.15.2u);7.1z=7.2b+((7.3l-7.2b)*7.2S);7.4D()}I M}};D.1l(D.28,{5K:{9l:9j,9i:7e,74:9g},2Y:{2e:H(a){a.T.2e=a.1z},2c:H(a){a.T.2c=a.1z},1y:H(a){D.1K(a.T.V,"1y",a.1z)},4w:H(a){a.T.V[a.1i]=a.1z+a.2M}}});D.17.2i=H(){J b=0,1S=0,T=7[0],3q;G(T)ao(D.14){J d=T.1d,4a=T,1s=T.1s,1Q=T.2z,5U=2k&&3r(5B)<9c&&!/9a/i.11(v),1g=D.2a,3c=1g(T,"30")=="3c";G(T.7y){J c=T.7y();1e(c.1A+29.2f(1Q.1C.2e,1Q.1c.2e),c.1S+29.2f(1Q.1C.2c,1Q.1c.2c));1e(-1Q.1C.6b,-1Q.1C.6a)}N{1e(T.5X,T.5W);1B(1s){1e(1s.5X,1s.5W);G(42&&!/^t(98|d|h)$/i.11(1s.2j)||2k&&!5U)2C(1s);G(!3c&&1g(1s,"30")=="3c")3c=M;4a=/^1c$/i.11(1s.2j)?4a:1s;1s=1s.1s}1B(d&&d.2j&&!/^1c|2K$/i.11(d.2j)){G(!/^96|1T.*$/i.11(1g(d,"18")))1e(-d.2e,-d.2c);G(42&&1g(d,"33")!="4j")2C(d);d=d.1d}G((5U&&(3c||1g(4a,"30")=="5x"))||(42&&1g(4a,"30")!="5x"))1e(-1Q.1c.5X,-1Q.1c.5W);G(3c)1e(29.2f(1Q.1C.2e,1Q.1c.2e),29.2f(1Q.1C.2c,1Q.1c.2c))}3q={1S:1S,1A:b}}H 2C(a){1e(D.2a(a,"6V",M),D.2a(a,"6U",M))}H 1e(l,t){b+=3r(l,10)||0;1S+=3r(t,10)||0}I 3q};D.17.1l({30:H(){J a=0,1S=0,3q;G(7[0]){J b=7.1s(),2i=7.2i(),4c=/^1c|2K$/i.11(b[0].2j)?{1S:0,1A:0}:b.2i();2i.1S-=25(7,\'94\');2i.1A-=25(7,\'aF\');4c.1S+=25(b,\'6U\');4c.1A+=25(b,\'6V\');3q={1S:2i.1S-4c.1S,1A:2i.1A-4c.1A}}I 3q},1s:H(){J a=7[0].1s;1B(a&&(!/^1c|2K$/i.11(a.2j)&&D.1g(a,\'30\')==\'93\'))a=a.1s;I D(a)}});D.P([\'5e\',\'5G\'],H(i,b){J c=\'4y\'+b;D.17[c]=H(a){G(!7[0])I;I a!=12?7.P(H(){7==1b||7==S?1b.92(!i?a:D(1b).2e(),i?a:D(1b).2c()):7[c]=a}):7[0]==1b||7[0]==S?46[i?\'aI\':\'aJ\']||D.71&&S.1C[c]||S.1c[c]:7[0][c]}});D.P(["6N","4b"],H(i,b){J c=i?"5e":"5G",4f=i?"6k":"6i";D.17["5s"+b]=H(){I 7[b.3y()]()+25(7,"57"+c)+25(7,"57"+4f)};D.17["90"+b]=H(a){I 7["5s"+b]()+25(7,"2C"+c+"4b")+25(7,"2C"+4f+"4b")+(a?25(7,"6S"+c)+25(7,"6S"+4f):0)}})})();',62,669,'|||||||this|||||||||||||||||||||||||||||||||||if|function|return|var|length|data|true|else|type|each|false|for|document|elem|null|style|event||nodeName|||test|undefined||browser|options|nodeType|fn|display|arguments|url|window|body|parentNode|add|msie|css|indexOf|prop|typeof|call|extend|script|in|replace|push|constructor|text|offsetParent|cur|status|div|apply|firstChild|opacity|now|left|while|documentElement|isFunction|filter|className|hidden|handle|match|complete|attr|ret|hide|show|dataType|trigger|doc|split|top|table|try|catch|success|break|cache|height||remove|tbody|string|guid|num|global|ready|fx|Math|curCSS|start|scrollTop|makeArray|scrollLeft|max|animate|width|offset|tagName|safari|map|toggle||done|Array|find|toUpperCase|button|special|duration|id|copy|value|handler|ownerDocument|select|new|border|exec|stack|none|opera|nextSibling|pushStack|target|html|inArray|unit|xml|bind|GET|isReady|merge|pos|timeout|delete|one|selected|px|step|jsre|position|async|preventDefault|overflow|name|which|queue|removeChild|namespace|insertBefore|nth|removeData|fixed|parseFloat|error|readyState|multiFilter|createElement|rl|re|trim|end|_|param|first|get|results|parseInt|slice|childNodes|encodeURIComponent|append|events|elems|toLowerCase|json|readyList|setTimeout|grep|mouseenter|color|is|custom|getElementsByTagName|block|stopPropagation|addEventListener|callee|proxy|mouseleave|timers|defaultView|password|disabled|last|has|appendChild|form|domManip|props|ajax|orig|set|easing|mozilla|load|prototype|curAnim|self|charCode|timerId|object|offsetChild|Width|parentOffset|src|unbind|br|currentStyle|clean|float|visible|relatedTarget|previousSibling|handlers|isXMLDoc|on|setup|nodeIndex|unique|shift|javascript|child|RegExp|_default|deep|scroll|lastModified|teardown|setRequestHeader|timeStamp|update|empty|tr|getAttribute|innerHTML|setInterval|checked|fromElement|Number|jQuery|state|active|jsonp|accepts|application|dir|input|responseText|click|styleSheets|unload|not|lastToggle|outline|mouseout|getPropertyValue|mouseover|getComputedStyle|bindReady|String|padding|pageX|metaKey|keyCode|getWH|andSelf|clientX|Left|all|visibility|container|index|init|triggered|removeAttribute|classFilter|prevObject|submit|file|after|windowData|inner|client|globalEval|sibling|jquery|absolute|clone|wrapAll|dequeue|version|triggerHandler|oldblock|ctrlKey|createTextNode|Top|handleError|getResponseHeader|parsererror|speeds|checkbox|old|00|radio|swing|href|Modified|ifModified|lastChild|safari2|startTime|offsetTop|offsetLeft|username|location|ajaxSettings|getElementById|isSimple|values|selectedIndex|runtimeStyle|rsLeft|_load|loaded|DOMContentLoaded|clientTop|clientLeft|toElement|srcElement|val|pageY|POST|unshift|Bottom|clientY|Right|fix|exclusive|detachEvent|cloneNode|removeEventListener|swap|toString|join|attachEvent|eval|substr|head|parse|textarea|reset|image|zoom|odd|even|before|prepend|exclude|expr|quickClass|quickID|uuid|quickChild|continue|Height|textContent|appendTo|contents|open|margin|evalScript|borderTopWidth|borderLeftWidth|parent|httpData|setArray|CSS1Compat|compatMode|boxModel|cssFloat|linear|def|webkit|nodeValue|speed|_toggle|eq|100|replaceWith|304|concat|200|alpha|Last|httpNotModified|getAttributeNode|httpSuccess|clearInterval|abort|beforeSend|splice|styleFloat|throw|colgroup|XMLHttpRequest|ActiveXObject|scriptCharset|callback|fieldset|multiple|processData|getBoundingClientRect|contentType|link|ajaxSend|ajaxSuccess|ajaxError|col|ajaxComplete|ajaxStop|ajaxStart|serializeArray|notmodified|keypress|keydown|change|mouseup|mousedown|dblclick|focus|blur|stylesheet|hasClass|rel|doScroll|black|hover|solid|cancelBubble|returnValue|wheelDelta|view|round|shiftKey|resize|screenY|screenX|relatedNode|mousemove|prevValue|originalTarget|offsetHeight|keyup|newValue|offsetWidth|eventPhase|detail|currentTarget|cancelable|bubbles|attrName|attrChange|altKey|originalEvent|charAt|0n|substring|animated|header|noConflict|line|enabled|innerText|contains|only|weight|font|gt|lt|uFFFF|u0128|size|417|Boolean|Date|toggleClass|removeClass|addClass|removeAttr|replaceAll|insertAfter|prependTo|wrap|contentWindow|contentDocument|iframe|children|siblings|prevAll|wrapInner|nextAll|outer|prev|scrollTo|static|marginTop|next|inline|parents|able|cellSpacing|adobeair|cellspacing|522|maxLength|maxlength|readOnly|400|readonly|fast|600|class|slow|1px|htmlFor|reverse|10000|PI|cos|compatible|Function|setData|ie|ra|it|rv|getData|userAgent|navigator|fadeTo|fadeIn|slideToggle|slideUp|slideDown|ig|responseXML|content|1223|NaN|fadeOut|300|protocol|send|setAttribute|option|dataFilter|cssText|changed|be|Accept|stop|With|Requested|Object|can|GMT|property|1970|Jan|01|Thu|Since|If|Type|Content|XMLHTTP|th|Microsoft|td|onreadystatechange|onload|cap|charset|colg|host|tfoot|specified|with|1_|thead|leg|plain|attributes|opt|embed|urlencoded|www|area|hr|ajaxSetup|meta|post|getJSON|getScript|marginLeft|img|elements|pageYOffset|pageXOffset|abbr|serialize|pixelLeft'.split('|'),0,{}))

// Checks the browser and adds classes to the body to reflect it.

$(document).ready(function(){
  if(typeof(Browser) !== "undefined") { //REQUIRES browserRedir.js
	  $("body").addClass(Browser.browserClass);
  }
});

﻿/* jQuery UI 1.5.3
 * Copyright (c) 2008 Paul Bakaus (ui.jquery.com)
 * Dual licensed under the MIT and GPL licenses. */(function($){$.ui={plugin:{add:function(module,option,set){var proto=$.ui[module].prototype;for(var i in set){proto.plugins[i]=proto.plugins[i]||[];proto.plugins[i].push([option,set[i]])}},call:function(instance,name,args){var set=instance.plugins[name];if(!set){return}for(var i=0;i<set.length;i++){if(instance.options[set[i][0]]){set[i][1].apply(instance.element,args)}}}},cssCache:{},css:function(name){if($.ui.cssCache[name]){return $.ui.cssCache[name]}var tmp=$('<div class="ui-gen">').addClass(name).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");$.ui.cssCache[name]=!!((!(/auto|default/).test(tmp.css("cursor"))||(/^[1-9]/).test(tmp.css("height"))||(/^[1-9]/).test(tmp.css("width"))||!(/none/).test(tmp.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css("backgroundColor"))));try{$("body").get(0).removeChild(tmp.get(0))}catch(e){}return $.ui.cssCache[name]},disableSelection:function(el){$(el).attr("unselectable","on").css("MozUserSelect","none")},enableSelection:function(el){$(el).attr("unselectable","off").css("MozUserSelect","")},hasScroll:function(e,a){var scroll=/top/.test(a||"top")?"scrollTop":"scrollLeft",has=false;if(e[scroll]>0){return true}e[scroll]=1;has=e[scroll]>0?true:false;e[scroll]=0;return has}};var _remove=$.fn.remove;$.fn.remove=function(){$("*",this).add(this).triggerHandler("remove");return _remove.apply(this,arguments)};function getter(namespace,plugin,method){var methods=$[namespace][plugin].getter||[];methods=(typeof methods=="string"?methods.split(/,?\s+/):methods);return($.inArray(method,methods)!=-1)}$.widget=function(name,prototype){var namespace=name.split(".")[0];name=name.split(".")[1];$.fn[name]=function(options){var isMethodCall=(typeof options=="string"),args=Array.prototype.slice.call(arguments,1);if(isMethodCall&&getter(namespace,name,options)){var instance=$.data(this[0],name);return(instance?instance[options].apply(instance,args):undefined)}return this.each(function(){var instance=$.data(this,name);if(isMethodCall&&instance&&$.isFunction(instance[options])){instance[options].apply(instance,args)}else{if(!isMethodCall){$.data(this,name,new $[namespace][name](this,options))}}})};$[namespace][name]=function(element,options){var self=this;this.widgetName=name;this.widgetBaseClass=namespace+"-"+name;this.options=$.extend({},$.widget.defaults,$[namespace][name].defaults,options);this.element=$(element).bind("setData."+name,function(e,key,value){return self.setData(key,value)}).bind("getData."+name,function(e,key){return self.getData(key)}).bind("remove",function(){return self.destroy()});this.init()};$[namespace][name].prototype=$.extend({},$.widget.prototype,prototype)};$.widget.prototype={init:function(){},destroy:function(){this.element.removeData(this.widgetName)},getData:function(key){return this.options[key]},setData:function(key,value){this.options[key]=value;if(key=="disabled"){this.element[value?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}},enable:function(){this.setData("disabled",false)},disable:function(){this.setData("disabled",true)}};$.widget.defaults={disabled:false};$.ui.mouse={mouseInit:function(){var self=this;this.element.bind("mousedown."+this.widgetName,function(e){return self.mouseDown(e)});if($.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},mouseDestroy:function(){this.element.unbind("."+this.widgetName);($.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},mouseDown:function(e){(this._mouseStarted&&this.mouseUp(e));this._mouseDownEvent=e;var self=this,btnIsLeft=(e.which==1),elIsCancel=(typeof this.options.cancel=="string"?$(e.target).parents().add(e.target).filter(this.options.cancel).length:false);if(!btnIsLeft||elIsCancel||!this.mouseCapture(e)){return true}this._mouseDelayMet=!this.options.delay;if(!this._mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){self._mouseDelayMet=true},this.options.delay)}if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(this.mouseStart(e)!==false);if(!this._mouseStarted){e.preventDefault();return true}}this._mouseMoveDelegate=function(e){return self.mouseMove(e)};this._mouseUpDelegate=function(e){return self.mouseUp(e)};$(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);return false},mouseMove:function(e){if($.browser.msie&&!e.button){return this.mouseUp(e)}if(this._mouseStarted){this.mouseDrag(e);return false}if(this.mouseDistanceMet(e)&&this.mouseDelayMet(e)){this._mouseStarted=(this.mouseStart(this._mouseDownEvent,e)!==false);(this._mouseStarted?this.mouseDrag(e):this.mouseUp(e))}return !this._mouseStarted},mouseUp:function(e){$(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this.mouseStop(e)}return false},mouseDistanceMet:function(e){return(Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance)},mouseDelayMet:function(e){return this._mouseDelayMet},mouseStart:function(e){},mouseDrag:function(e){},mouseStop:function(e){},mouseCapture:function(e){return true}};$.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);

/* jQuery UI Slider
 * Depends: ui.core.js */
(function($){$.fn.unwrap=$.fn.unwrap||function(expr){return this.each(function(){$(this).parents(expr).eq(0).after(this).remove()})};$.widget("ui.slider",{plugins:{},ui:function(e){return{options:this.options,handle:this.currentHandle,value:this.options.axis!="both"||!this.options.axis?Math.round(this.value(null,this.options.axis=="vertical"?"y":"x")):{x:Math.round(this.value(null,"x")),y:Math.round(this.value(null,"y"))},range:this.getRange()}},propagate:function(n,e){$.ui.plugin.call(this,n,[e,this.ui()]);this.element.triggerHandler(n=="slide"?n:"slide"+n,[e,this.ui()],this.options[n])},destroy:function(){this.element.removeClass("ui-slider ui-slider-disabled").removeData("slider").unbind(".slider");if(this.handle&&this.handle.length){this.handle.unwrap("a");this.handle.each(function(){$(this).data("mouse").mouseDestroy()})}this.generated&&this.generated.remove()},setData:function(key,value){$.widget.prototype.setData.apply(this,arguments);if(/min|max|steps/.test(key)){this.initBoundaries()}if(key=="range"){value?this.handle.length==2&&this.createRange():this.removeRange()}},init:function(){var self=this;this.element.addClass("ui-slider");this.initBoundaries();this.handle=$(this.options.handle,this.element);if(!this.handle.length){self.handle=self.generated=$(self.options.handles||[0]).map(function(){var handle=$("<div/>").addClass("ui-slider-handle").appendTo(self.element);if(this.id){handle.attr("id",this.id)}return handle[0]})}var handleclass=function(el){this.element=$(el);this.element.data("mouse",this);this.options=self.options;this.element.bind("mousedown",function(){if(self.currentHandle){this.blur(self.currentHandle)}self.focus(this,1)});this.mouseInit()};$.extend(handleclass.prototype,$.ui.mouse,{mouseStart:function(e){return self.start.call(self,e,this.element[0])},mouseStop:function(e){return self.stop.call(self,e,this.element[0])},mouseDrag:function(e){return self.drag.call(self,e,this.element[0])},mouseCapture:function(){return true},trigger:function(e){this.mouseDown(e)}});$(this.handle).each(function(){new handleclass(this)}).wrap('<a href="javascript:void(0)" style="outline:none;border:none;"></a>').parent().bind("focus",function(e){self.focus(this.firstChild)}).bind("blur",function(e){self.blur(this.firstChild)}).bind("keydown",function(e){if(!self.options.noKeyboard){self.keydown(e.keyCode,this.firstChild)}});this.element.bind("mousedown.slider",function(e){self.click.apply(self,[e]);self.currentHandle.data("mouse").trigger(e);self.firstValue=self.firstValue+1});$.each(this.options.handles||[],function(index,handle){self.moveTo(handle.start,index,true)});if(!isNaN(this.options.startValue)){this.moveTo(this.options.startValue,0,true)}this.previousHandle=$(this.handle[0]);if(this.handle.length==2&&this.options.range){this.createRange()}},initBoundaries:function(){var element=this.element[0],o=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};$.extend(o,{axis:o.axis||(element.offsetWidth<element.offsetHeight?"vertical":"horizontal"),max:!isNaN(parseInt(o.max,10))?{x:parseInt(o.max,10),y:parseInt(o.max,10)}:({x:o.max&&o.max.x||100,y:o.max&&o.max.y||100}),min:!isNaN(parseInt(o.min,10))?{x:parseInt(o.min,10),y:parseInt(o.min,10)}:({x:o.min&&o.min.x||0,y:o.min&&o.min.y||0})});o.realMax={x:o.max.x-o.min.x,y:o.max.y-o.min.y};o.stepping={x:o.stepping&&o.stepping.x||parseInt(o.stepping,10)||(o.steps?o.realMax.x/(o.steps.x||parseInt(o.steps,10)||o.realMax.x):0),y:o.stepping&&o.stepping.y||parseInt(o.stepping,10)||(o.steps?o.realMax.y/(o.steps.y||parseInt(o.steps,10)||o.realMax.y):0)}},keydown:function(keyCode,handle){if(/(37|38|39|40)/.test(keyCode)){this.moveTo({x:/(37|39)/.test(keyCode)?(keyCode==37?"-":"+")+"="+this.oneStep("x"):0,y:/(38|40)/.test(keyCode)?(keyCode==38?"-":"+")+"="+this.oneStep("y"):0},handle)}},focus:function(handle,hard){this.currentHandle=$(handle).addClass("ui-slider-handle-active");if(hard){this.currentHandle.parent()[0].focus()}},blur:function(handle){$(handle).removeClass("ui-slider-handle-active");if(this.currentHandle&&this.currentHandle[0]==handle){this.previousHandle=this.currentHandle;this.currentHandle=null}},click:function(e){var pointer=[e.pageX,e.pageY];var clickedHandle=false;this.handle.each(function(){if(this==e.target){clickedHandle=true}});if(clickedHandle||this.options.disabled||!(this.currentHandle||this.previousHandle)){return}if(!this.currentHandle&&this.previousHandle){this.focus(this.previousHandle,true)}this.offset=this.element.offset();this.moveTo({y:this.convertValue(e.pageY-this.offset.top-this.currentHandle[0].offsetHeight/2,"y"),x:this.convertValue(e.pageX-this.offset.left-this.currentHandle[0].offsetWidth/2,"x")},null,!this.options.distance)},createRange:function(){if(this.rangeElement){return}this.rangeElement=$("<div></div>").addClass("ui-slider-range").css({position:"absolute"}).appendTo(this.element);this.updateRange()},removeRange:function(){this.rangeElement.remove();this.rangeElement=null},updateRange:function(){var prop=this.options.axis=="vertical"?"top":"left";var size=this.options.axis=="vertical"?"height":"width";this.rangeElement.css(prop,(parseInt($(this.handle[0]).css(prop),10)||0)+this.handleSize(0,this.options.axis=="vertical"?"y":"x")/2);this.rangeElement.css(size,(parseInt($(this.handle[1]).css(prop),10)||0)-(parseInt($(this.handle[0]).css(prop),10)||0))},getRange:function(){return this.rangeElement?this.convertValue(parseInt(this.rangeElement.css(this.options.axis=="vertical"?"height":"width"),10),this.options.axis=="vertical"?"y":"x"):null},handleIndex:function(){return this.handle.index(this.currentHandle[0])},value:function(handle,axis){if(this.handle.length==1){this.currentHandle=this.handle}if(!axis){axis=this.options.axis=="vertical"?"y":"x"}var curHandle=$(handle!=undefined&&handle!==null?this.handle[handle]||handle:this.currentHandle);if(curHandle.data("mouse").sliderValue){return parseInt(curHandle.data("mouse").sliderValue[axis],10)}else{return parseInt(((parseInt(curHandle.css(axis=="x"?"left":"top"),10)/(this.actualSize[axis=="x"?"width":"height"]-this.handleSize(handle,axis)))*this.options.realMax[axis])+this.options.min[axis],10)}},convertValue:function(value,axis){return this.options.min[axis]+(value/(this.actualSize[axis=="x"?"width":"height"]-this.handleSize(null,axis)))*this.options.realMax[axis]},translateValue:function(value,axis){return((value-this.options.min[axis])/this.options.realMax[axis])*(this.actualSize[axis=="x"?"width":"height"]-this.handleSize(null,axis))},translateRange:function(value,axis){if(this.rangeElement){if(this.currentHandle[0]==this.handle[0]&&value>=this.translateValue(this.value(1),axis)){value=this.translateValue(this.value(1,axis)-this.oneStep(axis),axis)}if(this.currentHandle[0]==this.handle[1]&&value<=this.translateValue(this.value(0),axis)){value=this.translateValue(this.value(0,axis)+this.oneStep(axis),axis)}}if(this.options.handles){var handle=this.options.handles[this.handleIndex()];if(value<this.translateValue(handle.min,axis)){value=this.translateValue(handle.min,axis)}else{if(value>this.translateValue(handle.max,axis)){value=this.translateValue(handle.max,axis)}}}return value},translateLimits:function(value,axis){if(value>=this.actualSize[axis=="x"?"width":"height"]-this.handleSize(null,axis)){value=this.actualSize[axis=="x"?"width":"height"]-this.handleSize(null,axis)}if(value<=0){value=0}return value},handleSize:function(handle,axis){return $(handle!=undefined&&handle!==null?this.handle[handle]:this.currentHandle)[0]["offset"+(axis=="x"?"Width":"Height")]},oneStep:function(axis){return this.options.stepping[axis]||1},start:function(e,handle){var o=this.options;if(o.disabled){return false}this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(!this.currentHandle){this.focus(this.previousHandle,true)}this.offset=this.element.offset();this.handleOffset=this.currentHandle.offset();this.clickOffset={top:e.pageY-this.handleOffset.top,left:e.pageX-this.handleOffset.left};this.firstValue=this.value();this.propagate("start",e);this.drag(e,handle);return true},stop:function(e){this.propagate("stop",e);if(this.firstValue!=this.value()){this.propagate("change",e)}this.focus(this.currentHandle,true);return false},drag:function(e,handle){var o=this.options;var position={top:e.pageY-this.offset.top-this.clickOffset.top,left:e.pageX-this.offset.left-this.clickOffset.left};if(!this.currentHandle){this.focus(this.previousHandle,true)}position.left=this.translateLimits(position.left,"x");position.top=this.translateLimits(position.top,"y");if(o.stepping.x){var value=this.convertValue(position.left,"x");value=Math.round(value/o.stepping.x)*o.stepping.x;position.left=this.translateValue(value,"x")}if(o.stepping.y){var value=this.convertValue(position.top,"y");value=Math.round(value/o.stepping.y)*o.stepping.y;position.top=this.translateValue(value,"y")}position.left=this.translateRange(position.left,"x");position.top=this.translateRange(position.top,"y");if(o.axis!="vertical"){this.currentHandle.css({left:position.left})}if(o.axis!="horizontal"){this.currentHandle.css({top:position.top})}this.currentHandle.data("mouse").sliderValue={x:Math.round(this.convertValue(position.left,"x"))||0,y:Math.round(this.convertValue(position.top,"y"))||0};if(this.rangeElement){this.updateRange()}this.propagate("slide",e);return false},moveTo:function(value,handle,noPropagation){var o=this.options;this.actualSize={width:this.element.outerWidth(),height:this.element.outerHeight()};if(handle==undefined&&!this.currentHandle&&this.handle.length!=1){return false}if(handle==undefined&&!this.currentHandle){handle=0}if(handle!=undefined){this.currentHandle=this.previousHandle=$(this.handle[handle]||handle)}if(value.x!==undefined&&value.y!==undefined){var x=value.x,y=value.y}else{var x=value,y=value}if(x!==undefined&&x.constructor!=Number){var me=/^\-\=/.test(x),pe=/^\+\=/.test(x);if(me||pe){x=isNaN(this.value(null,"x"))?0:this.value(null,"x")+parseInt(x.replace(me?"=":"+=",""),10)}else{x=isNaN(parseInt(x,10))?undefined:parseInt(x,10)}}if(y!==undefined&&y.constructor!=Number){var me=/^\-\=/.test(y),pe=/^\+\=/.test(y);if(me||pe){y=isNaN(this.value(null,"y"))?0:this.value(null,"y")+parseInt(y.replace(me?"=":"+=",""),10)}else{y=isNaN(parseInt(y,10))?undefined:parseInt(y,10)}}if(o.axis!="vertical"&&x!==undefined){if(o.stepping.x){x=Math.round(x/o.stepping.x)*o.stepping.x}x=this.translateValue(x,"x");x=this.translateLimits(x,"x");x=this.translateRange(x,"x");if(!isNaN(x)){o.animate?this.currentHandle.stop().animate({left:x},(Math.abs(parseInt(this.currentHandle.css("left"))-x))*(!isNaN(parseInt(o.animate))?o.animate:5)):this.currentHandle.css({left:x})}}if(o.axis!="horizontal"&&y!==undefined){if(o.stepping.y){y=Math.round(y/o.stepping.y)*o.stepping.y}y=this.translateValue(y,"y");y=this.translateLimits(y,"y");y=this.translateRange(y,"y");if(!isNaN(y)){o.animate?this.currentHandle.stop().animate({top:y},(Math.abs(parseInt(this.currentHandle.css("top"))-y))*(!isNaN(parseInt(o.animate))?o.animate:5)):this.currentHandle.css({top:y})}}if(this.rangeElement){this.updateRange()}this.currentHandle.data("mouse").sliderValue={x:Math.round(this.convertValue(x,"x"))||0,y:Math.round(this.convertValue(y,"y"))||0};if(!noPropagation){this.propagate("start",null);this.propagate("stop",null);this.propagate("change",null);this.propagate("slide",null)}}});$.ui.slider.getter="value";$.ui.slider.defaults={handle:".ui-slider-handle",distance:1,animate:false}})(jQuery);


(function(A){A.widget("ui.tabs",{init:function(){this.options.event+=".tabs";this.tabify(true)},setData:function(B,C){if((/^selected/).test(B)){this.select(C)}else{this.options[B]=C;this.tabify()}},length:function(){return this.$tabs.length},tabId:function(B){return B.title&&B.title.replace(/\s/g,"_").replace(/[^A-Za-z0-9\-_:\.]/g,"")||this.options.idPrefix+A.data(B)},ui:function(C,B){return{options:this.options,tab:C,panel:B,index:this.$tabs.index(C)}},tabify:function(O){this.$lis=A("li:has(a[href])",this.element);this.$tabs=this.$lis.map(function(){return A("a",this)[0]});this.$panels=A([]);var P=this,D=this.options;this.$tabs.each(function(R,Q){if(Q.hash&&Q.hash.replace("#","")){P.$panels=P.$panels.add(Q.hash)}else{if(A(Q).attr("href")!="#"){A.data(Q,"href.tabs",Q.href);A.data(Q,"load.tabs",Q.href);var T=P.tabId(Q);Q.href="#"+T;var S=A("#"+T);if(!S.length){S=A(D.panelTemplate).attr("id",T).addClass(D.panelClass).insertAfter(P.$panels[R-1]||P.element);S.data("destroy.tabs",true)}P.$panels=P.$panels.add(S)}else{D.disabled.push(R+1)}}});if(O){this.element.addClass(D.navClass);this.$panels.each(function(){var Q=A(this);Q.addClass(D.panelClass)});if(D.selected===undefined){if(location.hash){this.$tabs.each(function(S,Q){if(Q.hash==location.hash){D.selected=S;if(A.browser.msie||A.browser.opera){var R=A(location.hash),T=R.attr("id");R.attr("id","");setTimeout(function(){R.attr("id",T)},500)}scrollTo(0,0);return false}})}else{if(D.cookie){var J=parseInt(A.cookie("ui-tabs"+A.data(P.element)),10);if(J&&P.$tabs[J]){D.selected=J}}else{if(P.$lis.filter("."+D.selectedClass).length){D.selected=P.$lis.index(P.$lis.filter("."+D.selectedClass)[0])}}}}D.selected=D.selected===null||D.selected!==undefined?D.selected:0;D.disabled=A.unique(D.disabled.concat(A.map(this.$lis.filter("."+D.disabledClass),function(R,Q){return P.$lis.index(R)}))).sort();if(A.inArray(D.selected,D.disabled)!=-1){D.disabled.splice(A.inArray(D.selected,D.disabled),1)}this.$panels.addClass(D.hideClass);this.$lis.removeClass(D.selectedClass);if(D.selected!==null){this.$panels.eq(D.selected).show().removeClass(D.hideClass);this.$lis.eq(D.selected).addClass(D.selectedClass);var K=function(){A(P.element).triggerHandler("tabsshow",[P.fakeEvent("tabsshow"),P.ui(P.$tabs[D.selected],P.$panels[D.selected])],D.show)};if(A.data(this.$tabs[D.selected],"load.tabs")){this.load(D.selected,K)}else{K()}}A(window).bind("unload",function(){P.$tabs.unbind(".tabs");P.$lis=P.$tabs=P.$panels=null})}for(var G=0,N;N=this.$lis[G];G++){A(N)[A.inArray(G,D.disabled)!=-1&&!A(N).hasClass(D.selectedClass)?"addClass":"removeClass"](D.disabledClass)}if(D.cache===false){this.$tabs.removeData("cache.tabs")}var C,I,B={"min-width":0,duration:1},E="normal";if(D.fx&&D.fx.constructor==Array){C=D.fx[0]||B,I=D.fx[1]||B}else{C=I=D.fx||B}var H={display:"",overflow:"",height:""};if(!A.browser.msie){H.opacity=""}function M(R,Q,S){Q.animate(C,C.duration||E,function(){Q.addClass(D.hideClass).css(H);if(A.browser.msie&&C.opacity){Q[0].style.filter=""}if(S){L(R,S,Q)}})}function L(R,S,Q){if(I===B){S.css("display","block")}S.animate(I,I.duration||E,function(){S.removeClass(D.hideClass).css(H);if(A.browser.msie&&I.opacity){S[0].style.filter=""}A(P.element).triggerHandler("tabsshow",[P.fakeEvent("tabsshow"),P.ui(R,S[0])],D.show)})}function F(R,T,Q,S){T.addClass(D.selectedClass).siblings().removeClass(D.selectedClass);M(R,Q,S)}this.$tabs.unbind(".tabs").bind(D.event,function(){var T=A(this).parents("li:eq(0)"),Q=P.$panels.filter(":visible"),S=A(this.hash);if((T.hasClass(D.selectedClass)&&!D.unselect)||T.hasClass(D.disabledClass)||A(this).hasClass(D.loadingClass)||A(P.element).triggerHandler("tabsselect",[P.fakeEvent("tabsselect"),P.ui(this,S[0])],D.select)===false){this.blur();return false}P.options.selected=P.$tabs.index(this);if(D.unselect){if(T.hasClass(D.selectedClass)){P.options.selected=null;T.removeClass(D.selectedClass);P.$panels.stop();M(this,Q);this.blur();return false}else{if(!Q.length){P.$panels.stop();var R=this;P.load(P.$tabs.index(this),function(){T.addClass(D.selectedClass).addClass(D.unselectClass);L(R,S)});this.blur();return false}}}if(D.cookie){A.cookie("ui-tabs"+A.data(P.element),P.options.selected,D.cookie)}P.$panels.stop();if(S.length){var R=this;P.load(P.$tabs.index(this),Q.length?function(){F(R,T,Q,S)}:function(){T.addClass(D.selectedClass);L(R,S)})}else{throw"jQuery UI Tabs: Mismatching fragment identifier."}if(A.browser.msie){this.blur()}return false});if(!(/^click/).test(D.event)){this.$tabs.bind("click.tabs",function(){return false})}},add:function(E,D,C){if(C==undefined){C=this.$tabs.length}var G=this.options;var I=A(G.tabTemplate.replace(/#\{href\}/g,E).replace(/#\{label\}/g,D));I.data("destroy.tabs",true);var H=E.indexOf("#")==0?E.replace("#",""):this.tabId(A("a:first-child",I)[0]);var F=A("#"+H);if(!F.length){F=A(G.panelTemplate).attr("id",H).addClass(G.hideClass).data("destroy.tabs",true)}F.addClass(G.panelClass);if(C>=this.$lis.length){I.appendTo(this.element);F.appendTo(this.element[0].parentNode)}else{I.insertBefore(this.$lis[C]);F.insertBefore(this.$panels[C])}G.disabled=A.map(G.disabled,function(K,J){return K>=C?++K:K});this.tabify();if(this.$tabs.length==1){I.addClass(G.selectedClass);F.removeClass(G.hideClass);var B=A.data(this.$tabs[0],"load.tabs");if(B){this.load(C,B)}}this.element.triggerHandler("tabsadd",[this.fakeEvent("tabsadd"),this.ui(this.$tabs[C],this.$panels[C])],G.add)},remove:function(B){var D=this.options,E=this.$lis.eq(B).remove(),C=this.$panels.eq(B).remove();if(E.hasClass(D.selectedClass)&&this.$tabs.length>1){this.select(B+(B+1<this.$tabs.length?1:-1))}D.disabled=A.map(A.grep(D.disabled,function(G,F){return G!=B}),function(G,F){return G>=B?--G:G});this.tabify();this.element.triggerHandler("tabsremove",[this.fakeEvent("tabsremove"),this.ui(E.find("a")[0],C[0])],D.remove)},enable:function(B){var C=this.options;if(A.inArray(B,C.disabled)==-1){return }var D=this.$lis.eq(B).removeClass(C.disabledClass);if(A.browser.safari){D.css("display","inline-block");setTimeout(function(){D.css("display","block")},0)}C.disabled=A.grep(C.disabled,function(F,E){return F!=B});this.element.triggerHandler("tabsenable",[this.fakeEvent("tabsenable"),this.ui(this.$tabs[B],this.$panels[B])],C.enable)},disable:function(C){var B=this,D=this.options;if(C!=D.selected){this.$lis.eq(C).addClass(D.disabledClass);D.disabled.push(C);D.disabled.sort();this.element.triggerHandler("tabsdisable",[this.fakeEvent("tabsdisable"),this.ui(this.$tabs[C],this.$panels[C])],D.disable)}},select:function(B){if(typeof B=="string"){B=this.$tabs.index(this.$tabs.filter("[href$="+B+"]")[0])}this.$tabs.eq(B).trigger(this.options.event)},load:function(G,K){var L=this,D=this.options,E=this.$tabs.eq(G),J=E[0],H=K==undefined||K===false,B=E.data("load.tabs");K=K||function(){};if(!B||!H&&A.data(J,"cache.tabs")){K();return }var M=function(N){var O=A(N),P=O.find("*:last");return P.length&&P.is(":not(img)")&&P||O};var C=function(){L.$tabs.filter("."+D.loadingClass).removeClass(D.loadingClass).each(function(){if(D.spinner){M(this).parent().html(M(this).data("label.tabs"))}});L.xhr=null};if(D.spinner){var I=M(J).html();M(J).wrapInner("<em></em>").find("em").data("label.tabs",I).html(D.spinner)}var F=A.extend({},D.ajaxOptions,{url:B,success:function(O,N){A(J.hash).html(O);C();if(D.cache){A.data(J,"cache.tabs",true)}A(L.element).triggerHandler("tabsload",[L.fakeEvent("tabsload"),L.ui(L.$tabs[G],L.$panels[G])],D.load);D.ajaxOptions.success&&D.ajaxOptions.success(O,N);K()}});if(this.xhr){this.xhr.abort();C()}E.addClass(D.loadingClass);setTimeout(function(){L.xhr=A.ajax(F)},0)},url:function(C,B){this.$tabs.eq(C).removeData("cache.tabs").data("load.tabs",B)},destroy:function(){var B=this.options;this.element.unbind(".tabs").removeClass(B.navClass).removeData("tabs");this.$tabs.each(function(){var C=A.data(this,"href.tabs");if(C){this.href=C}var D=A(this).unbind(".tabs");A.each(["href","load","cache"],function(E,F){D.removeData(F+".tabs")})});this.$lis.add(this.$panels).each(function(){if(A.data(this,"destroy.tabs")){A(this).remove()}else{A(this).removeClass([B.selectedClass,B.unselectClass,B.disabledClass,B.panelClass,B.hideClass].join(" "))}})},fakeEvent:function(B){return A.event.fix({type:B,target:this.element[0]})}});A.ui.tabs.defaults={unselect:false,event:"click",disabled:[],cookie:null,spinner:"Loading&#8230;",cache:false,idPrefix:"ui-tabs-",ajaxOptions:{},fx:null,tabTemplate:'<li><a href="#{href}"><span>#{label}</span></a></li>',panelTemplate:"<div></div>",navClass:"ui-tabs-nav",selectedClass:"ui-tabs-selected",unselectClass:"ui-tabs-unselect",disabledClass:"ui-tabs-disabled",panelClass:"ui-tabs-panel",hideClass:"ui-tabs-hide",loadingClass:"ui-tabs-loading"};A.ui.tabs.getter="length";A.extend(A.ui.tabs.prototype,{rotation:null,rotate:function(C,F){F=F||false;var B=this,E=this.options.selected;function G(){B.rotation=setInterval(function(){E=++E<B.$tabs.length?E:0;B.select(E)},C)}function D(H){if(!H||H.clientX){clearInterval(B.rotation)}}if(C){G();if(!F){this.$tabs.bind(this.options.event,D)}else{this.$tabs.bind(this.options.event,function(){D();E=B.options.selected;G()})}}else{D();this.$tabs.unbind(this.options.event,D)}}})})(jQuery)

/*
 * jQuery Cycle Plugin (with Transition Definitions)
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007-2008 M. Alsup
 * Version: 2.30 (02-NOV-2008)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
;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($){8 q=\'2.30\';8 r=$.25.26&&/37 6.0/.1u(38.39);4 1n(){7(27.28&&27.28.1n)27.28.1n(\'[B] \'+3a.3b.3c.3d(2x,\'\'))};$.E.B=4(n){8 o=2x[1];O x.1s(4(){7(n===3e||n===P)n={};7(n.29==2y){3f(n){2a\'3g\':7(x.S)1v(x.S);x.S=0;$(x).1F(\'B.1M\',\'\');O;2a\'2b\':x.1g=1;O;2a\'2z\':x.1g=0;7(o===2c){n=$(x).1F(\'B.1M\');7(!n){1n(\'2A 1o 2B, 2C 1o 2z\');O}7(x.S){1v(x.S);x.S=0}1j(n.1N,n,1,1)}O;3h:n={1p:n}}}Q 7(n.29==3i){8 d=n;n=$(x).1F(\'B.1M\');7(!n){1n(\'2A 1o 2B, 2C 1o 1O 2D\');O}7(d<0||d>=n.1N.L){1n(\'3j 2D 1G: \'+d);O}n.N=d;7(x.S){1v(x.S);x.S=0}1j(n.1N,n,1,d>=n.1b);O}7(x.S)1v(x.S);x.S=0;x.1g=0;8 e=$(x);8 f=n.2d?$(n.2d,x):e.3k();8 g=f.3l();7(g.L<2){1n(\'3m; 3n 3o 3p: \'+g.L);O}8 h=$.3q({},$.E.B.2E,n||{},$.2F?e.2F():$.3r?e.1F():{});7(h.2e)h.2f=h.2g||g.L;e.1F(\'B.1M\',h);h.1w=x;h.1N=g;h.H=h.H?[h.H]:[];h.1k=h.1k?[h.1k]:[];h.1k.1P(4(){h.2h=0});7(h.1x)h.1k.J(4(){1j(g,h,0,!h.1y)});7(r&&h.1Q&&!h.2G)2i(f);8 j=x.3s;h.D=T((j.1H(/w:(\\d+)/)||[])[1])||h.D;h.C=T((j.1H(/h:(\\d+)/)||[])[1])||h.C;h.W=T((j.1H(/t:(\\d+)/)||[])[1])||h.W;7(e.u(\'1R\')==\'3t\')e.u(\'1R\',\'3u\');7(h.D)e.D(h.D);7(h.C&&h.C!=\'1S\')e.C(h.C);7(h.18)h.18=T(h.18);7(h.1l){h.1q=[];1I(8 i=0;i<g.L;i++)h.1q.J(i);h.1q.3v(4(a,b){O 3w.1l()-0.5});h.Z=0;h.18=h.1q[0]}Q 7(h.18>=g.L)h.18=0;8 k=h.18||0;f.u({1R:\'2H\',y:0,9:0}).U().1s(4(i){8 z=k?i>=k?g.L-(i-k):k-i:g.L-i;$(x).u(\'z-1G\',z)});$(g[k]).u(\'1h\',1).V();7($.25.26)g[k].2I.2J(\'2j\');7(h.1m&&h.D)f.D(h.D);7(h.1m&&h.C&&h.C!=\'1S\')f.C(h.C);7(h.2b)e.2K(4(){x.1g=1},4(){x.1g=0});8 l=$.E.B.M[h.1p];7($.2L(l))l(e,f,h);Q 7(h.1p!=\'2k\')1n(\'3x 3y: \'+h.1p);f.1s(4(){8 a=$(x);x.11=(h.1m&&h.C)?h.C:a.C();x.12=(h.1m&&h.D)?h.D:a.D()});h.A=h.A||{};h.I=h.I||{};h.G=h.G||{};f.1o(\':2l(\'+k+\')\').u(h.A);7(h.1f)$(f[k]).u(h.1f);7(h.W){h.W=T(h.W);7(h.19.29==2y)h.19=$.1p.3z[h.19]||T(h.19);7(!h.1T)h.19=h.19/2;3A((h.W-h.19)<3B)h.W+=h.19}7(h.2m)h.1U=h.1V=h.2m;7(!h.1z)h.1z=h.19;7(!h.1J)h.1J=h.19;h.2M=g.L;h.1b=k;7(h.1l){h.N=h.1b;7(++h.Z==g.L)h.Z=0;h.N=h.1q[h.Z]}Q h.N=h.18>=(g.L-1)?0:h.18+1;8 m=f[k];7(h.H.L)h.H[0].1W(m,[m,m,h,2c]);7(h.1k.L>1)h.1k[1].1W(m,[m,m,h,2c]);7(h.1K&&!h.1a)h.1a=h.1K;7(h.1a)$(h.1a).2n(\'1K\',4(){O 1O(g,h,h.1y?-1:1)});7(h.2o)$(h.2o).2n(\'1K\',4(){O 1O(g,h,h.1y?1:-1)});7(h.1r)2N(g,h);h.3C=4(a,b){8 c=$(a),s=c[0];7(!h.2g)h.2f++;g[b?\'1P\':\'J\'](s);7(h.1c)h.1c[b?\'1P\':\'J\'](s);h.2M=g.L;c.u(\'1R\',\'2H\');c[b?\'3D\':\'2O\'](e);7(b){h.1b++;h.N++}7(r&&h.1Q&&!h.2G)2i(c);7(h.1m&&h.D)c.D(h.D);7(h.1m&&h.C&&h.C!=\'1S\')f.C(h.C);s.11=(h.1m&&h.C)?h.C:c.C();s.12=(h.1m&&h.D)?h.D:c.D();c.u(h.A);7(h.1r)$.E.B.2p(g.L-1,s,$(h.1r),g,h);7(1X h.X==\'4\')h.X(c)};7(h.W||h.1x)x.S=1Y(4(){1j(g,h,0,!h.1y)},h.1x?10:h.W+(h.2P||0))})};4 1j(a,b,c,d){7(b.2h)O;8 p=b.1w,1A=a[b.1b],1a=a[b.N];7(p.S===0&&!c)O;7(!c&&!p.1g&&((b.2e&&(--b.2f<=0))||(b.1Z&&!b.1l&&b.N<b.1b))){7(b.2q)b.2q(b);O}7(c||!p.1g){7(b.H.L)$.1s(b.H,4(i,o){o.1W(1a,[1A,1a,b,d])});8 e=4(){7($.25.26&&b.1Q)x.2I.2J(\'2j\');$.1s(b.1k,4(i,o){o.1W(1a,[1A,1a,b,d])})};7(b.N!=b.1b){b.2h=1;7(b.20)b.20(1A,1a,b,e,d);Q 7($.2L($.E.B[b.1p]))$.E.B[b.1p](1A,1a,b,e);Q $.E.B.2k(1A,1a,b,e,c&&b.2Q)}7(b.1l){b.1b=b.N;7(++b.Z==a.L)b.Z=0;b.N=b.1q[b.Z]}Q{8 f=(b.N+1)==a.L;b.N=f?0:b.N+1;b.1b=f?a.L-1:b.N-1}7(b.1r)$.E.B.2r(b.1r,b.1b)}7(b.W&&!b.1x)p.S=1Y(4(){1j(a,b,0,!b.1y)},b.W);Q 7(b.1x&&p.1g)p.S=1Y(4(){1j(a,b,0,!b.1y)},10)};$.E.B.2r=4(a,b){$(a).3E(\'a\').3F(\'2R\').2j(\'a:2l(\'+b+\')\').3G(\'2R\')};4 1O(a,b,c){8 p=b.1w,W=p.S;7(W){1v(W);p.S=0}7(b.1l&&c<0){b.Z--;7(--b.Z==-2)b.Z=a.L-2;Q 7(b.Z==-1)b.Z=a.L-1;b.N=b.1q[b.Z]}Q 7(b.1l){7(++b.Z==a.L)b.Z=0;b.N=b.1q[b.Z]}Q{b.N=b.1b+c;7(b.N<0){7(b.1Z)O 21;b.N=a.L-1}Q 7(b.N>=a.L){7(b.1Z)O 21;b.N=0}}7(b.22&&1X b.22==\'4\')b.22(c>0,b.N,a[b.N]);1j(a,b,1,c>=0);O 21};4 2N(a,b){8 c=$(b.1r);$.1s(a,4(i,o){$.E.B.2p(i,o,c,a,b)});$.E.B.2r(b.1r,b.18)};$.E.B.2p=4(i,a,b,c,d){8 e=(1X d.2s==\'4\')?$(d.2s(i,a)):$(\'<a 3H="#">\'+(i+1)+\'</a>\');7(e.3I(\'3J\').L==0)e.2O(b);e.2n(d.2S,4(){d.N=i;8 p=d.1w,W=p.S;7(W){1v(W);p.S=0}7(1X d.2t==\'4\')d.2t(d.N,c[d.N]);1j(c,d,1,d.1b<i);O 21});7(d.2T)e.2K(4(){d.1w.1g=1},4(){d.1w.1g=0})};4 2i(b){4 23(s){8 s=T(s).3K(16);O s.L<2?\'0\'+s:s};4 2U(e){1I(;e&&e.3L.3M()!=\'3N\';e=e.3O){8 v=$.u(e,\'2V-2W\');7(v.3P(\'3Q\')>=0){8 a=v.1H(/\\d+/g);O\'#\'+23(a[0])+23(a[1])+23(a[2])}7(v&&v!=\'3R\')O v}O\'#3S\'};b.1s(4(){$(x).u(\'2V-2W\',2U(x))})};$.E.B.2k=4(a,b,c,d,e){8 f=$(a),$n=$(b);$n.u(c.A);8 g=e?1:c.1z;8 h=e?1:c.1J;8 i=e?P:c.1U;8 j=e?P:c.1V;8 k=4(){$n.24(c.I,g,i,d)};f.24(c.G,h,j,4(){7(c.K)f.u(c.K);7(!c.1T)k()});7(c.1T)k()};$.E.B.M={2X:4(b,c,d){c.1o(\':2l(\'+d.18+\')\').u(\'1h\',0);d.H.J(4(){$(x).V()});d.I={1h:1};d.G={1h:0};d.A={1h:0};d.K={R:\'Y\'};d.X=4(a){a.U()}}};$.E.B.3T=4(){O q};$.E.B.2E={1p:\'2X\',W:3U,1x:0,19:3V,1z:P,1J:P,1a:P,2o:P,22:P,1r:P,2t:P,2S:\'1K\',2s:P,H:P,1k:P,2q:P,2m:P,1U:P,1V:P,1L:P,I:P,G:P,A:P,K:P,20:P,C:\'1S\',18:0,1T:1,1l:0,1m:0,2b:0,2T:0,2e:0,2g:0,2P:0,2d:P,1Q:0,1Z:0,2Q:0}})(2Y);(4($){$.E.B.M.3W=4(d,e,f){d.u(\'17\',\'1d\');f.H.J(4(a,b,c){$(x).V();c.A.y=b.1B;c.G.y=0-a.1B});f.1f={y:0};f.I={y:0};f.K={R:\'Y\'}};$.E.B.M.3X=4(d,e,f){d.u(\'17\',\'1d\');f.H.J(4(a,b,c){$(x).V();c.A.y=0-b.1B;c.G.y=a.1B});f.1f={y:0};f.I={y:0};f.K={R:\'Y\'}};$.E.B.M.3Y=4(d,e,f){d.u(\'17\',\'1d\');f.H.J(4(a,b,c){$(x).V();c.A.9=b.1C;c.G.9=0-a.1C});f.1f={9:0};f.I={9:0}};$.E.B.M.3Z=4(d,e,f){d.u(\'17\',\'1d\');f.H.J(4(a,b,c){$(x).V();c.A.9=0-b.1C;c.G.9=a.1C});f.1f={9:0};f.I={9:0}};$.E.B.M.40=4(f,g,h){f.u(\'17\',\'1d\').D();h.H.J(4(a,b,c,d){$(x).V();8 e=a.1C,2u=b.1C;c.A=d?{9:2u}:{9:-2u};c.I.9=0;c.G.9=d?-e:e;g.1o(a).u(c.A)});h.1f={9:0};h.K={R:\'Y\'}};$.E.B.M.41=4(f,g,h){f.u(\'17\',\'1d\');h.H.J(4(a,b,c,d){$(x).V();8 e=a.1B,2v=b.1B;c.A=d?{y:-2v}:{y:2v};c.I.y=0;c.G.y=d?e:-e;g.1o(a).u(c.A)});h.1f={y:0};h.K={R:\'Y\'}};$.E.B.M.42=4(d,e,f){f.H.J(4(a,b,c){$(a).u(\'F\',1)});f.X=4(a){a.U()};f.A={F:2};f.I={D:\'V\'};f.G={D:\'U\'}};$.E.B.M.43=4(d,e,f){f.H.J(4(a,b,c){$(a).u(\'F\',1)});f.X=4(a){a.U()};f.A={F:2};f.I={C:\'V\'};f.G={C:\'U\'}};$.E.B.M.1L=4(g,h,j){8 w=g.u(\'17\',\'2Z\').D();h.u({9:0,y:0});j.H.J(4(){$(x).V()});j.19=j.19/2;j.1l=0;j.1L=j.1L||{9:-w,y:15};j.1c=[];1I(8 i=0;i<h.L;i++)j.1c.J(h[i]);1I(8 i=0;i<j.18;i++)j.1c.J(j.1c.31());j.20=4(a,b,c,d,e){8 f=e?$(a):$(b);f.24(c.1L,c.1z,c.1U,4(){e?c.1c.J(c.1c.31()):c.1c.1P(c.1c.44());7(e)1I(8 i=0,2w=c.1c.L;i<2w;i++)$(c.1c[i]).u(\'z-1G\',2w-i);Q{8 z=$(a).u(\'z-1G\');f.u(\'z-1G\',T(z)+1)}f.24({9:0,y:0},c.1J,c.1V,4(){$(e?x:a).U();7(d)d()})})};j.X=4(a){a.U()}};$.E.B.M.45=4(d,e,f){f.H.J(4(a,b,c){$(x).V();c.A.y=b.11;c.I.C=b.11});f.X=4(a){a.U()};f.1f={y:0};f.A={C:0};f.I={y:0};f.G={C:0};f.K={R:\'Y\'}};$.E.B.M.46=4(d,e,f){f.H.J(4(a,b,c){$(x).V();c.I.C=b.11;c.G.y=a.11});f.X=4(a){a.U()};f.1f={y:0};f.A={y:0,C:0};f.G={C:0};f.K={R:\'Y\'}};$.E.B.M.47=4(d,e,f){f.H.J(4(a,b,c){$(x).V();c.A.9=b.12;c.I.D=b.12});f.X=4(a){a.U()};f.A={D:0};f.I={9:0};f.G={D:0};f.K={R:\'Y\'}};$.E.B.M.48=4(d,e,f){f.H.J(4(a,b,c){$(x).V();c.I.D=b.12;c.G.9=a.12});f.X=4(a){a.U()};f.A={9:0,D:0};f.I={9:0};f.G={D:0};f.K={R:\'Y\'}};$.E.B.M.32=4(d,e,f){f.1f={y:0,9:0};f.K={R:\'Y\'};f.H.J(4(a,b,c){$(x).V();c.A={D:0,C:0,y:b.11/2,9:b.12/2};c.K={R:\'Y\'};c.I={y:0,9:0,D:b.12,C:b.11};c.G={D:0,C:0,y:a.11/2,9:a.12/2};$(a).u(\'F\',2);$(b).u(\'F\',1)});f.X=4(a){a.U()}};$.E.B.M.49=4(d,e,f){f.H.J(4(a,b,c){c.A={D:0,C:0,1h:1,9:b.12/2,y:b.11/2,F:1};c.I={y:0,9:0,D:b.12,C:b.11}});f.G={1h:0};f.K={F:0}};$.E.B.M.4a=4(d,e,f){8 w=d.u(\'17\',\'1d\').D();e.V();f.H.J(4(a,b,c){$(a).u(\'F\',1)});f.A={9:w,F:2};f.K={F:1};f.I={9:0};f.G={9:w}};$.E.B.M.4b=4(d,e,f){8 h=d.u(\'17\',\'1d\').C();e.V();f.H.J(4(a,b,c){$(a).u(\'F\',1)});f.A={y:h,F:2};f.K={F:1};f.I={y:0};f.G={y:h}};$.E.B.M.4c=4(d,e,f){8 h=d.u(\'17\',\'1d\').C();8 w=d.D();e.V();f.H.J(4(a,b,c){$(a).u(\'F\',1)});f.A={y:h,9:w,F:2};f.K={F:1};f.I={y:0,9:0};f.G={y:h,9:w}};$.E.B.M.4d=4(d,e,f){f.H.J(4(a,b,c){c.A={9:x.12/2,D:0,F:2};c.I={9:0,D:x.12};c.G={9:0};$(a).u(\'F\',1)});f.X=4(a){a.U().u(\'F\',1)}};$.E.B.M.4e=4(d,e,f){f.H.J(4(a,b,c){c.A={y:x.11/2,C:0,F:2};c.I={y:0,C:x.11};c.G={y:0};$(a).u(\'F\',1)});f.X=4(a){a.U().u(\'F\',1)}};$.E.B.M.4f=4(d,e,f){f.H.J(4(a,b,c){c.A={9:b.12/2,D:0,F:1,R:\'1D\'};c.I={9:0,D:x.12};c.G={9:a.12/2,D:0};$(a).u(\'F\',2)});f.X=4(a){a.U()};f.K={F:1,R:\'Y\'}};$.E.B.M.4g=4(d,e,f){f.H.J(4(a,b,c){c.A={y:b.11/2,C:0,F:1,R:\'1D\'};c.I={y:0,C:x.11};c.G={y:a.11/2,C:0};$(a).u(\'F\',2)});f.X=4(a){a.U()};f.K={F:1,R:\'Y\'}};$.E.B.M.4h=4(e,f,g){8 d=g.33||\'9\';8 w=e.u(\'17\',\'1d\').D();8 h=e.C();g.H.J(4(a,b,c){c.A=c.A||{};c.A.F=2;c.A.R=\'1D\';7(d==\'34\')c.A.9=-w;Q 7(d==\'35\')c.A.y=h;Q 7(d==\'36\')c.A.y=-h;Q c.A.9=w;$(a).u(\'F\',1)});7(!g.I)g.I={9:0,y:0};7(!g.G)g.G={9:0,y:0};g.K=g.K||{};g.K.F=2;g.K.R=\'Y\'};$.E.B.M.4i=4(e,f,g){8 d=g.33||\'9\';8 w=e.u(\'17\',\'1d\').D();8 h=e.C();g.H.J(4(a,b,c){c.A.R=\'1D\';7(d==\'34\')c.G.9=w;Q 7(d==\'35\')c.G.y=-h;Q 7(d==\'36\')c.G.y=h;Q c.G.9=-w;$(a).u(\'F\',2);$(b).u(\'F\',1)});g.X=4(a){a.U()};7(!g.I)g.I={9:0,y:0};g.A=g.A||{};g.A.y=0;g.A.9=0;g.K=g.K||{};g.K.F=1;g.K.R=\'Y\'};$.E.B.M.4j=4(d,e,f){8 w=d.u(\'17\',\'2Z\').D();8 h=d.C();f.H.J(4(a,b,c){$(a).u(\'F\',2);c.A.R=\'1D\';7(!c.G.9&&!c.G.y)c.G={9:w*2,y:-h/2,1h:0};Q c.G.1h=0});f.X=4(a){a.U()};f.A={9:0,y:0,F:1,1h:1};f.I={9:0};f.K={F:2,R:\'Y\'}};$.E.B.M.4k=4(o,p,q){8 w=o.u(\'17\',\'1d\').D();8 h=o.C();q.A=q.A||{};8 s;7(q.1i){7(/4l/.1u(q.1i))s=\'1t(1e 1e \'+h+\'14 1e)\';Q 7(/4m/.1u(q.1i))s=\'1t(1e \'+w+\'14 \'+h+\'14 \'+w+\'14)\';Q 7(/4n/.1u(q.1i))s=\'1t(1e \'+w+\'14 1e 1e)\';Q 7(/4o/.1u(q.1i))s=\'1t(\'+h+\'14 \'+w+\'14 \'+h+\'14 1e)\';Q 7(/32/.1u(q.1i)){8 t=T(h/2);8 l=T(w/2);s=\'1t(\'+t+\'14 \'+l+\'14 \'+t+\'14 \'+l+\'14)\'}}q.A.1i=q.A.1i||s||\'1t(1e 1e 1e 1e)\';8 d=q.A.1i.1H(/(\\d+)/g);8 t=T(d[0]),r=T(d[1]),b=T(d[2]),l=T(d[3]);q.H.J(4(g,i,j){7(g==i)O;8 k=$(g).u(\'F\',2);8 m=$(i).u({F:3,R:\'1D\'});8 n=1,1E=T((j.1z/13))-1;4 f(){8 a=t?t-T(n*(t/1E)):0;8 c=l?l-T(n*(l/1E)):0;8 d=b<h?b+T(n*((h-b)/1E||1)):h;8 e=r<w?r+T(n*((w-r)/1E||1)):w;m.u({1i:\'1t(\'+a+\'14 \'+e+\'14 \'+d+\'14 \'+c+\'14)\'});(n++<=1E)?1Y(f,13):k.u(\'R\',\'Y\')}f()});q.K={};q.I={9:0};q.G={9:0}}})(2Y);',62,273,'||||function|||if|var|left|||||||||||||||||||||css|||this|top||cssBefore|cycle|height|width|fn|zIndex|animOut|before|animIn|push|cssAfter|length|transitions|nextSlide|return|null|else|display|cycleTimeout|parseInt|hide|show|timeout|onAddSlide|none|randomIndex||cycleH|cycleW||px|||overflow|startingSlide|speed|next|currSlide|els|hidden|0px|cssFirst|cyclePause|opacity|clip|go|after|random|fit|log|not|fx|randomMap|pager|each|rect|test|clearTimeout|container|continuous|rev|speedIn|curr|offsetHeight|offsetWidth|block|count|data|index|match|for|speedOut|click|shuffle|opts|elements|advance|unshift|cleartype|position|auto|sync|easeIn|easeOut|apply|typeof|setTimeout|nowrap|fxFn|false|prevNextClick|hex|animate|browser|msie|window|console|constructor|case|pause|true|slideExpr|autostop|countdown|autostopCount|busy|clearTypeFix|filter|custom|eq|easing|bind|prev|createPagerAnchor|end|updateActivePagerLink|pagerAnchorBuilder|pagerClick|nextW|nextH|len|arguments|String|resume|options|found|can|slide|defaults|metadata|cleartypeNoBg|absolute|style|removeAttribute|hover|isFunction|slideCount|buildPager|appendTo|delay|fastOnEvent|activeSlide|pagerEvent|pauseOnPagerHover|getBg|background|color|fade|jQuery|visible||shift|zoom|direction|right|up|down|MSIE|navigator|userAgent|Array|prototype|join|call|undefined|switch|stop|default|Number|invalid|children|get|terminating|too|few|slides|extend|meta|className|static|relative|sort|Math|unknown|transition|speeds|while|250|addSlide|prependTo|find|removeClass|addClass|href|parents|body|toString|nodeName|toLowerCase|html|parentNode|indexOf|rgb|transparent|ffffff|ver|4000|1000|scrollUp|scrollDown|scrollLeft|scrollRight|scrollHorz|scrollVert|slideX|slideY|pop|turnUp|turnDown|turnLeft|turnRight|fadeZoom|blindX|blindY|blindZ|growX|growY|curtainX|curtainY|cover|uncover|toss|wipe|l2r|r2l|t2b|b2t'.split('|'),0,{}));


/* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 * Copyright © 2008 George McGinley Smith
 * Open source under the BSD License. */
jQuery.easing['jswing']=jQuery.easing['swing'];jQuery.extend(jQuery.easing,{def:'easeOutQuad',swing:function(e,a,c,b,d){return jQuery.easing[jQuery.easing.def](e,a,c,b,d)},easeInQuad:function(e,a,c,b,d){return b*(a/=d)*a+c},easeOutQuad:function(e,a,c,b,d){return-b*(a/=d)*(a-2)+c},easeInOutQuad:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a+c;return-b/2*((--a)*(a-2)-1)+c},easeInCubic:function(e,a,c,b,d){return b*(a/=d)*a*a+c},easeOutCubic:function(e,a,c,b,d){return b*((a=a/d-1)*a*a+1)+c},easeInOutCubic:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a+c;return b/2*((a-=2)*a*a+2)+c},easeInQuart:function(e,a,c,b,d){return b*(a/=d)*a*a*a+c},easeOutQuart:function(e,a,c,b,d){return-b*((a=a/d-1)*a*a*a-1)+c},easeInOutQuart:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a*a+c;return-b/2*((a-=2)*a*a*a-2)+c},easeInQuint:function(e,a,c,b,d){return b*(a/=d)*a*a*a*a+c},easeOutQuint:function(e,a,c,b,d){return b*((a=a/d-1)*a*a*a*a+1)+c},easeInOutQuint:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a*a*a+c;return b/2*((a-=2)*a*a*a*a+2)+c},easeInSine:function(e,a,c,b,d){return-b*Math.cos(a/d*(Math.PI/2))+b+c},easeOutSine:function(e,a,c,b,d){return b*Math.sin(a/d*(Math.PI/2))+c},easeInOutSine:function(e,a,c,b,d){return-b/2*(Math.cos(Math.PI*a/d)-1)+c},easeInExpo:function(e,a,c,b,d){return(a==0)?c:b*Math.pow(2,10*(a/d-1))+c},easeOutExpo:function(e,a,c,b,d){return(a==d)?c+b:b*(-Math.pow(2,-10*a/d)+1)+c},easeInOutExpo:function(e,a,c,b,d){if(a==0)return c;if(a==d)return c+b;if((a/=d/2)<1)return b/2*Math.pow(2,10*(a-1))+c;return b/2*(-Math.pow(2,-10*--a)+2)+c},easeInCirc:function(e,a,c,b,d){return-b*(Math.sqrt(1-(a/=d)*a)-1)+c},easeOutCirc:function(e,a,c,b,d){return b*Math.sqrt(1-(a=a/d-1)*a)+c},easeInOutCirc:function(e,a,c,b,d){if((a/=d/2)<1)return-b/2*(Math.sqrt(1-a*a)-1)+c;return b/2*(Math.sqrt(1-(a-=2)*a)+1)+c},easeInElastic:function(e,a,c,b,d){var f=1.70158;var g=0;var h=b;if(a==0)return c;if((a/=d)==1)return c+b;if(!g)g=d*.3;if(h<Math.abs(b)){h=b;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(b/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*d-f)*(2*Math.PI)/g))+c},easeOutElastic:function(e,a,c,b,d){var f=1.70158;var g=0;var h=b;if(a==0)return c;if((a/=d)==1)return c+b;if(!g)g=d*.3;if(h<Math.abs(b)){h=b;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(b/h);return h*Math.pow(2,-10*a)*Math.sin((a*d-f)*(2*Math.PI)/g)+b+c},easeInOutElastic:function(e,a,c,b,d){var f=1.70158;var g=0;var h=b;if(a==0)return c;if((a/=d/2)==2)return c+b;if(!g)g=d*(.3*1.5);if(h<Math.abs(b)){h=b;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(b/h);if(a<1)return-.5*(h*Math.pow(2,10*(a-=1))*Math.sin((a*d-f)*(2*Math.PI)/g))+c;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*d-f)*(2*Math.PI)/g)*.5+b+c},easeInBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;return b*(a/=d)*a*((f+1)*a-f)+c},easeOutBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;return b*((a=a/d-1)*a*((f+1)*a+f)+1)+c},easeInOutBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;if((a/=d/2)<1)return b/2*(a*a*(((f*=(1.525))+1)*a-f))+c;return b/2*((a-=2)*a*(((f*=(1.525))+1)*a+f)+2)+c},easeInBounce:function(e,a,c,b,d){return b-jQuery.easing.easeOutBounce(e,d-a,0,b,d)+c},easeOutBounce:function(e,a,c,b,d){if((a/=d)<(1/2.75)){return b*(7.5625*a*a)+c}else if(a<(2/2.75)){return b*(7.5625*(a-=(1.5/2.75))*a+.75)+c}else if(a<(2.5/2.75)){return b*(7.5625*(a-=(2.25/2.75))*a+.9375)+c}else{return b*(7.5625*(a-=(2.625/2.75))*a+.984375)+c}},easeInOutBounce:function(e,a,c,b,d){if(a<d/2)return jQuery.easing.easeInBounce(e,a*2,0,b,d)*.5+c;return jQuery.easing.easeOutBounce(e,a*2-d,0,b,d)*.5+b*.5+c}});

/* jQuery truncateText Plugin
   Intelligently truncates the content of the passed element.
   By Livingston Samuel - http://livingstonsamuel.com */
;(function(d){d.fn.truncateText=function(a){var g={length:10,ellipsisText:"...",contentType:'text'};var a=d.extend(g,a);return this.each(function(){var b=d(this);var c=(a.contentType=="text")?b.text():b.html();if(c.length>a.length){var f=c.indexOf(' ',a.length);if(f!="-1"){var e=c.substring(0,f);if(a.contentType=="text"){e+=a.ellipsisText;b.text(e);b.attr({title:c})}else if(a.contentType=="html"){b.html(e);b.append(a.ellipsisText)}}}})}})(jQuery);

/* Copyright (c) 2006 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 *
 * $LastChangedDate: 2007-12-14 23:57:10 -0600 (Fri, 14 Dec 2007) $
 * $Rev: 4163 $
 *
 * Version: 3.0
 * 
 * Requires: $ 1.2.2+
 */
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}('(5($){$.6.j.4={L:5(){9 b=$.6.j.4.i;7($.8.f)$(2).o(\'y.4\',5(a){$.d(2,\'h\',{x:a.x,l:a.l,s:a.s,r:a.r})});7(2.q)2.q(($.8.f?\'v\':\'4\'),b,n);m 2.w=b},D:5(){9 a=$.6.j.4.i;$(2).k(\'y.4\');7(2.u)2.u(($.8.f?\'v\':\'4\'),a,n);m 2.w=5(){};$.A(2,\'h\')},i:5(a){9 c=U.T.S.P(O,1);a=$.6.N(a||M.6);$.t(a,$.d(2,\'h\')||{});9 b=0,K=J;7(a.e)b=a.e/I;7(a.p)b=-a.p/3;7($.8.H)b=-a.e;a.d=a.d||{};a.G="4";c.z(b);c.z(a);g $.6.F.E(2,c)}};$.Q.t({4:5(a){g a?2.o("4",a):2.R("4")},C:5(a){g 2.k("4",a)}})})(B);',57,57,'||this||mousewheel|function|event|if|browser|var||||data|wheelDelta|mozilla|return|mwcursorposdata|handler|special|unbind|pageY|else|false|bind|detail|addEventListener|clientY|clientX|extend|removeEventListener|DOMMouseScroll|onmousewheel|pageX|mousemove|unshift|removeData|jQuery|unmousewheel|teardown|apply|handle|type|opera|120|true|returnValue|setup|window|fix|arguments|call|fn|trigger|slice|prototype|Array'.split('|'),0,{}));

/* Copyright (c) 2006 Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * 
 * See http://kelvinluck.com/assets/jquery/jScrollPane/
 * $Id: jScrollPane.js 4765 2008-02-17 21:14:59Z kelvinluck $
 */

/**
 * Replace the vertical scroll bars on any matched elements with a fancy
 * styleable (via CSS) version. With JS disabled the elements will
 * gracefully degrade to the browsers own implementation of overflow:auto.
 * If the mousewheel plugin has been included on the page then the scrollable areas will also
 * respond to the mouse wheel.
 *
 * @example jQuery(".scroll-pane").jScrollPane();
 *
 * @name jScrollPane
 * @type jQuery
 * @param Object	settings	hash with options, described below.
 *								scrollbarWidth	-	The width of the generated scrollbar in pixels
 *								scrollbarMargin	-	The amount of space to leave on the side of the scrollbar in pixels
 *								wheelSpeed		-	The speed the pane will scroll in response to the mouse wheel in pixels
 *								showArrows		-	Whether to display arrows for the user to scroll with
 *								arrowSize		-	The height of the arrow buttons if showArrows=true
 *								animateTo		-	Whether to animate when calling scrollTo and scrollBy
 *								dragMinHeight	-	The minimum height to allow the drag bar to be
 *								dragMaxHeight	-	The maximum height to allow the drag bar to be
 *								animateInterval	-	The interval in milliseconds to update an animating scrollPane (default 100)
 *								animateStep		-	The amount to divide the remaining scroll distance by when animating (default 3)
 *								maintainPosition-	Whether you want the contents of the scroll pane to maintain it's position when you re-initialise it - so it doesn't scroll as you add more content (default true)
 *								scrollbarOnLeft	-	Display the scrollbar on the left side?  (needs stylesheet changes, see examples.html)
 * @return jQuery
 * @cat Plugins/jScrollPane
 * @author Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com)
 */
jQuery.jScrollPane = {
	active : []
};
jQuery.fn.jScrollPane = function(settings)
{
	settings = jQuery.extend(
		{
			scrollbarWidth : 10,
			scrollbarMargin : 5,
			wheelSpeed : 18,
			showArrows : false,
			arrowSize : 0,
			animateTo : false,
			dragMinHeight : 1,
			dragMaxHeight : 99999,
			animateInterval : 100,
			animateStep: 3,
			maintainPosition: true,
			scrollbarOnLeft: false,
			prefix : "jScroll"
		}, settings
	);

	return this.each(
		function()
		{
			var $this = jQuery(this);
			if (jQuery(this).parent().is('.' + settings.prefix + 'PaneContainer')) {
				var currentScrollPosition = settings.maintainPosition ? $this.offset({relativeTo:jQuery(this).parent()[0]}).top : 0;
				var $c = jQuery(this).parent();
				var paneWidth = $c.innerWidth();
				var paneHeight = $c.outerHeight();
				var trackHeight = paneHeight;
				if ($c.unmousewheel) {
					$c.unmousewheel();
				}
				jQuery('>.' + settings.prefix + 'PaneTrack, >.' + settings.prefix + 'ArrowUp, >.' + settings.prefix + 'ArrowDown', $c).remove();
				$this.css({'top':0});
			} else {
				var currentScrollPosition = 0;
				this.originalPadding = $this.css('paddingTop') + ' ' + $this.css('paddingRight') + ' ' + $this.css('paddingBottom') + ' ' + $this.css('paddingLeft');
				this.originalSidePaddingTotal = (parseInt($this.css('paddingLeft')) || 0) + (parseInt($this.css('paddingRight')) || 0);
				var paneWidth = $this.innerWidth();
				var paneHeight = $this.innerHeight();
				var trackHeight = paneHeight;
				$this.wrap(
					jQuery('<div></div>').attr(
						{'className':settings.prefix+'PaneContainer'}
					).css(
						{
							'height':paneHeight+'px', 
							'width':paneWidth+'px'
						}
					)
				);
				// deal with text size changes (if the jquery.em plugin is included)
				// and re-initialise the scrollPane so the track maintains the
				// correct size
				jQuery(document).bind(
					'emchange', 
					function(e)
					{
						$this.jScrollPane(settings);
					}
				);
			}

			var p = this.originalSidePaddingTotal;
			if (typeof(p) == "undefined") { p = 0 }; // can be undefined in ie7
			var cssWidth = paneWidth - settings.scrollbarWidth - settings.scrollbarMargin - p;
			var cssToApply = {
				'height':'auto',
				'width': cssWidth + 'px'
			}

			if(settings.scrollbarOnLeft) {
				cssToApply.paddingLeft = settings.scrollbarMargin + settings.scrollbarWidth + 'px';
			} else {
				cssToApply.paddingRight = settings.scrollbarMargin + 'px';
			}

      $this.css(cssToApply);
			var contentHeight = $this.outerHeight();
			var percentInView = paneHeight / contentHeight;
			if (percentInView < .99) {
				var $container = $this.parent();
				$container.append(
					jQuery('<div></div>').attr({'className':settings.prefix + 'PaneTrack'}).css({'width':settings.scrollbarWidth+'px'}).append(
						jQuery('<div></div>').attr({'className':settings.prefix + 'PaneDrag'}).css({'width':settings.scrollbarWidth+'px'}).append(
							jQuery('<div></div>').attr({'className':settings.prefix + 'PaneDragTop'}).css({'width':settings.scrollbarWidth+'px'}),
							jQuery('<div></div>').attr({'className':settings.prefix + 'PaneDragBottom'}).css({'width':settings.scrollbarWidth+'px'})
						)
					)
				);
				var $track = jQuery('>.' + settings.prefix + 'PaneTrack', $container);
				var $drag = jQuery('>.' + settings.prefix + 'PaneTrack .' + settings.prefix + 'PaneDrag', $container);
				
				if (settings.showArrows) {
					
					var currentArrowButton;
					var currentArrowDirection;
					var currentArrowInterval;
					var currentArrowInc;
					var whileArrowButtonDown = function()
					{
						if (currentArrowInc > 4 || currentArrowInc%4==0) {
							positionDrag(dragPosition + currentArrowDirection * mouseWheelMultiplier);
						}
						currentArrowInc ++;
					};
					var onArrowMouseUp = function(event)
					{
						jQuery('html').unbind('mouseup', onArrowMouseUp);
						currentArrowButton.removeClass(settings.prefix + 'ActiveArrowButton');
						clearInterval(currentArrowInterval);
						//console.log($(event.target));
						//currentArrowButton.parent().removeClass(settings.prefix + 'ArrowUpClicked ' + settings.prefix + 'ArrowDownClicked');
					};
					var onArrowMouseDown = function() {
						//console.log(direction);
						//currentArrowButton = $(this);
						jQuery('html').bind('mouseup', onArrowMouseUp);
						currentArrowButton.addClass(settings.prefix + 'ActiveArrowButton');
						currentArrowInc = 0;
						whileArrowButtonDown();
						currentArrowInterval = setInterval(whileArrowButtonDown, 100);
					};
					$container
						.append(
							jQuery('<a></a>')
								.attr({'href':'javascript:;', 'className':settings.prefix + 'ArrowUp'})
								.css({'width':settings.scrollbarWidth+'px'})
								.html('Scroll up')
								.bind('mousedown', function()
								{
									currentArrowButton = jQuery(this);
									currentArrowDirection = -1;
									onArrowMouseDown();
									this.blur();
									return false;
								}),
							jQuery('<a></a>')
								.attr({'href':'javascript:;', 'className':settings.prefix + 'ArrowDown'})
								.css({'width':settings.scrollbarWidth+'px'})
								.html('Scroll down')
								.bind('mousedown', function()
								{
									currentArrowButton = jQuery(this);
									currentArrowDirection = 1;
									onArrowMouseDown();
									this.blur();
									return false;
								})
						);
					var $upArrow = jQuery('>.' + settings.prefix + 'ArrowUp', $container);
					var $downArrow = jQuery('>.' + settings.prefix + 'ArrowDown', $container);
					if (settings.arrowSize) {
						trackHeight = paneHeight - settings.arrowSize - settings.arrowSize;
						$track
							.css({'height': trackHeight+'px', top:settings.arrowSize+'px'})
					} else {
						var topArrowHeight = $upArrow.height();
						settings.arrowSize = topArrowHeight;
						trackHeight = paneHeight - topArrowHeight - $downArrow.height();
						$track
							.css({'height': trackHeight+'px', top:topArrowHeight+'px'})
					}
				}
				
				var $pane = jQuery(this).css({'position':'absolute', 'overflow':'visible'});
				
				var currentOffset;
				var maxY;
				var mouseWheelMultiplier;
				// store this in a seperate variable so we can keep track more accurately than just updating the css property..
				var dragPosition = 0;
				var dragMiddle = percentInView*paneHeight/2;
				
				// pos function borrowed from tooltip plugin and adapted...
				var getPos = function (event, c) {
					var p = c == 'X' ? 'Left' : 'Top';
					return event['page' + c] || (event['client' + c] + (document.documentElement['scroll' + p] || document.body['scroll' + p])) || 0;
				};
				
				var ignoreNativeDrag = function() {	return false; };
				
				var initDrag = function()
				{
					ceaseAnimation();
					currentOffset = $drag.offset(false);
					currentOffset.top -= dragPosition;
					maxY = trackHeight - $drag[0].offsetHeight;
					mouseWheelMultiplier = 2 * settings.wheelSpeed * maxY / contentHeight;
				};
				
				var onStartDrag = function(event)
				{
					initDrag();
					dragMiddle = getPos(event, 'Y') - dragPosition - currentOffset.top;
					jQuery('html').bind('mouseup', onStopDrag).bind('mousemove', updateScroll);
					if (jQuery.browser.msie) {
						jQuery('html').bind('dragstart', ignoreNativeDrag).bind('selectstart', ignoreNativeDrag);
					}
					return false;
				};
				var onStopDrag = function()
				{
					jQuery('html').unbind('mouseup', onStopDrag).unbind('mousemove', updateScroll);
					dragMiddle = percentInView*paneHeight/2;
					if (jQuery.browser.msie) {
						jQuery('html').unbind('dragstart', ignoreNativeDrag).unbind('selectstart', ignoreNativeDrag);
					}
				};
				var positionDrag = function(destY)
				{
					destY = destY < 0 ? 0 : (destY > maxY ? maxY : destY);
					dragPosition = destY;
					$drag.css({'top':destY+'px'});
					var p = destY / maxY;
					$pane.css({'top':((paneHeight-contentHeight)*p) + 'px'});
					$this.trigger('scroll');
					if (settings.showArrows) {
						$upArrow[destY == 0 ? 'addClass' : 'removeClass']('disabled');
						$downArrow[destY == maxY ? 'addClass' : 'removeClass']('disabled');
					}
				};
				var updateScroll = function(e)
				{
					positionDrag(getPos(e, 'Y') - currentOffset.top - dragMiddle);
				};
				
				var dragH = Math.max(Math.min(percentInView*(paneHeight-settings.arrowSize*2), settings.dragMaxHeight), settings.dragMinHeight);
				
				$drag.css(
					{'height':dragH+'px'}
				).bind('mousedown', onStartDrag);
				
				var trackScrollInterval;
				var trackScrollInc;
				var trackScrollMousePos;
				var doTrackScroll = function()
				{
					if (trackScrollInc > 8 || trackScrollInc%4==0) {
						positionDrag((dragPosition - ((dragPosition - trackScrollMousePos) / 2)));
					}
					trackScrollInc ++;
				};
				var onStopTrackClick = function()
				{
					clearInterval(trackScrollInterval);
					jQuery('html').unbind('mouseup', onStopTrackClick).unbind('mousemove', onTrackMouseMove);
				};
				var onTrackMouseMove = function(event)
				{
					trackScrollMousePos = getPos(event, 'Y') - currentOffset.top - dragMiddle;
				};
				var onTrackClick = function(event)
				{
					initDrag();
					onTrackMouseMove(event);
					trackScrollInc = 0;
					jQuery('html').bind('mouseup', onStopTrackClick).bind('mousemove', onTrackMouseMove);
					trackScrollInterval = setInterval(doTrackScroll, 100);
					doTrackScroll();
				};
				
				$track.bind('mousedown', onTrackClick);
				
				// if the mousewheel plugin has been included then also react to the mousewheel
				if ($container.mousewheel) {
					$container.mousewheel(
						function (event, delta) {
							initDrag();
							ceaseAnimation();
							var d = dragPosition;
							positionDrag(dragPosition - delta * mouseWheelMultiplier);
							var dragOccured = d != dragPosition;
							return !dragOccured;
						},
						false
					);					
				}
				var _animateToPosition;
				var _animateToInterval;
				function animateToPosition()
				{
					var diff = (_animateToPosition - dragPosition) / settings.animateStep;
					if (diff > 1 || diff < -1) {
						positionDrag(dragPosition + diff);
					} else {
						positionDrag(_animateToPosition);
						ceaseAnimation();
					}
				}
				var ceaseAnimation = function()
				{
					if (_animateToInterval) {
						clearInterval(_animateToInterval);
						delete _animateToPosition;
					}
				};
				var scrollTo = function(pos, preventAni)
				{
					if (typeof pos == "string") {
						$e = jQuery(pos, this);
						if (!$e.length) return;
						pos = $e.offset().top - $this.offset().top;
					}
					ceaseAnimation();
					var destDragPosition = -pos/(paneHeight-contentHeight) * maxY;
					if (preventAni || !settings.animateTo) {
						positionDrag(destDragPosition);
					} else {
						_animateToPosition = destDragPosition;
						_animateToInterval = setInterval(animateToPosition, settings.animateInterval);
					}
				};
				$this[0].scrollTo = scrollTo;
				
				$this[0].scrollBy = function(delta)
				{
					var currentPos = -parseInt($pane.css('top')) || 0;
					scrollTo(currentPos + delta);
				};
				
				initDrag();
				
				scrollTo(-currentScrollPosition, true);
				
				jQuery.jScrollPane.active.push($this[0]);

			} else {
			  if (typeof(this.originalSidePaddingTotal) == "undefined") { this.originalSidePaddingTotal = 0; }
				$this.css(
					{
						'height':paneHeight+'px',
						'width':paneWidth-this.originalSidePaddingTotal+'px',
						'padding':this.originalPadding
					}
				);
				// remove from active list?
			}
		}
	)
};

// clean up the scrollTo expandos
jQuery(window)
	.bind('unload', function() {
		var els = jQuery.jScrollPane.active; 
		for (var i=0; i<els.length; i++) {
			els[i].scrollTo = els[i].scrollBy = null;
		}
	}
);

/* jQuery custom selectboxes
  Copyright (c) 2008 Krzysztof Suszyński (suszynski.org)
  Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
  @version 0.6.1
  @original_author Krzysztof Suszyński <k.suszynski@wit.edu.pl>
  @Modifications Livingston Samuel <livingston@thoughtworks.com>, ThoughtWorks

  NOTE: Any item with value "default" will be shown when any option is not selected and will be gone once any of the option is selected
*/
jQuery.fn.selectbox = function(options) {
	var handleSelected = function(e) {
		var classToAdd = ( settings.selectedAction === "highlight")? "selValue listelementhover" : "selValue hidden";
		var classToRemove = ( settings.selectedAction === "highlight")? "selValue listelementhover" : "selValue listelementhover hidden";

		var currentSelectBox = jQuery("div[rel="+ e.attr("rel") +"]");
		jQuery('.selValue', currentSelectBox ).removeClass('selValue');

		var selectedValue = jQuery('.' + settings.className + '-currentItem', currentSelectBox).attr('rel');

		jQuery('.' + settings.className + '-item', currentSelectBox).each(function(){
			var currentVal = jQuery(this).attr('rel');
			if ( currentVal === selectedValue ) {
				if ( selectedValue === "default" ) {
					jQuery(this).remove();
					return;
				}
				jQuery(this).addClass(classToAdd);
			} else
				jQuery(this).removeClass(classToRemove);
		});
	};

  /* Default settings */
  var settings = {
	className: 'jquery-selectbox',
	animationSpeed: "fast",
	listboxMaxSize: 10,
	replaceInvisible: false,
	fixWidth: false,
	  fixHeight: false,
	  numVisibleElements: 5,
	setfirstval: true,
	selectedAction : "hide" //  'hide' / 'highlight'
  };
  var commonClass = 'jquery-custom-selectboxes-replaced';
  var listOpen = false;
  var showList = function(listObj) {
	var selectbox = listObj.parents('.' + settings.className + '');
	listObj.find("span[rel=default]").remove();
	  listObj.slideDown(settings.animationSpeed, function() { listOpen = true });
	selectbox.addClass('selecthover');
	  if (settings.fixHeight)
		listObj.find(".list_wrapper").jScrollPane({showArrows:false});
	jQuery(document).bind('click', onBlurList);
	return listObj;
  };
  var hideList = function(listObj) {
	listObj.slideUp(settings.animationSpeed, function() {
	  listOpen = false;
	  jQuery(this).parents('.' + settings.className + '').removeClass('selecthover');
	  handleSelected(jQuery(this).parents('.' + settings.className + ''));
	});
	jQuery(document).unbind('click', onBlurList);
	return listObj;
  };
  var onBlurList = function(e) {
	var currentListElements = jQuery('.' + settings.className + '-list:visible').parent().find('*').andSelf();
	if (jQuery.inArray( e.target, currentListElements ) < 0 && listOpen)
	  hideList(jQuery('.' + commonClass + '-list'));
	return false;
  };

  settings = jQuery.extend(settings, options || {}); //Extend default settings

  /* Wrapping all passed elements */
  return this.each(function() {
	var _this = jQuery(this);
	if (_this.filter(':visible').length == 0 && !settings.replaceInvisible)
	  return;
	var replacement = jQuery(
	  '<div class="' + settings.className + ' ' + commonClass + '" rel="' + _this.attr("id") + '">' +
		  '<div class="' + settings.className + '-list ' + commonClass + '-list">' +
		  '<div class="list_wrapper" />' +
		  '<div class="corner bottom"><em></em></div>' +
		'</div>' +
		'<span class="' + settings.className + '-currentItem" />' +
	  '</div>');

		var defaultValue = (settings.setfirstval)? jQuery("option:first", _this).val() : jQuery("option:selected", _this).val();

	_this.val(defaultValue);

	jQuery('option', _this).each(function(k, v) {
	  var v = jQuery(v);
		var itemVal = v.val();
	  if ( itemVal === "" ) return;
	  var set_class = ( defaultValue === itemVal && itemVal !== "default" )? " selValue listelementhover hidden" : "";
	  var option_text = (itemVal === "default")? "" : v.text();
	  var listElement = jQuery(
						  '<span class="' + settings.className + '-item value-' + itemVal + ' item-' + k + set_class + '" rel="' + itemVal + '">' +
							option_text
						  + '</span>');
	  listElement.click(function() {
		var thisListElement = jQuery(this);
		var thisReplacment = thisListElement.parents('.' + settings.className);
		var thisIndex = thisListElement[0].className.split(' ');
		for (var k1 in thisIndex) {
		  if (/^item-[0-9]+$/.test(thisIndex[k1])) {
			thisIndex = parseInt(thisIndex[k1].replace('item-', ''), 10);
			break;
		  }
		}
		var thisValue = thisListElement[0].className.split(' ');
		for (var k2 in thisValue) {
		  if (/^value-.+$/.test(thisValue[k2])) {
			thisValue = thisValue[k2].replace('value-', '');
			break;
		  }
		}
		thisReplacment.find('.' + settings.className + '-currentItem')
							.text(thisListElement.text()).attr("rel",thisValue);
		thisReplacment.find('.' + settings.className + '-item[rel="default"]')
							.text("");
		thisReplacment.find('select')
							.val(thisValue)
							.triggerHandler('change');
		var thisSublist = thisReplacment.find('.' + settings.className + '-list');
		if (thisSublist.filter(":visible").length > 0)
		  hideList(thisSublist);
		else
		  showList(thisSublist);
	  }).bind('mouseenter', function() {
		jQuery('.selValue').removeClass('listelementhover');
		jQuery(this).addClass('listelementhover');
	  }).bind('mouseleave', function() {
		jQuery(this).removeClass('listelementhover');
		jQuery('.selValue').addClass('listelementhover');
	  });
	  jQuery('.' + settings.className + '-list .list_wrapper', replacement).append(listElement);
	  if (v.filter(':selected').length > 0)
		jQuery('.' + settings.className + '-currentItem', replacement).text(v.text()).attr("rel",v.val());
	});

	replacement.find('.' + settings.className + '-currentItem').click(function() {
	  var thisMoreButton = jQuery(this);
	  var currentSelectBox = thisMoreButton.parent();
	  var otherLists = jQuery('.' + settings.className + '-list').not(thisMoreButton.siblings('.' + settings.className + '-list'));
	  hideList(otherLists);
	  var thisList = thisMoreButton.siblings('.' + settings.className + '-list');
	  var thisListPrecise = jQuery('.' + settings.className + '-list', currentSelectBox);
	  if (thisList.filter(":visible").length > 0)
		  hideList(thisListPrecise);
		else
		  showList(thisListPrecise);
	});
	_this.hide().replaceWith(replacement).appendTo(replacement);
	var thisListBox = replacement.find('.' + settings.className + '-list');
	var thisListBoxSize = thisListBox.find('.' + settings.className + '-item').length;
	if (thisListBoxSize > settings.listboxMaxSize)
	  thisListBoxSize = settings.listboxMaxSize;
	if (thisListBoxSize == 0)
	  thisListBoxSize = 1;
	var thisListBoxWidth = Math.round(_this.width() + 15);
	if (jQuery.browser.safari)
	  thisListBoxWidth = thisListBoxWidth + 2;
	replacement.css('width', thisListBoxWidth + 'px');
	var listBoxWidth = (settings.fixWidth)? thisListBoxWidth : Math.round(thisListBoxWidth + 7);
	  if (settings.fixHeight) {
		  thisListBox.find(".list_wrapper").css({
			  height: (settings.numVisibleElements * 21)+ 'px',
			  overflow: 'hidden'
			});
		  thisListBox.css({
			  width: listBoxWidth + 'px'
		  });
	  } else {
		  thisListBox.css({
			  width: listBoxWidth + 'px',
			  height: 'auto',
			  maxHeight: (thisListBoxSize * 10)+ 'em'
			});
	  }
  });
};
jQuery.fn.unselectbox = function() {
  var commonClass = 'jquery-custom-selectboxes-replaced';
  return this.each(function() {
	var selectToRemove = jQuery(this).filter('.' + commonClass);
	selectToRemove.replaceWith(selectToRemove.find('select').show());
  });
};

;(function($) {
	$.fn.setHintText = function(options) {
		var defaults = {
			defaultText: "Enter here..."
		};
    var options = $.extend(defaults, options);
    return this.each(function() {
      var me = $(this);
      var textContent = (me.val().length > 0)? me.val() : options.defaultText;
      me.val(textContent).addClass("setHint");
      if(textContent.length > 0) {
        me.focus(function(){
            if($.trim(me.val()) == textContent) me.val("").removeClass("setHint");
          }).blur(function(){
            if($.trim(me.val()) == "")  me.val(textContent).addClass("setHint");
          });
       }
    });
  }
})(jQuery);


;(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnDoubleNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null,onBuild:null,onChange:null},o||{});return this.each(function(){var running=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var div=$(this),ul=$("ul",div),tLi=$("li",ul),tl=tLi.size(),v=o.visible;var tmpHtml="";if(o.circular){ul.prepend(tLi.slice(tl-v).clone()).append(tLi.slice(0,v).clone());o.start+=v;}var li=$("li",ul),itemLength=li.size(),curr=o.start;div.css("visibility","visible");li.css("overflow","hidden").css("float",o.vertical?"none":"left").children().css("overflow","hidden");ul.css("margin","0").css("padding","0").css("position","relative").css("list-style-type","none").css("z-index","1");div.css("overflow","hidden").css("position","relative").css("z-index","2").css("left","0px");var liSize=o.vertical?height(li):width(li);var ulSize=liSize*itemLength;var divSize=liSize*v;li.css("width",li.width()).css("height",li.height());ul.css(sizeCss,ulSize+"px").css(animCss,-(curr*liSize));div.css(sizeCss,divSize+"px");if(o.onBuild){o.onBuild.call(this,vis());}if(o.btnPrev){$(o.btnPrev).click(function(){if(o.onClick){o.onClick.call(this);}return go(curr-o.scroll);});}if(o.btnNext){$(o.btnNext).click(function(){if(o.onClick){o.onClick.call(this);}return go(curr+o.scroll);});}if(o.btnDoubleNext){$(o.btnDoubleNext).click(function(){o.scroll++;o.speed-=500;go(curr+o.scroll,true);o.scroll--;o.speed+=500;return false;});}if(o.btnGo){$.each(o.btnGo,function(i,val){$(val).click(function(){return go(o.circular?o.visible+i:i);});});}if(o.mouseWheel&&div.mousewheel){div.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll);});}if(o.auto){setInterval(function(){go(curr+o.scroll);},o.auto+o.speed);}function vis(){return li.slice(curr).slice(0,v);}function go(to,isDouble){if(!running){if(o.beforeStart){o.beforeStart.call(this,vis());}if(o.circular){if(to<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*liSize)+"px");curr=to==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll;}else{if(to>=itemLength-v+1){if(isDouble&&o.visible==1){tmpHtml=$(li).eq(v).html();$(li).eq(v).html($(li).eq(li.length-1).html());}ul.css(animCss,-((v)*liSize)+"px");curr=to==itemLength-v+1?v+1:v+o.scroll;}else{curr=to;}}}else{if(to<0||to>itemLength-v){return;}else{curr=to;}}running=true;if(!isDouble){tmpSpeed=o.speed;}else{tmpSpeed=o.speed;}ul.animate(animCss=="left"?{left:-(curr*liSize)}:{top:-(curr*liSize)},tmpSpeed,o.easing,function(){if(isDouble&&tmpHtml!=""){$(li).eq(v).html(tmpHtml);tmpHtml="";}if(o.afterEnd){o.afterEnd.call(this,vis());}if(o.onChange){o.onChange.call(this,curr);}running=false;});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled");}}return false;}});};function css(el,prop){return parseInt($.css(el[0],prop))||0;}function width(el){return el[0].offsetWidth+css(el,"marginLeft")+css(el,"marginRight");}function height(el){return el[0].offsetHeight+css(el,"marginTop")+css(el,"marginBottom");}})(jQuery);

(function(a){a.fn.jPerspectiveCarousel=function(c){var b={mainCarouselDiv:null,secondaryCarouselDiv:null,nextBtnName:null,prevBtnName:null,totalNumHolder:null,currentPositionHolder:null,noBackgroundClass:null,easing:"swing",speed:500,numVisibleInPreview:2,onBuild:null,onShift:null,currentLinkText:null,afterEnd:null,beforeStart:null};var c=a.extend(b,c);return this.each(function(){var h=a(this);var f=a(c.mainCarouselDiv,h);var d=a(c.secondaryCarouselDiv,h);var k=a(c.nextBtnName,h);var i=a(c.prevBtnName,h);var g;if(c.currentLinkText){a(".carousel_see_all a",h).text(c.currentLinkText);}if(c.currentLinkText=="NULL"){a(".carousel_see_all a",h).hide();}var j=a("li",f).length;a(c.totalNumHolder,h).html(j);if(j==2){c.numVisibleInPreview=1;}if(j==1){c.numVisibleInPreview=0;a(k).add(i).hide();a("li",f).addClass(c.noBackgroundClass);k=null;i=null;h.addClass("one_book");}if(j>1){c.numVisibleInPreview=2;a(d).html("<ul>");a("ul",d).append(a("li:not(:first)",f).clone());a("ul",d).append(a("li:first",f).clone());if(j==2){c.numVisibleInPreview=1;a(f).addClass("two_book_main_carousel");}}var l=0;var e=function(m){a("li.book"+m+" .bookCover img",h).each(function(){a(this).attr({src:a(this).attr("rel")}).removeAttr("rel");});};a(f).jCarouselLite({btnNext:k,btnPrev:i,visible:1,speed:c.speed,easing:c.easing,scroll:1,onBuild:function(){if(j>0){for(var m=1;m<=4;m++){e(m);}if(j>4){e(j);}}},onChange:function(m){if(!m||m==0){m=j;}else{if(m>j){m=m-j;}}a(c.currentPositionHolder,h).html(m);if(c.onShift){c.onShift.call(this,m);}g=m;},onClick:function(){if(a(this).hasClass("carousel_next_button")){if(g!=1&&typeof(g)!="undefined"){l=g+3;if((l<=j)){e(l);}}}if(a(this).hasClass("carousel_prev_button")){if(g>5||g==j){l=Math.abs(parseInt(g-1));if((l<=j&&l>0)){e(l);}}}}});if(j>1){a(d).jCarouselLite({btnNext:k,btnPrev:i,visible:c.numVisibleInPreview,speed:c.speed,scroll:1,easing:c.easing});}if(c.onBuild){c.onBuild.call(this);}});};})(jQuery);

/*
Popupwindow plugin for jQuery.
by: Tony Petruzzi
homepage: http://rip747.wordpress.com
plugin download: http://rip747.wordpress.com/2007/03/02/the-return-of-popupwindow-jquery-plugin/
*/
jQuery.fn.popupwindow=function(p){var profiles=p||{};return this.each(function(index){var settings,parameters,mysettings,b,a;mysettings=(jQuery(this).attr("rel")||"").split(",");settings={height:600,width:600,toolbar:0,scrollbars:0,status:0,resizable:1,left:0,top:0,center:0,createnew:1,location:0,menubar:0};if(mysettings.length==1&&mysettings[0].split(":").length==1){a=mysettings[0];if(typeof profiles[a]!="undefined"){settings=jQuery.extend(settings,profiles[a]);}}else{for(var i=0;i<mysettings.length;i++){b=mysettings[i].split(":");if(typeof settings[b[0]]!="undefined"&&b.length==2){settings[b[0]]=b[1];}}}if(settings.center==1){settings.top=(screen.height-(settings.height+110))/2;settings.left=(screen.width-settings.width)/2;}parameters="location="+settings.location+",menubar="+settings.menubar+",height="+settings.height+",width="+settings.width+",toolbar="+settings.toolbar+",scrollbars="+settings.scrollbars+",status="+settings.status+",resizable="+settings.resizable+",left="+settings.left+",screenX="+settings.left+",top="+settings.top+",screenY="+settings.top;jQuery(this).bind("click",function(){var name=settings.createnew?"PopUpWindow"+index:"PopUpWindow";window.open(this.href,name,parameters).focus();return false;});});};

var popup_profiles = {
    print: {
      height:750,
      width:800,
      menubar:1,
      center:1,
      resizable:0,
      status:1
    },

    contact_us: {
      height:700,
      width:660,
      scrollbars:0,
      status:1,
      center:1,
      resizable:0
    }
  };

$(document).ready(function() {
  $(".popup_window").popupwindow(popup_profiles);
});

/* Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
 * Modified by Livingston Samuel, ThoughtWorks */
var tb_pathToImage="/images/loadingAnimation.gif";$(document).ready(function(){tb_init('a.thickbox,area.thickbox,input.thickbox');init_image();});function init_image(){imgLoader=new Image();imgLoader.src=tb_pathToImage;}function handleThickboxOverThickbox(){$("a.thickboxOverThickbox").bind("click",function(){tb_remove();var link=$(this).attr("href");setTimeout(function(){tb_show("",link,false);},500);return false;});};function tb_init(domChunk){$(domChunk).click(function(){var t=this.title||this.name||null;var a=this.href||this.alt;var g=this.rel||false;tb_show(t,a,g);this.blur();return false;});};function tb_show(caption,url,imageGroup){try{if(typeof document.body.style.maxHeight==="undefined"){$("body","html").css({height: "100%",width: "100%"});$("html").css("overflow","hidden");if(document.getElementById("TB_HideSelect")===null){$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");$("#TB_overlay").click(tb_remove);}}else{if(document.getElementById("TB_overlay")===null){$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");$("#TB_overlay").click(tb_remove);}}if(tb_detectMacXFF()){$("#TB_overlay").addClass("TB_overlayMacFFBGHack");}else{$("#TB_overlay").addClass("TB_overlayBG");}if(caption===null){caption="";}$("body").append("<div id='TB_load'><img src='"+imgLoader.src+"'/></div>");$('#TB_load').show();var baseURL;if(url.indexOf("?")!==-1){baseURL=url.substr(0,url.indexOf("?"));}else{baseURL=url;}var urlString=/\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;var urlType=baseURL.toLowerCase().match(urlString);if(urlType=='.jpg'||urlType=='.jpeg'||urlType=='.png'||urlType=='.gif'||urlType=='.bmp'){TB_PrevCaption="";TB_PrevURL="";TB_PrevHTML="";TB_NextCaption="";TB_NextURL="";TB_NextHTML="";TB_imageCount="";TB_FoundURL=false;if(imageGroup){TB_TempArray=$("a[@rel="+imageGroup+"]").get();for(TB_Counter=0;((TB_Counter<TB_TempArray.length)&&(TB_NextHTML===""));TB_Counter++){var urlTypeTemp=TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);if(!(TB_TempArray[TB_Counter].href==url)){if(TB_FoundURL){TB_NextCaption=TB_TempArray[TB_Counter].title;TB_NextURL=TB_TempArray[TB_Counter].href;TB_NextHTML="<span id='TB_next'>  <a href='#'>Next></a></span>";}else{TB_PrevCaption=TB_TempArray[TB_Counter].title;TB_PrevURL=TB_TempArray[TB_Counter].href;TB_PrevHTML="<span id='TB_prev'>  <a href='#'><Prev</a></span>";}}else{TB_FoundURL=true;TB_imageCount="Image "+(TB_Counter+1)+" of "+(TB_TempArray.length);}}}imgPreloader=new Image();imgPreloader.onload=function(){imgPreloader.onload=null;var pagesize=tb_getPageSize();var x=pagesize[0]-150;var y=pagesize[1]-150;var imageWidth=imgPreloader.width;var imageHeight=imgPreloader.height;if(imageWidth>x){imageHeight=imageHeight*(x/imageWidth);imageWidth=x;if(imageHeight>y){imageWidth=imageWidth*(y/imageHeight);imageHeight=y;}}else if(imageHeight>y){imageWidth=imageWidth*(y/imageHeight);imageHeight=y;if(imageWidth>x){imageHeight=imageHeight*(x/imageWidth);imageWidth=x;}}TB_WIDTH=imageWidth+30;TB_HEIGHT=imageHeight+60;$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>"+"<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>"+TB_imageCount+TB_PrevHTML+TB_NextHTML+"</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div>");$("#TB_closeWindowButton").click(tb_remove);if(!(TB_PrevHTML==="")){function goPrev(){if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}$("#TB_window").remove();$("body").append("<div id='TB_window'></div>");tb_show(TB_PrevCaption,TB_PrevURL,imageGroup);return false;}$("#TB_prev").click(goPrev);}if(!(TB_NextHTML==="")){function goNext(){$("#TB_window").remove();$("body").append("<div id='TB_window'></div>");tb_show(TB_NextCaption,TB_NextURL,imageGroup);return false;}$("#TB_next").click(goNext);}document.onkeydown=function(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;}if(keycode==27){tb_remove();}else if(keycode==190){if(!(TB_NextHTML=="")){document.onkeydown="";goNext();}}else if(keycode==188){if(!(TB_PrevHTML=="")){document.onkeydown="";goPrev();}}};tb_position();$("#TB_load").remove();$("#TB_ImageOff").click(tb_remove);$("#TB_window").css({display:"block"});};imgPreloader.src=url;}else{var queryString=url.replace(/^[^\?]+\??/,'');var params=tb_parseQuery(queryString);TB_WIDTH=(params['width']*1)+126||630;TB_HEIGHT=(params['height']*1)+92||440;ajaxContentW=TB_WIDTH-96;ajaxContentH=TB_HEIGHT-92;if(url.indexOf('TB_iframe')!=-1){urlNoQuery=url.split('TB_');$("#TB_iframeContent").remove();if(params['modal']!="true"){$("#TB_window").append("<div class='corners top'><em></em></div><div class='thickbox_wrap_outer'><div class='thickbox_wrap_inner' style='height: 440px'><div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe();' style='width:"+(ajaxContentW)+"px;height:"+(ajaxContentH)+"px;'></iframe></div></div><div class='corners bottom'><em></em></div>");}else{$("#TB_overlay").unbind();$("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW+29)+"px;height:"+(ajaxContentH+17)+"px;'></iframe>");}}else{if($("#TB_window").css("display")!="block"){if(params['modal']!="true"){$("#TB_window").append("<div class='corners top'><em></em></div><div class='thickbox_wrap_outer'><div class='thickbox_wrap_inner'><div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div></div></div><div class='corners bottom'><em></em></div>");}else{$("#TB_overlay").unbind();$("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");}}else{$("#TB_ajaxContent")[0].style.width=ajaxContentW+"px";$("#TB_ajaxContent")[0].style.height=ajaxContentH+"px";$("#TB_ajaxContent")[0].scrollTop=0;$("#TB_ajaxWindowTitle").html(caption);}}$("#TB_closeWindowButton").click(tb_remove);if(url.indexOf('TB_inline')!=-1){$("#TB_ajaxContent").append($('#'+params['inlineId']).children());$("#TB_window").unload(function(){$('#'+params['inlineId']).append($("#TB_ajaxContent").children());});tb_position();$("#TB_load").remove();$("#TB_window").css({display:"block"});}else if(url.indexOf('TB_iframe')!=-1){tb_position();if($.browser.safari){$("#TB_load").remove();$("#TB_window").css({display:"block"});}}else{$("#TB_ajaxContent").load(url+="&random="+(new Date().getTime()),function(){tb_position();$("#TB_load").remove();tb_init("#TB_ajaxContent a.thickbox");$("#TB_window").css({display:"block"});});}}if(!params['modal']){document.onkeyup=function(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;}if(keycode==27){tb_remove();}};}}catch(e){}}function tb_showIframe(){$("#TB_load").remove();$("#TB_window").css({display:"block"});}function tb_remove(){$("#TB_imageOff").unbind("click");$("#TB_closeWindowButton").unbind("click");$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});$("#TB_load").remove();if(typeof document.body.style.maxHeight=="undefined"){$("body","html").css({height: "auto",width: "auto"});$("html").css("overflow","");}document.onkeydown="";document.onkeyup="";return false;}function tb_position(){$("#TB_window").css({marginLeft: '-'+parseInt((TB_WIDTH/2),10)+'px',width: TB_WIDTH+'px'});if(!(jQuery.browser.msie&&jQuery.browser.version<7)){$("#TB_window").css({marginTop: '-'+parseInt((TB_HEIGHT/2),10)+'px'});}}function tb_parseQuery(query){var Params={};if(!query){return Params;}var Pairs=query.split(/[;&]/);for(var i=0;i<Pairs.length;i++){var KeyVal=Pairs[i].split('=');if(!KeyVal||KeyVal.length!=2){continue;}var key=unescape(KeyVal[0]);var val=unescape(KeyVal[1]);val=val.replace(/\+/g,' ');Params[key]=val;}return Params;}function tb_getPageSize(){var de=document.documentElement;var w=window.innerWidth||self.innerWidth||(de&&de.clientWidth)||document.body.clientWidth;var h=window.innerHeight||self.innerHeight||(de&&de.clientHeight)||document.body.clientHeight;arrayPageSize=[w,h];return arrayPageSize;}function tb_detectMacXFF(){var userAgent=navigator.userAgent.toLowerCase();if(userAgent.indexOf('mac')!=-1&&userAgent.indexOf('firefox')!=-1){return true;}}

/* jQuery Form Plugin 2.16 (17-OCT-2008)
 * @requires jQuery v1.2.2 or later
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses - http://www.opensource.org/licenses/mit-license.php, http://www.gnu.org/licenses/gpl.html */
;(function($){$.fn.ajaxSubmit=function(options){if(!this.length){log("ajaxSubmit: skipping submit process - no element selected");return this;}if(typeof options=="function"){options={success:options};}options=$.extend({url:this.attr("action")||window.location.toString(),type:this.attr("method")||"GET"},options||{});var veto={};this.trigger("form-pre-serialize",[this,options,veto]);if(veto.veto){log("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this;}var a=this.formToArray(options.semantic);if(options.data){options.extraData=options.data;for(var n in options.data){if(options.data[n] instanceof Array){for(var k in options.data[n]){a.push({name:n,value:options.data[n][k]});}}else{a.push({name:n,value:options.data[n]});}}}if(options.beforeSubmit&&options.beforeSubmit(a,this,options)===false){log("ajaxSubmit: submit aborted via beforeSubmit callback");return this;}this.trigger("form-submit-validate",[a,this,options,veto]);if(veto.veto){log("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this;}var q=$.param(a);if(options.type.toUpperCase()=="GET"){options.url+=(options.url.indexOf("?")>=0?"&":"?")+q;options.data=null;}else{options.data=q;}var $form=this,callbacks=[];if(options.resetForm){callbacks.push(function(){$form.resetForm();});}if(options.clearForm){callbacks.push(function(){$form.clearForm();});}if(!options.dataType&&options.target){var oldSuccess=options.success||function(){};callbacks.push(function(data){$(options.target).html(data).each(oldSuccess,arguments);});}else{if(options.success){callbacks.push(options.success);}}options.success=function(data,status){for(var i=0,max=callbacks.length;i<max;i++){callbacks[i].apply(options,[data,status,$form]);}};var files=$("input:file",this).fieldValue();var found=false;for(var j=0;j<files.length;j++){if(files[j]){found=true;}}if(options.iframe||found){if($.browser.safari&&options.closeKeepAlive){$.get(options.closeKeepAlive,fileUpload);}else{fileUpload();}}else{$.ajax(options);}this.trigger("form-submit-notify",[this,options]);return this;function fileUpload(){var form=$form[0];if($(":input[@name=submit]",form).length){alert('Error: Form elements must not be named "submit".');return;}var opts=$.extend({},$.ajaxSettings,options);var s=jQuery.extend(true,{},$.extend(true,{},$.ajaxSettings),opts);var id="jqFormIO"+(new Date().getTime());var $io=$('<iframe id="'+id+'" name="'+id+'" />');var io=$io[0];if($.browser.msie||$.browser.opera){io.src='javascript:false;document.write("");';}$io.css({position:"absolute",top:"-1000px",left:"-1000px"});var xhr={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(){this.aborted=1;$io.attr("src","about:blank");}};var g=opts.global;if(g&&!$.active++){$.event.trigger("ajaxStart");}if(g){$.event.trigger("ajaxSend",[xhr,opts]);}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;return;}if(xhr.aborted){return;}var cbInvoked=0;var timedOut=0;var sub=form.clk;if(sub){var n=sub.name;if(n&&!sub.disabled){options.extraData=options.extraData||{};options.extraData[n]=sub.value;if(sub.type=="image"){options.extraData[name+".x"]=form.clk_x;options.extraData[name+".y"]=form.clk_y;}}}setTimeout(function(){var t=$form.attr("target"),a=$form.attr("action");$form.attr({target:id,method:"POST",action:opts.url});if(!options.skipEncodingOverride){$form.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"});}if(opts.timeout){setTimeout(function(){timedOut=true;cb();},opts.timeout);}var extraInputs=[];try{if(options.extraData){for(var n in options.extraData){extraInputs.push($('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />').appendTo(form)[0]);}}$io.appendTo("body");io.attachEvent?io.attachEvent("onload",cb):io.addEventListener("load",cb,false);form.submit();}finally{$form.attr("action",a);t?$form.attr("target",t):$form.removeAttr("target");$(extraInputs).remove();}},10);function cb(){if(cbInvoked++){return;}io.detachEvent?io.detachEvent("onload",cb):io.removeEventListener("load",cb,false);var operaHack=0;var ok=true;try{if(timedOut){throw"timeout";}var data,doc;doc=io.contentWindow?io.contentWindow.document:io.contentDocument?io.contentDocument:io.document;if(doc.body==null&&!operaHack&&$.browser.opera){operaHack=1;cbInvoked--;setTimeout(cb,100);return;}xhr.responseText=doc.body?doc.body.innerHTML:null;xhr.responseXML=doc.XMLDocument?doc.XMLDocument:doc;xhr.getResponseHeader=function(header){var headers={"content-type":opts.dataType};return headers[header];};if(opts.dataType=="json"||opts.dataType=="script"){var ta=doc.getElementsByTagName("textarea")[0];xhr.responseText=ta?ta.value:xhr.responseText;}else{if(opts.dataType=="xml"&&!xhr.responseXML&&xhr.responseText!=null){xhr.responseXML=toXml(xhr.responseText);}}data=$.httpData(xhr,opts.dataType);}catch(e){ok=false;$.handleError(opts,xhr,"error",e);}if(ok){opts.success(data,"success");if(g){$.event.trigger("ajaxSuccess",[xhr,opts]);}}if(g){$.event.trigger("ajaxComplete",[xhr,opts]);}if(g&&!--$.active){$.event.trigger("ajaxStop");}if(opts.complete){opts.complete(xhr,ok?"success":"error");}setTimeout(function(){$io.remove();xhr.responseXML=null;},100);}function toXml(s,doc){if(window.ActiveXObject){doc=new ActiveXObject("Microsoft.XMLDOM");doc.async="false";doc.loadXML(s);}else{doc=(new DOMParser()).parseFromString(s,"text/xml");}return(doc&&doc.documentElement&&doc.documentElement.tagName!="parsererror")?doc:null;}}};$.fn.ajaxForm=function(options){return this.ajaxFormUnbind().bind("submit.form-plugin",function(){$(this).ajaxSubmit(options);return false;}).each(function(){$(":submit,input:image",this).bind("click.form-plugin",function(e){var form=this.form;form.clk=this;if(this.type=="image"){if(e.offsetX!=undefined){form.clk_x=e.offsetX;form.clk_y=e.offsetY;}else{if(typeof $.fn.offset=="function"){var offset=$(this).offset();form.clk_x=e.pageX-offset.left;form.clk_y=e.pageY-offset.top;}else{form.clk_x=e.pageX-this.offsetLeft;form.clk_y=e.pageY-this.offsetTop;}}}setTimeout(function(){form.clk=form.clk_x=form.clk_y=null;},10);});});};$.fn.ajaxFormUnbind=function(){this.unbind("submit.form-plugin");return this.each(function(){$(":submit,input:image",this).unbind("click.form-plugin");});};$.fn.formToArray=function(semantic){var a=[];if(this.length==0){return a;}var form=this[0];var els=semantic?form.getElementsByTagName("*"):form.elements;if(!els){return a;}for(var i=0,max=els.length;i<max;i++){var el=els[i];var n=el.name;if(!n){continue;}if(semantic&&form.clk&&el.type=="image"){if(!el.disabled&&form.clk==el){a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y});}continue;}var v=$.fieldValue(el,true);if(v&&v.constructor==Array){for(var j=0,jmax=v.length;j<jmax;j++){a.push({name:n,value:v[j]});}}else{if(v!==null&&typeof v!="undefined"){a.push({name:n,value:v});}}}if(!semantic&&form.clk){var inputs=form.getElementsByTagName("input");for(var i=0,max=inputs.length;i<max;i++){var input=inputs[i];var n=input.name;if(n&&!input.disabled&&input.type=="image"&&form.clk==input){a.push({name:n+".x",value:form.clk_x},{name:n+".y",value:form.clk_y});}}}return a;};$.fn.formSerialize=function(semantic){return $.param(this.formToArray(semantic));};$.fn.fieldSerialize=function(successful){var a=[];this.each(function(){var n=this.name;if(!n){return;}var v=$.fieldValue(this,successful);if(v&&v.constructor==Array){for(var i=0,max=v.length;i<max;i++){a.push({name:n,value:v[i]});}}else{if(v!==null&&typeof v!="undefined"){a.push({name:this.name,value:v});}}});return $.param(a);};$.fn.fieldValue=function(successful){for(var val=[],i=0,max=this.length;i<max;i++){var el=this[i];var v=$.fieldValue(el,successful);if(v===null||typeof v=="undefined"||(v.constructor==Array&&!v.length)){continue;}v.constructor==Array?$.merge(val,v):val.push(v);}return val;};$.fieldValue=function(el,successful){var n=el.name,t=el.type,tag=el.tagName.toLowerCase();if(typeof successful=="undefined"){successful=true;}if(successful&&(!n||el.disabled||t=="reset"||t=="button"||(t=="checkbox"||t=="radio")&&!el.checked||(t=="submit"||t=="image")&&el.form&&el.form.clk!=el||tag=="select"&&el.selectedIndex==-1)){return null;}if(tag=="select"){var index=el.selectedIndex;if(index<0){return null;}var a=[],ops=el.options;var one=(t=="select-one");var max=(one?index+1:ops.length);for(var i=(one?index:0);i<max;i++){var op=ops[i];if(op.selected){var v=$.browser.msie&&!(op.attributes.value.specified)?op.text:op.value;if(one){return v;}a.push(v);}}return a;}return el.value;};$.fn.clearForm=function(){return this.each(function(){$("input,select,textarea",this).clearFields();});};$.fn.clearFields=$.fn.clearInputs=function(){return this.each(function(){var t=this.type,tag=this.tagName.toLowerCase();if(t=="text"||t=="password"||tag=="textarea"){this.value="";}else{if(t=="checkbox"||t=="radio"){this.checked=false;}else{if(tag=="select"){this.selectedIndex=-1;}}}});};$.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset();}});};$.fn.enable=function(b){if(b==undefined){b=true;}return this.each(function(){this.disabled=!b;});};$.fn.selected=function(select){if(select==undefined){select=true;}return this.each(function(){var t=this.type;if(t=="checkbox"||t=="radio"){this.checked=select;}else{if(this.tagName.toLowerCase()=="option"){var $sel=$(this).parent("select");if(select&&$sel[0]&&$sel[0].type=="select-one"){$sel.find("option").selected(false);}this.selected=select;}}});};function log(){if($.fn.ajaxSubmit.debug&&window.console&&window.console.log){window.console.log("[jquery.form] "+Array.prototype.join.call(arguments,""));}}})(jQuery);

/*
 ### jQuery Star Rating Plugin v2.5 - 2008-09-10 ###
 * http://www.fyneworks.com/ - diego@fyneworks.com
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 ###
 Project: http://plugins.jquery.com/project/MultipleFriendlyStarRating
 Website: http://www.fyneworks.com/jquery/star-rating/
*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';6(13.H)(7($){$.3={q:\'14 15\',I:\'\',h:0,J:16,5:{},8:{x:7(n,a,b,c){4.j(n);$(a).K(\'.r\'+n).L().k(\'17\'+(c||\'M\'));g d=$(a).s(\'a\');9=d.t();6(b.N)b.N.y($.3.5[n].e[0],[9,d[0]])},j:7(n,a,b){$.3.5[n].e.18(\'.r\'+n).z(\'u\').z(\'19\')},m:7(n,a,b){6(!$($.3.5[n].o).1a(\'.q\'))$($.3.5[n].o).K(\'.r\'+n).L().k(\'u\');g c=$(a).s(\'a\');9=c.t();6(b.O)b.O.y($.3.5[n].e[0],[9,c[0]])},p:7(n,a,b){$.3.5[n].o=a;g c=$(a).s(\'a\');9=c.t();$.3.5[n].e.9(9);$.3.8.j(n,a,b);$.3.8.m(n,a,b);6(b.P)b.P.y($.3.5[n].e[0],[9,c[0]])}}};$.Q.3=7(d){6(4.R==0)A 4;d=$.S({},$.3,d||{});4.1b(7(i){g a=$.S({},d||{},($.T?$(4).T():($.1c?$(4).1d():1e))||{});g n=(4.U||\'1f-3\').1g(/\\[|\\]/,"1h");6(!$.3.5[n])$.3.5[n]={B:0};i=$.3.5[n].B;$.3.5[n].B++;$.3.5[n].l=$.3.5[n].l||a.l||$(4).1i(\'C\');6(i==0){$.3.5[n].e=$(\'<V W="1j" U="\'+n+\'" D=""\'+(a.l?\' C="C"\':\'\')+\'/>\');$(4).X($.3.5[n].e);6($.3.5[n].l||a.1k){}Y{$(4).X($(\'<w Z="q"><a E="\'+a.q+\'">\'+a.I+\'</a></w>\').10(7(){$.3.8.j(n,4,a);$(4).k(\'u\')}).11(7(){$.3.8.m(n,4,a);$(4).z(\'u\')}).p(7(){$.3.8.p(n,4,a)}))}};f=$(\'<w Z="12"><a E="\'+(4.E||4.D)+\'">\'+4.D+\'</a></w>\');$(4).1l(f);6(a.1m)a.h=2;6(1n a.h==\'1o\'&&a.h>0){g b=($.Q.F?$(f).F():0)||a.J;g c=(i%a.h),G=1p.1q(b/a.h);$(f).F(G).1r(\'a\').1s({\'1t-1u\':\'-\'+(c*G)+\'1v\'})};$(f).k(\'r\'+n);6($.3.5[n].l)$(f).k(\'1w\');Y $(f).k(\'1x\').10(7(){$.3.8.j(n,4,a);$.3.8.x(n,4,a,\'M\')}).11(7(){$.3.8.j(n,4,a);$.3.8.m(n,4,a)}).p(7(){$.3.8.p(n,4,a)});6(4.1y)$.3.5[n].o=f;$(4).1z();6(i+1==4.R)$.3.8.m(n,4,a)});1A(n 1B $.3.5)(7(c,v,n){6(!c)A;$.3.8.x(n,c,d||{},\'1C\');$(v).9($(c).s(\'a\').t())})($.3.5[n].o,$.3.5[n].e,n);A 4};$(7(){$(\'V[@W=1D].12\').3()})})(H);',62,102,'|||rating|this|groups|if|function|event|val|||||valueElem|eStar|var|split||drain|addClass|readOnly|reset||current|click|cancel|star_group_|children|text|star_on||div|fill|apply|removeClass|return|count|disabled|value|title|width|spw|jQuery|cancelValue|starWidth|prevAll|andSelf|hover|focus|blur|callback|fn|length|extend|metadata|name|input|type|before|else|class|mouseover|mouseout|star|window|Cancel|Rating||star_|siblings|star_hover|is|each|meta|data|null|unnamed|replace|_|attr|hidden|required|after|half|typeof|number|Math|floor|find|css|margin|left|px|star_readonly|star_live|checked|remove|for|in|on|radio'.split('|'),0,{}))

var _jscr_originalSizes=new Array();var _jscr_differenceSizes=new Array();var _jscr_previousWindowSize=new Array();var _jscr_originalPercentages=new Array();var _jscr_intervals=new Array();var _jscr_trackInt=new Array();var _jscr_originalPos=new Array();var _jscr_globalProperties=new Array();jQuery.jScrollHorizontalPane={active:[]};jQuery.fn.jScrollHorizontalPane=function(settings){settings=jQuery.extend({scrollbarHeight:10,scrollbarMargin:5,wheelSpeed:18,showArrows:false,arrowSize:10,animateTo:false,dragMinWidth:1,dragMaxWidth:99999,animateInterval:100,animateStep:3,maintainPosition:true,resize:true,minimumWidth:200,reset:false},settings);return this.each(function(){if(settings.reset==true){jQuery.fn.jScrollHorizontalPane.reset()}var $this=jQuery(this);var mouseWheelNext=0;var mouseWheelMove=false;var currentId=$this.attr("id");if(currentId==undefined){currentId=$this.attr("class")}var previousWindow=_jscr_previousWindowSize[currentId];_jscr_originalPos[currentId]=-1;_jscr_globalProperties[currentId]=settings;_jscr_previousWindowSize[currentId]=$(window).width();if(_jscr_originalSizes[currentId]==undefined){if((jQuery.browser.msie)&&(parseInt(jQuery.browser.version)==6)){var outerWidth=parseInt($this.outerWidth())-parseInt($this.offset().left);_jscr_differenceSizes[currentId]=$this.offset().left/$(window).width()}else{var outerWidth=$this.outerWidth();_jscr_differenceSizes[currentId]=$this.position().left/$(window).width()}percentageWidth=(outerWidth/$(window).width());_jscr_originalPercentages[currentId]=percentageWidth;_jscr_originalSizes[currentId]=$(window).width()}else{percentageWidth=_jscr_originalPercentages[currentId];diff=_jscr_differenceSizes[currentId]-(($this.offset().left+_jscr_originalPos[currentId])/$(window).width());percentageWidth=percentageWidth+diff}var halfIntervals=new Array();_jscr_intervals=new Array();halfIntervals[0]=0;_jscr_intervals[0]=0;margin=$this.position().left;offset=1;if(margin<0){margin=0}$(".scroll-interval",$this).each(function(i,elem){pos=$(elem).position().left-margin;if(pos!=0){_jscr_intervals[i+offset]=pos}else{offset--}});if(_jscr_intervals.length<=1){_jscr_intervals=new Array()}if(jQuery(this).parent().is(".jHScrollPaneContainer")){var currentScrollPosition=settings.maintainPosition?$this.offset({relativeTo:jQuery(this).parent()[0]}).left:0;var $c=jQuery(this).parent();var paneWidth=$c.outerWidth();var paneHeight=$c.innerHeight();var rightPos=$this.offset().left+_jscr_originalPos[currentId]+paneWidth;if((previousWindow!=$(window).width())&&((rightPos>$(window).width())||(previousWindow<$(window).width()))&&(settings.resize==true)){if($(window).width()>=_jscr_originalSizes[currentId]){paneWidth=($(window).width()*percentageWidth)}else{paneWidth=$(window).width()-($this.offset().left+_jscr_originalPos[currentId])-10}if(paneWidth<settings.minimumWidth){paneWidth=settings.minimumWidth}jQuery(this).parent().css({height:paneHeight+"px",width:paneWidth+"px"})}var trackWidth=paneWidth;if($c.unmousewheel){if($.browser.opera){$c.unbind("mousewheel",fn=function(){})}else{$c.unmousewheel()}}jQuery(">.jHScrollPaneTrack, >.jHScrollArrowLeft, >.jHScrollArrowRight",$c).remove();$this.css({left:0});_jscr_originalPos[currentId]=-1}else{var currentScrollPosition=0;this.originalPadding=$this.css("paddingTop")+" "+$this.css("paddingRight")+" "+$this.css("paddingBottom")+" "+$this.css("paddingLeft");this.originalSidePaddingTotal=(parseInt($this.css("paddingLeft"))||0)+(parseInt($this.css("paddingRight"))||0);var paneWidth=$this.outerWidth();var rightPos=$this.offset().left+_jscr_originalPos[currentId]+paneWidth;if((rightPos)>$(window).width()){paneWidth=$(window).width()*percentageWidth}if(paneWidth<settings.minimumWidth){paneWidth=settings.minimumWidth}var paneHeight=$this.innerHeight();var trackWidth=paneWidth;$this.wrap(jQuery("<div></div>").attr({className:"jHScrollPaneContainer"}).css({height:paneHeight+"px",width:paneWidth+"px"}));jQuery(document).bind("emchange",function(e,cur,prev){$this.jScrollHorizontalPane(settings)})}var p=this.originalSidePaddingTotal;if(typeof(p)=="undefined"){p=0}var cssHeight=paneHeight-settings.scrollbarHeight-p;$this.css("height",String(cssHeight)+"px");var contentWidth=$this.outerWidth();if($.browser.msie||$.browser.opera||$.browser.safari){var ieWidth=0;$this.children().each(function(i,elem){if($(elem).outerWidth()>ieWidth){ieWidth=$(elem).outerWidth()}});if(ieWidth>contentWidth){contentWidth=ieWidth}}var percentInView=paneWidth/contentWidth;var trackIntervals=new Array();if(percentInView<0.99){var $container=$this.parent();$container.append(jQuery("<div></div>").attr({className:"jHScrollPaneTrack"}).css({height:settings.scrollbarHeight+"px"}).append(jQuery("<div></div>").attr({className:"jHScrollPaneDrag"}).css({height:settings.scrollbarHeight+"px"}).append(jQuery("<div></div>").attr({className:"jHScrollPaneDragLeft"}).css({height:settings.scrollbarHeight+"px"}),jQuery("<div></div>").attr({className:"jHScrollPaneDragRight"}).css({height:settings.scrollbarHeight+"px"}))));var $track=jQuery(">.jHScrollPaneTrack",$container);for(inter in _jscr_intervals){if(settings.showArrows==true){scrollOffset=settings.arrowSize}else{scrollOffset=0}intervalTrackPos=_jscr_intervals[inter]/contentWidth*$track.width()-(scrollOffset);trackIntervals[inter]=intervalTrackPos;if(trackIntervals[inter-1]!=undefined){halfIntervals[inter-1]=(trackIntervals[inter]+trackIntervals[inter-1])/2}if(inter!=0){interObj=jQuery("<div>|</div>").attr({className:"jHScrollIntervalTrack"}).css({left:intervalTrackPos+"px"});$track.append(interObj)}}var $drag=jQuery(">.jHScrollPaneTrack .jHScrollPaneDrag",$container);if(settings.showArrows){var currentArrowButton;var currentArrowDirection;var currentArrowInterval;var currentArrowInc;var whileArrowButtonDown=function(){if(currentArrowInc>4||currentArrowInc%4==0){positionDrag(dragPosition+currentArrowDirection*mouseWheelMultiplier)}currentArrowInc++};var onArrowMouseUp=function(event){jQuery("body").unbind("mouseup",onArrowMouseUp);currentArrowButton.removeClass("jHScrollActiveArrowButton");clearInterval(currentArrowInterval);arrowUp=true;moveIntervals()};var onArrowMouseDown=function(){jQuery("body").bind("mouseup",onArrowMouseUp);currentArrowButton.addClass("jHScrollActiveArrowButton");currentArrowInc=0;whileArrowButtonDown();currentArrowInterval=setInterval(whileArrowButtonDown,100)};$container.append(jQuery("<a></a>").attr({href:"javascript:;",className:"jHScrollArrowLeft"}).css({width:settings.arrowSize+"px"}).html("Scroll Left").bind("mousedown",function(){currentArrowButton=jQuery(this);currentArrowDirection=-1;onArrowMouseDown();this.blur();return false}),jQuery("<a></a>").attr({href:"javascript:;",className:"jHScrollArrowRight"}).css({width:settings.arrowSize+"px"}).html("Scroll Right").bind("mousedown",function(){currentArrowButton=jQuery(this);currentArrowDirection=1;onArrowMouseDown();this.blur();return false}));if(settings.arrowSize){trackWidth=paneWidth-settings.arrowSize-settings.arrowSize;$track.css({width:trackWidth+"px",left:settings.arrowSize+"px"})}else{var leftArrowWidth=jQuery(">.jHScrollArrowLeft",$container).width();settings.arrowSize=leftArrowWidth;trackWidth=paneWidth-leftArrowWidth-jQuery(">.jHScrollArrowRight",$container).width();$track.css({width:trackWidth+"px",left:leftArrowWidth+"px"})}}var $pane=jQuery(this).css({position:"absolute",overflow:"visible"});var currentOffset;var maxX;var mouseWheelMultiplier;var dragPosition=0;var dragMiddle=percentInView*paneWidth/2;var getPos=function(event,c){var p=c=="X"?"Left":"Bottom";return event["page"+c]||(event["client"+c]+(document.documentElement["scroll"+p]||document.body["scroll"+p]))||0};var ignoreNativeDrag=function(){return false};var currentInterval=0;var direction=1;var arrowUp=false;var intervalMove=false;_jscr_trackInt[currentId]=-1;var initDrag=function(){ceaseAnimation();currentOffset=$drag.offset(false);currentOffset.left-=dragPosition;maxX=trackWidth-$drag[0].offsetWidth;mouseWheelMultiplier=2*settings.wheelSpeed*maxX/contentWidth};var onStartDrag=function(event){initDrag();dragMiddle=getPos(event,"X")-dragPosition-currentOffset.left;jQuery("body").bind("mouseup",onStopDrag).bind("mousemove",updateScroll);if(jQuery.browser.msie){jQuery("body").bind("dragstart",ignoreNativeDrag).bind("selectstart",ignoreNativeDrag)}return false};var onStopDrag=function(){jQuery("body").unbind("mouseup",onStopDrag).unbind("mousemove",updateScroll);dragMiddle=percentInView*paneWidth/2;moveIntervals();if(jQuery.browser.msie){jQuery("body").unbind("dragstart",ignoreNativeDrag).unbind("selectstart",ignoreNativeDrag)}};var positionDrag=function(destX){evaluateIntervals(dragPosition,destX);destX=destX<0?0:(destX>maxX?maxX:destX);dragPosition=destX;$drag.css({left:destX+"px"});var p=destX/maxX;_jscr_originalPos[currentId]=(paneWidth-contentWidth)*p*-1;$pane.css({left:((paneWidth-contentWidth)*p)+"px"});$this.trigger("scroll")};var updateScroll=function(e){positionDrag(getPos(e,"X")-currentOffset.left-dragMiddle)};var evaluateIntervals=function(position,destX){if((intervalMove==false)&&(mouseWheelMove!=true)){_jscr_trackInt[currentId]=-1;halfInter=-1;smallInter=-1;bigInter=-1;endDragPos=destX+$drag.width();fullTrackWidth=$(".jHScrollPaneTrack").width();for(inter in trackIntervals){if((endDragPos>=fullTrackWidth)&&(endDragPos>=trackIntervals[inter])){_jscr_trackInt[currentId]=inter}else{if(destX>=trackIntervals[inter]){smallInter=inter}else{bigInter=inter;break}}}if(_jscr_trackInt[currentId]==-1){smallDistance=destX-trackIntervals[smallInter];largeDistance=trackIntervals[bigInter]-destX;if(smallDistance<=largeDistance){_jscr_trackInt[currentId]=smallInter}else{_jscr_trackInt[currentId]=bigInter}}}else{intervalMove=false}};var moveIntervals=function(){if(_jscr_trackInt[currentId]!=-1){if(arrowUp==true){if((direction==-1)&&(_jscr_trackInt[currentId]!=0)){_jscr_trackInt[currentId]=currentInterval-1}else{if((direction==1)&&(_jscr_trackInt[currentId]!=(_jscr_intervals.length-1))){_jscr_trackInt[currentId]=parseInt(currentInterval)+1}}arrowUp=false}intervalMove=true;positionDrag(trackIntervals[_jscr_trackInt[currentId]]);currentInterval=_jscr_trackInt[currentId]}};var arrowSize=0;if(settings.showArrows==true){arrowSize=settings.arrowSize}var dragH=Math.max(Math.min(percentInView*(paneWidth-arrowSize*2),settings.dragMaxWidth),settings.dragMinWidth);$drag.css({width:dragH+"px"}).bind("mousedown",onStartDrag);var trackScrollInterval;var trackScrollInc;var trackScrollMousePos;var doTrackScroll=function(){if(trackScrollInc>8||trackScrollInc%4==0){positionDrag((dragPosition-((dragPosition-trackScrollMousePos)/2)))}trackScrollInc++};var onStopTrackClick=function(){clearInterval(trackScrollInterval);moveIntervals();jQuery("body").unbind("mouseup",onStopTrackClick).unbind("mousemove",onTrackMouseMove)};var onTrackMouseMove=function(event){trackScrollMousePos=getPos(event,"X")-currentOffset.left-dragMiddle};var onTrackClick=function(event){initDrag();onTrackMouseMove(event);trackScrollInc=0;jQuery("body").bind("mouseup",onStopTrackClick).bind("mousemove",onTrackMouseMove);trackScrollInterval=setInterval(doTrackScroll,100);doTrackScroll()};$track.bind("mousedown",onTrackClick);if($container.mousewheel){$container.mousewheel(function(event,delta){var movePos=-1;if($.browser.opera){delta=event.wheelDelta/120}if(trackIntervals.length>1){mouseWheelMove=true;if(delta<0){_jscr_trackInt[currentId]=parseInt(_jscr_trackInt[currentId])+1;if((_jscr_trackInt[currentId])>=trackIntervals.length-1){_jscr_trackInt[currentId]=trackIntervals.length-1}if((parseInt($drag.width())+parseInt(trackIntervals[_jscr_trackInt[currentId]]))>parseInt($(".jHScrollPaneTrack").width())){movePos=parseInt($(".jHScrollPaneTrack").width())-$drag.width()}}else{_jscr_trackInt[currentId]=parseInt(_jscr_trackInt[currentId])-1;if(_jscr_trackInt[currentId]<0){_jscr_trackInt[currentId]=0}}}initDrag();ceaseAnimation();var d=dragPosition;if(mouseWheelMove==true){if(movePos==-1){positionDrag(trackIntervals[_jscr_trackInt[currentId]])}else{positionDrag(movePos)}}else{positionDrag(dragPosition-delta*mouseWheelMultiplier)}moveIntervals();var dragOccured=d!=dragPosition;mouseWheelMove=false;return !dragOccured},false)}var _animateToPosition;var _animateToInterval;function animateToPosition(){var diff=(_animateToPosition-dragPosition)/settings.animateStep;if((diff>1||diff<-1)&&((dragPosition+diff+$drag.width())<(paneWidth))){positionDrag(dragPosition+diff)}else{positionDrag(_animateToPosition);ceaseAnimation()}}var ceaseAnimation=function(){if(_animateToInterval){clearInterval(_animateToInterval);delete _animateToPosition}};var scrollTo=function(pos,preventAni){if(typeof pos=="string"){$e=jQuery(pos,this);if(!$e.length){return}pos=$e.position().left}ceaseAnimation();var destDragPosition=-pos/(paneWidth-contentWidth)*maxX;if(!preventAni||settings.animateTo){_animateToPosition=destDragPosition;_animateToInterval=setInterval(animateToPosition,settings.animateInterval)}else{positionDrag(destDragPosition)}};$this[0].scrollTo=scrollTo;$this[0].scrollBy=function(delta){var currentPos=-parseInt($pane.css("left"))||0;scrollTo(currentPos+delta)};initDrag();scrollTo(-currentScrollPosition,true);jQuery.jScrollHorizontalPane.active.push($this[0])}else{var scrollTo=function(pos,preventAni){};$this[0].scrollTo=scrollTo;if(typeof(this.originalSidePaddingTotal)!="undefined"){$this.css("height",paneHeight-this.originaPadding+"px")}else{$this.css("height",paneHeight+"px")}$this.css("width",paneWidth+"px");if(typeof(this.originaPadding)!="undefined"){$this.css("padding",this.originaPadding)}}})};jQuery.fn.jScrollHorizontalPane.reset=function(){_jscr_originalSizes=new Array();_jscr_differenceSizes=new Array();_jscr_previousWindowSize=new Array();_jscr_originalPercentages=new Array();_jscr_intervals=new Array();_jscr_trackInt=new Array();_jscr_originalPos=new Array();_jscr_globalProperties=new Array()};jQuery(window).bind("unload",function(){var els=jQuery.jScrollHorizontalPane.active;for(var i=0;i<els.length;i++){els[i].scrollTo=els[i].scrollBy=null}});(function($){jQuery(function($){$(window).wresize(resizeScroller);function resizeScroller(){$(".scroll-pane").each(function(i,elem){if($(elem).attr("id")==undefined){id=$(elem).attr("class")}else{id=$(elem).attr("id")}$(elem).jScrollHorizontalPane(_jscr_globalProperties[$(elem).attr("id")])})}});$.fn.wresize=function(f){version="1.1";wresize={fired:false,width:0};function resizeOnce(){if($.browser.msie){if(!wresize.fired){wresize.fired=true}else{var version=parseInt($.browser.version,10);wresize.fired=false;if(version<7){return false}else{if(version==7){var width=$(window).width();if(width!=wresize.width){wresize.width=width;return false}}}}}return true}function handleWResize(e){if(resizeOnce()){return f.apply(this,[e])}}this.each(function(){if(this==window){$(this).resize(handleWResize)}else{$(this).resize(f)}});return this}})(jQuery);

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){17.2m.27=6(b){4 c=b.2g||1j.22;5(!c&&b.J==Y)x F;j.A=$.2a({E:"E",1h:\'21\',1b:1T},b);5(b.C)j.C.1O(b.C);4 q=b.J!=Y?b.J.K().X(/[\\s,\\+\\.]+/):j.V(c,j.C);5(q&&q.1y("")){j.1v(q);x F.G(6(){4 a=F;5(a==1j)a=$("P")[0];j.1n(a,q)})}1l x F};4 j={A:{},m:[],C:[[/^9:\\/\\/(k\\.)?23\\./i,/q=([^&]+)/i],[/^9:\\/\\/(k\\.)?B\\.1X\\./i,/p=([^&]+)/i],[/^9:\\/\\/(k\\.)?B\\.1S\\./i,/q=([^&]+)/i],[/^9:\\/\\/(k\\.)?B\\.1R\\./i,/1Q=([^&]+)/i],[/^9:\\/\\/(k\\.)?B\\.1P\\./i,/1N=([^&]+)/i],[/^9:\\/\\/(k\\.)?1M\\.Z/i,/q=([^&]+)/i],[/^9:\\/\\/(k\\.)?1L\\./i,/q=([^&]+)/i],[/^9:\\/\\/(k\\.)?1K\\./i,/q=([^&]+)/i],[/^9:\\/\\/(k\\.)?B\\.1H\\./i,/q=([^&]+)/i],[/^9:\\/\\/(k\\.)?1G\\./i,/q=([^&]+)/i],[/^9:\\/\\/(k\\.)?1F\\.Z/i,/([^\\?\\/]+)(?:\\?.*)$/i]],N:{},V:6(b,c){b=1D(b);4 d=1A;$.G(c,6(i,n){5(n[0].1w(b)){4 a=b.v(n[1]);5(a){d=a[1].K();x 2k}}});5(d){d=d.Q(/(\\\'|")/,\'\\$1\');d=d.X(/[\\s,\\+\\.]+/)}x d},H:[[/[\\1r-\\1q\\1s-\\2c]/7,\'a\'],[/[\\1o\\29-\\1m]/7,\'c\'],[/[\\28-\\26]/7,\'e\'],[/[\\25-\\1i]/7,\'i\'],[/\\1g/7,\'n\'],[/[\\24-\\1f\\1t]/7,\'o\'],[/[\\1e-\\20]/7,\'s\'],[/[\\1Y-\\1c]/7,\'t\'],[/[\\1U-\\1a]/7,\'u\'],[/\\19/7,\'y\'],[/[\\16\\15\\14\\13]/7,\'\\\'\']],L:/[\\16\\15\\1r-\\1q\\1o-\\1i\\1g-\\1f\\1t-\\1a\\19\\1s-\\1m\\1e-\\1c\\14\\13]/7,M:6(q){j.L.11=0;5(j.L.1w(q)){12(4 i=0,l=j.H.z;i<l;i++)q=q.Q(j.H[i][0],j.H[i][1])}x q},10:/((?:\\\\{2})*)([[\\]{}*?|])/g,1v:6(a){4 b=[],m;$.G(a,6(i,n){5(n=j.M(n).Q(j.10,"$1\\\\$2"))b.1J(n)});m=b.1y("|");1I(j.A.E){18"E":m=\'\\\\b(?:\'+m+\')\\\\b\';1z;18"1k":m=\'\\\\b\\\\w*(\'+m+\')\\\\w*\\\\b\';1z}j.m=1V 1W(m,"1E");$.G(b,6(i,n){j.N[n]=j.A.1h+(j.A.1b?i+1:\'\')})},W:/s(?:1C|1Z)|1B/i,1n:6(a,b){4 c=j.A,D,U;D=c.1d?$(c.1d):$("P");5(!D.z)D=$("P");U=c.1x?$(c.1x):$([]);D.G(6(){j.T(F,b,U)})},T:6(a,b,c){5(c.r(a)!=-1)x;4 d=j.A.E=="1k"?1:0;12(4 e=0,S=a.R.z;e<S;e++){4 f=a.R[e];5(f.O!=8){5(f.O==3){4 g=f.2j,1u=j.M(g);4 h="",v,r=0;j.m.11=0;2i(v=j.m.2h(1u)){h+=g.1p(r,v.r-r)+\'<I 2f="\'+j.N[v[d].K()]+\'">\'+g.1p(v.r,v[0].z)+"</I>";r=v.r+v[0].z}5(h){h+=g.2e(r);4 i=$.2d([],$("<I>"+h+"</I>")[0].R);S+=i.z-1;e+=i.z-1;$(f).2l(i).2b()}}1l{5(f.O==1&&f.2n.B(j.W)==-1)j.T(f,b,c)}}}}}})(17)',62,148,'||||var|if|function|ig||http|||||||||||www||regex|||||index||||match||return||length|options|search|engines|elHighlight|exact|this|each|regexAccent|span|keys|toLowerCase|matchAccent|replaceAccent|subs|nodeType|body|replace|childNodes|endIndex|hiliteTree|noHighlight|decodeURL|nosearch|split|undefined|com|escapeRegEx|lastIndex|for|u2019|u2018|x92|x91|jQuery|case|xFF|xDC|style_name_suffix|u0167|highlight|u015A|xD6|xD1|style_name|xCF|document|whole|else|u010D|hiliteElement|xC7|substr|xC5|xC0|u0100|xD8|textNoAcc|buildReplaceTools|test|nohighlight|join|break|null|textarea|cript|decodeURIComponent|gi|technorati|alltheweb|lycos|switch|push|feedster|altavista|ask|userQuery|unshift|aol|query|live|msn|true|xD9|new|RegExp|yahoo|u0162|tyle|u0161|hilite|referrer|google|xD2|xCC|xCB|SearchHighlight|xC8|u0106|extend|remove|u0105|merge|substring|class|debug_referrer|exec|while|data|false|before|fn|nodeName'.split('|'),0,{}))


Dimensions = {
  maxWidth : ($(window).width()- 20),
  defaultHeight : 750,
  defaultWidth: 495,
  defaultButtonLocation : 350,
  smallHeight : 500,
  smallWidth  : 330,
  widthOffset : 39,
  heightOffset : 17,
  scrollOffset : 27,
  blackLine : 2
};

Direction = {
  next : "next",
  previous : "prev",
  none : "page"
};

Watermarks = {
  offset        : 12,
  widthForLogo  : 275
};

Colors = {
  white           : "#ffffff",
  lightGrey       : "#efefef",
  darkGrey        : "#a9a9a9"
};

Controls = {
  single_page           : { view : "#single_page_view", disabled : "#single_page_disabled", selected : "#single_page_selected" },
  double_page           : { view : "#double_page_view", disabled : "#double_page_disabled", selected : "#double_page_selected" },
  zoom                  : { state : "#zoom_state", out : "#zoom_out", disabled : "#zoom_disabled" }, // in is a reserved word
  nextPage              : { barButton : "#next_page", barHover : "#next_page_hover", pageButton : "#page_next", pageHover : "#page_next_hover", disabled : "#next_page_disabled" },
  previousPage          : { barButton : "#previous_page", barHover : "#previous_page_hover", pageButton : "#page_previous", pageHover : "#page_previous_hover", disabled : "#previous_page_disabled" },
  onPageButtonsDistance : 0.28, // Percentage from top of the page
  skipPage              : { field : "#skip_to_page_field", max : "#max_pages" }
};

BookReader = {
  container       : "#reader_container",
  reader          : "#reader",
  box             : "#reader_box",
  previous_button : "#page_previous",
  next_button     : "#page_next"
};

Prefix = {
  search : "S",
  tableOfContents : "T",
  none : null
};

Term = {
  none : null
};

Side = {
  left : "left",
  right : "right",
  none : null
};

blank_image = "/images/1px.gif";

LeftPage = {
  container       : "#left_page",
  cover           : "#left_page_cover",
  image           : "#left_page_display",
  watermark       : "#left_watermark",
  watermarkLogo   : "#left_watermark_logo",
  loading         : "#left_page_loading",
  loadingImage    : "#left_page_loader",
  blank           : "#left_page_blank",
  unviewable      : "#left_page_not_viewable"
};

RightPage = {
  container       : "#right_page",
  cover           : "#right_page_cover",
  image           : "#right_page_display",
  watermark       : "#right_watermark",
  watermarkLogo   : "#right_watermark_logo",
  loading         : "#right_page_loading",
  loadingImage    : "#right_page_loader",
  blank           : "#right_page_blank",
  unviewable      : "#right_page_not_viewable"
};


function PageView(initialState) {
  this.state = initialState;
  this.previousState = initialState;
  $(Controls.single_page.view).click(function() { return reader.pageView.toggle("single"); });
  $(Controls.double_page.view).click(function() { return reader.pageView.toggle("double"); });
  
  this.isSingle = function() { return this.state == "single"; };
  this.isDouble = function() { return this.state == "double"; };
  
  this.singleView = function() {
    if (reader.pages.right !== null) {
      reader.pages.right.hide();
    }
    reader.zoom.fullSize();
    $(Controls.double_page.selected).fadeOut();
    $(Controls.single_page.selected).fadeIn();
    
  };
  
  this.doubleView = function() {
    Search.hide();
    $(Controls.double_page.disabled).fadeOut();
    if (reader.pages.right === null) {
      // TODO: possible bug with prefix.none what if you are in a toc?
      reader.pages.loadRight(reader.pages.left.page_sequence, Direction.next, Prefix.none);
    } else {
      reader.pages.right.show();
    }
    reader.zoom.out();
    $(Controls.single_page.selected).fadeOut();
    $(Controls.double_page.selected).fadeIn();
  };
  
  this.toggle = function(viewState) { 
    if(jsonCache.prefetching) { return false;}
    if (this.state == viewState) { return false; }
    if (Search.isOpen() && viewState == "double") { return false; }
    if (reader.pages.right !== null && reader.pages.right.page_sequence > maxPages) {
      $(Controls.double_page.disabled).fadeIn();
    }
    this.previousState = this.state;
    this.state = viewState;
    if (this.isSingle()) {
      this.singleView();
    } else {
      this.doubleView();
    }
    return false;
  };
}


function Pages() {
  this.left = null;
  this.right = null;
  this.loadingLeft = false;
  
  $(LeftPage.image).load(function() { reader.pages.left.show(); });
  $(RightPage.image).load(function() { reader.pages.right.show(); });
  
  this.both = function() { return [this.left, this.right]; };
  
  this.all = function() {
    var pages = [];
    if (this.left !== null) { pages[0] = this.left; }
    if (this.right !== null) { pages[1] = this.right; }
    return pages;
  };
  
  this.startState = function() {
    this.left = new Page(0, null, Side.left, Direction.none, null);
    this.left.loadingPage.show();
    this.right = new Page(0, null, Side.right, Direction.none, null);
    if (reader.pageView.isDouble()) {
      this.right.loadingPage.show();
    }
  };
  
  this.loadPageNumber = function(number) {
    jsonCache.corrupted = true;
    var pageNumber = Number( number );
    var index = $.inArray(pageNumber, pageNumbers);
    var pageSequence = pageSequences[index];
    this.loadPage(pageSequence);
    return false;
  }
  
  this.loadPage = function(sequence) {
    this.loadLeft(sequence, Direction.none, Term.none, Prefix.none);
  };
  
  this.loadTableOfContents = function(sequence) {
    jsonCache.corrupted = true;
    this.loadLeft(sequence, Direction.none, Term.none, Prefix.tableOfContents);
  };
  
  this.loadSearch = function(sequence, term) {
    reader.pageView.toggle("single");
    this.loadLeft(sequence, Direction.none, term, Prefix.search);
    if (reader.pageView.isDouble()) {
      this.unloadRight();
      reader.pageView.toggle("single");
    }
  };
  
  this.load = function(direction) {
    debugLog("Pages.load("+ direction+")");
    if (direction == Direction.none) {
      this.loadLeft(startSequence, Direction.none, Prefix.none);
    } else {
      if (reader.pageView.isDouble()) {
        if (direction == Direction.next) {
          this.loadLeft(this.right.page_sequence, direction, Prefix.none);
        } else {
          this.loadRight(this.left.page_sequence, direction, Prefix.none);
        }
      } else {
        this.loadLeft(this.left.page_sequence, direction, Prefix.none);
      }
    }
    return false;
  };
  
  this.loadLeft = function(sequence, direction, term, sequencePrefix) {
    if (this.invalidSequence(sequence) || (jsonCache.prefetching)) { return false; }
    this.left = new Page(sequence, term, Side.left, direction, sequencePrefix);
    this.left.fetch();
    
    this.adjustControls(Side.left, sequence);
    if (sharethis !== null) { sharethis.updateLink(this.left.page_number); }
  };
  
  this.loadRight = function(sequence, direction, term, sequencePrefix) {
    if (this.invalidSequence(sequence) || (jsonCache.prefetching && jsonCache.eagerFrontlock)) { return false; }
    
    if (reader.pageView.isDouble()) {
      if (sequence > maxPages || (sequence == maxPages && direction == Direction.next)) {
        this.unloadRight();
        reader.pageView.toggle("single");
      } else {
        this.right = new Page(sequence, term, Side.right, direction, sequencePrefix);
        this.right.fetch();
      }
    } else {
      if (this.right !== null) {
        this.unloadRight();
      }
    }
    this.adjustControls(Side.right, sequence);
  };
  
  this.invalidSequence = function(sequence) {
    return (sequence < firstSequence || sequence > maxPages);
  };
  
  this.unloadRight = function() {
    this.right.hide();
    this.right = null;
  };
  
  this.adjustControls = function(side, sequence) {
    if (side == Side.left) {
      if (sequence >= maxPages) {
        $(Controls.double_page.disabled).fadeIn();
        PageControls.onLastPage();
      } else {
        $(Controls.double_page.disabled).fadeOut();
        PageControls.normalNext();
      }
      if (sequence <= firstSequence) {
        PageControls.onFirstPage();
      } else {
        PageControls.normalPrevious();
      }
      
      var index = $.inArray(sequence, tocSequences);
      if (index != -1 && sequence != startSequence) {
        $("#table_of_contents_selector").html("<div id='selected_toc'>" + tocNames[index] + "</div>");
        tracker.tocChanged(tocNames[index]);
      } else {
        // Update the ToC to the closest match (rounding down)
        if (sequence != startSequence) {
          var closestTocSequence = -1;
          var lastToC = -1;
          $.each(tocSequences, function() {
            if (closestTocSequence != -1) { return false; }
            if (this <= reader.pages.left.page_sequence) {
              lastToC = this;
            } else {
              closestTocSequence = lastToC;
            }
          });
          var index = $.inArray(Number(closestTocSequence), tocSequences);
          if (index != -1) {
            $("#table_of_contents_selector").html("<div id='selected_toc'>" + tocNames[index] + "</div>");
          }
        }
      }
    } else {
      if (reader.pages.right !== null && sequence >= maxPages) {
        PageControls.onLastPage();
      } else {
        PageControls.normalNext();
      }
    }
  };
  
  this.previous = function() { reader.pageView.previousState = reader.pageView.state; return this.load(Direction.previous); };
  this.next = function() { reader.pageView.previousState = reader.pageView.state; return this.load(Direction.next); };
}


function Zoom(initialState) {
  this.state = initialState;
  $(Controls.zoom.state).click(function() { reader.zoom.toggle(null); });
  
  this.isDisabled = function(zoomState) {
    var pageIsNarrowerThanBrowser = $(BookReader.container).width() < $(document).width();
    if (pageIsNarrowerThanBrowser && reader.pageView.isSingle() ) {
      return true;
    } else {
      return false;
    }
  };
  
  this.isIn = function() { return this.state == "in"; };
  this.isOut = function() { return this.state == "out"; };
  this.fullSize = function() { this.toggle("in"); }; // "in" is a reserved word
  this.out = function() { this.toggle("out"); };
  
  this.toggle = function(zoomState) {
    if (this.isDisabled() && zoomState === null) { return false; }
    
    if (zoomState === null) {
       this.state = (this.isOut() ? "in" : "out");
    } else {
       this.state = zoomState;
    }
    
    $.each(reader.pages.all(), function() { this.adjustToSize(); });
    
    if (this.isDisabled()) {
      $(Controls.zoom.out).fadeOut();
      $(Controls.zoom.disabled).fadeIn();
    } else {
      $(Controls.zoom.disabled).fadeOut();
      if (this.isIn()) {
        $(Controls.zoom.out).fadeIn();
      } else {
        $(Controls.zoom.out).fadeOut();
      }
    }
  };
}


function PageImage(page, url, width, height) {
  this.originalWidth = width;
  this.originalHeight = height;
  
  this.currentHeight = function() {
    return (page.largeDisplay() ? Dimensions.defaultHeight : Dimensions.smallHeight);
  };
  
  this.currentWidth = function() {
    if (page.largeDisplay()) {
      return Math.round((Dimensions.defaultHeight * this.originalWidth) / this.originalHeight);
    } else {
      return Math.round((this.originalWidth / this.originalHeight) * Dimensions.smallHeight);
    }
  };
  
  this.adjustButtons = function() {
    var location = Math.round(this.currentHeight() * Controls.onPageButtonsDistance);
    $.each([BookReader.previous_button, BookReader.next_button], function() { $(this).css("top", location + "px"); });
  };
  
  this.adjustImage = function(width, height) {
    $(page.elements.image).attr("src", url);
    $(page.elements.image).css("width", width + "px");
    $(page.elements.image).css("height", height + "px");
  };
  
  this.adjustReader = function(width, height) {
    var otherSideWidth = 0;
    $.each([BookReader.container, BookReader.box], function() { $(this).css("height", height + "px"); });
    $(BookReader.box).css("height", height + Dimensions.heightOffset + "px");

    if (reader.pageView.isDouble()) {
      otherSideWidth = $(page.otherPage().elements.container).width();
    }
    reader.setLeftMargin( ($(document).width() - width - otherSideWidth - Dimensions.blackLine) / 2 );
    reader.setWidth( width - Dimensions.blackLine, otherSideWidth - Dimensions.blackLine );
  };
  
  this.adjustPage = function(width, height) {
    $(page.elements.container).css("width", width - Dimensions.blackLine + "px");
    $(page.elements.container).css("height", height + "px");
    $(page.elements.cover).css("width", width - Dimensions.blackLine + "px");
  };
  
  this.adjustToSize = function() {
    var width = this.currentWidth();
    var height = this.currentHeight();
    
    this.adjustImage(width, height);
    this.adjustReader(width, height);
    this.adjustButtons();
    this.adjustPage(width, height);
  };
  
  this.show = function() {
    page.loadingPage.hide();
    $(page.elements.image).show();
    $(BookReader.reader).css("background-color", Colors.lightGrey);
  };
  
  this.adjustToSize();
}

function PageWatermark(page) {
  
  this.show = function() {
    $(page.elements.watermark).css("width", page.currentWidth() + "px");
    $(page.elements.watermark).css("top", page.currentHeight() - Watermarks.offset + "px");
    if (page.currentWidth() < Watermarks.widthForLogo) {
      $(page.elements.watermarkLogo).hide();
    } else {
      $(page.elements.watermarkLogo).show();
    }
    $(page.elements.watermark).show();
  };
  
  this.hide = function() { $(page.elements.watermark).hide(); };
}

function LoadingPage(page) {
  
  this.show = function() {
    this.clearImage();
    page.blankPage.hide();
    page.unviewablePage.hide();
    page.watermark.hide();
    this.adjustReader();
    $(page.elements.loading).show();
    $(page.elements.container).show();
  };
  
  this.clearImage = function() {
    $(page.elements.image).hide();
    $(page.elements.image).attr("src", blank_image);
    $(page.elements.image).css({"width": "auto", "height": "auto"});
  };
  
  this.adjustReader = function() {
    $(page.elements.container).css("background-color", Colors.white);
    $(BookReader.box).css("height", page.currentHeight() + Dimensions.heightOffset + "px");
  };
  
  this.hide = function() { $(page.elements.loading).hide(); };
}

function NonImagePage(page) {
  
  this.show = function(color) {
    var width = page.currentWidth();
    page.loadingPage.hide();
    $(page.elements.image).hide();
    $(page.elements.image).attr("width", width);
    page.watermark.hide();
    
    $(page.elements.container).css("background-color", color);
    this.adjustReader();
    $(page.elements.cover).css("width", width + "px");
    $(page.elements.container).css("width", width + "px");
    
  };
  
  this.adjustReader = function() {
    var width = page.currentWidth();
    
    if (reader.pageView.isDouble()) {
      otherSideWidth = $(page.otherPage().elements.container).width();
      
      reader.setLeftMargin( ($(document).width() - width - otherSideWidth) / 2 );
      reader.setWidth( width, otherSideWidth);
    } else {
      reader.setLeftMargin( ($(document).width() - width) / 2 );
      reader.setWidth( width, 0 );
    }
  };
}

function BlankPage(page) {
  
  this.show = function() {
    nonImagePage = new NonImagePage(page);
    nonImagePage.show(Colors.white);
    $(page.elements.blank).show();
  };
  
  this.hide = function() { $(page.elements.blank).hide(); };
}

function UnviewablePage(page) {
  
  this.show = function() {
    nonImagePage = new NonImagePage(page);
    nonImagePage.show(Colors.darkGrey);
    $(page.elements.unviewable).show();
  };
  
  this.hide = function() { $(page.elements.unviewable).hide(); };
}


function Comments() {
  
  this.initializeReviewers = function() {
    this.login = new ReviewerLogin();
    this.register = new ReviewerRegister();
    this.submit = new ReviewerSubmit();
  };
  
  this.restoreField = function(element) {
    $(element).html("Required");
    $(element).css("color", "#dedede");
  };
  
  this.setError = function(element, message) {
    $(element).html(message);
    $(element).css("color", "#f00");
  };
  
  this.hasReviews = function() {
    // $("BVSummaryReadReviewsLink").attr("onclick");
    $("#customers_recommended").html($(".BVRatingSummaryBuyAgain").html());
    $("#customer_rating").html($(".BVcustomerRating").html());
    $("#customer_score").html($(".BVcustomerRatingScore").html());
    $("#read_all_reviews").click(function() { if(typeof window.readAllReviewsBV == 'function') { readAllReviewsBV(); return false; }});
    
    $("#has_comments").show();
    $('.review_scrollable').jScrollPane({scrollbarWidth:9,prefix:"review"});
    
    $('#comments_carousel .carousel').jCarouselLite({
      btnNext: '#next_comment .button',
      btnPrev: '#prev_comment .button',
      visible: this.visible,
      speed: 125,
      scroll: 3,
      circular: true,
      easing: 'swing'
    });
    
    if (this.total > 3) {
      $('#next_comment .button').show();
      $('#prev_comment .button').show();
    }
  };
  
  this.hasNoReviews = function() {
    $("#customer_rating").html($(".BVWriteFirstImageCell #BVSubmissionURL").html());
    $("#BVSubmissionURL").css("display", "inline");
    $("#BVCustomerRatings").mouseover(function() {
      $(".BVWriteFirstLink").attr("href", writeAReviewURL);
      $(".BVWriteFirstLink").addClass("write_a_review");
    });
    $("#existing_comments").hide();
    $("#comment_score_and_ratings").hide();
  }
  
  this.total = $('#comments_carousel .carousel ul li').length;
  if (this.total > 3) {
    this.visible = 3;
  } else {
    this.visible = this.total;
  }
  
  if (this.total > 0) {
    this.hasReviews();
  } else {
    this.hasNoReviews();
  }
  
  $("#next_comment .button").click(function() {
    $('.review_scrollable').jScrollPane({scrollbarWidth:9,prefix:"review"});
  });
  
  $("#prev_comment .button").click(function() {
    $('.review_scrollable').jScrollPane({scrollbarWidth:9,prefix:"review"});
  });
  
  $("#BVSubmissionURL").attr("href", writeAReviewURL);
  tb_init('.write_a_review');
  tb_init("#BVSubmissionURL");
  tb_init('.BVWriteFirstLink');
}

$.postJSON = function(url, data, callback) { $.post(url, data, callback, "json"); };

function ReviewerLogin() {
  this.url = reviewerLoginURL;
  
  this.clearErrors = function() {
    $("#login_error").html("");
    comments.restoreField("#login_email_error");
    comments.restoreField("#login_password_error");
  };
  
  this.parseResponse = function(data) {
    if (data.message) {
      $("#login_error").html(data.message);
    } else {
      comments.submit.show();
    }
  };
  
  this.validate = function() {
    var valid = true;
    if ($("#login_email").val() === "") {
      comments.setError("#login_email_error", "Please enter a valid email address");
      valid = false;
    }
    if ($("#login_password").val() === "") {
      comments.setError("#login_password_error", "Please enter a password");
      valid = false;
    }
    return valid;
  };
  
  this.formSubmit = function() {
    comments.login.clearErrors();
    comments.register.clearErrors();
    if (comments.login.validate()) {
      var opts = { authenticity_token: $("#login_token").val(),
                   email_id: $("#login_email").val(),
                   password: $("#login_password").val()
                 };
      var obj = this;
      $.postJSON(obj.url, opts, function(data) {
        obj.parseResponse(data);
      });
    }
    return false;
  }
  
  $("#login_form").submit(function() {
    try {
      comments.login.formSubmit();
    } catch(e) {
      debugLog(e);
    }
    return false;
  });
}

function ReviewerRegister() {
  this.url = reviewerRegisterURL;
  
  this.clearErrors = function() {
    comments.restoreField("#email_id_error");
    comments.restoreField("#password_error");
    comments.restoreField("#password_confirmation_error");
  };
  
  this.parseResponse = function(data) {
    if (data.errors) {
      $.each(data.errors, function() {
        var attribute = this[0];
        var message = this[1];
        var element = $("#" + attribute + "_error");
        if (element.html() == "Required") {
          element.css("color", "#f00");
          element.html(message);
        }
      });
    } else {
      comments.submit.show();
    }
  };
  
  this.formSubmit = function() {
    comments.register.clearErrors();
    comments.login.clearErrors();
    var opts = { authenticity_token: $("#register_token").val(),
                 email_id: $("#register_email").val(),
                 password: $("#register_password").val(),
                 password_confirmation: $("#password_confirmation").val(),
                 age_confirmation: $("#age_confirmation").val()
               };
    var obj = this;
    $.postJSON(obj.url, opts, function(data) {
      obj.parseResponse(data);
    });
    return false
  }
  
  $("#register_form").submit(function() {
    try {
      comments.register.formSubmit();
    } catch(e) {
      debugLog(e);
    }
    return false;
  });
}

function ReviewerSubmit() {
  this.url = reviewerSubmissionURL;
  
  this.clearErrors = function() {
    $("#duplicate_error").html("");
    comments.restoreField("#nickname_error");
    comments.restoreField("#rating_error");
    comments.restoreField("#title_error");
    comments.restoreField("#recommended_error");
    comments.restoreField("#body_error");
  };
  
  this.validate = function(would_recommend) {
    this.clearErrors();
    var valid = true;
    if ($("#nickname").val().length < 4) {
      comments.setError("#nickname_error", "Please enter a longer nickname");
      valid = false;
    }
    if ($("#nickname").val().length > 25) {
      comments.setError("#nickname_error", "Please enter a shorter nickname");
      valid = false;
    }
    if ($("#nickname").val() === "") {
      comments.setError("#nickname_error", "Please enter a nickname");
      valid = false;
    }
    
    if ($("#title").val() === "") {
      comments.setError("#title_error", "Please enter a title");
      valid = false;
    }
    if ($("#title").val().length > 50) {
      comments.setError("#title_error", "Please enter title less than 50 characters.");
      valid = false;
    }
    
    if ($("#body").val().length < 50) {
      comments.setError("#body_error", "Please make your review at least 50 characters");
      valid = false;
    }
    if ($("#body").val().length > 10000) {
      comments.setError("#body_error", "Please make your review shorter");
      valid = false;
    }
    if ($("#body").val() === "") {
      comments.setError("#body_error", "Please enter your review");
      valid = false;
    }
    if ($(".star_on").length === 0) {
      comments.setError("#rating_error", "Please choose a star rating");
      valid = false;
    }
    if (would_recommend === "") {
      comments.setError("#recommended_error", "Please choose a recommendation");
      valid = false;
    }
    return valid;
  };
  
  this.parseResponse = function(data) {
    if (data.submitted) {
      // Successfully submitted review
      tb_remove();
    } else if (data.errors) {
      this.clearErrors();
      $.each(data.errors, function() {
        var attribute = this[0];
        var message = this[1];
        var element = $("#" + attribute + "_error");
        if (element.html() == "Required" || attribute == "duplicate") {
          comments.setError("#" + attribute + "_error", message);
        }
      });
    } else {
      // Fatal Error
      comments.setError("#duplicate_error", "Sorry, there was a problem submitting your review. Please try again later.");
    }
  };
  
  this.show = function() {
    $("#login_or_register_container").hide();
    $("#TB_ajaxContent").css("height", "365px");
    $("#submit_container").fadeIn();
  };
  
  this.formSubmit = function() {
    var would_recommend = $("#recommend_true").attr("checked") === true ? true : "";
    if (would_recommend === "") {
      would_recommend = $("#recommend_false").attr("checked") === true ? false : "";
    }
    if (comments.submit.validate(would_recommend)) {
      
      var opts = { authenticity_token: $("#submit_token").val(),
                   product_id : $("#product_id").val(),
                   nickname: $("#nickname").val(),
                   rating: $(".star_on").length === 0 ? "" : $(".star_on").length,
                   title: $("#title").val(),
                   body: $("#body").val(),
                   recommended: would_recommend,
                   page_number: $("#page_number").val()
                 };
      var obj = this;
      $.postJSON(obj.url, opts, function(data) {
        obj.parseResponse(data);
      });
    }
    return false;
  }
  
  $("#submit_form").submit(function() {
    try {
      comments.submit.formSubmit();
    } catch(e) {
      debugLog(e);
    }
    return false;
  });
  
  $("input.star").rating();
  $("#page_number").keydown(function(e) { return Keyboard.isANumber(e); });
  
}


function authorQuestions() {
  this.total = $('#how_i_came_to_write_container .carousel ul li').length;
  this.current = 1;
  
  if (this.total > 1) {
    $('#next_author .button').show();
  }
  $('#how_i_came_to_write_container .carousel').jCarouselLite({
    btnNext: '#next_author .button',
    btnPrev: '#prev_author .button',
    visible: 1,
    speed: 250,
    scroll: 1,
    circular: false,
    easing: 'swing'
  });
  
  this.next = function() {
    this.current += 1;
    if (this.current >= this.total) {
      $('#next_author .button').fadeOut();
      $('#prev_author .button').fadeIn();
    }
    $('#prev_author .button').fadeIn();
  };
  
  this.previous = function() {
    this.current -= 1;
    if (this.current == 1) {
      $('#prev_author .button').fadeOut();
      $('#next_author .button').fadeIn();
    }
    $('#next_author .button').fadeIn();
  };
  
  $('#prev_author .button').click(function() { reader.authorQuestions.previous(); return false; });
  $('#next_author .button').click(function() { reader.authorQuestions.next(); return false; });
}

function Reader() {
  this.tracker = new Tracker();
  this.pageView = new PageView("single");
  this.zoom = new Zoom("in");
  this.pages = new Pages();
  this.authorQuestions = new authorQuestions();
  this.widthSet = false;
  this.viewingCover = false;
  
  $(BookReader.reader).bind("contextmenu", function() { return false; });
  
  $(window).resize(function() {
    Dimensions.maxWidth = $(window).width() - 20; 
    reader.pages.left.adjustToSize();
    if (reader.pages.right !== null) {
      reader.pages.right.adjustToSize();
    }
  });
  
  this.setLeftMargin = function(offset) {
    var margin = offset;
    if (margin < 5) { margin = 5; }
    $(BookReader.box).css("margin-left", margin + "px");
  };
  
  this.setWidth = function(leftWidth, rightWidth) {
    var containerWidth = (leftWidth + rightWidth + Dimensions.widthOffset - Dimensions.blackLine);
    if (containerWidth > Dimensions.maxWidth) { this.setLeftMargin(0); }
    $(BookReader.container).css("width", containerWidth + "px");
    $(BookReader.reader).css("width", (leftWidth + rightWidth - Dimensions.blackLine - Dimensions.blackLine) + "px");
    $(BookReader.box).css("width", containerWidth + "px");
    
    var height = Dimensions.smallHeight + Dimensions.scrollOffset;
    if (this.zoom.isIn()) {
      height = Dimensions.defaultHeight + Dimensions.scrollOffset;
    }
    $(BookReader.container).css("height", height + "px");
    $(BookReader.reader).css("height", height + "px");
    $(BookReader.box).css("height", height + Dimensions.heightOffset + "px");
    
    var width = $(BookReader.container).width();
    if (width > Dimensions.maxWidth && this.widthSet === false) {
      $(BookReader.box).css("width", Dimensions.maxWidth + "px");
    }
    $(BookReader.container).jScrollHorizontalPane({showArrows: true, scrollbarHeight: 27, reset: true, resize: true});
    
  };
}


function Page(sequence, term, side, direction, sequencePrefix) {
  this.options = { method: direction };
  if (term !== null) {
    this.options = $.extend({ term: term}, this.options);
    this.url = searchResultPageURL;
  } else {
    this.url = changePageURL;
  }

  this.page_sequence = sequence;
  this.page_number = null;
  this.term = term;
  this.side = side;
  this.image = null;
  this.hidden = true;
  this.blankPage = new BlankPage(this);
  this.loadingPage = new LoadingPage(this);
  this.unviewablePage = new UnviewablePage(this);
  this.watermark = new PageWatermark(this);
  this.next_page_fetched = false;
  var self = this;

  this.fetch = function() {
    this.image = null;
    var data = null;
    this.loadingPage.show();

    if (reader.pageView.isSingle()) {
      if (direction === Direction.none) {
        this.fetchNow(false, jsonCache.center, true);
      } else {
        if (jsonCache.current.left !== undefined) {
          if (direction === Direction.previous) {
            this.parseResponse(jsonCache.previous.right);
            jsonCache.moveLeft();
          }
          else if (direction === Direction.next) {
            this.parseResponse(jsonCache.current.right);
            jsonCache.moveRight();
          }
        }
        else {
          this.fetchNow(true);
        }
      }
    }

    if (reader.pageView.isDouble()) {

      if (side === Side.left) {
        if (jsonCache.corrupted) {
          jsonCache.prefetching = true;
          this.fetchNow(false, jsonCache.center, false);
          jsonCache.corrupted = true;
        } else {
          if (reader.pageView.previousState === "single") {
            this.parseResponse(jsonCache.current.left);
          } else {
            if (direction === Direction.previous) {
              this.parseResponse(jsonCache.previous.left);
            } else if (direction === Direction.next) {
              this.parseResponse(jsonCache.next.left);
            } else {
              jsonCache.prefetching = true;
              this.fetchNow(false, jsonCache.center, false);
              jsonCache.corrupted = true;
            }
          }
        }
      }

      if (side === Side.right) {
        if (jsonCache.corrupted) {
          this.fetchNow(false, jsonCache.center + 1, true);
        } else if (reader.pageView.previousState === "single") {
          this.parseResponse(jsonCache.current.right);
        } else {
          if (direction === Direction.previous) {
            this.parseResponse(jsonCache.previous.right);
            jsonCache.moveLeft();
          } else if (direction === Direction.next) {
            this.parseResponse(jsonCache.next.right);
            jsonCache.moveRight();
          }
        }
      }

    }
  }

  this.fetchNow = function(fetchAndBuild, position, eagerLoad) {
    var page = this;
    var prefix = "";
    if (typeof(sequencePrefix) != "undefined" && sequencePrefix !== null) {
      prefix = sequencePrefix;
    }
    var opts = { sequence : String(this.page_sequence), method : (direction || "page") };
    if(typeof(this.term) != "undefined" && this.term != null){
      opts["term"] = this.term;
    }

    $.getJSON(this.url, opts, function(data) {
      page.parseResponse(data);
      if (fetchAndBuild) {
        jsonCache.buildCache(data);
      } else {
        jsonCache.cacheWindow[position] = data;
        if (eagerLoad) {
          if (reader.pageView.isDouble()) {
            jsonCache.eagerLoadForward(jsonCache.center + 2);
          }
          else {
            jsonCache.eagerLoadForward(jsonCache.center + 1);
          }
          if (page.page_sequence > 2) {
            jsonCache.eagerLoadBackward(jsonCache.center - 1);
          }
        }
      }
    });
  };

  this.parseResponse = function(data) {
    if (data === undefined) {
      this.blankPage.show();
      return;
    }
    if (data.blank) {
      this.blankPage.show();
      this.page_sequence = data.page_sequence;
    } else if (data.image_url) {
      this.image = new PageImage(this, data.image_url, data.width, data.height);
      this.watermark = new PageWatermark(this);
      debugLog("parseResponse image sequence was: " + this.page_sequence + " changing to: " + data.page_sequence);

      this.page_sequence = data.page_sequence;
      this.page_number = data.page_number;

      // Control Adjustments
      if (side == Side.left) {
        SkipToPage.set(this.page_sequence);
      }
      reader.pages.adjustControls(side, this.page_sequence);
      tracker.pageViewed(this.page_sequence);

    } else if (data.no_cookies) {
      this.unviewablePage.show();
      if (side == Side.left) {
        alert("Sorry, you must enable cookies to use Browse Inside");
      }
    } else {
      this.unviewablePage.show();
      if (side == Side.left) {
        SkipToPage.set(-1);
      }
    }

    if (reader.pageView.isDouble()) {
      if (side == Side.left && direction == Direction.next || direction == Direction.none) {
        if (direction == Direction.none) {
          direction = Direction.next;
        }
        reader.pages.loadRight(this.page_sequence, direction, term, sequencePrefix);
      } else if (side == Side.right && direction == Direction.previous) {
        reader.pages.loadLeft(this.page_sequence, direction, term, sequencePrefix);
      }
    } else {
      reader.pages.right = null;
    }
  };

  this.largeDisplay = function() {
    return reader.pageView.isSingle() || reader.zoom.isIn();
  };

  this.currentHeight = function() {
    if (this.image !== null) {
      return this.image.currentHeight();
    } else {
      return (this.largeDisplay() ? Dimensions.defaultHeight : Dimensions.smallHeight);
    }
  };

  this.currentWidth = function() {
    if (this.image !== null) {
      return this.image.currentWidth();
    } else {
      return (this.largeDisplay() ? Dimensions.defaultWidth : Dimensions.smallWidth);
    }
  };

  this.adjustToSize = function() {
    if (this.image !== null && !this.hidden) {
      this.image.adjustToSize();
    }
  };

  this.otherPage = function() {
    if (side == "left") {
      return reader.pages.right;
    } else {
      return reader.pages.left;
    }
  };

  this.show = function() {
    this.hidden = false;
    $(this.elements.container).show();
    $(this.elements.image).show();
    if (this.image !== null) {
      this.image.show();
      this.watermark.show();
    }
  };

  this.hide = function() {
    $(this.elements.container).hide();
    this.hidden = true;
  };

  if (side == "left") {
    this.elements = LeftPage;
  } else {
    this.elements = RightPage;
  }
}

var Keyboard = function() {
  var leftArrowCode = 37;
  var rightArrowCode = 39;
  return {
    isANumber: function(e) {
      var validKeys = [leftArrowCode, rightArrowCode, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 13, 8, 46, 9, 27, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105];
      var index = $.inArray(e.which, validKeys);
      if (index != -1) {
        return true;
      } else {
        return false;
      }
    },
    
    allowArrowsToChangePages: function(e) {
      switch(e.which) {
        case leftArrowCode:
          reader.pages.previous();
          break;
        case rightArrowCode:
          reader.pages.next();
          break;
      }
    },
    
    initialize: function() {
      $("#skip_to_page_field").keydown(function(e) { return Keyboard.isANumber(e); });
      $(document).keydown(function(e) { return Keyboard.allowArrowsToChangePages(e); });
    }
  };
}();

$(document).ready(function() {
  Keyboard.initialize();
});


var Search = function() {
  var promptText = "Search in this Book...";
  var open = false;
  return {
    
    isOpen: function() { return open; },
    
    hide: function() {
      open = false;
      $("#search_form_container").css("background", "none");
      $("#search_results_container").slideUp(750);
      $("#double_page_disabled").fadeOut();
    },
    
    loading: function() {
      $("#results_loading").show();
      $("#results_close_link").hide();
      $("#results_header_text").hide();
      $("#result_set_container").hide();
      $(".jScrollPaneContainer").hide();
      $("#results_header").show();
      $("#search_header_divider").hide();
      $("#search_form_container").css("background-image", "url('/images/browse_inside/search_top.png')");
      $("#search_results_container").slideDown(100);
      $("#results_list").html("");
      $("#double_page_disabled").fadeOut();
    },
    
    show: function() {
      $("#results_header_text").css("height", "auto");
      $("#results_header").css("height", "auto");
      $("#results_loading").hide();
      $("#results_header_text").show();
      $("#results_close_link").show();
      $("#results_list").show();
      $("#search_form_container").css("background-image", "url('/images/browse_inside/search_top.png')");
      $(".jScrollPaneContainer").show();
      $("#search_header_divider").show();
      $("#result_set_container").slideDown(1000);
      $(".scroll_section").jScrollPane({showArrows:true, scrollbarWidth: 27});
      $("#results_close_link").click(function() { Search.hide(); return false; });
    },
    
    query: function(term) {
      Search.loading();
      $("#search_results_top").load(searchInsideURL, { authenticity_token: formAuthToken, query: term }, function() {
        Search.show();
        tracker.bookSearched(term);
      });
    },
    
    initialize: function() {
      open = false;
      
      $("#search_query").focus(function() { this.value = ""; });
      
      $("#search_query").blur(function() {
        if (this.value === "") { this.value = promptText; }
      });
      
      $("#search_form").submit(function() {
        if ($("#search_query").attr("value") != promptText &&
            $("#search_query").attr("value") !== "") {
          Search.query( $("#search_query").attr("value") );
        }
        return false;
      });
      
      $("#search_query").attr("value", promptText);
    }
  };
}();


$(document).ready(function() {
  Search.initialize();
});


var TableOfContents = function() {
  var isOpen;
  return {
    
    show: function() {
      $("#table_of_contents_list_container").slideDown(500);
      $(".toc_scroll_section").jScrollPane({showArrows:false, prefix:'toc'});
      isOpen = true;
    },
    
    hide: function() {
      $("#table_of_contents_list_container").slideUp(500);
      isOpen = false;
    },
    
    initialize: function() {
      isOpen = false;
      
      $("#table_of_contents_selector").click(function() {
        if (isOpen) {
          TableOfContents.hide();
        } else {
          TableOfContents.show();
        }
        return false;
      });
      
      $.each($(".toc_entry").find("a"), function() {
        $("#" + this.id).click(function() {
          reader.pages.loadTableOfContents( Number(this.name) );
          $("#table_of_contents_selector").html("<div id='selected_toc'>" + this.innerHTML + "</div>");
          TableOfContents.hide();
          tracker.tocChanged(this.innerHTML);
          return false;
        });
      });
    }
  };
}();

$(document).ready(function() {
  TableOfContents.initialize();
});


// eVar31=bookbrowse, prop35=searchterm, prop36=tocname, event2=pageview, event24=search, event25=toc
function Tracker() {
  this.eVarName = "BookBrowse"
  this.events = { pageViewed : "event23", bookSearched : "event24", tocChanged : "event25" };
  this.pagesViewed = [];
  this.searchesMade = 0;
  this.tocSectionsViewed = 0;
  
  this.pageViewed = function(sequence) {
    var pageHasBeenViewed = $.inArray(sequence, this.pagesViewed);
    if (pageHasBeenViewed == -1) {
       this.pagesViewed.push(sequence);
       // debugLog("Tracker.pageViewed(" + sequence + ")");
       s.eVar31 = this.eVarName;
       s.events = s.events=s.apl(s.events, this.events.pageViewed,",",23);
       s.tl();
    }
  };
  
  this.bookSearched = function(term) {
    var searchTerm = escape(term.toLowerCase());
    // debugLog("Tracker.bookSearched(" + searchTerm + ")");
    s.eVar31 = this.eVarName;
    s.events = s.events=s.apl(s.events, this.events.bookSearched,",",24);
    s.prop35 = searchTerm;
    s.tl();
    this.searchesMade += 1;
  };
  
  this.tocChanged = function(sectionName) {
    var tocSection = escape(sectionName.toLowerCase().replace(/\n|\s/g, ""));
    var data = { eVar31 : this.eVarName,
                 events : this.events.tocChanged,
                 prop36 : tocSection };
    // debugLog("Tracker.tocChanged(" + tocSection + ")");
    s.eVar31 = this.eVarName;
    s.events = s.events=s.apl(s.events, this.events.tocChanged,",",25);
    s.prop36 = tocSection;
    s.tl();
    this.tocSectionsViewed += 1;
  };
  
}


function debugLog(message) {
  if (typeof(debug) == "undefined" || debug === false) { return false; }
  if (typeof(console) != "undefined") {
    console.log(message);
  } else {
    if (document.getElementById("logger") === null) {
      $(document.body).append("<div id='logger'><a id='hide_logger'>hide</a><ol></ol></div>");
      $("#logger").css("position", "fixed");
      $("#logger").css("top", "0");
      $("#logger").css("left", "0");
      $("#logger").css("height", "50px");
      $("#logger").css("overflow-y", "scroll");
      $("#logger").css("width", "200px");
      $("#logger").css("background-color", "white");
      $("#logger").css("border", "1px solid black");
      $("#logger #hide_logger").click(function() {
        var height = $("#logger").height();
        if (height == 30) {
          $("#logger").css("height", "200px");
          $("#hide_logger").html("hide");
        } else {
          $("#logger").css("height", "30px");
          $("#hide_logger").html("show");
        }
        return false;
      });
    }
    $("#logger ol").append("<li>" + message + "</li>");
  }  
}

// Must be defined for IE
var reader = null;
var comments = null;
var sharethis = null;
var stats = {};

var PageControls = function() {
  return {
    
    initializePreviousButtons: function() {
      $(Controls.previousPage.barButton).click(function() { return reader.pages.previous(); });
      $(Controls.previousPage.barButton).mouseover(function() {
        if (reader.pages.left.page_sequence > 1) { $(Controls.previousPage.barHover).show(); }
      });
      $(Controls.previousPage.barButton).mouseout(function() { $(Controls.previousPage.barHover).hide(); });
      
      $(Controls.previousPage.pageButton).click(function() { return reader.pages.previous(); });
      $(Controls.previousPage.pageButton).mouseover(function() {
        if (reader.pages.left.page_sequence > 1) { $(Controls.previousPage.pageHover).show(); }
      });
      $(Controls.previousPage.pageButton).mouseout(function() { $(Controls.previousPage.pageHover).hide(); });
    },
    
    initializeNextButtons: function() {
      $(Controls.nextPage.barButton).click(function() { return reader.pages.next(); });
      $(Controls.nextPage.barButton).mouseover(function() {
        if (reader.pages.left.page_sequence < maxPages) { $(Controls.nextPage.barHover).show(); }
      });
      $(Controls.nextPage.barButton).mouseout(function() { $(Controls.nextPage.barHover).hide(); });
      
      $(Controls.nextPage.pageButton).click(function() { return reader.pages.next(); });
      $(Controls.nextPage.pageButton).mouseover(function() {
        if (reader.pages.left.page_sequence < maxPages) { $(Controls.nextPage.pageHover).show(); }
      });
      $(Controls.nextPage.pageButton).mouseout(function() { $(Controls.nextPage.pageHover).hide(); });
    },
    
    onFirstPage: function() {
      $(Controls.previousPage.barHover).hide();
      $(Controls.previousPage.pageHover).hide();
      $(Controls.previousPage.disabled).fadeIn();
      $(Controls.previousPage.pageButton).fadeOut();
    },
    
    onLastPage: function() {
      $(Controls.nextPage.barHover).hide();
      $(Controls.nextPage.pageHover).hide();
      $(Controls.nextPage.disabled).fadeIn();
      $(Controls.nextPage.pageButton).fadeOut();
    },
    
    normalPrevious: function() {
      $(Controls.previousPage.disabled).fadeOut();
      $(Controls.previousPage.pageButton).fadeIn();
    },
    
    normalNext: function() {
      $(Controls.nextPage.disabled).fadeOut();
      $(Controls.nextPage.pageButton).fadeIn();
    },
    
    initialize: function() {
      PageControls.initializePreviousButtons();
      PageControls.initializeNextButtons();
    }
  };
}();

var SkipToPage = function() {
  return {
    set: function(sequence) {
      var index;
      index = $.inArray(sequence, pageSequences);
      if (index != -1) {
        $(Controls.skipPage.field).attr('value', pageNumbers[index]);
        SkipToPage.enable(pageNumbers[index]);
      } else {
        SkipToPage.disable();
      }
    },
    
    initialize: function() {
      $(Controls.skipPage.field).focus(function() { this.value = ''; });
      
      $(Controls.skipPage.field).blur(function() {
        if (this.value === '') { this.value = reader.pages.left.page_number; }
      });
      
      $(Controls.skipPage.field).change(function() {
        if (this.value === '') { this.value = 0; }
        if (Number(this.value) > pageNumbers.length) { this.value = pageNumbers.length; }
        if (Number(this.value) < lowestNumberedPage) { this.value = lowestNumberedPage; }
        
        reader.pages.loadPageNumber( this.value );
      });
      $(Controls.skipPage.field).attr("maxlength", String(pageNumbers.length).length);
      $(Controls.skipPage.field).attr("size", String(pageNumbers.length).length);
      $(Controls.skipPage.max).html("&nbsp;/&nbsp;" + pageNumbers[pageNumbers.length - 1]);
      
      SkipToPage.set(reader.pages.left.page_sequence);
    },
    
    disable: function() {
      $(Controls.skipPage.field).attr('value', '');
    },
    
    enable: function(value) {
      $(Controls.skipPage.field).attr('value', value);
    }
  };
}();



function JSONCache(windowSize) {

  this.cacheWindow = new Array(windowSize);
  this.windowSize = windowSize;
  this.center = (windowSize / 2) - 1; // Assuming windowSize will be an even number
  this.prefetching = false;
  this.previous = { left : this.cacheWindow[this.center - 2], right : this.cacheWindow[this.center - 1] };
  this.current = { left : this.cacheWindow[this.center], right : this.cacheWindow[this.center + 1] };
  this.next = { left : this.cacheWindow[this.center + 2], right : this.cacheWindow[this.center + 3] };
  this.corrupted = false;
  this.eagerFrontlock = false;
  this.eagerBacklock = false;

  this.buildCache = function(data) {
    this.corrupted = false;
    this.prefetching = true;
    this.cacheWindow[this.center] = data;
    this.eagerLoadForward(this.center + 1);
  }

  this.eagerLoadForward = function(position) {
    this.eagerFrontlock = true;
    this.prefetching = true;
    var jsonStore = this;
    if (position >= this.windowSize) {
      this.eagerFrontlock = false;          
      this.updateCache();
      return;
    }
    var currentSequence = this.cacheWindow[position - 1].page_sequence;
    $.getJSON(changePageURL, { sequence : currentSequence, method : "next" }, function(data) {
      jsonStore.cacheWindow[position] = data;
      jsonStore.prefetchImage(data.image_url);
      jsonStore.eagerLoadForward(position + 1);
    });
  }

  this.eagerLoadBackward = function(position) {
    this.eagerBacklock = true;
    this.prefetching = true;    
    var jsonStore = this;
    if (position < 0) {
      this.eagerBacklock = false;     
      this.updateCache();
      return;
    }
    var currentSequence = this.cacheWindow[position + 1].page_sequence;
    $.getJSON(changePageURL, { sequence : currentSequence, method : "prev" }, function(data) {
      jsonStore.cacheWindow[position] = data;
      jsonStore.prefetchImage(data.image_url);
      jsonStore.eagerLoadBackward(position - 1);
    });
  }

  this.prefetchImage = function(image_url) {
    var image = new Image();
    image.src = image_url;
  }

  this.moveRight = function() {
    this.prefetching = true;
    var numberOfShifts = 1;
    if (reader.pageView.isDouble()) {
      numberOfShifts = 2;
    }
    for (var i = 0; i < numberOfShifts; i++) {
      for (var j = 0; j < (this.windowSize - 1); j++) {
        this.cacheWindow[j] = this.cacheWindow[j + 1];
      }
    }
    this.eagerLoadForward(this.windowSize - numberOfShifts);
  }

  this.moveLeft = function() {
    this.prefetching = true;
    var numberOfShifts = 1;
    if (reader.pageView.isDouble()) {
      numberOfShifts = 2;
    }
    for (var i = 0; i < numberOfShifts; i++) {
      for (var j = (this.windowSize - 1); j > 0; j--) {
        this.cacheWindow[j] = this.cacheWindow[j - 1];
      }
    }
    this.eagerLoadBackward(numberOfShifts - 1);
  }

  this.updateCache = function(){
    this.previous = { left : this.cacheWindow[this.center - 2], right : this.cacheWindow[this.center - 1] };
    this.current = { left : this.cacheWindow[this.center], right : this.cacheWindow[this.center + 1] };
    this.next = { left : this.cacheWindow[this.center + 2], right : this.cacheWindow[this.center + 3] };
    this.corrupted = false;
    if(!this.eagerFrontlock && !this.eagerBacklock){
      this.prefetching = false;
    }
  }

}


$(document).ready(function() {
  jsonCache = new JSONCache(6);
  tracker = new Tracker();
  reader = new Reader();
  reader.pages.startState();
  reader.pages.load(Direction.none);
  SkipToPage.initialize();
  PageControls.initialize();
  comments = new Comments();
});