PageSourceSearch

https://www.sbcera.org/sites/main/files/js/js_17a5014b7789e50ad6c8c3ad40f95216.js

js sbcera.org collected 2026-10-06 08:46:14 UTC 288,977 bytes, 6,350 lines download raw bytes

1
2/*
3 * jQuery 1.2.6 - New Wave Javascript
4 *
5 * Copyright (c) 2008 John Resig (jquery.com)
6 * Dual licensed under the MIT (MIT-LICENSE.txt)
7 * and GPL (GPL-LICENSE.txt) licenses.
8 *
9 * Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008)
10 * Rev: 5685
11 */
12eval(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));
12N 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;
12--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;
121B(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};
12b.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}
12,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|
12none|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|seri
12alize|pixelLeft'.split('|'),0,{}));
13/**
14 * For jQuery versions less than 3.4.0, this replaces the jQuery.extend
15 * function with the one from jQuery 3.4.0, slightly modified (documented
16 * below) to be compatible with older jQuery versions and browsers.
17 *
18 * This provides the Object.prototype pollution vulnerability fix to Drupal
19 * installations running older jQuery versions, including the versions shipped
20 * with Drupal core and https://www.drupal.org/project/jquery_update.
21 *
22 * @see https://github.com/jquery/jquery/pull/4333
23 */
24
25(function (jQuery) {
26
27// Do not override jQuery.extend() if the jQuery version is already >=3.4.0.
28var versionParts = jQuery.fn.jquery.split('.');
29var majorVersion = parseInt(versionParts[0]);
30var minorVersion = parseInt(versionParts[1]);
31var patchVersion = parseInt(versionParts[2]);
32var isPreReleaseVersion = (patchVersion.toString() !== versionParts[2]);
33if (
34  (majorVersion > 3) ||
35  (majorVersion === 3 && minorVersion > 4) ||
36  (majorVersion === 3 && minorVersion === 4 && patchVersion > 0) ||
37  (majorVersion === 3 && minorVersion === 4 && patchVersion === 0 && !isPreReleaseVersion)
38) {
39  return;
40}
41
42/**
43 * This adds some funtions from jQuery 1.4.4 (the default version used in
44 * Drupal 7) for when they aren't present, like when using jQuery 1.2.6 (the
45 * default version used in Drupal 6).
46 */
47
48if (typeof jQuery.type === 'undefined') {
49  var toString = Object.prototype.toString,
50      class2type = {};
51
52  // Populate the class2type map
53  jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
54    class2type[ "[object " + name + "]" ] = name.toLowerCase();
55  });
56
57  jQuery.type = function (obj) {
58    return obj == null ?
59      String( obj ) :
60      class2type[ toString.call(obj) ] || "object";
61  };
62}
63
64if (typeof jQuery.isArray === 'undefined') {
65  jQuery.isArray = function (obj) {
66    return jQuery.type(obj) === "array";
67  };
68}
69
70if (typeof jQuery.isWindow === 'undefined') {
71  jQuery.isWindow = function (obj) {
72    return obj && typeof obj === "object" && "setInterval" in obj;
73  };
74}
75
76if (typeof jQuery.isPlainObject === 'undefined') {
77  var hasOwn = Object.prototype.hasOwnProperty;
78
79  jQuery.isPlainObject = function (obj) {
80    // Must be an Object.
81    // Because of IE, we also have to check the presence of the constructor property.
82    // Make sure that DOM nodes and window objects don't pass through, as well
83    if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
84      return false;
85    }
86
87    // Not own constructor property must be Object
88    if ( obj.constructor &&
89      !hasOwn.call(obj, "constructor") &&
90      !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
91      return false;
92    }
93
94    // Own properties are enumerated firstly, so to speed up,
95    // if last one is own, then all properties are own.
96
97    var key;
98    for ( key in obj ) {}
99
100    return key === undefined || hasOwn.call( obj, key );
101  };
102}
103
104/**
105 * This is almost verbatim copied from jQuery 3.4.0.
106 *
107 * Only two minor changes have been made:
108 * - The call to isFunction() is changed to jQuery.isFunction().
109 * - The two calls to Array.isArray() is changed to jQuery.isArray().
110 *
111 * The above two changes ensure compatibility with all older jQuery versions
112 * (1.2.6 - 3.3.1) and older browser versions (e.g., IE8).
113 */
114jQuery.extend = jQuery.fn.extend = function() {
115  var options, name, src, copy, copyIsArray, clone,
116    target = arguments[ 0 ] || {},
117    i = 1,
118    length = arguments.length,
119    deep = false;
120
121  // Handle a deep copy situation
122  if ( typeof target === "boolean" ) {
123    deep = target;
124
125    // Skip the boolean and the target
126    target = arguments[ i ] || {};
127    i++;
128  }
129
130  // Handle case when target is a string or something (possible in deep copy)
131  if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
132    target = {};
133  }
134
135  // Extend jQuery itself if only one argument is passed
136  if ( i === length ) {
137    target = this;
138    i--;
139  }
140
141  for ( ; i < length; i++ ) {
142
143    // Only deal with non-null/undefined values
144    if ( ( options = arguments[ i ] ) != null ) {
145
146      // Extend the base object
147      for ( name in options ) {
148        copy = options[ name ];
149
150        // Prevent Object.prototype pollution
151        // Prevent never-ending loop
152        if ( name === "__proto__" || target === copy ) {
153          continue;
154        }
155
156        // Recurse if we're merging plain objects or arrays
157        if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
158          ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
159          src = target[ name ];
160
161          // Ensure proper type for the source value
162          if ( copyIsArray && !jQuery.isArray( src ) ) {
163            clone = [];
164          } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
165            clone = {};
166          } else {
167            clone = src;
168          }
169          copyIsArray = false;
170
171          // Never move original objects, clone them
172          target[ name ] = jQuery.extend( deep, clone, copy );
173
174          // Don't bring in undefined values
175        } else if ( copy !== undefined ) {
176          target[ name ] = copy;
177        }
178      }
179    }
180  }
181
182  // Return the modified object
183  return target;
184};
185
186})(jQuery);
187;
188/**
189 * For jQuery versions less than 3.5.0, this replaces the jQuery.htmlPrefilter()
190 * function with one that fixes these security vulnerabilities while also
191 * retaining the pre-3.5.0 behavior where it's safe to do so.
192 * - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11022
193 * - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11023
194 *
195 * Additionally, for jQuery versions that do not have a jQuery.htmlPrefilter()
196 * function (1.x prior to 1.12 and 2.x prior to 2.2), this adds it, and
197 * extends the functions that need to call it to do so.
198 *
199 * Drupal core's jQuery version is 1.4.4, but jQuery Update can provide a
200 * different version, so this covers all versions between 1.4.4 and 3.4.1.
201 * The GitHub links in the code comments below link to jQuery 1.5 code, because
202 * 1.4.4 isn't on GitHub, but the referenced code didn't change from 1.4.4 to
203 * 1.5.
204 */
205
206(function (jQuery) {
207
208  // Parts of this backport differ by jQuery version.
209  var versionParts = jQuery.fn.jquery.split('.');
210  var majorVersion = parseInt(versionParts[0]);
211  var minorVersion = parseInt(versionParts[1]);
212
213  // No backport is needed if we're already on jQuery 3.5 or higher.
214  if ( (majorVersion > 3) || (majorVersion === 3 && minorVersion >= 5) ) {
215    return;
216  }
217
218  // Prior to jQuery 3.5, jQuery converted XHTML-style self-closing tags to
219  // their XML equivalent: e.g., "<div />" to "<div></div>". This is
220  // problematic for several reasons, including that it's vulnerable to XSS
221  // attacks. However, since this was jQuery's behavior for many years, many
222  // Drupal modules and jQuery plugins may be relying on it. Therefore, we
223  // preserve that behavior, but for a limited set of tags only, that we believe
224  // to not be vulnerable. This is the set of HTML tags that satisfy all of the
225  // following conditions:
226  // - In DOMPurify's list of HTML tags. If an HTML tag isn't safe enough to
227  //   appear in that list, then we don't want to mess with it here either.
228  //   @see https://github.com/cure53/DOMPurify/blob/2.0.11/dist/purify.js#L128
229  // - A normal element (not a void, template, text, or foreign element).
230  //   @see https://html.spec.whatwg.org/multipage/syntax.html#elements-2
231  // - An element that is still defined by the current HTML specification
232  //   (not a deprecated element), because we do not want to rely on how
233  //   browsers parse deprecated elements.
234  //   @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element
235  // - Not 'html', 'head', or 'body', because this pseudo-XHTML expansion is
236  //   designed for fragments, not entire documents.
237  // - Not 'colgroup', because due to an idiosyncrasy of jQuery's original
238  //   regular expression, it didn't match on colgroup, and we don't want to
239  //   introduce a behavior change for that.
240  var selfClosingTagsToReplace = [
241    'a', 'abbr', 'address', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo',
242    'blockquote', 'button', 'canvas', 'caption', 'cite', 'code', 'data',
243    'datalist', 'dd', 'del', 'details', 'dfn', 'div', 'dl', 'dt', 'em',
244    'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3',
245    'h4', 'h5', 'h6', 'header', 'hgroup', 'i', 'ins', 'kbd', 'label', 'legend',
246    'li', 'main', 'map', 'mark', 'menu', 'meter', 'nav', 'ol', 'optgroup',
247    'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt',
248    'ruby', 's', 'samp', 'section', 'select', 'small', 'source', 'span',
249    'strong', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th',
250    'thead', 'time', 'tr', 'u', 'ul', 'var', 'video'
251  ];
252
253  // Define regular expressions for <TAG/> and <TAG ATTRIBUTES/>. Doing this as
254  // two expressions makes it easier to target <a/> without also targeting
255  // every tag that starts with "a".
256  var xhtmlRegExpGroup = '(' + selfClosingTagsToReplace.join('|') + ')';
257  var whitespace = '[\\x20\\t\\r\\n\\f]';
258  var rxhtmlTagWithoutSpaceOrAttributes = new RegExp('<' + xhtmlRegExpGroup + '\\/>', 'gi');
259  var rxhtmlTagWithSpaceAndMaybeAttributes = new RegExp('<' + xhtmlRegExpGroup + '(' + whitespace + '[^>]*)\\/>', 'gi');
260
261  // jQuery 3.5 also fixed a vulnerability for when </select> appears within
262  // an <option> or <optgroup>, but it did that in local code that we can't
263  // backport directly. Instead, we filter such cases out. To do so, we need to
264  // determine when jQuery would otherwise invoke the vulnerable code, which it
265  // uses this regular expression to determine. The regular expression changed
266  // for version 3.0.0 and changed again for 3.4.0.
267  // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L4958
268  // @see https://github.com/jquery/jquery/blob/3.0.0/dist/jquery.js#L4584
269  // @see https://github.com/jquery/jquery/blob/3.4.0/dist/jquery.js#L4712
270  var rtagName;
271  if (majorVersion < 3) {
272    rtagName = /<([\w:]+)/;
273  }
274  else if (minorVersion < 4) {
275    rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
276  }
277  else {
278    rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i;
279  }
280
281  // The regular expression that jQuery uses to determine which self-closing
282  // tags to expand to open and close tags. This is vulnerable, because it
283  // matches all tag names except the few excluded ones. We only use this
284  // expression for determining vulnerability. The expression changed for
285  // version 3, but we only need to check for vulnerability in versions 1 and 2,
286  // so we use the expression from those versions.
287  // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L4957
288  var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi;
289
290  jQuery.extend({
291    htmlPrefilter: function (html) {
292      // This is how jQuery determines the first tag in the HTML.
293      // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L5521
294      var tag = ( rtagName.exec( html ) || [ "", "" ] )[ 1 ].toLowerCase();
295
296      // It is not valid HTML for <option> or <optgroup> to have <select> as
297      // either a descendant or sibling, and attempts to inject one can cause
298      // XSS on jQuery versions before 3.5. Since this is invalid HTML and a
299      // possible XSS attack, reject the entire string.
300      // @see https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11023
301      if ((tag === 'option' || tag === 'optgroup') && html.match(/<\/?select/i)) {
302        html = '';
303      }
304
305      // Retain jQuery's prior to 3.5 conversion of pseudo-XHTML, but for only
306      // the tags in the `selfClosingTagsToReplace` list defined above.
307      // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L5518
308      // @see https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-11022
309      html = html.replace(rxhtmlTagWithoutSpaceOrAttributes, "<$1></$1>");
310      html = html.replace(rxhtmlTagWithSpaceAndMaybeAttributes, "<$1$2></$1>");
311
312      // Prior to jQuery 1.12 and 2.2, this function gets called (via code later
313      // in this file) in addition to, rather than instead of, the unsafe
314      // expansion of self-closing tags (including ones not in the list above).
315      // We can't prevent that unsafe expansion from running, so instead we
316      // check to make sure that it doesn't affect the DOM returned by the
317      // browser's parsing logic. If it does affect it, then it's vulnerable to
318      // XSS, so we reject the entire string.
319      if ( (majorVersion === 1 && minorVersion < 12) || (majorVersion === 2 && minorVersion < 2) ) {
320        var htmlRisky = html.replace(rxhtmlTag, "<$1></$2>");
321        if (htmlRisky !== html) {
322          // Even though htmlRisky and html are different strings, they might
323          // represent the same HTML structure once parsed, in which case,
324          // htmlRisky is actually safe. We can ask the browser to parse both
325          // to find out, but the browser can't parse table fragments (e.g., a
326          // root-level "<td>"), so we need to wrap them. We just need this
327          // technique to work on all supported browsers; we don't need to
328          // copy from the specific jQuery version we're using.
329          // @see https://github.com/jquery/jquery/blob/3.5.1/dist/jquery.js#L4939
330          var wrapMap = {
331            thead: [ 1, "<table>", "</table>" ],
332            col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
333            tr: [ 2, "<table><tbody>", "</tbody></table>" ],
334            td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
335          };
336          wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
337          wrapMap.th = wrapMap.td;
338
339          // Function to wrap HTML into something that a browser can parse.
340          // @see https://github.com/jquery/jquery/blob/3.5.1/dist/jquery.js#L5032
341          var getWrappedHtml = function (html) {
342            var wrap = wrapMap[tag];
343            if (wrap) {
344              html = wrap[1] + html + wrap[2];
345            }
346            return html;
347          };
348
349          // Function to return canonical HTML after parsing it. This parses
350          // only; it doesn't execute scripts.
351          // @see https://github.com/jquery/jquery-migrate/blob/3.3.0/src/jquery/manipulation.js#L5
352          var getParsedHtml = function (html) {
353            var doc = window.document.implementation.createHTMLDocument( "" );
354            doc.body.innerHTML = html;
355            return doc.body ? doc.body.innerHTML : '';
356          };
357
358          // If the browser couldn't parse either one successfully, or if
359          // htmlRisky parses differently than html, then html is vulnerable,
360          // so reject it.
361          var htmlParsed = getParsedHtml(getWrappedHtml(html));
362          var htmlRiskyParsed = getParsedHtml(getWrappedHtml(htmlRisky));
363          if (htmlRiskyParsed === '' || htmlParsed === '' || (htmlRiskyParsed !== htmlParsed)) {
364            html = '';
365          }
366        }
367      }
368
369      return html;
370    }
371  });
372
373  // Prior to jQuery 1.12 and 2.2, jQuery.clean(), jQuery.buildFragment(), and
374  // jQuery.fn.html() did not call jQuery.htmlPrefilter(), so we add that.
375  if ( (majorVersion === 1 && minorVersion < 12) || (majorVersion === 2 && minorVersion < 2) ) {
376    // Filter the HTML coming into jQuery.fn.html().
377    var fnOriginalHtml = jQuery.fn.html;
378    jQuery.fn.extend({
379      // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L5147
380      html: function (value) {
381        if (typeof value === "string") {
382          value = jQuery.htmlPrefilter(value);
383        }
384        // .html() can be called as a setter (with an argument) or as a getter
385        // (without an argument), so invoke fnOriginalHtml() the same way that
386        // we were invoked.
387        return fnOriginalHtml.apply(this, arguments.length ? [value] : []);
388      }
389    });
390
391    // The regular expression that jQuery uses to determine if a string is HTML.
392    // Used by both clean() and buildFragment().
393    // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L4960
394    var rhtml = /<|&#?\w+;/;
395
396    // Filter HTML coming into:
397    // - jQuery.clean() for versions prior to 1.9.
398    // - jQuery.buildFragment() for 1.9 and above.
399    //
400    // The looping constructs in the two functions might be essentially
401    // identical, but they're each expressed here in the way that most closely
402    // matches their original expression in jQuery, so that we filter all of
403    // the items and only the items that jQuery will treat as HTML strings.
404    if (majorVersion === 1 && minorVersion < 9) {
405      var originalClean = jQuery.clean;
406      jQuery.extend({
407        // @see https://github.com/jquery/jquery/blob/1.5/jquery.js#L5493
408        'clean': function (elems, context, fragment, scripts) {
409          for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
410            if ( typeof elem === "string" && rhtml.test( elem ) ) {
411              elems[i] = elem = jQuery.htmlPrefilter(elem);
412            }
413          }
414          return originalClean.call(this, elems, context, fragment, scripts);
415        }
416      });
417    }
418    else {
419      var originalBuildFragment = jQuery.buildFragment;
420      jQuery.extend({
421        // @see https://github.com/jquery/jquery/blob/1.9.0/jquery.js#L6419
422        'buildFragment': function (elems, context, scripts, selection) {
423          var l = elems.length;
424          for ( var i = 0; i < l; i++ ) {
425            var elem = elems[i];
426            if (elem || elem === 0) {
427              if ( jQuery.type( elem ) !== "object" && rhtml.test( elem ) ) {
428                elems[i] = elem = jQuery.htmlPrefilter(elem);
429              }
430            }
431          }
432          return originalBuildFragment.call(this, elems, context, scripts, selection);
433        }
434      });
435    }
436  }
437
438})(jQuery);
439;
440
441/**
442 * Override jQuery.fn.init to guard against XSS attacks.
443 *
444 * See http://bugs.jquery.com/ticket/9521
445 */
446(function () {
447  var jquery_init = jQuery.fn.init;
448  jQuery.fn.init = function (selector, context, rootjQuery) {
449    // If the string contains a "#" before a "<", treat it as invalid HTML.
450    if (selector && typeof selector === 'string') {
451      var hash_position = selector.indexOf('#');
452      if (hash_position >= 0) {
453        var bracket_position = selector.indexOf('<');
454        if (bracket_position > hash_position) {
455          throw 'Syntax error, unrecognized expression: ' + selector;
456        }
457      }
458    }
459    return jquery_init.call(this, selector, context, rootjQuery);
460  };
461  jQuery.fn.init.prototype = jquery_init.prototype;
462
463  /**
464   * Pre-filter Ajax requests to guard against XSS attacks.
465   *
466   * See https://github.com/jquery/jquery/issues/2432
467   */
468  if ($.ajaxPrefilter) {
469    // For newer versions of jQuery, use an Ajax prefilter to prevent
470    // auto-executing script tags from untrusted domains. This is similar to the
471    // fix that is built in to jQuery 3.0 and higher.
472    $.ajaxPrefilter(function (s) {
473      if (s.crossDomain) {
474        s.contents.script = false;
475      }
476    });
477  }
478  else if ($.httpData) {
479    // For the version of jQuery that ships with Drupal core, override
480    // jQuery.httpData to prevent auto-detecting "script" data types from
481    // untrusted domains.
482    var jquery_httpData = $.httpData;
483    $.httpData = function (xhr, type, s) {
484      // @todo Consider backporting code from newer jQuery versions to check for
485      //   a cross-domain request here, rather than using Drupal.urlIsLocal() to
486      //   block scripts from all URLs that are not on the same site.
487      if (!type && (!s || !Drupal.urlIsLocal(s.url))) {
488        var content_type = xhr.getResponseHeader('content-type') || '';
489        if (content_type.indexOf('javascript') >= 0) {
490          // Default to a safe data type.
491          type = 'text';
492        }
493      }
494      return jquery_httpData.call(this, xhr, type, s);
495    };
496    $.httpData.prototype = jquery_httpData.prototype;
497  }
498})();
499
500var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} };
501
502/**
503 * Set the variable that indicates if JavaScript behaviors should be applied
504 */
505Drupal.jsEnabled = true;
506
507/**
508 * Attach all registered behaviors to a page element.
509 *
510 * Behaviors are event-triggered actions that attach to page elements, enhancing
511 * default non-Javascript UIs. Behaviors are registered in the Drupal.behaviors
512 * object as follows:
513 * @code
514 *    Drupal.behaviors.behaviorName = function () {
515 *      ...
516 *    };
517 * @endcode
518 *
519 * Drupal.attachBehaviors is added below to the jQuery ready event and so
520 * runs on initial page load. Developers implementing AHAH/AJAX in their
521 * solutions should also call this function after new page content has been
522 * loaded, feeding in an element to be processed, in order to attach all
523 * behaviors to the new content.
524 *
525 * Behaviors should use a class in the form behaviorName-processed to ensure
526 * the behavior is attached only once to a given element. (Doing so enables
527 * the reprocessing of given elements, which may be needed on occasion despite
528 * the ability to limit behavior attachment to a particular element.)
529 *
530 * @param context
531 *   An element to attach behaviors to. If none is given, the document element
532 *   is used.
533 */
534Drupal.attachBehaviors = function(context) {
535  context = context || document;
536  // Execute all of them.
537  jQuery.each(Drupal.behaviors, function() {
538    this(context);
539  });
540};
541
542/**
543 * Encode special characters in a plain-text string for display as HTML.
544 */
545Drupal.checkPlain = function(str) {
546  str = String(str);
547  var replace = { '&': '&amp;', "'": '&#39;', '"': '&quot;', '<': '&lt;', '>': '&gt;' };
548  for (var character in replace) {
549    var regex = new RegExp(character, 'g');
550    str = str.replace(regex, replace[character]);
551  }
552  return str;
553};
554
555/**
556 * Translate strings to the page language or a given language.
557 *
558 * See the documentation of the server-side t() function for further details.
559 *
560 * @param str
561 *   A string containing the English string to translate.
562 * @param args
563 *   An object of replacements pairs to make after translation. Incidences
564 *   of any key in this array are replaced with the corresponding value.
565 *   Based on the first character of the key, the value is escaped and/or themed:
566 *    - !variable: inserted as is
567 *    - @variable: escape plain text to HTML (Drupal.checkPlain)
568 *    - %variable: escape text and theme as a placeholder for user-submitted
569 *      content (checkPlain + Drupal.theme('placeholder'))
570 * @return
571 *   The translated string.
572 */
573Drupal.t = function(str, args) {
574  // Fetch the localized version of the string.
575  if (Drupal.locale.strings && Drupal.locale.strings[str]) {
576    str = Drupal.locale.strings[str];
577  }
578
579  if (args) {
580    // Transform arguments before inserting them
581    for (var key in args) {
582      switch (key.charAt(0)) {
583        // Escaped only
584        case '@':
585          args[key] = Drupal.checkPlain(args[key]);
586        break;
587        // Pass-through
588        case '!':
589          break;
590        // Escaped and placeholder
591        case '%':
592        default:
593          args[key] = Drupal.theme('placeholder', args[key]);
594          break;
595      }
596      str = str.replace(key, args[key]);
597    }
598  }
599  return str;
600};
601
602/**
603 * Format a string containing a count of items.
604 *
605 * This function ensures that the string is pluralized correctly. Since Drupal.t() is
606 * called by this function, make sure not to pass already-localized strings to it.
607 *
608 * See the documentation of the server-side format_plural() function for further details.
609 *
610 * @param count
611 *   The item count to display.
612 * @param singular
613 *   The string for the singular case. Please make sure it is clear this is
614 *   singular, to ease translation (e.g. use "1 new comment" instead of "1 new").
615 *   Do not use @count in the singular string.
616 * @param plural
617 *   The string for the plural case. Please make sure it is clear this is plural,
618 *   to ease translation. Use @count in place of the item count, as in "@count
619 *   new comments".
620 * @param args
621 *   An object of replacements pairs to make after translation. Incidences
622 *   of any key in this array are replaced with the corresponding value.
623 *   Based on the first character of the key, the value is escaped and/or themed:
624 *    - !variable: inserted as is
625 *    - @variable: escape plain text to HTML (Drupal.checkPlain)
626 *    - %variable: escape text and theme as a placeholder for user-submitted
627 *      content (checkPlain + Drupal.theme('placeholder'))
628 *   Note that you do not need to include @count in this array.
629 *   This replacement is done automatically for the plural case.
630 * @return
631 *   A translated string.
632 */
633Drupal.formatPlural = function(count, singular, plural, args) {
634  var args = args || {};
635  args['@count'] = count;
636  // Determine the index of the plural form.
637  var index = Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula(args['@count']) : ((args['@count'] == 1) ? 0 : 1);
638
639  if (index == 0) {
640    return Drupal.t(singular, args);
641  }
642  else if (index == 1) {
643    return Drupal.t(plural, args);
644  }
645  else {
646    args['@count['+ index +']'] = args['@count'];
647    delete args['@count'];
648    return Drupal.t(plural.replace('@count', '@count['+ index +']'), args);
649  }
650};
651
652/**
653 * Returns the passed in URL as an absolute URL.
654 *
655 * @param url
656 *   The URL string to be normalized to an absolute URL.
657 *
658 * @return
659 *   The normalized, absolute URL.
660 *
661 * @see https://github.com/angular/angular.js/blob/v1.4.4/src/ng/urlUtils.js
662 * @see https://grack.com/blog/2009/11/17/absolutizing-url-in-javascript
663 * @see https://github.com/jquery/jquery-ui/blob/1.11.4/ui/tabs.js#L53
664 */
665Drupal.absoluteUrl = function (url) {
666  var urlParsingNode = document.createElement('a');
667
668  // Decode the URL first; this is required by IE <= 6. Decoding non-UTF-8
669  // strings may throw an exception.
670  try {
671    url = decodeURIComponent(url);
672  } catch (e) {}
673
674  urlParsingNode.setAttribute('href', url);
675
676  // IE <= 7 normalizes the URL when assigned to the anchor node similar to
677  // the other browsers.
678  return urlParsingNode.cloneNode(false).href;
679};
680
681/**
682 * Returns true if the URL is within Drupal's base path.
683 *
684 * @param url
685 *   The URL string to be tested.
686 *
687 * @return
688 *   Boolean true if local.
689 *
690 * @see https://github.com/jquery/jquery-ui/blob/1.11.4/ui/tabs.js#L58
691 */
692Drupal.urlIsLocal = function (url) {
693  // Always use browser-derived absolute URLs in the comparison, to avoid
694  // attempts to break out of the base path using directory traversal.
695  var absoluteUrl = Drupal.absoluteUrl(url);
696  var protocol = location.protocol;
697
698  // Consider URLs that match this site's base URL but use HTTPS instead of HTTP
699  // as local as well.
700  if (protocol === 'http:' && absoluteUrl.indexOf('https:') === 0) {
701    protocol = 'https:';
702  }
703  var baseUrl = protocol + '//' + location.host + Drupal.settings.basePath.slice(0, -1);
704
705  // Decoding non-UTF-8 strings may throw an exception.
706  try {
707    absoluteUrl = decodeURIComponent(absoluteUrl);
708  } catch (e) {}
709  try {
710    baseUrl = decodeURIComponent(baseUrl);
711  } catch (e) {}
712
713  // The given URL matches the site's base URL, or has a path under the site's
714  // base URL.
715  return absoluteUrl === baseUrl || absoluteUrl.indexOf(baseUrl + '/') === 0;
716};
717
718/**
719 * Generate the themed representation of a Drupal object.
720 *
721 * All requests for themed output must go through this function. It examines
722 * the request and routes it to the appropriate theme function. If the current
723 * theme does not provide an override function, the generic theme function is
724 * called.
725 *
726 * For example, to retrieve the HTML that is output by theme_placeholder(text),
727 * call Drupal.theme('placeholder', text).
728 *
729 * @param func
730 *   The name of the theme function to call.
731 * @param ...
732 *   Additional arguments to pass along to the theme function.
733 * @return
734 *   Any data the theme function returns. This could be a plain HTML string,
735 *   but also a complex object.
736 */
737Drupal.theme = function(func) {
738  for (var i = 1, args = []; i < arguments.length; i++) {
739    args.push(arguments[i]);
740  }
741
742  return (Drupal.theme[func] || Drupal.theme.prototype[func]).apply(this, args);
743};
744
745/**
746 * Parse a JSON response.
747 *
748 * The result is either the JSON object, or an object with 'status' 0 and 'data' an error message.
749 */
750Drupal.parseJson = function (data) {
751  if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) {
752    return { status: 0, data: data.length ? data : Drupal.t('Unspecified error') };
753  }
754  return eval('(' + data + ');');
755};
756
757/**
758 * Freeze the current body height (as minimum height). Used to prevent
759 * unnecessary upwards scrolling when doing DOM manipulations.
760 */
761Drupal.freezeHeight = function () {
762  Drupal.unfreezeHeight();
763  var div = document.createElement('div');
764  $(div).css({
765    position: 'absolute',
766    top: '0px',
767    left: '0px',
768    width: '1px',
769    height: $('body').css('height')
770  }).attr('id', 'freeze-height');
771  $('body').append(div);
772};
773
774/**
775 * Unfreeze the body height
776 */
777Drupal.unfreezeHeight = function () {
778  $('#freeze-height').remove();
779};
780
781/**
782 * Wrapper around encodeURIComponent() which avoids Apache quirks (equivalent of
783 * drupal_urlencode() in PHP). This function should only be used on paths, not
784 * on query string arguments.
785 */
786Drupal.encodeURIComponent = function (item, uri) {
787  uri = uri || location.href;
788  item = encodeURIComponent(item).replace(/%2F/g, '/');
789  return (uri.indexOf('?q=') != -1) ? item : item.replace(/%26/g, '%2526').replace(/%23/g, '%2523').replace(/\/\//g, '/%252F');
790};
791
792/**
793 * Get the text selection in a textarea.
794 */
795Drupal.getSelection = function (element) {
796  if (typeof(element.selectionStart) != 'number' && document.selection) {
797    // The current selection
798    var range1 = document.selection.createRange();
799    var range2 = range1.duplicate();
800    // Select all text.
801    range2.moveToElementText(element);
802    // Now move 'dummy' end point to end point of original range.
803    range2.setEndPoint('EndToEnd', range1);
804    // Now we can calculate start and end points.
805    var start = range2.text.length - range1.text.length;
806    var end = start + range1.text.length;
807    return { 'start': start, 'end': end };
808  }
809  return { 'start': element.selectionStart, 'end': element.selectionEnd };
810};
811
812/**
813 * Sanitizes a URL for use with jQuery.ajax().
814 *
815 * @param url
816 *   The URL string to be sanitized.
817 *
818 * @return
819 *   The sanitized URL.
820 */
821Drupal.sanitizeAjaxUrl = function (url) {
822  var regex = /\=\?(&|$)/;
823  while (url.match(regex)) {
824    url = url.replace(regex, '');
825  }
826  return url;
827}
828
829/**
830 * Build an error message from ahah response.
831 */
832Drupal.ahahError = function(xmlhttp, uri) {
833  if (xmlhttp.status == 200) {
834    if (jQuery.trim(xmlhttp.responseText)) {
835      var message = Drupal.t("An error occurred. \n@uri\n@text", {'@uri': uri, '@text': xmlhttp.responseText });
836    }
837    else {
838      var message = Drupal.t("An error occurred. \n@uri\n(no information available).", {'@uri': uri });
839    }
840  }
841  else {
842    var message = Drupal.t("An HTTP error @status occurred. \n@uri", {'@uri': uri, '@status': xmlhttp.status });
843  }
844  return message.replace(/\n/g, '<br />');
845}
846
847// Global Killswitch on the <html> element
848$(document.documentElement).addClass('js');
849// Attach all behaviors.
850$(document).ready(function() {
851  Drupal.attachBehaviors(this);
852});
853
854/**
855 * The default themes.
856 */
857Drupal.theme.prototype = {
858
859  /**
860   * Formats text for emphasized display in a placeholder inside a sentence.
861   *
862   * @param str
863   *   The text to format (plain-text).
864   * @return
865   *   The formatted text (html).
866   */
867  placeholder: function(str) {
868    return '<em>' + Drupal.checkPlain(str) + '</em>';
869  }
870};
871;
872
873/**
874 * Adds the custom autocomplete widget behavior.
875 */
876Drupal.behaviors.apachesolr_autocomplete = function(context) {
877  $(".apachesolr-autocomplete.unprocessed", context).autocomplete(Drupal.settings.apachesolr_autocomplete.path,
878  {
879    // Classnames for the widget.
880    inputClass: "",
881    loadingClass: "throbbing",
882    // Do not select first suggestion by default.
883    selectFirst: false,
884    // Specify no matching as it wil be done on server-side.
885    matchContains: false,
886    matchSubset: false,
887    // Maximum number of items to show in widget.
888    max: 50,
889    scroll: true,
890    scrollHeight: 360,
891    // Data returned from server is JSON-encoded.
892    dataType: "json",
893    // Function to parse returned json into elements.
894    parse: function(data) {
895      return $.map(data, function(item) {
896        return {
897          data: item,          // Echo the input data.
898          value: item.display, // This will be shown in the options widget.
899          result: item.key     // The actual value to put into the form element.
900        }
901      });
902    },
903    // Return the HTML to display in the options widget.
904    formatItem: function(item) {
905      return item.display;
906    }
907  }).result(function(item, element) {
908    // Handle selection of an element in the autocomplete widget.
909    // We should submit the widget's parent form.
910    $(this).get(0).form.submit();
911  }).addClass('form-autocomplete'); // Add Drupal autocomplete widget's style.
912};
913;
914/*
915 * jQuery Autocomplete plugin 1.1
916 *
917 * Copyright (c) 2009 Jörn Zaefferer
918 *
919 * Dual licensed under the MIT and GPL licenses:
920 *   http://www.opensource.org/licenses/mit-license.php
921 *   http://www.gnu.org/licenses/gpl.html
922 *
923 */
924
925;(function($) {
926	
927$.fn.extend({
928	autocomplete: function(urlOrData, options) {
929		var isUrl = typeof urlOrData == "string";
930		options = $.extend({}, $.Autocompleter.defaults, {
931			url: isUrl ? urlOrData : null,
932			data: isUrl ? null : urlOrData,
933			delay: isUrl ? $.Autocompleter.defaults.delay : 10,
934			max: options && !options.scroll ? 10 : 150
935		}, options);
936		
937		// if highlight is set to false, replace it with a do-nothing function
938		options.highlight = options.highlight || function(value) { return value; };
939		
940		// if the formatMatch option is not specified, then use formatItem for backwards compatibility
941		options.formatMatch = options.formatMatch || options.formatItem;
942		
943		return this.each(function() {
944			new $.Autocompleter(this, options);
945		});
946	},
947	result: function(handler) {
948		return this.bind("result", handler);
949	},
950	search: function(handler) {
951		return this.trigger("search", [handler]);
952	},
953	flushCache: function() {
954		return this.trigger("flushCache");
955	},
956	setOptions: function(options){
957		return this.trigger("setOptions", [options]);
958	},
959	unautocomplete: function() {
960		return this.trigger("unautocomplete");
961	}
962});
963
964$.Autocompleter = function(input, options) {
965
966	var KEY = {
967		UP: 38,
968		DOWN: 40,
969		DEL: 46,
970		TAB: 9,
971		RETURN: 13,
972		ESC: 27,
973		COMMA: 188,
974		PAGEUP: 33,
975		PAGEDOWN: 34,
976		BACKSPACE: 8
977	};
978
979	// Create $ object for input element
980	var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);
981
982	var timeout;
983	var previousValue = "";
984	var cache = $.Autocompleter.Cache(options);
985	var hasFocus = 0;
986	var lastKeyPressCode;
987	var config = {
988		mouseDownOnSelect: false
989	};
990	var select = $.Autocompleter.Select(options, input, selectCurrent, config);
991	
992	var blockSubmit;
993	
994	// prevent form submit in opera when selecting with return key
995	$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
996		if (blockSubmit) {
997			blockSubmit = false;
998			return false;
999		}
1000	});
1001	
1002	// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
1003	$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
1004		// a keypress means the input has focus
1005		// avoids issue where input had focus before the autocomplete was applied
1006		hasFocus = 1;
1007		// track last key pressed
1008		lastKeyPressCode = event.keyCode;
1009		switch(event.keyCode) {
1010		
1011			case KEY.UP:
1012				event.preventDefault();
1013				if ( select.visible() ) {
1014					select.prev();
1015				} else {
1016					onChange(0, true);
1017				}
1018				break;
1019				
1020			case KEY.DOWN:
1021				event.preventDefault();
1022				if ( select.visible() ) {
1023					select.next();
1024				} else {
1025					onChange(0, true);
1026				}
1027				break;
1028				
1029			case KEY.PAGEUP:
1030				event.preventDefault();
1031				if ( select.visible() ) {
1032					select.pageUp();
1033				} else {
1034					onChange(0, true);
1035				}
1036				break;
1037				
1038			case KEY.PAGEDOWN:
1039				event.preventDefault();
1040				if ( select.visible() ) {
1041					select.pageDown();
1042				} else {
1043					onChange(0, true);
1044				}
1045				break;
1046			
1047			// matches also semicolon
1048			case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
1049			case KEY.TAB:
1050			case KEY.RETURN:
1051				if( selectCurrent() ) {
1052					// stop default to prevent a form submit, Opera needs special handling
1053					event.preventDefault();
1054					blockSubmit = true;
1055					return false;
1056				}
1057				break;
1058				
1059			case KEY.ESC:
1060				select.hide();
1061				break;
1062				
1063			default:
1064				clearTimeout(timeout);
1065				timeout = setTimeout(onChange, options.delay);
1066				break;
1067		}
1068	}).focus(function(){
1069		// track whether the field has focus, we shouldn't process any
1070		// results if the field no longer has focus
1071		hasFocus++;
1072	}).blur(function() {
1073		hasFocus = 0;
1074		if (!config.mouseDownOnSelect) {
1075			hideResults();
1076		}
1077	}).click(function() {
1078		// show select when clicking in a focused field
1079		if ( hasFocus++ > 1 && !select.visible() ) {
1080			onChange(0, true);
1081		}
1082	}).bind("search", function() {
1083		// TODO why not just specifying both arguments?
1084		var fn = (arguments.length > 1) ? arguments[1] : null;
1085		function findValueCallback(q, data) {
1086			var result;
1087			if( data && data.length ) {
1088				for (var i=0; i < data.length; i++) {
1089					if( data[i].result.toLowerCase() == q.toLowerCase() ) {
1090						result = data[i];
1091						break;
1092					}
1093				}
1094			}
1095			if( typeof fn == "function" ) fn(result);
1096			else $input.trigger("result", result && [result.data, result.value]);
1097		}
1098		$.each(trimWords($input.val()), function(i, value) {
1099			request(value, findValueCallback, findValueCallback);
1100		});
1101	}).bind("flushCache", function() {
1102		cache.flush();
1103	}).bind("setOptions", function() {
1104		$.extend(options, arguments[1]);
1105		// if we've updated the data, repopulate
1106		if ( "data" in arguments[1] )
1107			cache.populate();
1108	}).bind("unautocomplete", function() {
1109		select.unbind();
1110		$input.unbind();
1111		$(input.form).unbind(".autocomplete");
1112	});
1113	
1114	
1115	function selectCurrent() {
1116		var selected = select.selected();
1117		if( !selected )
1118			return false;
1119		
1120		var v = selected.result;
1121		previousValue = v;
1122		
1123		if ( options.multiple ) {
1124			var words = trimWords($input.val());
1125			if ( words.length > 1 ) {
1126				var seperator = options.multipleSeparator.length;
1127				var cursorAt = $(input).selection().start;
1128				var wordAt, progress = 0;
1129				$.each(words, function(i, word) {
1130					progress += word.length;
1131					if (cursorAt <= progress) {
1132						wordAt = i;
1133						return false;
1134					}
1135					progress += seperator;
1136				});
1137				words[wordAt] = v;
1138				// TODO this should set the cursor to the right position, but it gets overriden somewhere
1139				//$.Autocompleter.Selection(input, progress + seperator, progress + seperator);
1140				v = words.join( options.multipleSeparator );
1141			}
1142			v += options.multipleSeparator;
1143		}
1144		
1145		$input.val(v);
1146		hideResultsNow();
1147		$input.trigger("result", [selected.data, selected.value]);
1148		return true;
1149	}
1150	
1151	function onChange(crap, skipPrevCheck) {
1152		if( lastKeyPressCode == KEY.DEL ) {
1153			select.hide();
1154			return;
1155		}
1156		
1157		var currentValue = $input.val();
1158		
1159		if ( !skipPrevCheck && currentValue == previousValue )
1160			return;
1161		
1162		previousValue = currentValue;
1163		
1164		currentValue = lastWord(currentValue);
1165		if ( currentValue.length >= options.minChars) {
1166			$input.addClass(options.loadingClass);
1167			if (!options.matchCase)
1168				currentValue = currentValue.toLowerCase();
1169			request(currentValue, receiveData, hideResultsNow);
1170		} else {
1171			stopLoading();
1172			select.hide();
1173		}
1174	};
1175	
1176	function trimWords(value) {
1177		if (!value)
1178			return [""];
1179		if (!options.multiple)
1180			return [$.trim(value)];
1181		return $.map(value.split(options.multipleSeparator), function(word) {
1182			return $.trim(value).length ? $.trim(word) : null;
1183		});
1184	}
1185	
1186	function lastWord(value) {
1187		if ( !options.multiple )
1188			return value;
1189		var words = trimWords(value);
1190		if (words.length == 1) 
1191			return words[0];
1192		var cursorAt = $(input).selection().start;
1193		if (cursorAt == value.length) {
1194			words = trimWords(value)
1195		} else {
1196			words = trimWords(value.replace(value.substring(cursorAt), ""));
1197		}
1198		return words[words.length - 1];
1199	}
1200	
1201	// fills in the input box w/the first match (assumed to be the best match)
1202	// q: the term entered
1203	// sValue: the first matching result
1204	function autoFill(q, sValue){
1205		// autofill in the complete box w/the first match as long as the user hasn't entered in more data
1206		// if the last user key pressed was backspace, don't autofill
1207		if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
1208			// fill in the value (keep the case the user has typed)
1209			$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
1210			// select the portion of the value not typed by the user (so the next character will erase)
1211			$(input).selection(previousValue.length, previousValue.length + sValue.length);
1212		}
1213	};
1214
1215	function hideResults() {
1216		clearTimeout(timeout);
1217		timeout = setTimeout(hideResultsNow, 200);
1218	};
1219
1220	function hideResultsNow() {
1221		var wasVisible = select.visible();
1222		select.hide();
1223		clearTimeout(timeout);
1224		stopLoading();
1225		if (options.mustMatch) {
1226			// call search and run callback
1227			$input.search(
1228				function (result){
1229					// if no value found, clear the input box
1230					if( !result ) {
1231						if (options.multiple) {
1232							var words = trimWords($input.val()).slice(0, -1);
1233							$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
1234						}
1235						else {
1236							$input.val( "" );
1237							$input.trigger("result", null);
1238						}
1239					}
1240				}
1241			);
1242		}
1243	};
1244
1245	function receiveData(q, data) {
1246		if ( data && data.length && hasFocus ) {
1247			stopLoading();
1248			select.display(data, q);
1249			autoFill(q, data[0].value);
1250			select.show();
1251		} else {
1252			hideResultsNow();
1253		}
1254	};
1255
1256	function request(term, success, failure) {
1257		if (!options.matchCase)
1258			term = term.toLowerCase();
1259		var data = cache.load(term);
1260		// recieve the cached data
1261		if (data && data.length) {
1262			success(term, data);
1263		// if an AJAX url has been supplied, try loading the data now
1264		} else if( (typeof options.url == "string") && (options.url.length > 0) ){
1265			
1266			var extraParams = {
1267				timestamp: +new Date()
1268			};
1269			$.each(options.extraParams, function(key, param) {
1270				extraParams[key] = typeof param == "function" ? param() : param;
1271			});
1272			
1273			$.ajax({
1274				// try to leverage ajaxQueue plugin to abort previous requests
1275				mode: "abort",
1276				// limit abortion to this input
1277				port: "autocomplete" + input.name,
1278				dataType: options.dataType,
1279				url: options.url,
1280				data: $.extend({
1281					query: lastWord(term),
1282					limit: options.max
1283				}, extraParams),
1284				success: function(data) {
1285					var parsed = options.parse && options.parse(data) || parse(data);
1286					cache.add(term, parsed);
1287					success(term, parsed);
1288				}
1289			});
1290		} else {
1291			// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
1292			select.emptyList();
1293			failure(term);
1294		}
1295	};
1296	
1297	function parse(data) {
1298		var parsed = [];
1299		var rows = data.split("\n");
1300		for (var i=0; i < rows.length; i++) {
1301			var row = $.trim(rows[i]);
1302			if (row) {
1303				row = row.split("|");
1304				parsed[parsed.length] = {
1305					data: row,
1306					value: row[0],
1307					result: options.formatResult && options.formatResult(row, row[0]) || row[0]
1308				};
1309			}
1310		}
1311		return parsed;
1312	};
1313
1314	function stopLoading() {
1315		$input.removeClass(options.loadingClass);
1316	};
1317
1318};
1319
1320$.Autocompleter.defaults = {
1321	inputClass: "ac_input",
1322	resultsClass: "ac_results",
1323	loadingClass: "ac_loading",
1324	minChars: 1,
1325	delay: 400,
1326	matchCase: false,
1327	matchSubset: true,
1328	matchContains: false,
1329	cacheLength: 10,
1330	max: 100,
1331	mustMatch: false,
1332	extraParams: {},
1333	selectFirst: true,
1334	formatItem: function(row) { return row[0]; },
1335	formatMatch: null,
1336	autoFill: false,
1337	width: 0,
1338	multiple: false,
1339	multipleSeparator: ", ",
1340	highlight: function(value, term) {
1341		return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
1342	},
1343    scroll: true,
1344    scrollHeight: 180
1345};
1346
1347$.Autocompleter.Cache = function(options) {
1348
1349	var data = {};
1350	var length = 0;
1351	
1352	function matchSubset(s, sub) {
1353		if (!options.matchCase) 
1354			s = s.toLowerCase();
1355		var i = s.indexOf(sub);
1356		if (options.matchContains == "word"){
1357			i = s.toLowerCase().search("\\b" + sub.toLowerCase());
1358		}
1359		if (i == -1) return false;
1360		return i == 0 || options.matchContains;
1361	};
1362	
1363	function add(q, value) {
1364		if (length > options.cacheLength){
1365			flush();
1366		}
1367		if (!data[q]){ 
1368			length++;
1369		}
1370		data[q] = value;
1371	}
1372	
1373	function populate(){
1374		if( !options.data ) return false;
1375		// track the matches
1376		var stMatchSets = {},
1377			nullData = 0;
1378
1379		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
1380		if( !options.url ) options.cacheLength = 1;
1381		
1382		// track all options for minChars = 0
1383		stMatchSets[""] = [];
1384		
1385		// loop through the array and create a lookup structure
1386		for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
1387			var rawValue = options.data[i];
1388			// if rawValue is a string, make an array otherwise just reference the array
1389			rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
1390			
1391			var value = options.formatMatch(rawValue, i+1, options.data.length);
1392			if ( value === false )
1393				continue;
1394				
1395			var firstChar = value.charAt(0).toLowerCase();
1396			// if no lookup array for this character exists, look it up now
1397			if( !stMatchSets[firstChar] ) 
1398				stMatchSets[firstChar] = [];
1399
1400			// if the match is a string
1401			var row = {
1402				value: value,
1403				data: rawValue,
1404				result: options.formatResult && options.formatResult(rawValue) || value
1405			};
1406			
1407			// push the current match into the set list
1408			stMatchSets[firstChar].push(row);
1409
1410			// keep track of minChars zero items
1411			if ( nullData++ < options.max ) {
1412				stMatchSets[""].push(row);
1413			}
1414		};
1415
1416		// add the data items to the cache
1417		$.each(stMatchSets, function(i, value) {
1418			// increase the cache size
1419			options.cacheLength++;
1420			// add to the cache
1421			add(i, value);
1422		});
1423	}
1424	
1425	// populate any existing data
1426	setTimeout(populate, 25);
1427	
1428	function flush(){
1429		data = {};
1430		length = 0;
1431	}
1432	
1433	return {
1434		flush: flush,
1435		add: add,
1436		populate: populate,
1437		load: function(q) {
1438			if (!options.cacheLength || !length)
1439				return null;
1440			/* 
1441			 * if dealing w/local data and matchContains than we must make sure
1442			 * to loop through all the data collections looking for matches
1443			 */
1444			if( !options.url && options.matchContains ){
1445				// track all matches
1446				var csub = [];
1447				// loop through all the data grids for matches
1448				for( var k in data ){
1449					// don't search through the stMatchSets[""] (minChars: 0) cache
1450					// this prevents duplicates
1451					if( k.length > 0 ){
1452						var c = data[k];
1453						$.each(c, function(i, x) {
1454							// if we've got a match, add it to the array
1455							if (matchSubset(x.value, q)) {
1456								csub.push(x);
1457							}
1458						});
1459					}
1460				}				
1461				return csub;
1462			} else 
1463			// if the exact item exists, use it
1464			if (data[q]){
1465				return data[q];
1466			} else
1467			if (options.matchSubset) {
1468				for (var i = q.length - 1; i >= options.minChars; i--) {
1469					var c = data[q.substr(0, i)];
1470					if (c) {
1471						var csub = [];
1472						$.each(c, function(i, x) {
1473							if (matchSubset(x.value, q)) {
1474								csub[csub.length] = x;
1475							}
1476						});
1477						return csub;
1478					}
1479				}
1480			}
1481			return null;
1482		}
1483	};
1484};
1485
1486$.Autocompleter.Select = function (options, input, select, config) {
1487	var CLASSES = {
1488		ACTIVE: "ac_over"
1489	};
1490	
1491	var listItems,
1492		active = -1,
1493		data,
1494		term = "",
1495		needsInit = true,
1496		element,
1497		list;
1498	
1499	// Create results
1500	function init() {
1501		if (!needsInit)
1502			return;
1503		element = $("<div/>")
1504		.hide()
1505		.addClass(options.resultsClass)
1506		.css("position", "absolute")
1507		.appendTo(document.body);
1508	
1509		list = $("<ul/>").appendTo(element).mouseover( function(event) {
1510			if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') {
1511	            active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
1512			    $(target(event)).addClass(CLASSES.ACTIVE);            
1513	        }
1514		}).click(function(event) {
1515			$(target(event)).addClass(CLASSES.ACTIVE);
1516			select();
1517			// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
1518			input.focus();
1519			return false;
1520		}).mousedown(function() {
1521			config.mouseDownOnSelect = true;
1522		}).mouseup(function() {
1523			config.mouseDownOnSelect = false;
1524		});
1525		
1526		if( options.width > 0 )
1527			element.css("width", options.width);
1528			
1529		needsInit = false;
1530	} 
1531	
1532	function target(event) {
1533		var element = event.target;
1534		while(element && element.tagName != "LI")
1535			element = element.parentNode;
1536		// more fun with IE, sometimes event.target is empty, just ignore it then
1537		if(!element)
1538			return [];
1539		return element;
1540	}
1541
1542	function moveSelect(step) {
1543		listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
1544		movePosition(step);
1545        var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
1546        if(options.scroll) {
1547            var offset = 0;
1548            listItems.slice(0, active).each(function() {
1549				offset += this.offsetHeight;
1550			});
1551            if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
1552                list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
1553            } else if(offset < list.scrollTop()) {
1554                list.scrollTop(offset);
1555            }
1556        }
1557	};
1558	
1559	function movePosition(step) {
1560		active += step;
1561		if (active < 0) {
1562			active = listItems.size() - 1;
1563		} else if (active >= listItems.size()) {
1564			active = 0;
1565		}
1566	}
1567	
1568	function limitNumberOfItems(available) {
1569		return options.max && options.max < available
1570			? options.max
1571			: available;
1572	}
1573	
1574	function fillList() {
1575		list.empty();
1576		var max = limitNumberOfItems(data.length);
1577		for (var i=0; i < max; i++) {
1578			if (!data[i])
1579				continue;
1580			var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
1581			if ( formatted === false )
1582				continue;
1583			var li = $("<li/>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
1584			$.data(li, "ac_data", data[i]);
1585		}
1586		listItems = list.find("li");
1587		if ( options.selectFirst ) {
1588			listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
1589			active = 0;
1590		}
1591		// apply bgiframe if available
1592		if ( $.fn.bgiframe )
1593			list.bgiframe();
1594	}
1595	
1596	return {
1597		display: function(d, q) {
1598			init();
1599			data = d;
1600			term = q;
1601			fillList();
1602		},
1603		next: function() {
1604			moveSelect(1);
1605		},
1606		prev: function() {
1607			moveSelect(-1);
1608		},
1609		pageUp: function() {
1610			if (active != 0 && active - 8 < 0) {
1611				moveSelect( -active );
1612			} else {
1613				moveSelect(-8);
1614			}
1615		},
1616		pageDown: function() {
1617			if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
1618				moveSelect( listItems.size() - 1 - active );
1619			} else {
1620				moveSelect(8);
1621			}
1622		},
1623		hide: function() {
1624			element && element.hide();
1625			listItems && listItems.removeClass(CLASSES.ACTIVE);
1626			active = -1;
1627		},
1628		visible : function() {
1629			return element && element.is(":visible");
1630		},
1631		current: function() {
1632			return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
1633		},
1634		show: function() {
1635			var offset = $(input).offset();
1636			element.css({
1637				width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(),
1638				top: offset.top + input.offsetHeight,
1639				left: offset.left
1640			}).show();
1641            if(options.scroll) {
1642                list.scrollTop(0);
1643                list.css({
1644					maxHeight: options.scrollHeight,
1645					overflow: 'auto'
1646				});
1647				
1648                if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
1649					var listHeight = 0;
1650					listItems.each(function() {
1651						listHeight += this.offsetHeight;
1652					});
1653					var scrollbarsVisible = listHeight > options.scrollHeight;
1654                    list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
1655					if (!scrollbarsVisible) {
1656						// IE doesn't recalculate width when scrollbar disappears
1657						listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
1658					}
1659                }
1660                
1661            }
1662		},
1663		selected: function() {
1664			var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
1665			return selected && selected.length && $.data(selected[0], "ac_data");
1666		},
1667		emptyList: function (){
1668			list && list.empty();
1669		},
1670		unbind: function() {
1671			element && element.remove();
1672		}
1673	};
1674};
1675
1676$.fn.selection = function(start, end) {
1677	if (start !== undefined) {
1678		return this.each(function() {
1679			if( this.createTextRange ){
1680				var selRange = this.createTextRange();
1681				if (end === undefined || start == end) {
1682					selRange.move("character", start);
1683					selRange.select();
1684				} else {
1685					selRange.collapse(true);
1686					selRange.moveStart("character", start);
1687					selRange.moveEnd("character", end);
1688					selRange.select();
1689				}
1690			} else if( this.setSelectionRange ){
1691				this.setSelectionRange(start, end);
1692			} else if( this.selectionStart ){
1693				this.selectionStart = start;
1694				this.selectionEnd = end;
1695			}
1696		});
1697	}
1698	var field = this[0];
1699	if ( field.createTextRange ) {
1700		var range = document.selection.createRange(),
1701			orig = field.value,
1702			teststring = "<->",
1703			textLength = range.text.length;
1704		range.text = teststring;
1705		var caretAt = field.value.indexOf(teststring);
1706		field.value = orig;
1707		this.selection(caretAt, caretAt + textLength);
1708		return {
1709			start: caretAt,
1710			end: caretAt + textLength
1711		}
1712	} else if( field.selectionStart !== undefined ){
1713		return {
1714			start: field.selectionStart,
1715			end: field.selectionEnd
1716		}
1717	}
1718};
1719
1720}
1720)(jQuery);
1721;
1722//Special function to load Drupal.settings.dd.$_GET with the values of GET, like PHP would have access to
1723
1724if (typeof Drupal.dd !== 'object') {
1725  Drupal.dd = {};
1726}
1727
1728Drupal.dd.$_GET = {};
1729
1730document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () {
1731  function decode(s) {
1732    return decodeURIComponent(s.split("+").join(" "));
1733  }
1734
1735  Drupal.dd.$_GET[decode(arguments[1])] = decode(arguments[2]);
1736});
1737
1738/**
1739 * DD Classes Animations
1740 */
1741
1742Drupal.DDClassesAnimations = {
1743  expand: function($content, duration) {
1744    var t = duration || 500;
1745    if ($content.length) {
1746      $content.stop(true,true).animate({opacity:'show', height:'show'}, t);
1747    }
1748  },
1749  collapse: function($content, duration) {
1750    var t = duration || 250;
1751    if ($content.length) {
1752      $content.stop(true,true).animate({opacity:'hide', height:'hide'}, t);
1753    }
1754  },
1755};
1756
1757/**
1758 * Drupal Behaviors
1759 */
1760
1761Drupal.behaviors.ddClassesFitAndFinish = function(context) {
1762  var $advancedMenu = $('.menu-adv', context);
1763
1764  if ($advancedMenu.length) {
1765    $advancedMenu.find('.navbar  a.depth-1').append(" <span class='arrow'>»</span>");
1766    $advancedMenu.find('.navbar .menuparent .menuparent a.depth-2').append(" <span class='arrow'>+</span>");
1767    $advancedMenu.find('.block-menu_block .collapsed a.depth-2').append(" <span class='arrow'>+</span>");
1768    $advancedMenu.find('.block-menu_block .block-title a.depth-2').prepend(" <span class='arrow'>«</span> ");
1769  }
1770};
1771
1772Drupal.behaviors.ddClassesImageLayouts = function(context) {
1773  $.each($(".node-full:not(.hide-captions) .field-image img[title], .enable-captions .field-image img[title], .enable-1-caption .field-image.c1 img[title]", context), function(k,v) {
1774    var image = $(v);
1775    var caption = image.attr('title');
1776    var imageContainer = image.parents('.field-image').slice(0,1);
1777    imageContainer.append("<span class='caption'>" + caption + "</span>");
1778  });
1779};
1780
1781Drupal.behaviors.ddClassesIE7Fixes = function(context) {
1782  if ($.browser.msie && $.browser.version.slice(0,1) === '7') {
1783    $("body").addClass("ie7");
1784    $.each($(".pod-image:visible", context), function(k,v) {
1785      var h = $(v).height();
1786      var w = $(v).width();
1787      $(v).find("span").height(h).width(w);
1788      $(v).find("span").css('display', 'block');
1789    });
1790
1791    $(".nice-menu li:empty, .block-menu_block li:empty", context).hide();
1792    $.each($('.channel > div', context) , function(key, value) {
1793      $(value).css('width', $(value).width() + 'px');
1794    });
1795
1796    $.each($(".channel", context), function(k,v) {
1797      var spacing = $(v).find(".node:last").css('margin-bottom');
1798      $(v).css('padding-bottom', spacing);
1799    });
1800  }
1801};
1802
1803Drupal.behaviors.initSubtermTabs = function(context) {
1804  $('div.switch-subtermtabs', context).each(function (channelIndex, element) {
1805    var $channel = $(element),
1806      count = 0,
1807      tabs = {};
1808
1809    $channel.find('.subterm').each(function (index, block) {
1810      var $block = $(block),
1811        tabName = '';
1812
1813      // Set tab name based on the subterm header text.
1814      if ($channel.hasClass('switch-subtermtabs')) {
1815        tabName = $block.find('.subterm-header').text();
1816      }
1817
1818      if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
1819      tabs[tabName].push($block.attr('id'));
1820    });
1821
1822    // Build an 'All' tab
1823    var alltab = { 'All': [] };
1824    $channel.find('.subterm').each(function (index, block) {
1825      alltab.All.push($(block).attr('id'));
1826    });
1827
1828    // If switch to add the all tab == enabled, put at beginning
1829    if ($channel.hasClass('tabs-all') && $channel.find('.subterm').size()) {
1830      tabs = $.extend(alltab, tabs);
1831    }
1832    // Or perhaps put it at the end
1833    else if ($channel.hasClass('tabs-all-e') && $channel.find('.subterm').size()) {
1834      tabs = $.extend(tabs, alltab);
1835    }
1836
1837    //Binding function e.g. 'click' or 'hover'
1838    var bindingFunction = 'click';
1839
1840    if ($channel.hasClass('tabs-show-hover')) {
1841      bindingFunction = 'mouseover';
1842    }
1843
1844    // Create a tablist which will contain all related tabs.
1845    var $dtabs = $('<div class="dtabs"></div>');
1846    $dtabs.attr({
1847      'role': 'tablist',
1848      'aria-label': 'Filter content by...',
1849    });
1850    // Create the tabs container from the tabs created
1851    $dtabs.prependTo($channel.find('.subterm-inner'));
1852
1853    // Create the tabs which controls which content to display.
1854    $.each(tabs, function(tabName, blocks) {
1855      count++;
1856      var $tab = $('<div class="tab"></div>');
1857      $tab.addClass('tab-'+ count);
1858      $tab.append('<span>' + tabName + ' <em>('+ blocks.length +')</em></span>');
1859      $tab.data('tabGroup', count);
1860      $tab.attr({
1861        'role': 'tab',
1862        'aria-controls': blocks.join(' '),
1863        'id': 'subterm-tabs-button_' + channelIndex + '-' + count,
1864      });
1865
1866      // Add our tab to the tablist container.
1867      $tab.appendTo($dtabs);
1868
1869      // Properly identify the content related to each of the tabs within the tablist.
1870      $.each(blocks, function(blockIndex, block) {
1871        var $underTabs = $channel.find('#' + block);
1872
1873        // Make sure we aren't duplicating efforts assigning variables.
1874        $underTabs.each(function(iii, tabPanelMember) {
1875          var $tabPanelMember = $(tabPanelMember);
1876          if (!$tabPanelMember.data('processed')) {
1877            $tabPanelMember.addClass('subterm-tab-content under-tab under-tab-' + count);
1878            $tabPanelMember.attr({
1879              'role': 'tabpanel',
1880              'aria-labelledby': 'subterm-tabs-button_' + channelIndex + '-' + count,
1881              'tabindex': 0,
1882            });
1883          } else {
1884            var labelledBy = $tabPanelMember.attr('aria-labelledby');
1885            $tabPanelMember
1886              .addClass('under-tab-' + count)
1887              .attr('aria-labelledby', labelledBy + ' subterm-tabs-button_' + channelIndex + '-' + count);
1888          }
1889        });
1890
1891        // Mark these as process so we can not duplicate assignment to attributes.
1892        $underTabs.data('processed', true);
1893      });
1894    });
1895
1896    // Bind the click or mouseover event
1897    $channel.find('.tab').bind(bindingFunction, function(event) {
1898      // Remove active from all tabs
1899      $dtabs.find('.tab')
1900        .removeClass('active')
1901        .attr({
1902          'aria-selected': false,
1903          'tabindex': -1,
1904        });
1905
1906      // Add active class to current tab
1907      $(event.currentTarget)
1908        .addClass('active')
1909        .attr({
1910          'aria-selected': true,
1911          'tabindex': 0,
1912        });
1913
1914      var duration = 250,
1915        $elementsToShow = $channel.find('.subterm-tab-content').filter('.under-tab-' + $(event.currentTarget).data('tabGroup')),
1916        $elementsToHide = $channel.find('.subterm-tab-content').not($elementsToShow);
1917
1918      // Hide all items under any tab
1919      $elementsToHide
1920        .animate({ opacity:'hide', height:'hide' }, duration);
1921
1922      // Show items under current tab
1923      $elementsToShow
1924        .stop(true, true)
1925        .animate({ opacity:'show', height:'show' }, duration * 2);
1926      $elementsToShow
1927        .removeClass('hide-in');
1928    });
1929
1930    // Mouseover event binding
1931    if (bindingFunction === 'mouseover') {
1932      $channel.mouseout(function() {
1933        $channel.find('.under-tab').addClass('hide-in').data('hideIn', 3);
1934      });
1935      $channel.find('.under-tab').mouseover(function() {
1936        $(this).removeClass('hide-in');
1937      });
1938    }
1939
1940    // Initial setup
1941    if ($channel.hasClass('tabs-1st')) {
1942      $channel.find('.under-tab').hide();
1943      $channel.find('.tab-1').get(0).click();
1944    } else if ($channel.hasClass('tabs-expand')) {
1945      $channel.find('.under-tab').hide();
1946    }
1947  });
1948};
1949
1950Drupal.behaviors.initTabs = function(context) {
1951  $('div[class*="switch-tabs-"]', context).not('.switch-tabs-disable').each(function(channelIndex, element) {
1952    var $channel = $(element),
1953      $nodes = $channel.find('.node'),
1954      tabClasses = {},
1955      count = 0,
1956      tabs = {};
1957
1958    // Fail-safe way to extract a Date object from a time element.
1959    function extractDate(dateElement) {
1960      var timeElement = $(dateElement).find('time');
1961      if (timeElement.length == 0) return;
1962
1963      var timeString = timeElement.attr('datetime');
1964      if (!timeString) return;
1965
1966      var match = timeString.match(/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}):(\d{2})?)?$/);
1967      if (!match) return;
1968
1969      return new Date(
1970        parseInt(match[1]),
1971        parseInt(match[2]) - 1,
1972        parseInt(match[3]),
1973        parseInt(match[4] || '0'),
1974        parseInt(match[5] || '0'),
1975        parseInt(match[6] || '0')
1976      );
1977    }
1978
1979    var monthAbbrevs = [
1980      'Jan',
1981      'Feb',
1982      'Mar',
1983      'Apr',
1984      'May',
1985      'Jun',
1986      'Jul',
1987      'Aug',
1988      'Sep',
1989      'Oct',
1990      'Nov',
1991      'Dec'
1992    ];
1993
1994    var monthNames = [
1995      'January',
1996      'February',
1997      'March',
1998      'April',
1999      'May',
2000      'June',
2001      'July',
2002      'August',
2003      'September',
2004      'October',
2005      'November',
2006      'December'
2007    ];
2008
2009    // Do not proceed if no nodes are present within this channel.
2010    if (!$nodes.length) {
2011      return;
2012    }
2013
2014    $nodes.each(function (index, node) {
2015      var $node = $(node),
2016        tabName = '',
2017       tabClass = '';
2018
2019      if ($channel.hasClass( 'switch-tabs-title' )) {
2020        tabName = $node.find('.node-header .title').text();
2021      }
2022      else if ($channel.hasClass( 'switch-tabs-pt' )) {
2023        tabName = $node.find('.node-item .post-type').attr('data-plural');
2024        tabClass = $node.attr('class').match(/pt(\d+)/);
2025        if (tabClass) { tabClass = tabClass[0]; }
2026      }
2027      else if ($channel.hasClass( 'switch-tabs-subtitle' )) {
2028        tabName = $node.find('.node-header .subtitle').text();
2029      }
2030      else if ($channel.hasClass( 'switch-tabs-image' )) {
2031        tabName = $node.find('.node-item .node-upper-image').html();
2032      }
2033      else if ($channel.hasClass( 'switch-tabs-image2' )) {
2034        tabName = $node.find('.node-item .slideshow-images a:first').html();
2035      }
2036      else if ($channel.hasClass( 'switch-tabs-sa' )) {
2037        $node.find('.node-item .meta-access').each(function(k,v) {
2038          tabName = $(v).text();
2039          if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2040          tabs[tabName].push($(node).attr('id'));
2041        });
2042      }
2043      else if ($channel.hasClass( 'switch-tabs-related' )) {
2044        $node.find('.node-item .meta-profile').each(function(k,v) {
2045          tabName = $(v).text();
2046          if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2047          tabs[tabName].push($node.attr('id'));
2048        });
2049      }
2050      else if ($channel.hasClass( 'switch-tabs-post-date' )) {
2051        $node.find('.node-item .post-date').each(function(di, dateElement) {
2052          var date = extractDate(dateElement);
2053          if (date) {
2054            tabName = monthNames[date.getMonth()] + ' ' + date.getDate();
2055          }
2056          // Fall back to legacy date parsing logic.
2057          else {
2058            tabName = $(dateElement).text().split(' ')[0] + ' ' + $(dateElement).text().split(',')[0].split(' ')[1];
2059          }
2060
2061          if (tabName === '') {tabName = 'Other';}
2062          if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2063          tabs[tabName].push($node.attr('id'));
2064        });
2065        // Not sure what was intended here, but reversing an object is impossible.
2066        // tabs = tabs.reverse();
2067      }
2068      else if ($channel.hasClass( 'switch-tabs-post-date-month' )) {
2069        $node.find('.node-item .post-date').each(function(di, dateElement) {
2070          var date = extractDate(dateElement);
2071          if (date) {
2072            tabName = monthNames[date.getMonth()];
2073          }
2074          // Fall back to legacy date parsing logic.
2075          else {
2076            tabName = $(dateElement).text().split(' ')[0];
2077          }
2078
2079          if (tabName === '') {tabName = 'Other';}
2080          if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2081          tabs[tabName].push($node.attr('id'));
2082        });
2083      }
2084      else if ($channel.hasClass( 'switch-tabs-post-date-m-year' )) {
2085        $node.find('.node-item .post-date').each(function(di, dateElement) {
2086          var date = extractDate(dateElement);
2087          if (date) {
2088            tabName = monthNames[date.getMonth()] + ' ' + date.getFullYear();
2089          }
2090          // Fall back to legacy date parsing logic.
2091          else {
2092            tabName = $(dateElement).text().split(' ')[0] + ' ' + $.trim($(dateElement).text().split(',')[1].split('-')[0]);
2093          }
2094
2095          if (tabName === '') {tabName = 'Other';}
2096          if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2097          tabs[tabName].push($node.attr('id'));
2098        });
2099      }
2100      else if ($channel.hasClass( 'switch-tabs-post-date-year' )) {
2101        $node.find('.node-item .post-date').each(function(di, dateElement) {
2102          var date = extractDate(dateElement);
2103          if (date) {
2104            tabName = date.getFullYear();
2105          }
2106          // Fall back to legacy date parsing logic.
2107          else {
2108            tabName = $.trim($(dateElement).text().split(',')[1].split('-')[0]);
2109          }
2110
2111          if (tabName === '') {tabName = 'Other';}
2112          if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2113          tabs[tabName].push($node.attr('id'));
2114        });
2115      }
2116
2117      if (tabName === '') {tabName = 'Other';}
2118      if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2119      tabs[tabName].push($node.attr('id'));
2120      if (tabClass) {tabClasses[tabName] = tabClass;}
2121    });
2122
2123    // Build an "All" tab
2124    var alltab = {'All': []};
2125    $channel.find(".node").each(function (index, node) {
2126      alltab.All.push($(node).attr('id'));
2127    });
2128
2129    // If switch to add the all tab == enabled, put at beginning
2130    if ($channel.hasClass('tabs-all') && $channel.find(".node").size()) {
2131      tabs = $.extend(alltab, tabs);
2132    }
2133    // Or perhaps put it at the end
2134    else if ($channel.hasClass('tabs-all-e') && $channel.find(".node").size()) {
2135      tabs = $.extend(tabs, alltab);
2136    }
2137
2138    //Binding function e.g. 'click' or 'hover'
2139    var bindingFunction = 'click';
2140
2141    if ($channel.hasClass('tabs-show-hover')) {
2142      bindingFunction = 'mouseover';
2143    }
2144
2145    var tabIndicesByHash = {};
2146
2147    // Collect all tab names in preparation for sorting. Note that we can't use
2148    // the ECMAScript 5.0 Object.keys function, because it's not availabe in
2149    // IE 8 and such.
2150    var tabNames = [], tabName;
2151    for (tabName in tabs) {
2152      if (tabs.hasOwnProperty(tabName)) {
2153        tabNames.push(tabName);
2154      }
2155    }
2156
2157    // Sort from new to old in the case of post date years.
2158    if ($channel.hasClass('switch-tabs-post-date-year')) {
2159      var allAtEnd = $channel.hasClass('tabs-all-e');
2160
2161      tabNames.sort(function(a, b) {
2162        if (a == 'All') {
2163          return allAtEnd ? 1 : -1;
2164        }
2165        else if (b == 'All') {
2166          return allAtEnd ? -1 : 1;
2167        }
2168        else {
2169          return -1 * a.localeCompare(b);
2170        }
2171      });
2172    }
2173
2174    // Create a tablist which will contain all related tabs.
2175    var $dtabs = $('<div class="dtabs"></div>');
2176    $dtabs.attr({
2177      'role': 'tablist',
2178      'aria-label': 'Filter content by...',
2179    });
2180    // Add our tablist at the top of the content channel.
2181    $dtabs.prependTo($channel.find('.block-content'));
2182
2183    // Create the tabs which controls which content to display.
2184    $.each(tabNames, function(i, tabName) {
2185      // An array of items by tabname => array(nodeID, nodeID, nodeID)
2186      var nodeIDs = tabs[tabName];
2187      var tabClass;
2188      count++;
2189
2190      if (tabClasses[tabName]) {
2191        tabClass = tabClasses[tabName];
2192      }
2193
2194      // Vary functionality based on views-row or node based rows markup.
2195      var rowBased = $channel.find('.views-row').length;
2196
2197      // Create the tab which controls visibility of it's related tabpanel content.
2198      var $tab = $('<div class="tab"></div>');
2199      $tab.addClass('tab-' + count);
2200      if (tabClass) {
2201        $tab.addClass('tab-' + tabClass);
2202      }
2203      $tab.append('<span>' + tabName + ' <em>('+ nodeIDs.length +')</em></span>');
2204      $tab.data('tabGroup', count);
2205      $tab.attr({
2206        'role': 'tab',
2207        'aria-selected': false,
2208        'id': 'tabs-button_' + channelIndex + '-' + count,
2209        'tabindex': -1,
2210      });
2211
2212      // Manage control assignment based on views-row or node based rows markup.
2213      var ariaControls = nodeIDs;
2214      if (rowBased) {
2215        ariaControls = $.map(nodeIDs, function(value) { return value + '-tabpanel'; });
2216      }
2217
2218      // Aria controls are based on the node ids.
2219      $tab.attr('aria-controls', ariaControls.join(' '));
2220
2221      // Add our tab to the tablist container.
2222      $tab.appendTo($dtabs);
2223
2224      // Properly identify the content related to each of the tabs within the tablist.
2225      $.each(nodeIDs, function(ii, nodeID) {
2226        var $underTabs = rowBased
2227          ? $channel.find('#' + nodeID).parent('.views-row')
2228          : $channel.find('#' + nodeID);
2229
2230        // Make sure we aren't duplicating efforts assigning variables.
2231        $underTabs.each(function(iii, tabPanelMember) {
2232          var $tabPanelMember = $(tabPanelMember);
2233          if (!$tabPanelMember.data('processed')) {
2234            $tabPanelMember.addClass('tab-content under-tab under-tab-' + count);
2235            $tabPanelMember.attr({
2236              'role': 'tabpanel',
2237              'aria-labelledby': 'tabs-button_' + channelIndex + '-' + count,
2238              'tabindex': 0,
2239            });
2240
2241            // Manage definition assignment based on views-row or node based rows markup.
2242            if (rowBased) {
2243              $underTabs.attr('id', nodeID + '-tabpanel');
2244            }
2245          } else {
2246            var ariaLabelledBy = $tabPanelMember.attr('aria-labelledby');
2247            $tabPanelMember
2248              .addClass('under-tab-' + count)
2249              .attr('aria-labelledby', ariaLabelledBy + ' tabs-button_' + channelIndex + '-' + count);
2250          }
2251        });
2252
2253        // Mark these as process so we can not duplicate assignment to attributes.
2254        $underTabs.data('processed', true);
2255      });
2256
2257      // Set the possible tab index based on a hash.
2258      var tabHash = tabName.replace(/\s+/g, '-').replace(/[^\w\d-]/g, '').toLowerCase();
2259      tabIndicesByHash[tabHash] = count;
2260    });
2261
2262    var $tabs = $dtabs.find('.tab');
2263    $tabs.bind(bindingFunction, function(event) {
2264      // Remove active from all tabs
2265      $tabs
2266        .not(event.currentTarget)
2267        .removeClass('active')
2268        .attr({
2269          'aria-selected': false,
2270          'tabindex': -1,
2271        });
2272
2273      // Add active class to current tab
2274      $(event.currentTarget)
2275        .addClass('active')
2276        .attr({
2277          'aria-selected': true,
2278          'tabindex': 0,
2279        });
2280
2281      var duration = 250,
2282      $elementsToShow = $channel.find('.tab-content').filter('.under-tab-' + $(event.currentTarget).data('tabGroup')),
2283      $elementsToHide = $channel.find('.tab-content').not($elementsToShow);
2284
2285      // Hide all items under any tab
2286      $elementsToHide
2287        .animate({ opacity:'hide', height:'hide' }, duration)
2288        .removeClass('js-tabs-show');
2289
2290      // Show items under current tab
2291      $elementsToShow
2292        .stop(true, true)
2293        .animate({ opacity:'show', height:'show' }, duration * 2)
2294        .addClass('js-tabs-show');
2295      $elementsToShow
2296        .removeClass('hide-in');
2297    });
2298
2299    if (bindingFunction === 'mouseover') {
2300      $channel.mouseout(function() {
2301        $channel.find('.under-tab').addClass('hide-in');
2302        $channel.find('.under-tab').data('hideIn', 3);
2303      });
2304      $channel.find('.under-tab').mouseover(function() {
2305        $(this).removeClass('hide-in');
2306      });
2307    }
2308
2309    var match;
2310
2311    if ((match = document.location.hash.match(/^#tab-(.+)$/)) && (index = tabIndicesByHash[match[1]])) {
2312      $channel.find('.under-tab').hide();
2313      $channel.find('.tab-' + index).get(0).click();
2314    } else if ($channel.hasClass('tabs-1st')) {
2315      $channel.find('.under-tab').hide();
2316      $channel.find('.tab-1').get(0).click();
2317    } else if ($channel.hasClass('tabs-expand')) {
2318      $channel.find('.under-tab').hide();
2319    }
2320  });
2321};
2322
2323/*
2324 *   Identifies long undordered lists with relatively short items and adds a CSS class
2325 *   Useful for stacking into two columns to save space.
2326 */
2327Drupal.behaviors.ddIdentifyLongListsOfShortItems = function(context) {
2328  var uls = $(".node-content ul", context);
2329  if (uls.size()) {
2330    $.each(uls, function(k, ul) {
2331      var lis = $(ul).find("li");
2332      var maxLiStringLength = 0;
2333      if (lis.size() > 3) {
2334        $.each (lis, function(k2, li) {
2335          if ($(li).text().length > maxLiStringLength) {
2336            maxLiStringLength = $(li).text().length;
2337          }
2338        });
2339      }
2340      if (maxLiStringLength > 0 && maxLiStringLength < 50) {
2341        $(ul).addClass("long-list-of-short-items");
2342      }
2343    });
2344  }
2345};
2346
2347Drupal.behaviors.ddNodeLevelTabs = function(context) {
2348  var instanceID = 0;
2349  var selector = '.node.h3s-tabs:not(.tabs-processed):not(.h3s-tabs-disable)';
2350  $(selector, context).each(function(i, node) {
2351    var $node = $(node);
2352    var $elements = $node.find('.node-content').children();
2353    var counter = -1;
2354    var tabs = [];
2355
2356    // Add processed identifier.
2357    $node.addClass('tabs-processed');
2358
2359    // Utility array to store the tab content groupings.
2360    var groupings = [];
2361
2362    // Loop through and label all tabbed content appropriately.
2363    $elements.each(function(ii, element) {
2364      var $element = $(element);
2365      if (element.tagName.toLowerCase() == 'h3' && $.trim($element.text())) {
2366        counter++;
2367        groupings[counter] = [];
2368        tabs[counter] = $element.text();
2369      }
2370      if (counter >= 0) {
2371        groupings[counter].push(element);
2372      }
2373    });
2374
2375    // Place all related content into a containing tabpanel element.
2376    $.each(groupings, function (ii, group) {
2377      var $contents = $('<div class="under-tab"></div>');
2378      $contents.attr({
2379        'role': 'tabpanel',
2380        'aria-labelledby': 'h3tabs-button_' + instanceID + '-' + ii,
2381        'id': 'h3tabs-tabpanel_' + instanceID + '-' + ii,
2382        'tabindex': 0,
2383      });
2384      $contents.data('id', ii);
2385      $(group).wrapAll($contents);
2386    })
2387
2388    // Create the tabs which controls which content to display.
2389    var $dtabs = $('<div class="dtabs"></div>');
2390    $dtabs.attr({
2391      'role': 'tablist',
2392      'aria-label': 'Filter content by...',
2393    });
2394
2395    if (tabs.length) {
2396      $dtabs.insertBefore($node.find('.under-tab').eq(0));
2397    }
2398
2399    $.each(tabs, function(ii, tab) {
2400      var $tab = $('<div class="tab"></div>');
2401      $tab.append('<span>' + tab + '</span>');
2402      $tab.addClass('show-tab-' + ii);
2403      $tab.data('id', ii);
2404      $tab.attr({
2405        'role': 'tab',
2406        'aria-selected': false,
2407        'aria-controls': 'h3tabs-tabpanel_' + instanceID + '-' + ii,
2408        'id': 'h3tabs-button_' + instanceID + '-' + ii,
2409      });
2410
2411      // Manage tab and tabpanel state on user interaction or init.
2412      $tab.bind('click', function(event) {
2413        var id = $(event.currentTarget).attr('id').replace('button', 'tabpanel');
2414        $node.find('.under-tab').hide();
2415        $node.find('#' + id).fadeIn('fast');
2416        $dtabs.children()
2417          .removeClass('active')
2418          .attr('aria-selected', false);
2419        $(event.currentTarget)
2420          .addClass('active')
2421          .attr('aria-selected', true);
2422      });
2423
2424      // Add the tab to the tablist.
2425      $tab.appendTo($dtabs);
2426    });
2427
2428    // Expand first tab by default.
2429    var currentTab = 0;
2430
2431    // Expand tabbed content based on hash.
2432    if (window.location.hash.length) {
2433      var $hashed = $node.find(window.location.hash);
2434      if ($hashed.length) {
2435        if ($hashed.is('.under-tab')) {
2436          currentTab = $hashed.data('id');
2437        } else if ($hashed.parents('.under-tab').length) {
2438          currentTab = $hashed.parents('.under-tab').data('id');
2439        }
2440      }
2441    }
2442
2443    // Expand whatever tab is set to be currently active.
2444    if (document.getElementById('h3tabs-button_' + instanceID + '-' + currentTab) !== null) {
2445      document.getElementById('h3tabs-button_' + instanceID + '-' + currentTab).click();
2446    }
2447
2448    // Advance the instanceID of this tabset by 1.
2449    instanceID += 1;
2450  });
2451};
2452
2453//To hide an element, give it the class hide-in and set $(element).data('hideIn', 4) for a four second coundown
2454
2455Drupal.behaviors.ddHideInXSecondsChecker = function(context) {
2456  Drupal.settings.ddCheckHideInXSeconds = function() {
2457    $.each($(".hide-in"), function (i, v) {
2458      var hideIn = $(v).data("hideIn");
2459      if (typeof hideIn === 'undefined') {
2460        hideIn = 0;
2461      }
2462      if (hideIn > 0) {
2463        $(v).data("hideIn", hideIn - 1);
2464      }
2465      else {
2466        $(v).data("hideIn", 0);
2467        $(v).removeClass("hide-in");
2468        $(v).fadeOut("fast");
2469
2470
2471
2472        var activeTab = $(v).parents(".channel").eq(0).find(".dtabs .tab.active").attr('rel');
2473        if (typeof activeTab === 'string') {
2474          if ($(v).hasClass("under-tab-" + activeTab)) {
2475            $(v).parents(".channel").eq(0).find(".dtabs .tab.active").removeClass('active');
2476          }
2477        }
2478      }
2479    });
2480    Drupal.settings.ddHideTimer = setTimeout(Drupal.settings.ddCheckHideInXSeconds, 1000);
2481  };
2482
2483  Drupal.settings.ddHideTimer = setTimeout(Drupal.settings.ddCheckHideInXSeconds, 1000);
2484
2485};
2486
2487Drupal.behaviors.randomDisplay = function(context) {
2488  //get any channel with a random-### class on it.
2489  //e.g. random-4, which means to pick 4 elements to display
2490  //each item gets .picked class
2491
2492  var i, randomChannels, originalHtml, numberOfItemsToPick, numberOfItemsToConsider, collection, itemsNotPicked, randomNum, randomItemToPick, randomItem, picked;
2493
2494  randomChannels = $(".channel[class*='random-']", context);
2495  $.each(randomChannels, function(k,v) {
2496
2497    // Stores original HTML (.block-content) for the admin in the tblock.data('originalHtml');
2498    // if ( $(v).data('originalHtml')) {
2499    //   $(v).find(".block-inner").replaceWith($(v).data('originalHtml'));
2500    // }
2501    // else {
2502    //   originalHtml = $(v).html();
2503    // }
2504    $(v).find('.views-row').removeClass("picked");
2505    numberOfItemsToPick = $(v).attr('class').split('random-').pop().slice(0,1);
2506    numberOfItemsToConsider = $(v).find(".views-row").length;
2507    // grab the last character of the class, e.g. 4 from .random-4
2508    // note: won't work above 9
2509    collection = $('<div class="view-content"></div>');
2510    for (i = 1; i <= numberOfItemsToPick; i++) {
2511      itemsNotPicked = numberOfItemsToConsider - i + 1;
2512      randomNum = Math.ceil(Math.random()*itemsNotPicked); //pick a number between 1 and itemsNotPicked
2513      randomItemToPick = randomNum - 1; //the index starts with zero, so reduce by 1
2514      randomItem = $(v).find(".views-row:not(.picked)").eq(randomItemToPick);
2515      randomItem.addClass("picked");
2516      $(collection).append(randomItem);
2517    }
2518
2519    picked = $(collection);
2520
2521    // $(v).data('originalHtml', originalHtml);
2522    $(v).find(".view-content").replaceWith(picked);
2523
2524  });
2525};
2526
2527Drupal.behaviors.externalWindowsForAttachments = function(context) {
2528  $(".node-links .link-file a").attr('target', '_blank');
2529  $(".node-content .file a").attr('target', '_blank');
2530};
2531
2532/**
2533 * Behavior to apply the overview default state for the Teaser behavior class.
2534 */
2535Drupal.behaviors.defaultTeaserDisplayOverview = function (context) {
2536  var overviews_without_display = $('.dd-overview-block', context).not('.open-new, .te-open-slideshow, .open-lightframe, .webform-ajax, .disable-links');
2537  overviews_without_display.each(function () {
2538    $(this).addClass('te-open-slideshow');
2539  });
2540};
2541
2542Drupal.behaviors.nodeEffects = function(context) {
2543  // TODO: This is broken, remove?
2544  $('.switch-pod-subt', context).each(function() {
2545    var $subtitle = $(this).find('.subtitle');
2546    $subtitle.hide();
2547
2548    $(this).find('.node-header a').hover(function() {
2549      $subtitle.animate({'opacity': '1', 'max-height':'200px'}, 'medium');
2550    }, function() {
2551      $subtitle.animate({'opacity': '0', 'max-height':'0px'}, 'medium');
2552    });
2553  });
2554
2555  // TODO: This is ancient, remove?
2556  $(".switch-pod-slide .node-header a", context).hover(function() {
2557    $(this).find('.subtitle').slideDown('medium');
2558  }, function() {
2559    $(this).find('.subtitle').slideUp('medium');
2560  });
2561
2562  // TODO: This is ancient, remove?
2563  $('.switch-img-swap .node-inner').each(function(k, v) {
2564    var image1Src = $(v).find('.field-image > a > img:visible').eq(0).attr('src');
2565    var image2Src = $(v).find('.slideshow-images > a > img').eq(0).attr('src');
2566
2567    $(v).find('.field-image > a > img').hover(function() {
2568      $(v).find('.field-image > a > img').attr('src', image2Src);
2569    }, function() {
2570      $(v).find('.field-image > a > img').attr('src', image1Src);
2571    });
2572  });
2573
2574  $('.open-new').each(function() {
2575    $(this).find('.node-header a, .field-image a, .link-read-more a').attr('target', '_blank');
2576  });
2577
2578  $('.open-lightframe').each(function() {
2579    // Videos.
2580    $(this).find('.node-header a, .field-image.field-video a, .link-read-more a').attr('rel', 'lightframe').attr('target', '');
2581
2582    // Images.
2583    var img_links = $(this).find(".field-image.field-not-video:not(.image-to-url) a");
2584    $.each(img_links, function (key, link) {
2585      var img = $(link).find('img');
2586      if (img) {
2587        var src = img.attr('src');
2588
2589        // If this is a site image, use the lightbox ImageCache preset.
2590        src = src.replace(
2591          /\/sites\/(main|default)\/files(\/imagecache\/[^\/]+)\/main-images\//,
2592          '/sites/$1/files/imagecache/lightbox/main-images/'
2593        );
2594
2595        $(link).attr('href', src);
2596        $(link).attr('rel', 'lightbox');
2597      }
2598    });
2599  });
2600
2601  /*
2602  var openInLightframe = $(".open-lightframe .node-header a, .open-lightframe .field-image a, .open-lightframe .link-read-more a");
2603  openInLightframe
2604  Drupal.attachBehaviors(openInLightframe);
2605  */
2606
2607  $(".te-open-slideshow .node, .te-open-slideshow.node",context).each(function() {
2608    // Images.
2609    var img_links = $(this).find(".field-image.field-not-video:not(.image-to-url) a");
2610    $.each(img_links, function (key, link) {
2611      var img = $(link).find('img');
2612      if (img) {
2613        var src = img.attr('src');
2614
2615        // If this is a site image, use the lightbox ImageCache preset.
2616        src = src.replace(
2617          /\/sites\/(main|default)\/files(\/imagecache\/[^\/]+)\/main-images\//,
2618          '/sites/$1/files/imagecache/lightbox/main-images/'
2619        );
2620
2621        $(link).attr('href', src);
2622        $(link).attr('rel', 'lightbox');
2623      }
2624    });
2625    Drupal.attachBehaviors(img_links);
2626
2627    // Videos.
2628    var video = $(this).find(".field-image.field-video a");
2629    $.each(video, function () {
2630      $(this).attr('rel', 'lightframe').attr('target', '');
2631    });
2632  });
2633
2634  $(".te-webform-compact .node-webform div:not(.dd_captcha) div.type-textfield", context).each(function() {
2635    var labeltext = $(this).find('label').text().replace(':', '').replace('*', '').trim();
2636    var inputbox = $(this).find('input');
2637
2638    if (inputbox.attr('size') === '60') {
2639      inputbox.attr('size', '20');
2640    }
2641
2642    inputbox.attr('title', labeltext);
2643
2644    if (! inputbox.val().length) {
2645      inputbox.val(labeltext);
2646    }
2647
2648    inputbox.focus(function() {
2649      if ($(this).val() === $(this).attr('title')) {
2650        $(this).val('');
2651      }
2652    });
2653    inputbox.blur(function() {
2654      if ($(this).val() === '') {
2655        $(this).val($(this).attr('title'));
2656      }
2657    });
2658  });
2659
2660  $(".webform-ajax form.webform-client-form", context).submit( function() {
2661    var webform = $(this).parent();
2662    webform.find("input.form-text").each(function() {
2663      if ($(this).val() === $(this).attr('title')) {
2664        $(this).val('');
2665      }
2666    });
2667    webform.fadeTo("fast", 0.5);
2668    webform.find("input[type='submit']").hide();
2669    webform.find(".form-submit").before("<span class='saving-webform'>Saving...</span>");
2670    webform.find(".saving-webform").hide().fadeIn('fast');
2671
2672    $.post($(this).attr('action'), $(this).serialize(), function(response) {
2673      var confirmation = $(response).find(".webform-confirmation");
2674      if (confirmation.size()) {
2675        webform.html(confirmation);
2676        webform.parents(".node").eq(0).addClass('webform-submitted-via-ajax');
2677      }
2678      else {
2679        webform.find(".saving-webform").remove();
2680        var problem = $(response).find(".messages.error");
2681        webform.append(problem);
2682        webform.find("input[type='submit']").show();
2683        webform.find(".messages.error").dialog({ modal: true, height: 'auto'});
2684      }
2685      webform.fadeTo("fast", 1);
2686    });
2687    return false;
2688  });
2689};
2690
2691Drupal.behaviors.slideshowImageBehaviors = function(context) {
2692  $.each($(".icpb-fullscreenslides.node, .icpb-fullscreenslides .node", context), function(k,v) {
2693
2694    //Remove any previous click events
2695    $(v).find(".field-image a").unbind("click");
2696    $(v).find(".field-image a").attr("rel", "");
2697    //For each image, set the new source to the full original images
2698    $.each($(v).find(".field-image a img"), function(k,v) {
2699      $(v).attr("src", $(v).attr("src").replace(/(imagecache\/\w+\/)/i, ''));
2700    });
2701
2702    //When an image is clicked, set the background image source to the current image
2703    $(v).find(".field-image a").click(function(e) {
2704      $("body").addClass("fullslide-mode");
2705      $("body").css("background-image", "url(" + $(this).find("img").attr("src") + ")");
2706      //Mark the link containing the current image with a class
2707      $(v).find(".field-image a").removeClass("currently-displaying-as-full-slide");
2708      $(this).addClass("currently-displaying-as-full-slide");
2709      e.preventDefault();
2710    });
2711
2712    //Setup forward and back buttons. Escape exits the slideshow.
2713    //Todo: add an X button to exit
2714    $(document).unbind("keydown");
2715    $(document).keydown(function(e){
2716      if (e.keyCode == 37) {
2717        $(".currently-displaying-as-full-slide").parent().prev().find("a").click();
2718      }
2719      if (e.keyCode == 39) {
2720        $(".currently-displaying-as-full-slide").parent().next().find("a").click();
2721      }
2722      if (e.keyCode == 27) {
2723        $("body").removeClass("fullslide-mode");
2724        window.location.reload();
2725      }
2726    });
2727  });
2728
2729
2730};
2731
2732Drupal.behaviors.foucChecks = function(context) {
2733  $(".fouc .node", context).css("visibility", "visible");
2734};
2735
2736Drupal.behaviors.correctLastVisibleClasses = function(context) {
2737  // Find all places where meta items appear
2738  $('.meta-inner').each(function() {
2739    // Find all visible meta items in this parent
2740    // Optimization: $('.meta-item:visible', this) is slower, see
2741    // http://jsperf.com/class-visible-vs-filter
2742    var items = $(this).find('.meta-item').filter(':visible');
2743
2744    if (items.length > 0) {
2745      // Add a last class to the last visible meta item in this parent
2746      items.eq(items.length - 1).addClass('last');
2747    }
2748  });
2749};
2750
2751Drupal.behaviors.ddDisableLinks = function(context) {
2752  $('.disable-links', context).each(function() {
2753    var $context = $(this);
2754    var $links = $context.find('.node-header a, .field-image a, .link-read-more a');
2755
2756    $links.each(function() {
2757      var $link = $(this);
2758
2759      // Skip video lightframes.
2760      if ($link.parents().is('.field-video')) {
2761        return;
2762      }
2763
2764      $link.attr('href', '').attr('target', '');
2765    });
2766
2767    $links.click(function() {
2768      return false;
2769    });
2770  });
2771};
2772
2773Drupal.behaviors.emailHide = function(context) {
2774  if ($(".field-email", context).size()) {
2775    $(".field-email", context).each(function(index) {
2776      this.innerHTML = this.innerHTML.replace(/\[remove-this-and-replace-with-at\]/g, '@');
2777    });
2778  }
2779};
2780
2781Drupal.behaviors.initializeStandardClasses = function (context) {
2782  $(".has-video .pod-images", context).click(function() {
2783   $(this).parents(".node").find(".field-image a").trigger('click');
2784   return false;
2785  });
2786};
2787
2788Drupal.behaviors.disableVideoFlashOnMobile = function(context) {
2789  var isiPad = navigator.userAgent.match(/iPad/i) !== null;
2790  var isiPhone = navigator.userAgent.match(/iPhone/i) !== null;
2791
2792  if (isiPad || isiPhone) {
2793    $("a.video-lightframe").unbind('click');
2794    $(".node.has-video").each(function () {
2795      $(this).find(".pod-images").unbind('click');
2796      $(this).find(".node-upper-image a, .node-image a").unbind('click');
2797      $(this).find(".node-upper-image a, .node-image a").attr('rel','');
2798      $(this).find(".node-upper-image a, .node-image a").attr('href', $(this).find("a.video-lightframe").eq(0).attr('href'));
2799    });
2800  }
2801};
2802
2803
2804Drupal.behaviors.dmodelCarousel = function(context) {
2805  var carouselNavigation = "<div class='carousel-navigation'><div class='carousel-previous'><a href='#'><span>«</span></a></div><div class='carousel-pager'></div><div class='carousel-next'><a href='#'><span>»</span></a></div></div>";
2806  $("div[class*='switch-carousel-'].carousel-enabled .view-content", context).cycle('destroy');
2807
2808  $("div[class*='switch-carousel-']:not('.switch-carousel-disable')", context).each(function () {
2809
2810    var classes = $(this).attr('class').split(' ');
2811    var ID = $(this).attr('id');
2812    var isSubtermContainer = ($(this).attr('class').indexOf('main-channel-subterm-') > -1);
2813    var baseContainer = '.view-content';
2814
2815    if (isSubtermContainer) {
2816      baseContainer = '.subterm-inner';
2817    }
2818
2819    var defaultSettings = {
2820      fx:   'fade',
2821      next: '#' + ID + ' .carousel-navigation .carousel-next',
2822      prev: '#' + ID + ' .carousel-navigation .carousel-previous',
2823      timeout: '8000',
2824      pause: true,
2825      pauseOnPagerHover: true,
2826      pager: '#' + ID + ' .carousel-navigation .carousel-pager',
2827      activePagerClass: 'active-slide',
2828      cleartype: true,
2829      cleartypeNoBg: true
2830    };
2831
2832
2833    var customSettings = {
2834
2835      'switch-carousel-fade' : {fx: 'fade', delay: -1000},
2836      'switch-carousel-fade-slow' : {fx: 'fade', delay: 1000, speedOut: 1500, speedIn: 2000},
2837      'switch-carousel-cover' : {fx: 'cover'},
2838      'switch-carousel-uncover' : {fx: 'uncover'},
2839      'switch-carousel-scroll-down' : {fx: 'scrollDown'},
2840      'switch-carousel-slide-simple' : {fx: 'scrollHorz'},
2841      'switch-carousel-slider' : {fx: 'scrollFade'},
2842
2843      'show-carousel-nav' : {next: defaultSettings.next, prev: defaultSettings.prev},
2844      'show-carousel-numbered' : {pagerAnchorBuilder: function(index, e) { return '<a href="#"><span>' + (index + 1) + '</span></a>'; } },
2845      'show-carousel-pager-titles-5r' : {pagerAnchorBuilder: function(index, e) { return '<a href="#">' + $('.node-header a .title', e).html() + "</a>"; } },
2846      'show-carousel-pager-titles-4b' : {next: defaultSettings.next, prev: defaultSettings.prev, pagerAnchorBuilder: function(index, e) { return '<a href="#"><span>' + $('.node-header .title', e).html() + "</span></a>"; } },
2847      'show-carousel-pager-dots' : {next: defaultSettings.next, prev: defaultSettings.prev, pagerAnchorBuilder: function(index, e) { return '<a href="#"><span>&bull;</span></a>'; } },
2848
2849      'carousel-random' : {random: 1},
2850      'carousel-not-random' : {random: false},
2851
2852      'carousel-repeat' : {nowrap: 0},
2853      'carousel-nowrap' : {nowrap: 1},
2854
2855      'carousel8' : {timeout: 8000},
2856      'carousel12' : {timeout: 12000},
2857      'carousel6' : {timeout: 6000},
2858      'carousel3' : {timeout: 3000},
2859      'carousel-manual-advance' : {timeout: 0}
2860    };
2861
2862    var settings = defaultSettings;
2863
2864    $.each(classes, function(index, val) {
2865      if (val && typeof customSettings[val] === 'object') {
2866        $.extend(settings, customSettings[val]);
2867      }
2868    });
2869
2870    $(this).addClass("carousel-enabled");
2871
2872    $(baseContainer, this).before(carouselNavigation).cycle(settings);
2873    $(baseContainer, this).dblclick(function() {
2874      $(this).cycle("pause");
2875    });
2876  });
2877};
2878
2879/**
2880 * DD Classes: Accordions
2881 */
2882
2883Drupal.behaviors.ddAccordion = function(context) {
2884  // Find all accordions that haven't been initialized yet
2885  var $h3accordions = $('.h3accordion.node:not(.accordion-processed), .h3accordion .node:not(.accordion-processed)', context),
2886      $h4accordions = $('.h4accordion.node:not(.accordion-processed), .h4accordion .node:not(.accordion-processed)', context);
2887
2888  // Used to identify nodes with accordions
2889  $h3accordions.addClass('h3a');
2890  $h4accordions.addClass('h4a');
2891
2892  // Iterate through each creating new accordion instances
2893  $h3accordions.add($h4accordions).each(function(id) {
2894    // Only process the accordion instance if it's not been disabled
2895    if (!$(this).hasClass('noaccordion')) {
2896      new Drupal.DDAccordion(this, id);
2897    }
2898  });
2899};
2900
2901Drupal.DDAccordion = function(element, id) {
2902  this.instanceID = id;
2903  this.accordion = element;
2904  this.$accordion = $(element);
2905  this.$headings = [];
2906  this.$contents = [];
2907  this.animations = Drupal.DDClassesAnimations;
2908  this.tag = this.getTag();
2909  this.multipleAllowed = this.setMultipleAllowed();
2910  this.duration = 300;
2911  this.init();
2912};
2913
2914Drupal.DDAccordion.prototype = {
2915  init: function() {
2916    var self = this;
2917
2918    // Mark this accordion processed
2919    self.$accordion.addClass("accordion-processed accordion");
2920
2921    // Group all elements within node content
2922    var $elements = self.$accordion.find(".node-content .body, .node-content .teaser, .node-content .body .under-tab, .node-content .teaser .under-tab").find('> *');
2923    if (!$elements.length) {
2924      $elements = self.$accordion.find(".node-content, .node-content .under-tab").find('> *');
2925    }
2926
2927    var groups = [],
2928      counter = -1,
2929      passedH3 = false;
2930
2931    $.each($elements, function(id, element) {
2932      var $element = $(element),
2933        tagName = element.tagName.toLowerCase();
2934
2935      // If processing h4s as tabs and we pass an h3, mark the flag
2936      if (self.tag == 'h4' && tagName == 'h3') {
2937        passedH3 = true;
2938      }
2939
2940      // Filters for the heading tag element
2941      if (self.tag == tagName && $.trim($element.text())) {
2942        counter++;
2943        passedH3 = false;
2944        groups[counter] = [];
2945        $element.addClass('accordion-heading');
2946
2947        // Add support when anchors are added within a heading.
2948        if ($element.find('a[id]').length) {
2949          var hash = $element.find('a[id]').attr('id');
2950          $element.attr('id', hash);
2951        }
2952
2953        var $link = $('<a href="#"><i class="icon"></i><span class="link-text">' + $element.text() + '</span></a>');
2954        // Add required accessible attributes to our accordion heading link/button.
2955        $link.attr({
2956          'role': 'button',
2957          'aria-expanded': false,
2958          'aria-controls': 'accordion-content-' + self.instanceID + '-' + counter,
2959          'id': 'accordion-heading-' + self.instanceID + '-' + counter,
2960        });
2961
2962        // Fill in contents of heading with our custom markup.
2963        $element.html($link);
2964
2965        // And make sure they don't scroll to the top of the page when clicked
2966        $element.find('a').click(function(event) {
2967          event.preventDefault();
2968        });
2969      }
2970
2971      // Filters for the content following each tag element
2972      if (counter >= 0 && !passedH3) {
2973        groups[counter].push(element);
2974      }
2975    });
2976
2977    // Iterate through content associated with each tab
2978    $.each(groups, function(id) {
2979      var $content = $(groups[id].slice(1));
2980      var $accordionContent = $('<div class="accordion-content"></div>');
2981      // Add required accessible attributes to our accordion content.
2982      $accordionContent.attr({
2983        'role': 'region',
2984        'aria-labelledby': 'accordion-heading-' + self.instanceID + '-' + id,
2985        'id': 'accordion-content-' + self.instanceID + '-' + id,
2986      });
2987      $content.wrapAll($accordionContent);
2988    });
2989
2990    // Save references to all accordion headings
2991    self.$headings = self.$accordion.find('.accordion-heading');
2992
2993    // Save references to all accordion content
2994    self.$contents = self.$accordion.find('.accordion-content');
2995
2996    // Add a click handler to each accordion heading
2997    self.$headings.bind('click', {scope: self}, self.clickHandler);
2998
2999    // Default to setting all accordions collapsed.
3000    this.deactivate(self.$headings);
3001    self.animations.collapse(self.$contents, self.duration);
3002
3003    // If it has the 1st class, expand the first accordion.
3004    if (self.$accordion.hasClass('accordion-1st') || self.$accordion.parents('.accordion-1st').length) {
3005      this.$headings.eq(0).click();
3006    }
3007
3008    // Expand accordions based on a hash.
3009    if (window.location.hash.length) {
3010      // Expand accordion if heading id matches the hash.
3011      self.$headings.filter(window.location.hash).click();
3012
3013      // Expand accordion if content contains an identified element matching the hash.
3014      self.$contents.find(window.location.hash)
3015        .parents('.accordion-content')
3016        .prev('.accordion-heading')
3017        .click();
3018    }
3019  },
3020  clickHandler: function(event) {
3021    var self = event.data.scope,
3022      $heading = $(this),
3023      $content = $heading.next('.accordion-content');
3024
3025    if ($content) {
3026      // Muliple open at once
3027      if (self.multipleAllowed) {
3028        if ($heading.is('.active')) {
3029          self.deactivate($heading);
3030          self.animations.collapse($content, self.duration);
3031        } else {
3032          self.activate($heading);
3033          self.animations.expand($content, self.duration);
3034        }
3035      } else {
3036        // One open at a time
3037        if ($heading.is('.active')) {
3038          // Deactive these elements
3039          self.deactivate($heading);
3040          self.animations.collapse($content, self.duration);
3041        } else {
3042          // Activate these elements
3043          self.activate($heading);
3044          self.animations.expand($content, self.duration);
3045          // Deactivate these elements
3046          self.deactivate(self.$headings.not($heading));
3047          self.animations.collapse(self.$contents.not($content), self.duration);
3048        }
3049      }
3050    }
3051  },
3052  // Manages the 'active' state of our accordion headings.
3053  activate: function($elements) {
3054    $elements.addClass('active');
3055    $elements.find('[role="button"]').attr('aria-expanded', true);
3056  },
3057  // Manages the 'inactive' state of our accordion headings.
3058  deactivate: function($elements) {
3059    $elements.removeClass('active');
3060    $elements.find('[role="button"]').attr('aria-expanded', false);
3061  },
3062  getTag: function () {
3063    var tag = 'h3';
3064
3065    if (this.$accordion.hasClass('h4a')) {
3066      tag = 'h4';
3067    }
3068
3069    return tag;
3070  },
3071  setMultipleAllowed: function() {
3072    // Set multi flag
3073    return this.$accordion.hasClass('accordion-multi') || this.$accordion.parents('.accordion-multi').length;
3074  }
3075};
3076
3077/*
3078 * Function to append TOC to the sidebar if node has class toc-right or toc-left.
3079 */
3080function appendTocToSidebar(context) {
3081  var leftSidebar = $('aside.page-left',context).find('div.page-sidebar.inner');
3082  var rightSidebar = $('aside.page-right',context).find('div.page-sidebar.inner');
3083  var tocRight = $('.toc-right');
3084  var tocLeft = $('.toc-left');
3085
3086  tocRight.find('#toc-wrapper').appendTo(rightSidebar).addClass('sidebar-toc');
3087  tocLeft.find('#toc-wrapper').appendTo(leftSidebar).addClass('sidebar-toc');
3088}
3089
3090Drupal.behaviors.switchTableOfContents = function(context) {
3091
3092  $("#toc-wrapper").remove();
3093
3094  $("#node-full.s-toc .node-content", context).prepend("<div id='toc-wrapper'><h2 id='toc-top' class='toc-title'>Table of contents</h2><ul id='toc'></ul></div>");
3095  $("#node-full.s-toc #toc", context).hide().tableOfContents(
3096    $("#node-full.s-toc"),      // Scoped to this element
3097    {
3098      startLevel: 3,    // H2 and up
3099      depth:      2,    // H2 through H4,
3100      topLinks:   true // Add "Top" Links to Each Header
3101    }
3102  ).slideDown("slow");
3103
3104  $(".channel.s-toc .block-inner", context).prepend("<div id='toc-wrapper'><h2 id='toc-top' class='toc-title'>In this section</h2><ul id='toc'></ul></div>");
3105  $(".channel.s-toc #toc", context).hide().tableOfContents(
3106    $("#toc-wrapper ~"),      // Scoped to this element
3107    {
3108      startLevel: 2,    // H2 and up
3109      depth:      3,    // H2 through H4,
3110      topLinks:   true // Add "Top" Links to Each Header
3111    }
3112  ).slideDown("slow");
3113
3114  //Legacy switch-toc support for help and other areas
3115
3116  $(".switch-toc", context).prepend("<div id='toc-wrapper'><h2 id='toc-top' class='toc-title'>In this section</h2><ul id='toc'></ul></div>");
3117  $(".switch-toc #toc", context).hide().tableOfContents(
3118    $(".switch-toc"),      // Scoped to this element
3119    {
3120      startLevel: 3,    // H2 and up
3121      depth:      2,    // H2 through H4,
3122      topLinks:   true // Add "Top" Links to Each Header
3123    }
3124  ).slideDown("slow");
3125
3126  // TOC position.
3127  // If we have class toc-right or toc-left it will append TOC to the sidebar.
3128  // Otherwise it will stay on top of the node.
3129  if($(window).width() >= 1025) {
3130    appendTocToSidebar(context);
3131  }
3132
3133  $(window).resize(function() {
3134    var toc = $('#toc-wrapper');
3135    if ($(this).width() >= 1025) {
3136      appendTocToSidebar(context);
3137    }
3138    else {
3139      $("#node-full.s-toc .node-content", context).prepend(toc);
3140      toc.removeClass('sidebar-toc');
3141    }
3142  });
3143};
3144
3145Drupal.behaviors.fixLightbox = function(context) {
3146  (function() {
3147    if (typeof Lightbox !== 'undefined') {
3148      Lightbox.filterXSS = function(str, allowed_tags) {
3149        return str.replace(/<\/?[^>]+(>|$)/g, "");
3150      };
3151      Lightbox.alternative_layout = 1;
3152      Lightbox.isSlideshow = true;
3153      Lightbox.togglePlayPause('lightshowPause', 'lightshowPlay');
3154    }
3155  }());
3156};
3157
3158
3159Drupal.behaviors.forceRowsToHaveSameHeight = function(context) {
3160
3161  var channels = $(".channel.force-rows", context);
3162
3163  $.each(channels, function (channel_k, channel_v) {
3164    var nodes = $(channel_v).find(".node");
3165    var numberOfNodesInChannel = $(channel_v).size();
3166    var lastTop = 0;
3167    var maxH = 1;
3168    var rowCount = 0;
3169
3170    //Reset height
3171    $(channel_v).find(".dd-row").height("");
3172
3173    $.each(nodes, function (k,v) {
3174      var itemHeight = $(v).height();
3175      var currentPosition = $(v).position();
3176
3177      if (currentPosition.top != lastTop) {
3178        rowCount++;
3179        lastTop = currentPosition.top;
3180        if (rowCount == 1) {
3181          $(channel_v).find(".dd-current-row").addClass("dd-first-row");
3182        }
3183        if (k == numberOfNodesInChannel) {
3184          $(channel_v).find(".dd-current-row").addClass("dd-last-row");
3185        }
3186
3187        $(channel_v).find(".dd-current-row").height(maxH);
3188        $(channel_v).find(".dd-current-row").removeClass("dd-current-row");
3189        maxH = 0;
3190      }
3191      $(v).addClass('dd-current-row').addClass('dd-row');
3192      if (itemHeight > maxH) {
3193        maxH = itemHeight;
3194      }
3195
3196
3197    });
3198  });
3199
3200};
3201
3202Drupal.behaviors.ddClassesImageGalleryPlugin = function(context) {
3203  // Elements identified by the image-gallery classname.
3204  $('.image-gallery', context).each(function() {
3205    var $instance = $(this),
3206      classes = $instance.attr('class').split(/\s/),
3207      options = {};
3208
3209    // Available plugins configurable options manipulated by classnames.
3210    var customSettings = {
3211      // Autoplay
3212      'gallery-ap':   {autoPlay: true},
3213      'gallery-no-ap':{autoPlay: false},
3214      // Progress bar
3215      'gallery-pb':   {showProgressBar: true},
3216      'gallery-no-pb':{showProgressBar: false},
3217      // Aspect ratio
3218      'gallery-ar43': {aspectRatio: '4:3'},
3219      'gallery-ar34': {aspectRatio: '3:4'},
3220      'gallery-ar32': {aspectRatio: '3:2'},
3221      'gallery-ar11': {aspectRatio: '1:1'},
3222      'gallery-ar169':{aspectRatio: '16:9'},
3223      // Animation duration
3224      'gallery-ad4':  {duration: 400},
3225      'gallery-ad6':  {duration: 600},
3226      'gallery-ad8':  {duration: 800},
3227      'gallery-ad10': {duration: 1000},
3228      // Duration between slides
3229      'gallery-sd4':  {slideshowDuration: 4000},
3230      'gallery-sd6':  {slideshowDuration: 6000},
3231      'gallery-sd8':  {slideshowDuration: 8000},
3232      'gallery-sd10': {slideshowDuration: 10000},
3233      'gallery-sd12': {slideshowDuration: 12000}
3234    };
3235
3236    // See if one of the classnames is an object key.
3237    $.each(classes, function(key, value) {
3238      if (value && typeof customSettings[value] === 'object') {
3239        $.extend(options, customSettings[value]);
3240      }
3241    });
3242
3243    // Create image gallery instances.
3244    $instance.gallery(options);
3245  });
3246};
3247
3248/**
3249 * Enables expanding overviews on term pages when "read more" is clicked.
3250 */
3251Drupal.behaviors.ddClassesExpanding = function(context) {
3252  $('.oexpanding .expanding', context).each(function() {
3253    var teaser = $(this).find('.teaser'),
3254        body = $(this).find('.body'),
3255        readmore = $(this).parents('div.node-inner').find('.link-read-more');
3256    readmore.find('a').click(function(e) {
3257      e.preventDefault();
3258      teaser.hide();
3259      body.show();
3260      readmore.hide();
3261      $(this).parents('div.node').removeClass('has-more');
3262    });
3263  });
3264};
3265
3266/*
3267(function(d){d.fn.shuffle=function(c){c=[];return this.each(function(){c.push(d(this).clone(true))}).each(function(a,b){d(b).replaceWith(c[a=Math.floor(Math.random()*c.length)]);c.splice(a,1)})};d.shuffle=function(a){return d(a).shuffle()}})(jQuery);
3268
3269*/
3270
3271/*
3272  TableOfContents Plugin for jQuery
3273
3274  Programmed by Doug Neiner
3275  Edited by Dennis Stevense for Digital Deployment
3276
3277  Version: 0.8-digitaldeployment
3278
3279  Based on code and concept by Janko Jovanovic
3280    in his article: http://www.jankoatwarpspeed.com/post/2009/08/20/Table-of-contents-using-jQuery.aspx
3281
3282  This plugin is offered under the MIT license:
3283
3284  (c) 2009 by Doug Neiner, http://dougneiner.com
3285
3286  Permission is hereby granted, free of charge, to any person obtaining
3287    a copy of this software and associated documentation files (the
3288    "Software"), to deal in the Software without restriction, including
3289    without limitation the rights to use, copy, modify, merge, publish,
3290    distribute, sublicense, and/or sell copies of the Software, and to
3291    permit persons to whom the Software is furnished to do so, subject to
3292    the following conditions:
3293
3294    The above copyright notice and this permission notice shall be
3295    included in all copies or substantial portions of the Software.
3296
3297    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
3298    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3299    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
3300    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
3301    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
3302    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
3303    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3304
3305*/
3306
3307
3308(function($){
3309
3310    $.TableOfContents = function(el, scope, options){
3311        // To avoid scope issues, use 'base' instead of 'this'
3312        // to reference this class from internal events and functions.
3313        var base = this;
3314
3315        // Access to jQuery and DOM versions of element
3316        base.$el = $(el);
3317        base.el = el;
3318
3319    base.toc = "";                               // We use this to build our TOC;
3320    base.listStyle = null;                       // This will store the type of list
3321    base.tags = ["h1","h2","h3","h4","h5","h6"]; // The six header tags
3322
3323
3324        base.init = function(){
3325      // Merge the defaultOptions with any options passed in
3326            base.options = $.extend({},$.TableOfContents.defaultOptions, options);
3327
3328      // Gets the scope. Defaults to the entire document if not specified
3329            if(typeof(scope) == "undefined" || scope == null) scope = document.body;
3330            base.$scope = $(scope);
3331
3332      // Find the first heading withing the scope
3333      var $first = base.$scope.find(base.tags.join(', ')).filter(':first');
3334
3335      // If no headings were found, stop building the TOC
3336      if($first.length !== 1) return;
3337
3338      // Set the starting depth
3339      base.starting_depth = base.options.startLevel;
3340
3341      // Quick validation on depth
3342      if(base.options.depth < 1) base.options.depth = 1;
3343
3344      // Get only the tags starting with startLevel, and counting the depth
3345      var filtered_tags = base.tags.splice(base.options.startLevel - 1, base.options.depth);
3346
3347      // Cache all the headings that match our new filter
3348      base.$headings = base.findHeadings(base.$scope, filtered_tags.join(', '));
3349
3350      // If topLinks is enabled, set/get an id for the body element
3351      if(base.options.topLinks !== false){
3352        var id = $(document.body).attr('id');
3353        if(id == "") {
3354          id = base.options.topBodyId;
3355          //document.body.id = id;
3356        }
3357
3358        // Cache the id locally
3359        base.topLinkId = id;
3360      }
3361
3362
3363      // Find out which list style to use
3364      if(base.$el.is('ul')){
3365        base.listStyle = 'ul';
3366      } else if (base.$el.is('ol')){
3367        base.listStyle = 'ol';
3368      }
3369
3370
3371      base.buildTOC();
3372
3373      if(base.options.proportionateSpacing === true && !base.tieredList()){
3374        base.addSpacing();
3375      }
3376
3377      return base; // Return this object for memory cleanup
3378        };
3379
3380    base.findHeadings = function($element, selector, $headings) {
3381      // If no headings are given, default to an empty jQuery set
3382      if ($headings === undefined) {
3383        $headings = $([]);
3384      }
3385
3386      // Iterate the children in order
3387      $element.children().each(function(i, child) {
3388        $child = $(child);
3389
3390        if ($child.is(selector)) {
3391          // We found a header, add it
3392          $headings = $headings.add($child);
3393        }
3394        else {
3395          // Recurse
3396          $headings = base.findHeadings($child, selector, $headings);
3397        }
3398      });
3399
3400      return $headings;
3401    };
3402
3403    // Helper function that returns true for both OL and UL lists
3404    base.tieredList = function(){
3405      return (base.listStyle === 'ul' || base.listStyle === 'ol');
3406    };
3407
3408    base.buildTOC = function(){
3409      base.current_depth = base.starting_depth;
3410
3411      base.$headings.each(function(i,element){
3412        // Get current depth base on h1, h2, h3, etc.
3413        var depth = parseInt(this.nodeName.toLowerCase().substr(1, 1));
3414
3415        // This changes depth, or adds separators, only if not the first item
3416        if(i > 0 || ( i === 0 && depth !== base.current_depth)){
3417          base.changeDepth(depth);
3418        }
3419
3420        // Add the TOC link
3421        base.toc += base.formatLink(this, depth, i) + "\n";
3422
3423        // Add the topLink if enabled
3424        if(base.options.topLinks !== false) base.addTopLink(this);
3425      });
3426
3427      // Close up any nested list
3428      base.changeDepth(base.starting_depth, true);
3429
3430      // Wrap entire TOC in an LI if item was nested.
3431      if(base.tieredList()) base.toc = "<li>\n" + base.toc + "</li>\n";
3432
3433      // Update the TOC element with the completed TOC
3434      base.$el.html(base.toc);
3435    };
3436
3437    base.addTopLink = function(element){
3438      // Get the text for the link (if topLinks === true, it defaults to "Top")
3439      var text = (base.options.topLinks === true ? "Back to contents" : base.options.topLinks );
3440      var $a = $("<a href='#" + base.topLinkId + "' class='" + base.options.topLinkClass + "'></a>")
3441        .html('<span>
3441' + text + '</span>');
3442
3443      // Append to the current Header element
3444      $(element).prepend($a);
3445    };
3446
3447    base.formatLink = function(element, depth, index){
3448      // Get the current id of the header element
3449      var id, a;
3450      id = element.id;
3451
3452      // If no id exisits, create a unique one
3453      if(id === ""){
3454        id = base.buildSlug($(element).text());
3455        element.id = id;
3456      }
3457
3458      // Start building the a link
3459      a = "<a href='#" + id + "'";
3460
3461      // If this isn't a tiered list, we need to add the depth class
3462      if(!base.tieredList()) { a += " class='" + base.depthClass(depth) + "'"; }
3463
3464      // Finish building the link
3465      if ($(element).find("a").size()) {
3466        a += ">" + base.options.levelText.replace('%', $(element).find("a").html()) + '</a>';
3467      }
3468      else {
3469        a += ">" + base.options.levelText.replace('%', $(element).html()) + '</a>';
3470      }
3471      return a;
3472    };
3473
3474    base.changeDepth = function(new_depth, last){
3475      var i, opening_tags, closing_tags, li;
3476
3477      if(last !== true) { last = false; }
3478
3479      // If straight links, just change depth and return
3480      if(!base.tieredList()){
3481        base.current_depth = new_depth;
3482        return true;
3483      }
3484
3485      // If nested
3486      if(new_depth > base.current_depth){
3487        // Add enough opening tags to step into the heading
3488        // as it is possible that a poorly built document
3489        // steps from h1 to h3 without an h2
3490        opening_tags = [];
3491        for(i = base.current_depth; i < new_depth; i++){
3492          opening_tags.push('<' + base.listStyle + '>' + "\n");
3493        }
3494       li = "<li>\n";
3495
3496        // Add the code to our TOC and an opening LI
3497        base.toc += opening_tags.join(li) + li;
3498
3499      } else if (new_depth < base.current_depth){
3500        // Close all the loops
3501        closing_tags = [];
3502        for(i = base.current_depth; i > new_depth; i--){
3503          closing_tags.push('</' + base.listStyle + '>' + "\n");
3504        }
3505
3506        // Add closing LI and any additional closing tags
3507        base.toc += "</li>\n" + closing_tags.join('</li>' + "\n");
3508
3509        // Open next block
3510        if (!last) {
3511          base.toc += "</li>\n<li>\n";
3512        }
3513      } else {
3514        // Just close a tag and open a new one
3515        // since the depth has not changed
3516        if (!last) {
3517          base.toc += "</li>\n<li>\n";
3518        }
3519      }
3520
3521      // Store the new depth
3522      base.current_depth = new_depth;
3523    };
3524
3525    base.buildSlug = function(text){
3526      text = text.toLowerCase().replace(/[^a-z0-9 \-]/gi,'').replace(/ /gi,'-');
3527      text = text.substr(0,50);
3528      return text;
3529    };
3530
3531    base.depthClass = function(depth){
3532      // Normalizes the depths to always start at 1, even if the starting tier is a h4
3533      return base.options.levelClass.replace('%', (depth - ( base.starting_depth - 1 ) ) );
3534    };
3535
3536    base.addSpacing = function(){
3537      var start = base.$headings.filter(':first').position().top;
3538
3539      base.$headings.each(function(i,el){
3540        var $a = base.$el.find('a:eq(' + i + ')');
3541        var pos = (
3542            ( $(this).position().top - start ) /
3543            ( base.$scope.height()   - start )
3544          ) * base.$el.height();
3545        $a.css({
3546          position: "absolute",
3547          top: pos
3548        });
3549      });
3550    };
3551
3552        return base.init();
3553    };
3554
3555
3556    $.TableOfContents.defaultOptions = {
3557    // One option is set by the container element, and not by changing
3558    // a setting here. That is the type of TOC to output. For a nested ordered list
3559    // make sure your wrapping element is an <ol>. For a nested bulleted list
3560    // make sure your wrapping element is an <ul>. For a straight outputting of links
3561    // use any other element.
3562
3563    // Which H tags should be the root items. h1 = 1, h2 = 2, etc.
3564    startLevel: 1,
3565
3566    // How many levels of H tags should be shown, including the startLevel
3567    // startLevel: 1, depth: 3 = h1, h2, h3
3568    // startLevel: 2, depth: 3 = h2, h3, h4
3569        depth: 3,
3570
3571    // Each link in a straight set is give a class designating how deep it is.
3572    // You can change the class by changing this option,
3573    // but you must include a % sign where you want the number to go.
3574    // Nested lists do not add classes, as you can determine their depth with straight css
3575    levelClass: "toc-depth-%",
3576
3577    // When each link is formed, you can supply additional html or text to be formatted
3578    // with the text of the header. % represents the text of the header
3579    levelText: "%",
3580
3581    // This plugin can add "To Top" links to each header element if you want.
3582    // Set topLinks to true to use the text "Top" or set it to some text or html
3583    // content you wish to use as the body of the link
3584    topLinks: false,
3585
3586    // If topLinks is either true or a text/html value, you can also set the following options:
3587
3588    // Class of the link that is added to the headers
3589    topLinkClass: "toc-top-link",
3590
3591    // Which class should be added to the body element if it does not
3592    // already have an id associated with it
3593    topBodyId: "toc-top",
3594
3595    // To have the TOC spaced proportionatly to the spacing of the headings,
3596    // you must have a fixed height on the TOC wrapper, and it must "haveLayout"
3597    // either position = fixed | absolute | relative
3598    // Finally, the TOC wrapper must not be a UL or an LI or this setting will
3599    // have no effect
3600    proportionateSpacing: false
3601
3602    };
3603
3604
3605    $.fn.tableOfContents = function(scope, options){
3606        return this.each(function(){
3607            var toc = new $.TableOfContents(this, scope, options);
3608      delete toc; // Free memory
3609        });
3610    };
3611
3612
3613})(jQuery);
3614
3615/*
3616 * jQuery Cycle Plugin (with Transition Definitions)
3617 * Examples and documentation at: http://jquery.malsup.com/cycle/
3618 * Copyright (c) 2007-2010 M. Alsup
3619 * Version: 2.88 (08-JUN-2010)
3620 * Dual licensed under the MIT and GPL licenses.
3621 * http://jquery.malsup.com/license.html
3622 * Requires: jQuery v1.2.6 or later
3623 */
3624(function($){var ver="2.88";
3624if($.support==undefined){$.support={opacity:!($.browser.msie)};}function debug(s){if($.fn.cycle.debug){log(s);}}function log(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "));}}$.fn.cycle=function(options,arg2){var o={s:this.selector,c:this.context};if(this.length===0&&options!="stop"){if(!$.isReady&&o.s){log("DOM not ready, queuing slideshow");$(function(){$(o.s,o.c).cycle(options,arg2);});return this;}log("terminating; zero elements found by selector"+($.isReady?"":" (DOM not ready)"));return this;}return this.each(function(){var opts=handleArguments(this,options,arg2);if(opts===false){return;}opts.updateActivePagerLink=opts.updateActivePagerLink||$.fn.cycle.updateActivePagerLink;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=this.cyclePause=0;var $cont=$(this);var $slides=opts.slideExpr?$(opts.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){log("terminating; too few slides: "+els.length);return;}var opts2=buildOptions($cont,$slides,els,opts,o);if(opts2===false){return;}var startTime=opts2.continuous?10:getTimeout(els[opts2.currSlide],els[opts2.nextSlide],opts2,!opts2.rev);if(startTime){startTime+=(opts2.delay||0);if(startTime<10){startTime=10;}debug("first timeout: "+startTime);this.cycleTimeout=setTimeout(function(){go(els,opts2,0,(!opts2.rev&&!opts.backwards));},startTime);}});};function handleArguments(cont,options,arg2){if(cont.cycleStop==undefined){cont.cycleStop=0;}if(options===undefined||options===null){options={};}if(options.constructor==String){switch(options){case"destroy":case"stop":var opts=$(cont).data("cycle.opts");if(!opts){return false;}cont.cycleStop++;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);}cont.cycleTimeout=0;$(cont).removeData("cycle.opts");if(options=="destroy"){destroy(opts);}return false;case"toggle":cont.cyclePause=(cont.cyclePause===1)?0:1;checkInstantResume(cont.cyclePause,arg2,cont);return false;case"pause":cont.cyclePause=1;return false;case"resume":cont.cyclePause=0;checkInstantResume(false,arg2,cont);return false;case"prev":case"next":var opts=$(cont).data("cycle.opts");if(!opts){log('options not found, "prev/next" ignored');return false;}$.fn.cycle[options](opts);return false;default:options={fx:options};}return options;}else{if(options.constructor==Number){var num=options;options=$(cont).data("cycle.opts");if(!options){log("options not found, can not advance slide");return false;}if(num<0||num>=options.elements.length){log("invalid slide index: "+num);return false;}options.nextSlide=num;if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}if(typeof arg2=="string"){options.oneTimeFx=arg2;}go(options.elements,options,1,num>=options.currSlide);return false;}}return options;function checkInstantResume(isPaused,arg2,cont){if(!isPaused&&arg2===true){var options=$(cont).data("cycle.opts");if(!options){log("options not found, can not resume");return false;}if(cont.cycleTimeout){clearTimeout(cont.cycleTimeout);cont.cycleTimeout=0;}go(options.elements,options,1,(!opts.rev&&!opts.backwards));}}}function removeFilter(el,opts){if(!$.support.opacity&&opts.cleartype&&el.style.filter){try{el.style.removeAttribute("filter");}catch(smother){}}}function destroy(opts){if(opts.next){$(opts.next).unbind(opts.prevNextEvent);}if(opts.prev){$(opts.prev).unbind(opts.prevNextEvent);}if(opts.pager||opts.pagerAnchorBuilder){$.each(opts.pagerAnchors||[],function(){this.unbind().remove();});}opts.pagerAnchors=null;if(opts.destroy){opts.destroy(opts);}}function buildOptions($cont,$slides,els,options,o){var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});if(opts.autostop){opts.countdown=opts.autostopCount||els.length;}var cont=$cont[0];$cont.data("cycle.opts",opts);opts.$cont=$cont;opts.stopCount=cont.cycleStop;opts.elements=els;opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];opts.after.unshift(function(){opts.busy=0;});if(!$.support.opacity&&opts.cleartype){opts.after.push(function(){removeFilter(this,opts);});}if(opts.continuous){opts.after.push(function(){go(els,opts,0,(!opts.rev&&!opts.backwards));});}saveOriginalOpts(opts);if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($slides);}if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}if(opts.startingSlide){opts.startingSlide=parseInt(opts.startingSlide);}
3624else{if(opts.backwards){opts.startingSlide=els.length-1;}}if(opts.random){opts.randomMap=[];for(var i=0;i<els.length;i++){opts.randomMap.push(i);}opts.randomMap.sort(function(a,b){return Math.random()-0.5;});opts.randomIndex=1;opts.startingSlide=opts.randomMap[1];}else{if(opts.startingSlide>=els.length){opts.startingSlide=0;}}opts.currSlide=opts.startingSlide||0;var first=opts.startingSlide;$slides.css({position:"absolute",top:0,left:0}).hide().each(function(i){var z;if(opts.backwards){z=first?i<=first?els.length+(i-first):first-i:els.length-i;}else{z=first?i>=first?els.length-(i-first):first-i:els.length-i;}$(this).css("z-index",z);});$(els[first]).css("opacity",1).show();removeFilter(els[first],opts);if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}var reshape=opts.containerResize&&!$cont.innerHeight();if(reshape){var maxw=0,maxh=0;for(var j=0;j<els.length;j++){var $e=$(els[j]),e=$e[0],w=$e.outerWidth(),h=$e.outerHeight();if(!w){w=e.offsetWidth||e.width||$e.attr("width");}if(!h){h=e.offsetHeight||e.height||$e.attr("height");}maxw=w>maxw?w:maxw;maxh=h>maxh?h:maxh;}if(maxw>0&&maxh>0){$cont.css({width:maxw+"px",height:maxh+"px"});}}if(opts.pause){$cont.hover(function(){this.cyclePause++;},function(){this.cyclePause--;});}if(supportMultiTransitions(opts)===false){return false;}var requeue=false;options.requeueAttempts=options.requeueAttempts||0;$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:($el.height()||this.offsetHeight||this.height||$el.attr("height")||0);this.cycleW=(opts.fit&&opts.width)?opts.width:($el.width()||this.offsetWidth||this.width||$el.attr("width")||0);if($el.is("img")){var loadingIE=($.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var loadingFF=($.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var loadingOp=($.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var loadingOther=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(loadingIE||loadingFF||loadingOp||loadingOther){if(o.s&&opts.requeueOnImageNotLoaded&&++options.requeueAttempts<100){log(options.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){$(o.s,o.c).cycle(options);},opts.requeueTimeout);requeue=true;return false;}else{log("could not determine size of image: "+this.src,this.cycleW,this.cycleH);}}}return true;});if(requeue){return false;}opts.cssBefore=opts.cssBefore||{};opts.animIn=opts.animIn||{};opts.animOut=opts.animOut||{};$slides.not(":eq("+first+")").css(opts.cssBefore);if(opts.cssFirst){$($slides[first]).css(opts.cssFirst);}if(opts.timeout){opts.timeout=parseInt(opts.timeout);if(opts.speed.constructor==String){opts.speed=$.fx.speeds[opts.speed]||parseInt(opts.speed);}if(!opts.sync){opts.speed=opts.speed/2;}var buffer=opts.fx=="shuffle"?500:250;while((opts.timeout-opts.speed)<buffer){opts.timeout+=opts.speed;}}if(opts.easing){opts.easeIn=opts.easeOut=opts.easing;}if(!opts.speedIn){opts.speedIn=opts.speed;}if(!opts.speedOut){opts.speedOut=opts.speed;}opts.slideCount=els.length;opts.currSlide=opts.lastSlide=first;if(opts.random){if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.backwards){opts.nextSlide=opts.startingSlide==0?(els.length-1):opts.startingSlide-1;}else{opts.nextSlide=opts.startingSlide>=(els.length-1)?0:opts.startingSlide+1;}}if(!opts.multiFx){var init=$.fn.cycle.transitions[opts.fx];if($.isFunction(init)){init($cont,$slides,opts);}else{if(opts.fx!="custom"&&!opts.multiFx){log("unknown transition: "+opts.fx,"; slideshow terminating");return false;}}}var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length>1){opts.after[1].apply(e0,[e0,e0,opts,true]);}if(opts.next){$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?-1:1);});}if(opts.prev){$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,opts.rev?1:-1);});}if(opts.pager||opts.pagerAnchorBuilder){buildPager(els,opts);}exposeAddSlide(opts,els);return opts;}function saveOriginalOpts(opts){opts.original={before:[],after:[]};opts.original.cssBefore=$.extend({},opts.cssBefore);opts.original.cssAfter=$.extend({},opts.cssAfter);opts.original.animIn=$.extend({},opts.animIn);opts.original.animOut=$.extend({},opts.animOut);$.each(opts.before,function(){opts.original.before.push(this);});$.each(opts.after,function(){opts.original.after.push(this);});}function supportMultiTransitions(opts){var i,tx,txs=$.fn.cycle.transitions;if(opts.fx.indexOf(",")>0){opts.multiFx=true;opts.fxs=opts.fx.replace(/\s*/g,"").split(",");for(i=0;i<opts.fxs.length;i++){var fx=opts.fxs[i];tx=txs[fx];if(!tx||!txs.hasOwnProperty(fx)||!$.isFunction(tx)){log("discarding unknown transition: ",fx);opts.fxs.splice(i,1);i--;}}if(!opts.fxs.length){log("No valid transitions named; slideshow terminating.");return false;}}else{if(opts.fx=="all"){opts.multiFx=true;opts.fxs=[];for(p in txs){tx=txs[p];if(txs.hasOwnProperty(p)&&$.isFunction(tx)){opts.fxs.push(p);}}}}if(opts.multiFx&&opts.randomizeEffects){var r1=Math.floor(Math.random()*20)+30;for(i=0;i<r1;i++){var r2=Math.floor(Math.random()*opts.fxs.length);opts.fxs.push(opts.fxs.splice(r2,1)[0]);}debug("randomized fx sequence: ",opts.fxs);}return true;}function exposeAddSlide(opts,els){opts.addSlide=function(newSlide,prepend){var $s=$(newSlide),s=$s[0];
3624if(!opts.autostopCount){opts.countdown++;}els[prepend?"unshift":"push"](s);if(opts.els){opts.els[prepend?"unshift":"push"](s);}opts.slideCount=els.length;$s.css("position","absolute");$s[prepend?"prependTo":"appendTo"](opts.$cont);if(prepend){opts.currSlide++;opts.nextSlide++;}if(!$.support.opacity&&opts.cleartype&&!opts.cleartypeNoBg){clearTypeFix($s);}if(opts.fit&&opts.width){$s.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}s.cycleH=(opts.fit&&opts.height)?opts.height:$s.height();s.cycleW=(opts.fit&&opts.width)?opts.width:$s.width();$s.css(opts.cssBefore);if(opts.pager||opts.pagerAnchorBuilder){$.fn.cycle.createPagerAnchor(els.length-1,s,$(opts.pager),els,opts);}if($.isFunction(opts.onAddSlide)){opts.onAddSlide($s);}else{$s.hide();}};}$.fn.cycle.resetState=function(opts,fx){fx=fx||opts.fx;opts.before=[];opts.after=[];opts.cssBefore=$.extend({},opts.original.cssBefore);opts.cssAfter=$.extend({},opts.original.cssAfter);opts.animIn=$.extend({},opts.original.animIn);opts.animOut=$.extend({},opts.original.animOut);opts.fxFn=null;$.each(opts.original.before,function(){opts.before.push(this);});$.each(opts.original.after,function(){opts.after.push(this);});var init=$.fn.cycle.transitions[fx];if($.isFunction(init)){init(opts.$cont,$(opts.elements),opts);}};function go(els,opts,manual,fwd){if(manual&&opts.busy&&opts.manualTrump){debug("manualTrump in go(), stopping active transition");$(els).stop(true,true);opts.busy=false;}if(opts.busy){debug("transition active, ignoring new tx request");return;}var p=opts.$cont[0],curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleStop!=opts.stopCount||p.cycleTimeout===0&&!manual){return;}if(!manual&&!p.cyclePause&&!opts.bounce&&((opts.autostop&&(--opts.countdown<=0))||(opts.nowrap&&!opts.random&&opts.nextSlide<opts.currSlide))){if(opts.end){opts.end(opts);}return;}var changed=false;if((manual||!p.cyclePause)&&(opts.nextSlide!=opts.currSlide)){changed=true;var fx=opts.fx;curr.cycleH=curr.cycleH||$(curr).height();curr.cycleW=curr.cycleW||$(curr).width();next.cycleH=next.cycleH||$(next).height();next.cycleW=next.cycleW||$(next).width();if(opts.multiFx){if(opts.lastFx==undefined||++opts.lastFx>=opts.fxs.length){opts.lastFx=0;}fx=opts.fxs[opts.lastFx];opts.currFx=fx;}if(opts.oneTimeFx){fx=opts.oneTimeFx;opts.oneTimeFx=null;}$.fn.cycle.resetState(opts,fx);if(opts.before.length){$.each(opts.before,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});}var after=function(){$.each(opts.after,function(i,o){if(p.cycleStop!=opts.stopCount){return;}o.apply(next,[curr,next,opts,fwd]);});};debug("tx firing; currSlide: "+opts.currSlide+"; nextSlide: "+opts.nextSlide);opts.busy=1;if(opts.fxFn){opts.fxFn(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{if($.isFunction($.fn.cycle[opts.fx])){$.fn.cycle[opts.fx](curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}else{$.fn.cycle.custom(curr,next,opts,after,fwd,manual&&opts.fastOnEvent);}}}if(changed||opts.nextSlide==opts.currSlide){opts.lastSlide=opts.currSlide;if(opts.random){opts.currSlide=opts.nextSlide;if(++opts.randomIndex==els.length){opts.randomIndex=0;}opts.nextSlide=opts.randomMap[opts.randomIndex];if(opts.nextSlide==opts.currSlide){opts.nextSlide=(opts.currSlide==opts.slideCount-1)?0:opts.currSlide+1;}}else{if(opts.backwards){var roll=(opts.nextSlide-1)<0;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=1;opts.currSlide=0;}else{opts.nextSlide=roll?(els.length-1):opts.nextSlide-1;opts.currSlide=roll?0:opts.nextSlide+1;}}else{var roll=(opts.nextSlide+1)==els.length;if(roll&&opts.bounce){opts.backwards=!opts.backwards;opts.nextSlide=els.length-2;opts.currSlide=els.length-1;}else{opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}}}}if(changed&&opts.pager){opts.updateActivePagerLink(opts.pager,opts.currSlide,opts.activePagerClass);}var ms=0;if(opts.timeout&&!opts.continuous){ms=getTimeout(els[opts.currSlide],els[opts.nextSlide],opts,fwd);}else{if(opts.continuous&&p.cyclePause){ms=10;}}if(ms>0){p.cycleTimeout=setTimeout(function(){go(els,opts,0,(!opts.rev&&!opts.backwards));},ms);}}
3624$.fn.cycle.updateActivePagerLink=function(pager,currSlide,clsName){$(pager).each(function(){$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);});};function getTimeout(curr,next,opts,fwd){if(opts.timeoutFn){var t=opts.timeoutFn.call(curr,curr,next,opts,fwd);while((t-opts.speed)<250){t+=opts.speed;}debug("calculated timeout: "+t+"; speed: "+opts.speed);if(t!==false){return t;}}return opts.timeout;}$.fn.cycle.next=function(opts){advance(opts,opts.rev?-1:1);};$.fn.cycle.prev=function(opts){advance(opts,opts.rev?1:-1);};function advance(opts,val){var els=opts.elements;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}if(opts.random&&val<0){opts.randomIndex--;if(--opts.randomIndex==-2){opts.randomIndex=els.length-2;}else{if(opts.randomIndex==-1){opts.randomIndex=els.length-1;}}opts.nextSlide=opts.randomMap[opts.randomIndex];}else{if(opts.random){opts.nextSlide=opts.randomMap[opts.randomIndex];}else{opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){if(opts.nowrap){return false;}opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){if(opts.nowrap){return false;}opts.nextSlide=0;}}}}var cb=opts.onPrevNextEvent||opts.prevNextClick;if($.isFunction(cb)){cb(val>0,opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,val>=0);return false;}function buildPager(els,opts){var $p=$(opts.pager);$.each(els,function(i,o){$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);});opts.updateActivePagerLink(opts.pager,opts.startingSlide,opts.activePagerClass);}$.fn.cycle.createPagerAnchor=function(i,el,$p,els,opts){var a;if($.isFunction(opts.pagerAnchorBuilder)){a=opts.pagerAnchorBuilder(i,el);debug("pagerAnchorBuilder("+i+", el) returned: "+a);}else{a='<a href="#">'+(i+1)+"</a>";}if(!a){return;}var $a=$(a);if($a.parents("body").length===0){var arr=[];if($p.length>1){$p.each(function(){var $clone=$a.clone(true);$(this).append($clone);arr.push($clone[0]);});$a=$(arr);}else{$a.appendTo($p);}}opts.pagerAnchors=opts.pagerAnchors||[];opts.pagerAnchors.push($a);$a.bind(opts.pagerEvent,function(e){e.preventDefault();opts.nextSlide=i;var p=opts.$cont[0],timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}var cb=opts.onPagerEvent||opts.pagerClick;if($.isFunction(cb)){cb(opts.nextSlide,els[opts.nextSlide]);}go(els,opts,1,opts.currSlide<i);});if(!/^click/.test(opts.pagerEvent)&&!opts.allowPagerClickBubble){$a.bind("click.cycle",function(){return false;});}if(opts.pauseOnPagerHover){$a.hover(function(){opts.$cont[0].cyclePause++;},function(){opts.$cont[0].cyclePause--;});}};$.fn.cycle.hopsFromLast=function(opts,fwd){var hops,l=opts.lastSlide,c=opts.currSlide;if(fwd){hops=c>l?c-l:opts.slideCount-l;}else{hops=c<l?l-c:l+opts.slideCount-c;}return hops;};function clearTypeFix($slides){debug("applying clearType background-color hack");function hex(s){s=parseInt(s).toString(16);return s.length<2?"0"+s:s;}function getBg(e){for(;e&&e.nodeName.toLowerCase()!="html";e=e.parentNode){var v=$.css(e,"background-color");if(v.indexOf("rgb")>=0){var rgb=v.match(/\d+/g);return"#"+hex(rgb[0])+hex(rgb[1])+hex(rgb[2]);}if(v&&v!="transparent"){return v;}}return"#ffffff";}$slides.each(function(){$(this).css("background-color",getBg(this));});}$.fn.cycle.commonReset=function(curr,next,opts,w,h,rev){$(opts.elements).not(curr).hide();opts.cssBefore.opacity=1;opts.cssBefore.display="block";if(w!==false&&next.cycleW>0){opts.cssBefore.width=next.cycleW;}if(h!==false&&next.cycleH>0){opts.cssBefore.height=next.cycleH;}opts.cssAfter=opts.cssAfter||{};opts.cssAfter.display="none";$(curr).css("zIndex",opts.slideCount+(rev===true?1:0));$(next).css("zIndex",opts.slideCount+(rev===true?0:1));};$.fn.cycle.custom=function(curr,next,opts,cb,fwd,speedOverride){var $l=$(curr),$n=$(next);var speedIn=opts.speedIn,speedOut=opts.speedOut,easeIn=opts.easeIn,easeOut=opts.easeOut;$n.css(opts.cssBefore);if(speedOverride){if(typeof speedOverride=="number"){speedIn=speedOut=speedOverride;}else{speedIn=speedOut=1;}easeIn=easeOut=null;}var fn=function(){$n.animate(opts.animIn,speedIn,easeIn,cb);};$l.animate(opts.animOut,speedOut,easeOut,function(){if(opts.cssAfter){$l.css(opts.cssAfter);}if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){$slides.not(":eq("+opts.currSlide+")").css("opacity",0);opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.opacity=0;});opts.animIn={opacity:1};opts.animOut={opacity:0}
3624;opts.cssBefore={top:0,left:0};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,onPrevNextEvent:null,prevNextEvent:"click.cycle",pager:null,onPagerEvent:null,pagerEvent:"click.cycle",allowPagerClickBubble:false,pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!$.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250,activePagerClass:"activeSlide",updateActivePagerLink:null,backwards:false};})(jQuery);
3625/*
3626 * jQuery Cycle Plugin Transition Definitions
3627 * This script is a plugin for the jQuery Cycle Plugin
3628 * Examples and documentation at: http://malsup.com/jquery/cycle/
3629 * Copyright (c) 2007-2010 M. Alsup
3630 * Version:  2.72
3631 * Dual licensed under the MIT and GPL licenses:
3632 * http://www.opensource.org/licenses/mit-license.php
3633 * http://www.gnu.org/licenses/gpl.html
3634 */
3635(function($){$.fn.cycle.transitions.none=function($cont,$slides,opts){opts.fxFn=function(curr,next,opts,after){$(next).show();$(curr).hide();after();};};$.fn.cycle.transitions.scrollUp=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssBefore={top:h,left:0};opts.cssFirst={top:0};opts.animIn={top:0};opts.animOut={top:-h};};$.fn.cycle.transitions.scrollDown=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var h=$cont.height();opts.cssFirst={top:0};opts.cssBefore={top:-h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.scrollLeft=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:0-w};};$.fn.cycle.transitions.scrollRight=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push($.fn.cycle.commonReset);var w=$cont.width();opts.cssFirst={left:0};opts.cssBefore={left:-w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.scrollHorz=function($cont,$slides,opts){$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts,fwd){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.left=fwd?(next.cycleW-1):(1-next.cycleW);opts.animOut.left=fwd?-curr.cycleW:curr.cycleW;});opts.cssFirst={left:0};opts.cssBefore={top:0};opts.animIn={left:0};opts.animOut={top:0};};$.fn.cycle.transitions.scrollVert=function($cont,$slides,opts){$cont.css("overflow","hidden");opts.before.push(function(curr,next,opts,fwd){$.fn.cycle.commonReset(curr,next,opts);opts.cssBefore.top=fwd?(1-next.cycleH):(next.cycleH-1);opts.animOut.top=fwd?curr.cycleH:-curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0};opts.animIn={top:0};opts.animOut={left:0};};$.fn.cycle.transitions.slideX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;});opts.cssBefore={left:0,top:0,width:0};opts.animIn={width:"show"};opts.animOut={width:0};};$.fn.cycle.transitions.slideY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$(opts.elements).not(curr).hide();$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;});opts.cssBefore={left:0,top:0,height:0};opts.animIn={height:"show"};opts.animOut={height:0};};$.fn.cycle.transitions.shuffle=function($cont,$slides,opts){var i,w=$cont.css("overflow","visible").width();$slides.css({left:0,top:0});opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);});if(!opts.speedAdjusted){opts.speed=opts.speed/2;opts.speedAdjusted=true;}opts.random=0;opts.shuffle=opts.shuffle||{left:-w,top:15};opts.els=[];for(i=0;i<$slides.length;i++){opts.els.push($slides[i]);}for(i=0;i<opts.currSlide;i++){opts.els.push(opts.els.shift());}opts.fxFn=function(curr,next,opts,cb,fwd){var $el=fwd?$(curr):$(next);$(next).css(opts.cssBefore);var count=opts.slideCount;$el.animate(opts.shuffle,opts.speedIn,opts.easeIn,function(){var hops=$.fn.cycle.hopsFromLast(opts,fwd);for(var k=0;k<hops;k++){fwd?opts.els.push(opts.els.shift()):opts.els.unshift(opts.els.pop());}if(fwd){for(var i=0,len=opts.els.length;i<len;i++){$(opts.els[i]).css("z-index",len-i+count);}}else{var z=$(curr).css("z-index");$el.css("z-index",parseInt(z)+1+count);}$el.animate({left:0,top:0},opts.speedOut,opts.easeOut,function(){$(fwd?this:curr).hide();if(cb){cb();}});});};opts.cssBefore={display:"block",opacity:1,top:0,left:0};};$.fn.cycle.transitions.turnUp=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=next.cycleH;opts.animIn.height=next.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,height:0};opts.animIn={top:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnDown=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssFirst={top:0};opts.cssBefore={left:0,top:0,height:0};opts.animOut={height:0};};$.fn.cycle.transitions.turnLeft=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=next.cycleW;opts.animIn.width=next.cycleW;});opts.cssBefore={top:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.turnRight=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={top:0,left:0,width:0};opts.animIn={left:0};opts.animOut={width:0};};$.fn.cycle.transitions.zoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false,true);opts.cssBefore.top=next.cycleH/2;opts.cssBefore.left=next.cycleW/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};opts.animOut={width:0,height:0,top:curr.cycleH/2,left:curr.cycleW/2};});opts.cssFirst={top:0,left:0};opts.cssBefore={width:0,height:0};};$.fn.cycle.transitions.fadeZoom=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,false);opts.cssBefore.left=next.cycleW/2;opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,left:0,width:next.cycleW,height:next.cycleH};});opts.cssBefore={width:0,height:0};opts.animOut={opacity:0}
3635;};$.fn.cycle.transitions.blindX=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.width=next.cycleW;opts.animOut.left=curr.cycleW;});opts.cssBefore={left:w,top:0};opts.animIn={left:0};opts.animOut={left:w};};$.fn.cycle.transitions.blindY=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:0};opts.animIn={top:0};opts.animOut={top:h};};$.fn.cycle.transitions.blindZ=function($cont,$slides,opts){var h=$cont.css("overflow","hidden").height();var w=$cont.width();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);opts.animIn.height=next.cycleH;opts.animOut.top=curr.cycleH;});opts.cssBefore={top:h,left:w};opts.animIn={top:0,left:0};opts.animOut={top:h,left:w};};$.fn.cycle.transitions.growX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true);opts.cssBefore.left=this.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:0};});opts.cssBefore={width:0,top:0};};$.fn.cycle.transitions.growY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false);opts.cssBefore.top=this.cycleH/2;opts.animIn={top:0,height:this.cycleH};opts.animOut={top:0};});opts.cssBefore={height:0,left:0};};
3636 $.fn.cycle.transitions.scrollFade = function($cont, $slides, opts) {
3637 $cont.css('overflow','visible').width();
3638 opts.before.push(function(curr, next, opts, fwd) {
3639   opts.cssBefore.opacity = 0;
3640   $.fn.cycle.commonReset(curr,next,opts);
3641   opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
3642   opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
3643 });
3644 opts.cssFirst = { left: 0 };
3645 opts.cssBefore= { top: 0, opacity: 0};
3646 opts.animIn   = { left: 0, opacity: 1};
3647 opts.animOut  = { top: 0, opacity: 0};
3648 };
3649
3650$.fn.cycle.transitions.curtainX=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,false,true,true);opts.cssBefore.left=next.cycleW/2;opts.animIn={left:0,width:this.cycleW};opts.animOut={left:curr.cycleW/2,width:0};});opts.cssBefore={top:0,width:0};};$.fn.cycle.transitions.curtainY=function($cont,$slides,opts){opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,false,true);opts.cssBefore.top=next.cycleH/2;opts.animIn={top:0,height:next.cycleH};opts.animOut={top:curr.cycleH/2,height:0};});opts.cssBefore={left:0,height:0};};$.fn.cycle.transitions.cover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts);if(d=="right"){opts.cssBefore.left=-w;}else{if(d=="up"){opts.cssBefore.top=h;}else{if(d=="down"){opts.cssBefore.top=-h;}else{opts.cssBefore.left=w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.uncover=function($cont,$slides,opts){var d=opts.direction||"left";var w=$cont.css("overflow","hidden").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(d=="right"){opts.animOut.left=w;}else{if(d=="up"){opts.animOut.top=-h;}else{if(d=="down"){opts.animOut.top=h;}else{opts.animOut.left=-w;}}}});opts.animIn={left:0,top:0};opts.animOut={opacity:1};opts.cssBefore={top:0,left:0};};$.fn.cycle.transitions.toss=function($cont,$slides,opts){var w=$cont.css("overflow","visible").width();var h=$cont.height();opts.before.push(function(curr,next,opts){$.fn.cycle.commonReset(curr,next,opts,true,true,true);if(!opts.animOut.left&&!opts.animOut.top){opts.animOut={left:w*2,top:-h/2,opacity:0};}else{opts.animOut.opacity=0;}});opts.cssBefore={left:0,top:0};opts.animIn={left:0};};$.fn.cycle.transitions.wipe=function($cont,$slides,opts){var w=$cont.css("overflow","hidden").width();
3650var h=$cont.height();opts.cssBefore=opts.cssBefore||{};var clip;if(opts.clip){if(/l2r/.test(opts.clip)){clip="rect(0px 0px "+h+"px 0px)";}else{if(/r2l/.test(opts.clip)){clip="rect(0px "+w+"px "+h+"px "+w+"px)";}else{if(/t2b/.test(opts.clip)){clip="rect(0px "+w+"px 0px 0px)";}else{if(/b2t/.test(opts.clip)){clip="rect("+h+"px "+w+"px "+h+"px 0px)";}else{if(/zoom/.test(opts.clip)){var top=parseInt(h/2);var left=parseInt(w/2);clip="rect("+top+"px "+left+"px "+top+"px "+left+"px)";}}}}}}opts.cssBefore.clip=opts.cssBefore.clip||clip||"rect(0px 0px 0px 0px)";var d=opts.cssBefore.clip.match(/(\d+)/g);var t=parseInt(d[0]),r=parseInt(d[1]),b=parseInt(d[2]),l=parseInt(d[3]);opts.before.push(function(curr,next,opts){if(curr==next){return;}var $curr=$(curr),$next=$(next);$.fn.cycle.commonReset(curr,next,opts,true,true,false);opts.cssAfter.display="block";var step=1,count=parseInt((opts.speedIn/13))-1;(function f(){var tt=t?t-parseInt(step*(t/count)):0;var ll=l?l-parseInt(step*(l/count)):0;var bb=b<h?b+parseInt(step*((h-b)/count||1)):h;var rr=r<w?r+parseInt(step*((w-r)/count||1)):w;$next.css({clip:"rect("+tt+"px "+rr+"px "+bb+"px "+ll+"px)"});(step++<=count)?setTimeout(f,13):$curr.css("display","none");})();});opts.cssBefore={display:"block",opacity:1,top:0,left:0};opts.animIn={left:0};opts.animOut={left:0};};})(jQuery);
3651;
3652/*
3653 * jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010
3654 * http://benalman.com/projects/jquery-dotimeout-plugin/
3655 *
3656 * Copyright (c) 2010 "Cowboy" Ben Alman
3657 * Dual licensed under the MIT and GPL licenses.
3658 * http://benalman.com/about/license/
3659 */
3660(function($){var a={},c="doTimeout",d=Array.prototype.slice;$[c]=function(){return b.apply(window,[0].concat(d.call(arguments)))};$.fn[c]=function(){var f=d.call(arguments),e=b.apply(this,[c+f[0]].concat(f));return typeof f[0]==="number"||typeof f[1]==="number"?this:e};function b(l){var m=this,h,k={},g=l?$.fn:$,n=arguments,i=4,f=n[1],j=n[2],p=n[3];if(typeof f!=="string"){i--;f=l=0;j=n[1];p=n[2]}if(l){h=m.eq(0);h.data(l,k=h.data(l)||{})}else{if(f){k=a[f]||(a[f]={})}}k.id&&clearTimeout(k.id);delete k.id;function e(){if(l){h.removeData(l)}else{if(f){delete a[f]}}}function o(){k.id=setTimeout(function(){k.fn()},j)}if(p){k.fn=function(q){if(typeof p==="string"){p=g[p]}p.apply(m,d.call(n,i))===true&&!q?o():e()};o()}else{if(k.fn){j===undefined?e():k.fn(j===false);return true}else{e()}}}})(jQuery);;
3661/**
3662 * @plugin gallery
3663 * @desc Creates a slideshow of images by way of many structured template formats.
3664 * todo: extend this to be nodes and a full node page.
3665 * */
3666;(function($, window, document, undefined) {
3667
3668  "use strict";
3669
3670  var pluginName = "gallery",
3671    defaults = {
3672      autoPlay: true,
3673      width: null,
3674      height: null,
3675      duration: 600,
3676      aspectRatio: '4:3', // (default '4:3'), '3:4', '3:2', '1:1', '16:9'
3677      galleryBorderWidth: 5,
3678      slideshowDuration: 6000,
3679      navArrowWidth: 30,
3680      showProgressBar: true,
3681      filmstripMarkerWidth: 50,
3682      userInteruptsSlideshow: true,
3683      // sets alternate image cache preset's sizing for all image uses.
3684      imageSizing: {
3685        zoomed: 'lightbox',
3686        slide:  'gallery',
3687        marker: 'thumbnail'
3688      },
3689      // used to replace values from imageSizing within classes and src attr's.
3690      icpPathRegEx: /files\/imagecache\/([^\/]+)/,
3691      icpClassRegEx: /field-image-preset-([^ ]+)/
3692    };
3693
3694  function Plugin(element, options) {
3695    this.element = element;
3696    this.$element = $(element);
3697    this._name = pluginName;
3698    this._defaults = defaults;
3699    this.options = $.extend({}, defaults, options);
3700
3701    // allows for ratios or defined width/height's.
3702    if ( !this.options.width || !this.options.height ) {
3703      this.options.width = this.$element.width() - this.options.galleryBorderWidth * 2;
3704      switch (this.options.aspectRatio) {
3705        case '3:4' : this.options.height = this.options.width / 3 * 4;  break;
3706        case '3:2' : this.options.height = this.options.width / 3 * 2;  break;
3707        case '1:1' : this.options.height = this.options.width * 1.00;   break;
3708        case '16:9': this.options.height = this.options.width * 0.5625; break;
3709        default    : this.options.height = this.options.width * 0.75;
3710      }
3711    }
3712
3713    this.$images = this.getImages();
3714    this.isPlaying = false;
3715    this.currentPage = 0;
3716    this.currentIndex = 0;
3717    this.currentCaption = '';
3718    this.totalImages = this.$images.length;
3719    this.markersPerPage = Math.floor((this.options.width - this.options.navArrowWidth * 2)/this.options.filmstripMarkerWidth);
3720    this.markerWidth = Math.floor((this.options.width - this.options.navArrowWidth * 2)/this.markersPerPage);
3721    this.pageWidth = this.markersPerPage * this.markerWidth;
3722    this.totalPages = Math.ceil(this.$images.length/this.markersPerPage);
3723
3724    // creates the gallery.
3725    this.$gallery = this.render('gallery');
3726    this.$gallery.insertBefore(this.$images.eq(0));
3727
3728    // wraps images with the gallery div.
3729    this.$galleryImages = this.render('galleryImages');
3730    this.$galleryImages.appendTo(this.$gallery);
3731    this.$images.appendTo(this.$galleryImages);
3732
3733    // creates all buttons for the gallery controls.
3734    this.controls = this.render('controls');
3735    this.controls.$wrapper.appendTo(this.$gallery);
3736
3737    // creates a caption container for passing captions for each image.
3738    this.$caption = this.render('caption');
3739    this.$caption.appendTo(this.$gallery);
3740
3741    // creates a progress bar which visually animates the autoplay duration.
3742    this.$progress = this.render('progress');
3743    this.$progress.appendTo(this.$gallery);
3744
3745    // creates a filmstrip and appends it to the gallery.
3746    this.$filmstrip = this.render('filmstrip');
3747    this.$filmstrip.appendTo(this.$gallery);
3748
3749    // this is references the showcase which is used for zoom/lightbox feature.
3750    this.$showcase = this.render('showcase');
3751
3752    // Add helper class to simplify gallery if there is only one image.
3753    if (this.totalImages <= 1) {
3754      this.$gallery.addClass('simple');
3755      // Assure elimination of the autoPlay feature.
3756      this.options.autoPlay = false;
3757    }
3758
3759    // initialize.
3760    this.init();
3761  }
3762
3763  Plugin.prototype = {
3764    init: function() {
3765      var plugin = this;
3766
3767      // Fire up the carousel with the first indexed image.
3768      plugin.$filmstrip.find('.marker').eq(plugin.currentIndex).trigger('click');
3769
3770      // Automatically start slideshow?
3771      if (plugin.options.autoPlay) {
3772        plugin.controls.$playBtn.trigger('click');
3773      }
3774
3775      // set element resize event handler.
3776      plugin.$element.bind('resize.gallery', {scope: plugin}, plugin.events.resize);
3777    },
3778    // -------------------------------------------------------------------------
3779    // Smart get of image resources to use within the gallery.
3780    // -------------------------------------------------------------------------
3781    getImages: function() {
3782      var plugin = this, $images;
3783      $images = plugin.$element.find('.node-image .field-image, .node-upper-image .field-image');
3784      $images.each(function(key, image) {
3785        var $image = $(image),
3786          src, href, classes;
3787        src = $image.find('img').attr('src');
3788        href = $image.find('a').attr('href');
3789        classes = $image.attr('class');
3790        // swap out imagecache paths according to passed imageSizing options.
3791        $image.attr('class', classes.replace(plugin.options.icpClassRegEx.exec(classes)[1], plugin.options.imageSizing.slide));
3792        if ( !$image.hasClass('field-video') ) {
3793          $image.find('a').attr('href', href.replace(plugin.options.icpPathRegEx.exec(href)[1], plugin.options.imageSizing.zoomed));
3794        }
3795        $image.find('img').attr('src', src.replace(plugin.options.icpPathRegEx.exec(src)[1], plugin.options.imageSizing.slide));
3796      });
3797
3798      // @todo: extend this to be nodes and a full node page.
3799      /*
3800       // node page
3801      if (plugin.$element.hasClass('node-full')) {
3802        // @note already implemented above ^
3803      }
3804      // views-blocks
3805      else if (plugin.$element.hasClass('views-block')) {
3806        $images = plugin.$element.find('.views-row');
3807      }
3808       */
3809      return $images;
3810    },
3811    // -------------------------------------------------------------------------
3812    // Sets plugin indexes for images and pages.
3813    // -------------------------------------------------------------------------
3814    setCurrentIndex: function(index) {
3815      var plugin = this;
3816      if (index <= 0) {
3817        index = plugin.totalImages;
3818      }
3819      else if (index > plugin.totalImages) {
3820        index = 1;
3821      }
3822      plugin.currentIndex = index;
3823      plugin.setActiveItems(index);
3824      var page = Math.ceil(index/plugin.markersPerPage);
3825      if (page !== plugin.currentPage) {
3826        plugin.gotoPage(page, false);
3827      }
3828      return index;
3829    },
3830    // -------------------------------------------------------------------------
3831    // Controls styling of active items.
3832    // -------------------------------------------------------------------------
3833    setActiveItems: function(index) {
3834      var plugin = this;
3835      // markers.
3836      plugin.$filmstrip.find('.active').removeClass('active');
3837      plugin.$filmstrip.find('.marker').eq(index - 1).addClass('active');
3838    },
3839    // -------------------------------------------------------------------------
3840    // Update current image.
3841    // -------------------------------------------------------------------------
3842    gotoImage: function(origin, destination, clickEvent) {
3843      var plugin = this,
3844        // -1 because the images are an array, index starts at 1.
3845        $origin = plugin.$images.eq(origin-1),
3846        $destination = plugin.$images.eq(destination-1);
3847      // resets the slideshow timer if caused by user interaction.
3848      if (clickEvent && plugin.isPlaying) {
3849        plugin.options.userInteruptsSlideshow
3850          ? plugin.controls.$pauseBtn.trigger('click')
3851          : plugin.options.userInteruptsSlideshow();
3852      }
3853      // shuffle images.
3854      $origin.css('z-index', 2).stop(true,true).animate({opacity:'hide'}, plugin.options.duration);
3855      $destination.css('z-index', 3).stop(true,true).animate({opacity:'show'}, plugin.options.duration);
3856      plugin.$images.not($origin).not($destination).css('z-index', 1).hide();
3857      // set caption.
3858      var $captionText = plugin.$caption.find('.gallery-caption-text'),
3859        prevHeight = $captionText.outerHeight();
3860      plugin.currentCaption = $destination.find('img').attr('title') || '';
3861      $captionText.stop(true,true).animate({opacity:'hide'}, plugin.options.duration/2, function() {
3862        $captionText.html(plugin.currentCaption);
3863        if (plugin.currentCaption.length > 0) {
3864          var newHeight = $captionText.outerHeight();
3865          plugin.$caption.height(prevHeight).stop(true,true).animate({height: newHeight}, plugin.options.duration/2);
3866          $captionText.animate({opacity:'show'}, plugin.options.duration/2);
3867        }
3868        else {
3869          plugin.$caption.stop(true,true).animate({height: 0}, plugin.options.duration/2);
3870        }
3871      });
3872    },
3873    // -------------------------------------------------------------------------
3874    // Update current filmstrip page.
3875    // -------------------------------------------------------------------------
3876    gotoPage: function(destination, clickEvent) {
3877      var plugin = this,
3878        origin = plugin.currentPage,
3879        difference = destination - origin,
3880        distance = plugin.markerWidth * plugin.markersPerPage,
3881        $content = plugin.$filmstrip.find('.markers-content'),
3882        duration = plugin.options.duration / 2,
3883        callback = function(){return true;};
3884      // resets the slideshow timer if caused by user interaction.
3885      if (clickEvent && plugin.isPlaying) {
3886        plugin.options.userInteruptsSlideshow
3887          ? plugin.controls.$pauseBtn.trigger('click')
3888          : plugin.options.userInteruptsSlideshow();
3889      }
3890      // is the destination greater than 1 page.
3891      if (difference <= -1 && difference >= 1) {
3892        distance = 0;
3893        if (difference > 0) {
3894          distance = -(plugin.totalPages - 1) * plugin.pageWidth;
3895        }
3896        duration = 50 * (plugin.totalPages - 1);
3897      }
3898      // next page.
3899      else if (destination > origin) {
3900        if (destination <= plugin.totalPages ) {
3901          distance = (destination - 1) * -distance;
3902        }
3903        else {
3904          duration = 100;
3905          distance = -(distance * (plugin.totalPages - 1)) - plugin.options.navArrowWidth;
3906          callback = function() {
3907            $content.animate({left: -(plugin.pageWidth * (plugin.totalPages - 1))}, 100);
3908          };
3909          destination = plugin.currentPage;
3910        }
3911      }
3912      // prev page.
3913      else if (destination < origin) {
3914        if (destination > 0) {
3915          distance = (destination - 1) * -distance;
3916        }
3917        else {
3918          duration = 100;
3919          distance = plugin.options.navArrowWidth;
3920          callback = function() {
3921            $content.animate({left: 0}, 100);
3922          };
3923          destination = plugin.currentPage;
3924        }
3925      }
3926      plugin.currentPage = destination;
3927      $content.animate({left: distance}, duration, callback);
3928    },
3929    // -------------------------------------------------------------------------
3930    // Slideshow Timer
3931    // -------------------------------------------------------------------------
3932    startSlideshowTimer: function() {
3933      var plugin = this;
3934      plugin.startProgressBar();
3935      $.doTimeout('slideshow', plugin.options.slideshowDuration, function() {
3936        var origin = plugin.currentIndex,
3937          destination = plugin.setCurrentIndex(plugin.currentIndex + 1);
3938        plugin.startProgressBar();
3939        plugin.gotoImage(origin, destination, false);
3940        return true;
3941      });
3942    },
3943    stopSlideshowTimer: function() {
3944      var plugin = this;
3945      $.doTimeout('slideshow');
3946      plugin.stopProgressBar();
3947    },
3948    // -------------------------------------------------------------------------
3949    // Progress Bar
3950    // -------------------------------------------------------------------------
3951    startProgressBar: function() {
3952      var plugin = this;
3953      if (plugin.options.showProgressBar) {
3954        plugin.$progress.width(0).show();
3955        plugin.$progress.stop(true).animate({width: plugin.options.width}, plugin.options.slideshowDuration, 'linear');
3956      }
3957    },
3958    stopProgressBar: function() {
3959      var plugin = this;
3960      if (plugin.options.showProgressBar) {
3961        plugin.$progress.stop(true,true).hide();
3962      }
3963    },
3964    // -------------------------------------------------------------------------
3965    // Event Handlers
3966    // -------------------------------------------------------------------------
3967    events: {
3968      resize: function(event) {
3969        console.log(event.type);
3970      },
3971      marker: function(event) {
3972        var plugin = event.data.scope,
3973          origin = plugin.currentIndex,
3974          destination = Number($(this).data('index'));
3975        if (origin != destination) {
3976          plugin.setCurrentIndex(destination);
3977          plugin.gotoImage(origin, destination, true);
3978        }
3979        event.preventDefault();
3980      },
3981      nextPage: function(event) {
3982        var plugin = event.data.scope;
3983        plugin.gotoPage(plugin.currentPage + 1, true);
3984      },
3985      prevPage: function(event) {
3986        var plugin = event.data.scope;
3987        plugin.gotoPage(plugin.currentPage - 1, true);
3988      },
3989      play: function(event) {
3990        var plugin = event.data.scope;
3991        if ( !plugin.isPlaying ) {
3992          $(this).hide();
3993          plugin.isPlaying = true;
3994          plugin.controls.$pauseBtn.show();
3995          plugin.startSlideshowTimer();
3996        }
3997      },
3998      pause: function(event) {
3999        var plugin = event.data.scope;
4000        if ( plugin.isPlaying ) {
4001          $(this).hide();
4002          plugin.isPlaying = false;
4003          plugin.controls.$playBtn.show();
4004          plugin.stopSlideshowTimer();
4005        }
4006      },
4007      prev: function(event) {
4008        var plugin = event.data.scope,
4009          origin = plugin.currentIndex,
4010          destination = plugin.setCurrentIndex(plugin.currentIndex - 1);
4011        plugin.gotoImage(origin, destination, true);
4012      },
4013      next: function(event) {
4014        var plugin = event.data.scope,
4015          origin = plugin.currentIndex,
4016          destination = plugin.setCurrentIndex(plugin.currentIndex + 1);
4017        plugin.gotoImage(origin, destination, true);
4018      },
4019      zoom: function(event) {
4020        var plugin = event.data.scope;
4021        // fire off the lightbox2 behavior.
4022        plugin.$images.eq(plugin.currentIndex-1).find('a').trigger('click');
4023      }
4024    },
4025    // -------------------------------------------------------------------------
4026    // jQuery Template Renderer
4027    // -------------------------------------------------------------------------
4028    render: function(name, args, args2, args3) {
4029      var plugin = this,
4030      templates = {
4031        gallery: function() {
4032          var $gallery = $('<div class="gallery"></div>');
4033          $gallery
4034            .addClass(pluginName)
4035            .width(plugin.options.width)
4036            .height(plugin.options.height)
4037            .css({
4038              border: plugin.options.galleryBorderWidth + 'px solid white',
4039              'margin-bottom': (plugin.options.galleryBorderWidth + 75) + 'px'
4040            });
4041          return $gallery;
4042        },
4043        galleryImages: function() {
4044          return $('<div class="gallery-images"></div>');
4045        },
4046        caption: function() {
4047          return $('<div class="gallery-caption"><div class="gallery-caption-text"></div></div>');
4048        },
4049        showcase: function() {
4050          var $showcase = $('#gallery-showcase');
4051          if ($showcase.length <= 0) {
4052            $showcase = $('<div id="gallery-showcase"></div>');
4053            plugin.$element.parents('body').append($showcase);
4054          }
4055          return $showcase;
4056        },
4057        button: function(type) {
4058          return $('<div class="btn-'+type+'"><span></span></div>');
4059        },
4060        controls: function() {
4061          var $wrapper = $('<div class="gallery-controls"></div>'),
4062            buttons = ['pause', 'play', 'zoom', 'next', 'prev'],
4063            controls = {};
4064          $.each(buttons, function(key, type) {
4065            var $btn = plugin.render('button', type);
4066            $btn.bind('click', {scope: plugin}, plugin.events[type]);
4067            $btn.appendTo($wrapper);
4068            controls['$'+type+'Btn'] = $btn;
4069          });
4070          controls.$wrapper = $wrapper;
4071          return controls;
4072        },
4073        markers: function() {
4074          var $markers = $('<div class="markers"></div>'),
4075            $inner = $('<div class="markers-content"></div>');
4076          $.each(plugin.$images, function(key, image) {
4077            var $marker = $('<a href="#" class="marker"></a>'),
4078              $wrap = $('<span class="marker-image"></span>'),
4079              $image = $(image).find('img').clone(),
4080              src = $image.attr('src');
4081            $image.attr('src', src.replace(plugin.options.icpPathRegEx.exec(src)[1], plugin.options.imageSizing.marker));
4082            $marker.data('index', key+1).width(plugin.markerWidth).bind('click', {scope: plugin}, plugin.events.marker);
4083            $image.prependTo($wrap);
4084            $wrap.prependTo($marker);
4085            $marker.appendTo($inner);
4086          });
4087          $inner.width(Math.ceil(plugin.pageWidth * plugin.totalPages));
4088          $inner.appendTo($markers);
4089          $markers.width(plugin.options.width - (plugin.options.navArrowWidth * 2));
4090          return $markers;
4091        },
4092        filmstrip: function() {
4093          var $filmstrip = $('<div class="gallery-filmstrip"></div>'),
4094            $inner = $('<div class="gallery-filmstrip-inner"></div>'),
4095            $links = plugin.render('markers'),
4096            $prev  = plugin.render('button', 'prev-page'),
4097            $next  = plugin.render('button', 'next-page');
4098          if (plugin.totalImages > 1) {
4099            $prev.appendTo($inner).bind('click', {scope: plugin}, plugin.events.prevPage);
4100            $next.appendTo($inner).bind('click', {scope: plugin}, plugin.events.nextPage);
4101            plugin.controls.$prevPageBtn = $prev;
4102            plugin.controls.$nextPageBtn = $next;
4103            $links.css({'margin': '0 '+plugin.options.navArrowWidth+'px'});
4104          }
4105          $inner.css({top: plugin.options.galleryBorderWidth+'px'});
4106          $links.appendTo($inner);
4107          $inner.appendTo($filmstrip);
4108          return $filmstrip;
4109        },
4110        progress: function() {
4111          return $('<div class="gallery-progress"></div>');
4112        }
4113      };
4114
4115      return templates[name](args, args2, args3);
4116    }
4117  };
4118
4119  $.fn[pluginName] = function (options) {
4120    return this.each(function () {
4121      if ( !$.data(this, "plugin_" + pluginName )) {
4122        $.data(this, "plugin_" + pluginName, new Plugin(this, options));
4123      }
4124    });
4125  };
4126
4127})(jQuery, window, document);
4128;
4129Drupal.behaviors.ddAddDateToCalendarWidget = function(context) {
4130  if (Drupal.settings.ddCreate && Drupal.settings.ddCreate.addDateToCalendarWidget) {
4131    var attach = function() {
4132      $('#calpopup .node-teaser:has(.first-upcoming):not(:has(a.add))').each(function() {
4133        var $teaser = $(this);
4134        var $date = $teaser.find(".first-upcoming");
4135        var nodeId = $teaser.attr("id").replace(/(node-)|(-teaser)/g, "");
4136
4137        var $addLink = $('<a class="add"></a>');
4138        var $addPopup = $('<div class="add-calendar-popup">Loading...</div>');
4139
4140        $date.append($addLink).append($addPopup);
4141        $addLink.toggle(function() {
4142          // Hide any existing popups.
4143          $('.add-calendar-popup:visible').fadeOut('fast');
4144
4145          $addPopup.fadeIn("fast").load(Drupal.settings.basePath + 'node/' + nodeId + ' #block-dd_create-calendar', function() {
4146            $addPopup.find("a").attr("target", "_blank");
4147          });
4148        }, function() {
4149          $addPopup.fadeOut("fast");
4150        });
4151      });
4152    };
4153
4154    attach();
4155
4156    $(document).ajaxComplete(function() {
4157      attach();
4158    });
4159  }
4160};
4161
4162/**
4163 * Handles adding the "node-advanced" class to navigation terms which should be
4164 * hidden on the node edit/create form.
4165 */
4166Drupal.behaviors.ddNavTermVisibility = function(context) {
4167  if (Drupal.settings.pt_nav_terms_hidden) { 
4168    var el = $('#edit-taxonomy-2-wrapper', context);
4169    for (var i = 0; i < Drupal.settings.pt_nav_terms_hidden.length; i++) {
4170      var tid = Drupal.settings.pt_nav_terms_hidden[i]; 
4171      var li = $('#edit-taxonomy-2-' + tid).parents('li');
4172      if (li.length) {
4173        $(li[0]).addClass('node-advanced');
4174      }
4175    }
4176  }
4177};
4178
4179/**
4180 * Handles the cloning form elements visiblity.
4181 */
4182Drupal.behaviors.ddClonePostVisibility = function(context) {
4183  if (Drupal.settings.clone_post) {
4184    // Hide tabs.
4185    $('.tabs').css("display","none");
4186  }
4187};
4188
4189/**
4190 * Disable URL Alias and show warning message when creating/editing overviews.
4191 */
4192Drupal.behaviors.ddOverviewVisibility = function(context) {
4193  var urlAlias = $('.vertical-tabs-path', context);
4194  var clonedUrlAlias = urlAlias.html();
4195  var postSelect = $('#edit-taxonomy-1');
4196  var warningMessage = "URL aliases should be added to the navigation term, not the Overview post. <a href='https://support.digitaldeployment.com/support/solutions/articles/4000085428-advanced-creating-custom-urls-for-posts-and-url-aliases-for-navigation-terms-'>Learn how to create URL aliases for navigation terms</a>.";
4197
4198  var postType = postSelect.find(":selected").text();
4199  if(postType == 'Overview') {
4200    urlAlias.html('<div style="white-space: normal;" class="messages warning no-attachment-text disable-url">' + warningMessage + '</div>');
4201  }
4202
4203  // On post type change.
4204  postSelect.change(function() {
4205    if($(this).find(":selected").text() == 'Overview') {
4206      $('.vertical-tabs-path').html('<div style="white-space: normal;" class="messages warning no-attachment-text disable-url">' + warningMessage + '</div>');
4207    }
4208    else {
4209      $('.vertical-tabs-path').html(clonedUrlAlias);
4210      // Remove the additional legend.
4211      $('.vertical-tabs-path').find('legend').remove();
4212    }
4213  });
4214
4215  $(".disable-url").unbind( "click" );
4216};
4217
4218/**
4219 * Show Visibility to unauthorized users when we have peeking enabled.
4220 */
4221Drupal.behaviors.VisibillityUnauthorizedUsers= function(context) {
4222  var accessDefaultt = $('#edit-dd-access-default', context);
4223  var accessEveryone = $('#edit-dd-access-rids-0', context);
4224  var visibilityDiv = $('#edit-dd-access-peeking-wrapper', context);
4225
4226  // Default state.
4227  if(accessEveryone.is(':checked')) {
4228    visibilityDiv.hide();
4229  }
4230
4231  // Everyone change
4232  accessEveryone.change(function() {
4233    if(!$(this).is(":checked")) {
4234      visibilityDiv.show();
4235    }
4236    else {
4237      visibilityDiv.hide();
4238    }
4239  });
4240
4241  // Default change
4242  accessDefaultt.change(function() {
4243    if(accessEveryone.is(":checked")) {
4244      visibilityDiv.hide();
4245    }
4246    else {
4247      visibilityDiv.show();
4248    }
4249  });
4250};
4251
4252/**
4253 * Autocomplete the calendar end date.
4254 */
4255Drupal.behaviors.setCalendarEndDate = function(context) {
4256  $("input[name^='field_date['][name*='[value]']", context).change(function autocompleteEndDate() {
4257    // Only get the date field.
4258    if($(this).hasClass('hasDatepicker')) {
4259      const name = this.name.split('[');
4260      const fieldId = name[1].split(']');
4261      $("input[name='field_date["+ fieldId[0] +"][value2][date]']").val($(this).val());
4262    }
4263  });
4264};
4265
4266/**
4267 * Handles temporary lat/lon field to be displayed under location.
4268 */
4269Drupal.behaviors.LatitudeLongitudeFields = function(context) {
4270  var latitude = $('#edit-location-x-wrapper');
4271  var longitude = $('#edit-location-y-wrapper');
4272  var locationField = $('#edit-field-location-0-text');
4273  // Place the inputs.
4274  longitude.insertBefore(locationField);
4275  latitude.insertBefore(locationField);
4276  // Display them.
4277  latitude.css('display','inline-block');
4278  longitude.css('display','inline-block');
4279};
4280;
4281Drupal.behaviors.ddLoginInit = function(context) {
4282  var $loginBlock = $('body.not-logged-in #block-dd_login-login', context);
4283  if ($loginBlock.size() == 0) {
4284    return;
4285  }
4286
4287  $loginBlock.dialog({ modal: true, height: 'auto', autoOpen: false, dialogClass: 'dd-login'}); 
4288
4289  $("body.not-logged-in a[href$='/user/login'], body.not-logged-in a[href$='/user']", context).click(function() {
4290    openLoginDialog();
4291    return false;
4292  });
4293
4294  if (location.hash == '#dd-login') {
4295    openLoginDialog();
4296  }
4297
4298  function openLoginDialog() {
4299    // Redirect to HTTPS, if necessary.
4300    if (Drupal.settings.ddForceHttpsAuthenticated && location.protocol != 'https:') {
4301      location.assign('https://' + location.hostname + location.pathname + location.search + '#dd-login');
4302      return;
4303    }
4304
4305    $loginBlock.dialog('open');
4306    $loginBlock.find('#edit-name').focus();
4307  }
4308};
4309;
4310Drupal.behaviors.ddPoll = function(context) {
4311  // Optimization: first search for .dd-poll-node, then search for the rest.
4312  $('.dd-poll-node', context).each(function() {
4313    var $node = $(this);
4314
4315    if ($node.find('.vote form').length) {
4316      new Drupal.ddPollNodeVote($node);
4317    }
4318    else if ($node.find('.results table').length) {
4319      new Drupal.ddPollNodeResults($node);
4320    }
4321  });
4322
4323  // Draw charts, if any, once all other behaviors are done processing.
4324  setTimeout(function() {
4325    Drupal.ddPollNodeResultsGraph.ready = true;
4326    Drupal.ddPollNodeResultsGraph.drawCharts();
4327  }, 0);
4328};
4329
4330Drupal.ddPollNodeVote = function($element) {
4331  var self = this;
4332  this.$element = $element;
4333  this.nid = this.$element.find('input[name=nid]').val();
4334  this.vid = this.getVid();
4335
4336  // If we couldn't establish a unique voter ID, leave the poll disabled.
4337  if (!this.vid) {
4338    this.$element.addClass('initialized');
4339    return;
4340  }
4341
4342  // Enable the poll.
4343  this.setMessage();
4344
4345  // Enable the submit button.
4346  this.$element.find('input.form-submit')
4347    .attr('disabled', false)
4348    .attr('data-disabled', false);
4349
4350  // Remove the dd_mobile 'disabled' button theme.
4351  this.$element.find('.ui-submit')
4352    .removeClass('ui-disabled')
4353    .attr('aria-disabled', false)
4354    .attr('data-disabled', false);
4355
4356  this.$element.addClass('initialized');
4357
4358  // Load the poll results if the voter has already voted for this poll.
4359  var nids = self.getVotedNids();
4360
4361  if ($.inArray(this.nid, nids) != -1) {
4362    this.$element.addClass('in-progress');
4363
4364    // Request the results.
4365    $.ajax({
4366      type: "GET",
4367      url: Drupal.settings.ddPoll['resultsURI'],
4368      data: { nid: this.nid, vid: this.vid },
4369      dataType: 'html',
4370      success: function(data) {
4371        self.setResults(data);
4372      },
4373      complete: function() {
4374        self.$element.removeClass('in-progress');
4375      }
4376    });
4377  }
4378
4379  // Submit the vote when the form is submitted.
4380  this.$element.find('form').submit(function() {
4381    var $form = $(this);
4382
4383    // Throw a fit if no answer has been selected.
4384    if ($form.find('input[name=aid]:checked').length == 0) {
4385      self.setMessage('Please select an answer in order to vote.', 'warning');
4386      return false;
4387    }
4388
4389    // Populate the voter ID.
4390    $form.find('input[name=vid]').val(self.vid);
4391
4392    // Disable the submit button.
4393    $form.find('input.form-submit')
4394      .attr('disabled', true)
4395      .attr('data-disabled', true);
4396
4397    // Adds the dd_mobile 'disabled' button theme.
4398    $form.find('.ui-submit')
4399      .addClass('ui-disabled')
4400      .attr('aria-disabled', true)
4401      .attr('data-disabled', true);
4402
4403    // Show something's going on.
4404    self.$element.addClass('in-progress');
4405
4406    $.ajax({
4407      type: "POST",
4408      url: $form.attr('action'),
4409      data: $form.serialize(),
4410      dataType: 'json',
4411      success: function(data) {
4412        // Remember this poll has been voted on.
4413        if (data['voted']) {
4414          var nids = self.getVotedNids();
4415
4416          if ($.inArray(self.nid, nids) == -1) {
4417            nids.push(self.nid);
4418          }
4419
4420          self.setVotedNids(nids);
4421        }
4422
4423        // Show a message, if necessary.
4424        if (data['message'] && data['messageType']) {
4425          self.setMessage(data['message'], data['messageType']);
4426        }
4427
4428        // Show the poll results, if available.
4429        if (data['results']) {
4430          self.setResults(data['results']);
4431        }
4432      },
4433      complete: function() {
4434        self.$element.removeClass('in-progress');
4435      }
4436    });
4437
4438    return false;
4439  });
4440};
4441
4442Drupal.ddPollNodeVote.prototype.setMessage = function(message, type) {
4443  var $element = this.$element.find('div.message');
4444
4445  // Reset the message element's classes.
4446  $element.attr('class', '');
4447  $element.addClass('message');
4448
4449  // Set the message.
4450  if (message) {
4451    $element.html(message);
4452
4453    if (!type) {
4454      type = 'notice';
4455    }
4456    $element.addClass('message-' + type);
4457  }
4458  else {
4459    $element.empty();
4460  }
4461};
4462
4463Drupal.ddPollNodeVote.prototype.setResults = function(results) {
4464  this.$element.find('div.vote').empty();
4465  this.$element.find('div.results').empty();
4466  this.$element.find('div.results').append(results);
4467
4468  new Drupal.ddPollNodeResults(this.$element);
4469};
4470
4471Drupal.ddPollNodeVote.prototype.getVid = function() {
4472  var vid = this.getPrimitiveVid();
4473
4474  if (!vid) {
4475    var randomVid = this.generateRandomVid();
4476    this.setVid(randomVid);
4477
4478    // Check whether we were actually able to save the
4479    if (this.getPrimitiveVid() == randomVid) {
4480      vid = randomVid;
4481    }
4482  }
4483
4484  return vid;
4485};
4486
4487Drupal.ddPollNodeVote.prototype.generateRandomVid = function() {
4488  // Generates a random two-byte integer.
4489  var randomWord = function() {
4490    return (Math.random() * 0x10000) | 0;
4491  };
4492
4493  // Formats a two-byte integer into a padded hex string.
4494  var formatWord = function(word) {
4495    var string = word.toString(16);
4496    while (string.length < 4) string = '0' + string;
4497    return string;
4498  };
4499
4500  // Generate a v4 UUID.
4501  var words = [null, null, null, null, null, null, null, null];
4502  words = $.map(words, randomWord);
4503  words[3] = words[3] & 0x0FFF | 0x4000;
4504  words[4] = words[4] & 0x3FFF | 0x8000;
4505
4506  return $.map(words, formatWord).join('');
4507};
4508
4509Drupal.ddPollNodeVote.prototype.setVid = function(vid) {
4510  if (typeof window.localStorage != 'undefined') {
4511    window.localStorage.setItem('VSESSIONID', vid);
4512  }
4513  else {
4514    document.cookie = "VSESSIONID=" + vid + "; expires=Sat, 1 Jan 2050 00:00:00 UTC; path=/";
4515  }
4516};
4517
4518Drupal.ddPollNodeVote.prototype.getPrimitiveVid = function() {
4519  var vid = undefined;
4520
4521  if (typeof window.localStorage != 'undefined') {
4522    vid = window.localStorage.getItem('VSESSIONID');
4523  }
4524
4525  if (vid === undefined) {
4526    var name = "VSESSIONID=";
4527
4528    $.each(document.cookie.split(';'), function(index, cookie) {
4529      cookie = $.trim(cookie);
4530
4531      if (cookie.indexOf(name) == 0) {
4532        vid = cookie.substring(name.length, cookie.length);
4533      }
4534    });
4535  }
4536
4537  if (typeof(vid) != 'string' || vid.length != 32) {
4538    vid = undefined;
4539  }
4540
4541  return vid;
4542};
4543
4544Drupal.ddPollNodeVote.prototype.setVotedNids = function(nids) {
4545  if ((typeof window.localStorage != 'undefined') && (typeof window.JSON != 'undefined')) {
4546    window.localStorage.setItem('ddPollVotedNids', JSON.stringify(nids));
4547  }
4548  else {
4549    document.cookie = "ddPollVotedNids=" + nids.join(',') + "; expires=Sat, 1 Jan 2050 00:00:00 UTC; path=/";
4550  }
4551};
4552
4553Drupal.ddPollNodeVote.prototype.getVotedNids = function() {
4554  var nids = undefined;
4555
4556  if ((typeof window.localStorage != 'undefined') && (typeof window.JSON != 'undefined')) {
4557    try {
4558      nids = JSON.parse(window.localStorage.getItem('ddPollVotedNids'));
4559    }
4560    catch(e) {
4561      // Ignore
4562    }
4563  }
4564
4565  if (nids == undefined) {
4566    var name = "ddPollVotedNids=";
4567
4568    $.each(document.cookie.split(';'), function(index, cookie) {
4569      cookie = $.trim(cookie);
4570
4571      if (cookie.indexOf(name) == 0) {
4572        nids = cookie.substring(name.length, cookie.length);
4573      }
4574    });
4575
4576    if (nids) {
4577      nids = nids.split(',');
4578    }
4579  }
4580
4581  if (typeof(nids) != 'object' || !(nids instanceof Array)) {
4582    nids = [];
4583  }
4584
4585  return nids;
4586};
4587
4588Drupal.ddPollNodeResults = function($element) {
4589//  var self = this;
4590  this.$element = $element;
4591
4592  // Add this to the array of results to be graphed and trigger them to be
4593  // drawn.
4594  Drupal.ddPollNodeResultsGraph.results.push(this);
4595  Drupal.ddPollNodeResultsGraph.drawCharts();
4596
4597  $element.addClass('initialized');
4598};
4599
4600Drupal.ddPollNodeResults.prototype.drawChart = function() {
4601  //noinspection JSUnresolvedFunction,JSUnresolvedVariable
4602  var data = new google.visualization.DataTable();
4603  //noinspection JSUnresolvedFunction
4604  data.addColumn('string', 'Answer');
4605  //noinspection JSUnresolvedFunction
4606  data.addColumn('number', 'Votes');
4607
4608  var $table = this.$element.find('table.dd-poll-results');
4609
4610  $table.find('tbody tr').each(function() {
4611    var $columns = $(this).find('td');
4612
4613    if ($columns.length == 2) {
4614      var answer = $columns.eq(0).text();
4615      var percent = parseFloat($columns.eq(1).text().replace('%', ''));
4616      //noinspection JSUnresolvedFunction
4617      data.addRow([answer, percent]);
4618    }
4619  });
4620
4621  var options = {
4622    width: '100%',
4623    height: 200,
4624    chartArea: {
4625      width: '100%'
4626    },
4627    legend: {
4628      position: 'bottom'
4629    },
4630    tooltip: {
4631      text: 'percentage'
4632    },
4633    backgroundColor: 'transparent',
4634    // So that slices with 0 votes still show up in the legend.
4635    sliceVisibilityThreshold: 0
4636  };
4637
4638  if (Drupal.ddPollNodeResultsGraphOptionsAlter) {
4639    Drupal.ddPollNodeResultsGraphOptionsAlter(this.$element, options);
4640  }
4641
4642  // Make a div to hold the chart, replacing the table.
4643  var $chartDiv = $('<div></div>');
4644  $table.css('display', 'none').after($chartDiv);
4645
4646  //noinspection JSUnresolvedFunction,JSUnresolvedVariable
4647  var chart = new google.visualization.PieChart($chartDiv.get(0));
4648  //noinspection JSUnresolvedFunction
4649  chart.draw(data, options);
4650};
4651
4652Drupal.ddPollNodeResultsGraph = {
4653  // Wether all graphs have been initialized.
4654  ready: false,
4655  // Whether the graph API has been loaded.
4656  prepared: false,
4657  // The results that need to be graphed.
4658  results: []
4659};
4660
4661Drupal.ddPollNodeResultsGraph.prepareCharts = function() {
4662  // Don't attempt to load the API more than once.
4663  if (Drupal.ddPollNodeResultsGraph.prepared) {
4664    return;
4665  }
4666
4667  var autoload = '{"modules":[{"name":"visualization","version":"1.0","packages":["corechart"],"callback":"Drupal.ddPollNodeResultsGraph.chartsPrepared"}]}';
4668
4669  // We don't use $.getScript, because it does unnecessary cache breaking.
4670  $.ajax({
4671    url: 'https://www.google.com/jsapi?autoload=' + encodeURIComponent(autoload),
4672    dataType: 'script',
4673    cache: true
4674  });
4675};
4676
4677Drupal.ddPollNodeResultsGraph.chartsPrepared = function() {
4678  // Now that the graph API has been loaded, re-trigger graphs to be drawn.
4679  Drupal.ddPollNodeResultsGraph.prepared = true;
4680  Drupal.ddPollNodeResultsGraph.drawCharts();
4681};
4682
4683Drupal.ddPollNodeResultsGraph.drawCharts = function() {
4684  // Abort if we're not ready yet or if there's nothing to draw.
4685  if (!Drupal.ddPollNodeResultsGraph.ready || Drupal.ddPollNodeResultsGraph.results.length == 0) {
4686    return;
4687  }
4688
4689  // Load the graph API first, if necessary.
4690  if (!Drupal.ddPollNodeResultsGraph.prepared) {
4691    Drupal.ddPollNodeResultsGraph.prepareCharts();
4692    return;
4693  }
4694
4695  while (Drupal.ddPollNodeResultsGraph.results.length > 0) {
4696    Drupal.ddPollNodeResultsGraph.results.pop().drawChart();
4697  }
4698};
4699;
4700// Get all cookieconsent cookies on a a site.
4701function getAllConsentCookies() {
4702  var theCookies = document.cookie.split(';');
4703  var cookieconsent_cookies = [];
4704
4705  $.each( theCookies, function( key, value ) {
4706    // if(value.includes('cookieconsent_status_')) { // fix this for IE 11 on Win 7
4707    if(value.indexOf('cookieconsent_status_') > -1) {
4708      cookieconsent_cookies.push(value.split("=")[0].replace(/ /g,''));
4709    }
4710  });
4711  return cookieconsent_cookies;
4712}
4713
4714// Retrieve an array key out of Drupal.settings.dd_sitewide_message_notification for a specific cookie.
4715function getArrayKey(name) {
4716  var cookie_key = null;
4717
4718  $.each(Drupal.settings.dd_sitewide_message_notification.dd_sitewide_message_cookie_name, function( key, value ) {
4719    if(value == name) {
4720      cookie_key = key;
4721    }
4722  });
4723  return cookie_key;
4724}
4725
4726// Get a cookie by name
4727function getCookie(name) {
4728  var value = "; " + document.cookie;
4729  var parts = value.split("; " + name + "=");
4730  if (parts.length == 2) return parts.pop().split(";").shift();
4731}
4732
4733// Delete a cookie by setting expire date to the past.
4734function deleteCookie(name) {
4735  document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
4736}
4737
4738Drupal.behaviors.dd_sitewide_message_reset_notifications = function (context) {
4739  // Check if we have any data.
4740  if( typeof Drupal.settings.dd_sitewide_message_notification === "undefined") {
4741    return;
4742  }
4743
4744  // Iterate over cookie consent cookies and check if needs to be reset.
4745  $.each( getAllConsentCookies(), function( key, value ) {
4746    var existing_cookie_version = getCookie(value).split(',')[1];
4747    var cookieArrayKey = getArrayKey(value);
4748    var cookie_version = Drupal.settings.dd_sitewide_message_notification.dd_sitewide_message_cookie_version;
4749
4750    // Check if we have more than one message.
4751    if (typeof(cookie_version) === 'object') {
4752      current_cookie_version = cookie_version[cookieArrayKey];
4753    } else {
4754      current_cookie_version = cookie_version;
4755    }
4756
4757    // Delete the cookie so it will re-appear.
4758    if (existing_cookie_version != current_cookie_version) {
4759      deleteCookie(value);
4760    }
4761  });
4762};
4763;
4764Drupal.behaviors.ddTwitterFeed = function(context) {
4765  var $feedBlock = $('.dd-twitter-feed', context);
4766  // See if there is a DD Twitter Feed Block present.
4767  if ($feedBlock.length > 0) {
4768    new Drupal.DDTwitterFeedTweets($feedBlock);
4769  }
4770};
4771
4772Drupal.DDTwitterFeedTweets = function($element) {
4773  var self = this;
4774  this.$element = $element;
4775
4776  // Add helper class for theming the load of tweets.
4777  this.$element.addClass('loading-tweets');
4778
4779  // Request the tweets.
4780  $.ajax({
4781    type: 'GET',
4782    cache: true,
4783    url: Drupal.settings.ddTwitterFeed['getTweetsURI'],
4784    dataType: 'html',
4785    success: function(data) {
4786      self.$element.find('.dd-twitter-feed-tweets').html(data);
4787      self.animateResults();
4788    },
4789    complete: function() {
4790      self.$element.removeClass('loading-tweets');
4791    }
4792  });
4793};
4794
4795Drupal.DDTwitterFeedTweets.prototype.animateResults = function() {
4796  var $tweets = this.$element.find('.dd-twitter-feed-tweet'),
4797        count = 0,
4798        total = $tweets.length,
4799        delay = 5500;
4800
4801  // show the first tweet.
4802  $tweets.eq(count).show();
4803
4804  // only animate if there is more than one tweet.
4805  if (total > 1) {
4806    window.setInterval(function() {
4807      // fade out current tweet.
4808      $tweets.eq(count).animate({opacity:'hide'}, 200, function() {
4809        count++;
4810        // keeps count in bounds.
4811        if (count >= total) count = 0;
4812        // fade in the next tweet.
4813        $tweets.eq(count).animate({opacity:'show'}, 300);
4814      });
4815    }, delay);
4816  }
4817};
4818;
4819// $Id: extlink.js,v 1.4.2.12 2010/05/26 01:25:56 quicksketch Exp $
4820
4821// This is unnecessary and breaks webwraps in IE
4822//(function ($) {
4823
4824function extlinkAttach(context) {
4825  // Strip the host name down, removing ports, subdomains, or www.
4826  var pattern = /^(([^\/:]+?\.)*)([^\.:]{4,})((\.[a-z]{1,4})*)(:[0-9]{1,5})?$/;
4827  var host = window.location.host.replace(pattern, '$3$4');
4828  var subdomain = window.location.host.replace(pattern, '$1');
4829
4830  // Determine what subdomains are considered internal.
4831  if (Drupal.settings.extlink.extSubdomains) {
4832    var subdomains = "([^/]*\\.)?";
4833  }
4834  else if (subdomain == 'www.' || subdomain == '') {
4835    var subdomains = "(www\\.)?";
4836  }
4837  else {
4838    var subdomains = subdomain.replace(".", "\\.");
4839  }
4840
4841  // Build regular expressions that define an internal link.
4842  var internal_link = new RegExp("^https?://" + subdomains + host, "i");
4843
4844  // Extra internal link matching.
4845  var extInclude = false;
4846  if (Drupal.settings.extlink.extInclude) {
4847    extInclude = new RegExp(Drupal.settings.extlink.extInclude.replace(/\\/, '\\'));
4848  }
4849
4850  // Extra external link matching.
4851  var extExclude = false;
4852  if (Drupal.settings.extlink.extExclude) {
4853    extExclude = new RegExp(Drupal.settings.extlink.extExclude.replace(/\\/, '\\'));
4854  }
4855
4856  // Find all links which are NOT internal and begin with http (as opposed
4857  // to ftp://, javascript:, etc. other kinds of links.
4858  // When operating on the 'this' variable, the host has been appended to
4859  // all links by the browser, even local ones.
4860  // In jQuery 1.1 and higher, we'd use a filter method here, but it is not
4861  // available in jQuery 1.0 (Drupal 5 default).
4862  var external_links = new Array();
4863  var mailto_links = new Array();
4864  $("a:not(." + Drupal.settings.extlink.extClass + ", ." + Drupal.settings.extlink.mailtoClass + ")", context).each(function(el) {
4865    try {
4866      var url = this.href.toLowerCase();
4867      if (url.indexOf('http') == 0 && (!url.match(internal_link) || (extInclude && url.match(extInclude))) && !(extExclude && url.match(extExclude))) {
4868        external_links.push(this);
4869      }
4870      else if (url.indexOf('mailto:') == 0) {
4871        mailto_links.push(this);
4872      }
4873    }
4874    // IE7 throws errors often when dealing with irregular links, such as:
4875    // <a href="node/10"></a> Empty tags.
4876    // <a href="http://user:[email protected]">example</a> User:pass syntax.
4877    catch(error) {
4878      return false;
4879    }
4880  });
4881
4882  if (Drupal.settings.extlink.extClass) {
4883    // Apply the "ext" class to all links not containing images.
4884    if (parseFloat($().jquery) < 1.2) {
4885      $(external_links).not('[img]').addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>'); });
4886    }
4887    else {
4888      $(external_links).not($(external_links).find('img').parents('a')).addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.extClass + '></span>'); });
4889    }
4890  }
4891
4892  if (Drupal.settings.extlink.mailtoClass) {
4893    // Apply the "mailto" class to all mailto links not containing images.
4894    if (parseFloat($().jquery) < 1.2) {
4895      $(mailto_links).not('[img]').addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>'); });
4896    }
4897    else {
4898      $(mailto_links).not($(mailto_links).find('img').parents('a')).addClass(Drupal.settings.extlink.mailtoClass).each(function() { if ($(this).css('display') == 'inline') $(this).after('<span class=' + Drupal.settings.extlink.mailtoClass + '></span>'); });
4899    }
4900  }
4901
4902  if (Drupal.settings.extlink.extTarget) {
4903    // Apply the target attribute to all links.
4904    $(external_links).attr('target', Drupal.settings.extlink.extTarget);
4905  }
4906
4907  if (Drupal.settings.extlink.extAlert) {
4908    // Add pop-up click-through dialog.
4909    $(external_links).click(function(e) {
4910     return confirm(Drupal.settings.extlink.extAlertText);
4911    });
4912  }
4913
4914  // Work around for Internet Explorer box model problems.
4915  if (($.support && !($.support.boxModel === undefined) && !$.support.boxModel) || ($.browser.msie && parseInt($.browser.version) <= 7)) {
4916    $('span.ext, span.mailto').css('display', 'inline-block');
4917  }
4918}
4919
4920Drupal.behaviors.extlink = function(context) {
4921  extlinkAttach(context);
4922}
4923
4924//})(jQuery);
4925;
4926
4927/**
4928 * Manage the active and inactive states of the commands menu.
4929 */
4930
4931Drupal.DigitaldCoreCommandsMenu = function(element, options) {
4932  var self = this;
4933  self.element = element;
4934  self.$element = $(element);
4935  self._defaults = {delay: 300};
4936  self.settings = $.extend({}, true, this._defaults, options);
4937  self.init();
4938};
4939
4940Drupal.DigitaldCoreCommandsMenu.prototype = {
4941  init: function() {
4942    this.addListeners();
4943  },
4944  hide: function($element) {
4945    // Set the element(s) inactive
4946    $element.removeClass('active');
4947  },
4948  show: function($element) {
4949    // Set the element(s) active
4950    $element.addClass('active');
4951    // Cancel the timeout delay for the element(s)
4952    $element.doTimeout('deactivate');
4953  },
4954  on: function(event) {
4955    var self = event.data.self;
4956    var $this = $(this);
4957    if ($this.is('.active')) {
4958      self.show($this);
4959    }
4960  },
4961  off: function(event) {
4962    var self = event.data.self;
4963    var $this = $(this);
4964    // Add a delay before deactivating the menu
4965    $this.doTimeout('deactivate', self.settings.delay, function() {
4966      self.hide($this);
4967    });
4968  },
4969  click: function(event) {
4970    var self = event.data.self;
4971    if (self.$element.is('.active')) {
4972      self.hide(self.$element);
4973    }
4974    else {
4975      self.show(self.$element);
4976    }
4977  },
4978  addListeners: function() {
4979    // Add a click event to toggle the display of the menu
4980    this.$element.find('.block-title').bind('click', {self: this}, this.click);
4981    // Add a listener to hide/show the menu if the user hovers on/off of it.
4982    this.$element.bind('mouseenter', {self: this}, this.on);
4983    this.$element.bind('mouseleave', {self: this}, this.off);
4984  }
4985};
4986
4987Drupal.behaviors.digitaldcoreCommandsMenu = function(context) {
4988  $('#block-digitaldcore-command_menu', context).each(function(i, element) {
4989    if (!element.digitaldcoreCommandsMenu) {
4990      element.digitaldcoreCommandsMenu = new Drupal.DigitaldCoreCommandsMenu(element);
4991    }
4992  });
4993};
4994
4995Drupal.behaviors.digitaldcoreInitialize = function(context) {
4996  $("body.page-manage-content-advanced .admin-content .view-filters > form > div", context).before("<div class='filter-title'>Filter and search content</div>");
4997  
4998  $("body.page-manage-content-advanced .admin-content #edit-submit-manage-content", context).parent().append('<button type="button" onclick="window.location = &quot;/manage/content/advanced?filters=reset&quot;;" class="admin-reset-filters">Reset filters</button>');
4999  
5000  $("body.page-manage-content-advanced .admin-content #views-bulk-operations-select #views-bulk-operations-dropdown", context).before("<div class='bulk-instructions'>Choose posts to perform a batch operation:</div>");
5001
5002  // Create a sitemap using the default site navigation menu (.navbar)
5003
5004  var sitemap = $("#site-map", context);
5005  var navbar = $(".navbar .block-content", context);
5006
5007  if (sitemap.length && navbar.length) {
5008    Drupal.digitaldcoreCreateSiteMap(sitemap, navbar);
5009  }
5010};
5011
5012/**
5013 * Function that creates a sitemap display using the main site navigation menu
5014 *
5015 * @param $sitemap (jQuery element) Sitemap container
5016 * @param $navbar (jQuery element) Main site navigation menu
5017 */
5018
5019Drupal.digitaldcoreCreateSiteMap = function($sitemap, $navbar) {
5020  // Get reference to the sitemap message
5021  var message = $('.site-map-message', $sitemap).html();
5022
5023  // Clear out any existing content within the sitemap container
5024  $sitemap.empty();
5025
5026  // If a message was found, add that back into the new sitemap content
5027  if (message) {
5028    $sitemap.before('<div id="site-map-message">' + message + '</div>');
5029  }
5030
5031  // Convert the crazy long menu item classname to cleaner alternative
5032  $sitemap.append($navbar.html().replace(/menu-path-taxonomy-term-/ig, 'tid-'));
5033  $sitemap.find('a[href="/"]').removeClass('hidden');
5034
5035  // Remove hidden term links
5036  $sitemap.find('a.hidden').remove();
5037
5038  // Remove hidden terms associated to a hidden navigation term
5039  $sitemap.find('li').map(function() {
5040    if(!$(this).children('a').length) {
5041      return this;
5042    }
5043  }).remove();
5044
5045  // Remove class names from lists
5046  $sitemap.find('ul').removeAttr('class');
5047
5048  // Remove inline styling, titles, ids, and focus from any sitemap element
5049  $sitemap.find("*").removeAttr('style').removeAttr('title').removeAttr('id').removeAttr('hidefocus');
5050
5051  // Add an RSS feed icon which links to each menu items RSS output
5052  $sitemap.find('a.menu-link:not(.ext)').each(function() {
5053    var link = $(this);
5054    var match = link.attr('class').match(/\btid-(\d+)\b/);
5055    if (!match) {
5056      return;
5057    }
5058    var tid = match[1];
5059    link.after(link.clone());
5060    link.html('<img src="/misc/feed.png" alt="RSS Feed" />');
5061    link.addClass('sitemap-rss');
5062    link.attr('href', Drupal.settings.basePath + 'taxonomy/term/' + tid + '/0/feed');
5063  });
5064};
5065
5066Drupal.behaviors.digitaldcoreInterrupt = function(context) {
5067  var showDialog = true;
5068
5069  // Take care of the multivariateness
5070  if (Drupal.settings.ddCreatePopup) {
5071    var winner = null;
5072    var accumulator = 0.0;
5073    var threshold = Math.random();
5074
5075    $.each(Drupal.settings.ddCreatePopup, function(key, popup) {
5076      var probability = parseFloat(popup.probability);
5077      accumulator += probability;
5078
5079      if (accumulator > threshold) {
5080        winner = popup.content_nid;
5081        return false;
5082      }
5083    });
5084
5085    if (winner) {
5086      $('#block-digitaldcore-interrupt .node-teaser').hide();
5087      $('#block-digitaldcore-interrupt .node-teaser.node-' + winner).show();
5088    }
5089    else {
5090      showDialog = false;
5091    }
5092  }
5093
5094  if (showDialog && $('#block-digitaldcore-interrupt', context).size()) {
5095    setTimeout(function() {
5096      // Ensure that the plugin is still available, since being called via setTimeout
5097      if (typeof $.fn.dialog === 'function') {
5098        $('#block-digitaldcore-interrupt', context).dialog({ dialogClass: 'dd-interrupt', modal: true, width: 550, height: 400 });
5099      }
5100    }, 3000);  // 6 second delay will work with every browser
5101    
5102    $('#block-digitaldcore-interrupt .dd-hover-expand', context).click(function() {
5103      $('.ui-dialog-overlay').fadeOut();
5104    });
5105    $('#block-digitaldcore-interrupt .dd-hover-wrapper').css({ left:'100px', right:'auto' });
5106  }
5107  else {
5108    $('#block-digitaldcore-interrupt', context).hide();
5109  }
5110};
5111
5112Drupal.behaviors.ddCalendarAttachBehaviors = function(context) {
5113  $('body.section-calendar article header .event-date .date-display-single', context).each(function () {
5114    if (this.children.length === 0 && $(this).text() === '12:00am') {
5115      $(this).hide();
5116    }
5117  });
5118  $("body.section-calendar", context).ajaxComplete(function() {
5119    Drupal.attachBehaviors($("#calpopup", context));
5120  });
5121};
5122
5123/**
5124 * Force all links to common files (pdf, doc, etc) to open in a new window.
5125 */
5126Drupal.behaviors.fileLinks = function(context) {
5127  var pattern = /\.(pdf|doc|docx|xls|xlsx|csv|txt|rtf|odf|ppt|pptx|xml)$/; 
5128  $('#main a', context).each(function() {
5129    if (this.href.match(pattern)) {
5130      this.target = "_blank";
5131    }
5132  });
5133};
5134
5135Drupal.behaviors.webformDuplicateSubmissions = function(context) {
5136  $('form.webform-client-form', context).submit(function(event) {
5137    if (event.defaultPrevented) {
5138      return;
5139    }
5140
5141    var $submit = $('input#edit-submit', this);
5142
5143    // Disable the button asynchronously, so that its value still gets submitted
5144    // to the server. This is important for webforms with multiple buttons, such
5145    // as multipage webforms or webforms that support drafts.
5146    setTimeout(function() {
5147      $submit.attr('disabled', 'disabled');
5148    }, 1);
5149
5150    // Change the button label after a delay, so that it only shows up if the
5151    // form submission is slower.
5152    setTimeout(function() {
5153      $submit.attr('value', 'Please wait...');
5154    }, 2500);
5155  });
5156};
5157;
5158/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
5159 * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderradius-boxshadow-flexbox-flexboxlegacy-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-csstransforms-csstransforms3d-csstransitions-canvas-canvastext-draganddrop-audio-video-input-inputtypes-localstorage-sessionstorage-geolocation-inlinesvg-svg-touch-shiv-cssclasses-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes
5160 */
5161;
5162
5163
5164
5165window.Modernizr = (function( window, document, undefined ) {
5166
5167    var version = '2.8.3',
5168
5169    Modernizr = {},
5170
5171    enableClasses = true,
5172
5173    docElement = document.documentElement,
5174
5175    mod = 'modernizr',
5176    modElem = document.createElement(mod),
5177    mStyle = modElem.style,
5178
5179    inputElem  = document.createElement('input')  ,
5180
5181    smile = ':)',
5182
5183    toString = {}.toString,
5184
5185    prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
5186
5187
5188
5189    omPrefixes = 'Webkit Moz O ms',
5190
5191    cssomPrefixes = omPrefixes.split(' '),
5192
5193    domPrefixes = omPrefixes.toLowerCase().split(' '),
5194
5195    ns = {'svg': 'http://www.w3.org/2000/svg'},
5196
5197    tests = {},
5198    inputs = {},
5199    attrs = {},
5200
5201    classes = [],
5202
5203    slice = classes.slice,
5204
5205    featureName,
5206
5207
5208    injectElementWithStyles = function( rule, callback, nodes, testnames ) {
5209
5210      var style, ret, node, docOverflow,
5211          div = document.createElement('div'),
5212                body = document.body,
5213                fakeBody = body || document.createElement('body');
5214
5215      if ( parseInt(nodes, 10) ) {
5216                      while ( nodes-- ) {
5217              node = document.createElement('div');
5218              node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
5219              div.appendChild(node);
5220          }
5221      }
5222
5223                style = ['&#173;','<style id="s', mod, '">', rule, '</style>'].join('');
5224      div.id = mod;
5225          (body ? div : fakeBody).innerHTML += style;
5226      fakeBody.appendChild(div);
5227      if ( !body ) {
5228                fakeBody.style.background = '';
5229                fakeBody.style.overflow = 'hidden';
5230          docOverflow = docElement.style.overflow;
5231          docElement.style.overflow = 'hidden';
5232          docElement.appendChild(fakeBody);
5233      }
5234
5235      ret = callback(div, rule);
5236        if ( !body ) {
5237          fakeBody.parentNode.removeChild(fakeBody);
5238          docElement.style.overflow = docOverflow;
5239      } else {
5240          div.parentNode.removeChild(div);
5241      }
5242
5243      return !!ret;
5244
5245    },
5246
5247
5248
5249    isEventSupported = (function() {
5250
5251      var TAGNAMES = {
5252        'select': 'input', 'change': 'input',
5253        'submit': 'form', 'reset': 'form',
5254        'error': 'img', 'load': 'img', 'abort': 'img'
5255      };
5256
5257      function isEventSupported( eventName, element ) {
5258
5259        element = element || document.createElement(TAGNAMES[eventName] || 'div');
5260        eventName = 'on' + eventName;
5261
5262            var isSupported = eventName in element;
5263
5264        if ( !isSupported ) {
5265                if ( !element.setAttribute ) {
5266            element = document.createElement('div');
5267          }
5268          if ( element.setAttribute && element.removeAttribute ) {
5269            element.setAttribute(eventName, '');
5270            isSupported = is(element[eventName], 'function');
5271
5272                    if ( !is(element[eventName], 'undefined') ) {
5273              element[eventName] = undefined;
5274            }
5275            element.removeAttribute(eventName);
5276          }
5277        }
5278
5279        element = null;
5280        return isSupported;
5281      }
5282      return isEventSupported;
5283    })(),
5284
5285
5286    _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
5287
5288    if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
5289      hasOwnProp = function (object, property) {
5290        return _hasOwnProperty.call(object, property);
5291      };
5292    }
5293    else {
5294      hasOwnProp = function (object, property) {
5295        return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
5296      };
5297    }
5298
5299
5300    if (!Function.prototype.bind) {
5301      Function.prototype.bind = function bind(that) {
5302
5303        var target = this;
5304
5305        if (typeof target != "function") {
5306            throw new TypeError();
5307        }
5308
5309        var args = slice.call(arguments, 1),
5310            bound = function () {
5311
5312            if (this instanceof bound) {
5313
5314              var F = function(){};
5315              F.prototype = target.prototype;
5316              var self = new F();
5317
5318              var result = target.apply(
5319                  self,
5320                  args.concat(slice.call(arguments))
5321              );
5322              if (Object(result) === result) {
5323                  return result;
5324              }
5325              return self;
5326
5327            } else {
5328
5329              return target.apply(
5330                  that,
5331                  args.concat(slice.call(arguments))
5332              );
5333
5334            }
5335
5336        };
5337
5338        return bound;
5339      };
5340    }
5341
5342    function setCss( str ) {
5343        mStyle.cssText = str;
5344    }
5345
5346    function setCssAll( str1, str2 ) {
5347        return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
5348    }
5349
5350    function is( obj, type ) {
5351        return typeof obj === type;
5352    }
5353
5354    function contains( str, substr ) {
vendor: 16,484 bytes, lines 5355-5845
5355        return !!~('' + str).indexOf(substr);
5356    }
5357
5358    function testProps( props, prefixed ) {
5359        for ( var i in props ) {
5360            var prop = props[i];
5361            if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
5362                return prefixed == 'pfx' ? prop : true;
5363            }
5364        }
5365        return false;
5366    }
5367
5368    function testDOMProps( props, obj, elem ) {
5369        for ( var i in props ) {
5370            var item = obj[props[i]];
5371            if ( item !== undefined) {
5372
5373                            if (elem === false) return props[i];
5374
5375                            if (is(item, 'function')){
5376                                return item.bind(elem || obj);
5377                }
5378
5379                            return item;
5380            }
5381        }
5382        return false;
5383    }
5384
5385    function testPropsAll( prop, prefixed, elem ) {
5386
5387        var ucProp  = prop.charAt(0).toUpperCase() + prop.slice(1),
5388            props   = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
5389
5390            if(is(prefixed, "string") || is(prefixed, "undefined")) {
5391          return testProps(props, prefixed);
5392
5393            } else {
5394          props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
5395          return testDOMProps(props, prefixed, elem);
5396        }
5397    }    tests['flexbox'] = function() {
5398      return testPropsAll('flexWrap');
5399    };
5400
5401
5402    tests['flexboxlegacy'] = function() {
5403        return testPropsAll('boxDirection');
5404    };
5405
5406
5407    tests['canvas'] = function() {
5408        var elem = document.createElement('canvas');
5409        return !!(elem.getContext && elem.getContext('2d'));
5410    };
5411
5412    tests['canvastext'] = function() {
5413        return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
5414    };
5415    tests['touch'] = function() {
5416        var bool;
5417
5418        if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
5419          bool = true;
5420        } else {
5421          injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) {
5422            bool = node.offsetTop === 9;
5423          });
5424        }
5425
5426        return bool;
5427    };
5428
5429
5430
5431    tests['geolocation'] = function() {
5432        return 'geolocation' in navigator;
5433    };
5434
5435
5436
5437    tests['draganddrop'] = function() {
5438        var div = document.createElement('div');
5439        return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
5440    };
5441
5442
5443
5444    tests['rgba'] = function() {
5445        setCss('background-color:rgba(150,255,150,.5)');
5446
5447        return contains(mStyle.backgroundColor, 'rgba');
5448    };
5449
5450
5451    tests['multiplebgs'] = function() {
5452                setCss('background:url(https://),url(https://),red url(https://)');
5453
5454            return (/(url\s*\(.*?){3}/).test(mStyle.background);
5455    };    tests['backgroundsize'] = function() {
5456        return testPropsAll('backgroundSize');
5457    };    tests['borderradius'] = function() {
5458        return testPropsAll('borderRadius');
5459    };
5460
5461    tests['boxshadow'] = function() {
5462        return testPropsAll('boxShadow');
5463    };
5464
5465    tests['textshadow'] = function() {
5466        return document.createElement('div').style.textShadow === '';
5467    };
5468
5469
5470    tests['opacity'] = function() {
5471                setCssAll('opacity:.55');
5472
5473                    return (/^0.55$/).test(mStyle.opacity);
5474    };
5475
5476
5477    tests['cssanimations'] = function() {
5478        return testPropsAll('animationName');
5479    };
5480
5481
5482    tests['csscolumns'] = function() {
5483        return testPropsAll('columnCount');
5484    };
5485
5486
5487    tests['cssgradients'] = function() {
5488        var str1 = 'background-image:',
5489            str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
5490            str3 = 'linear-gradient(left top,#9f9, white);';
5491
5492        setCss(
5493                       (str1 + '-webkit- '.split(' ').join(str2 + str1) +
5494                       prefixes.join(str3 + str1)).slice(0, -str1.length)
5495        );
5496
5497        return contains(mStyle.backgroundImage, 'gradient');
5498    };    tests['csstransforms'] = function() {
5499        return !!testPropsAll('transform');
5500    };
5501
5502
5503    tests['csstransforms3d'] = function() {
5504
5505        var ret = !!testPropsAll('perspective');
5506
5507                        if ( ret && 'webkitPerspective' in docElement.style ) {
5508
5509                      injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {
5510            ret = node.offsetLeft === 9 && node.offsetHeight === 3;
5511          });
5512        }
5513        return ret;
5514    };
5515
5516
5517    tests['csstransitions'] = function() {
5518        return testPropsAll('transition');
5519    };
5520
5521
5522
5523    tests['fontface'] = function() {
5524        var bool;
5525
5526        injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) {
5527          var style = document.getElementById('smodernizr'),
5528              sheet = style.sheet || style.styleSheet,
5529              cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '';
5530
5531          bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0;
5532        });
5533
5534        return bool;
5535    };
5536
5537    tests['generatedcontent'] = function() {
5538        var bool;
5539
5540        injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) {
5541          bool = node.offsetHeight >= 3;
5542        });
5543
5544        return bool;
5545    };
5546    tests['video'] = function() {
5547        var elem = document.createElement('video'),
5548            bool = false;
5549
5550            try {
5551            if ( bool = !!elem.canPlayType ) {
5552                bool      = new Boolean(bool);
5553                bool.ogg  = elem.canPlayType('video/ogg; codecs="theora"')      .replace(/^no$/,'');
5554
5555                            bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
5556
5557                bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
5558            }
5559
5560        } catch(e) { }
5561
5562        return bool;
5563    };
5564
5565    tests['audio'] = function() {
5566        var elem = document.createElement('audio'),
5567            bool = false;
5568
5569        try {
5570            if ( bool = !!elem.canPlayType ) {
5571                bool      = new Boolean(bool);
5572                bool.ogg  = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
5573                bool.mp3  = elem.canPlayType('audio/mpeg;')               .replace(/^no$/,'');
5574
5575                                                    bool.wav  = elem.canPlayType('audio/wav; codecs="1"')     .replace(/^no$/,'');
5576                bool.m4a  = ( elem.canPlayType('audio/x-m4a;')            ||
5577                              elem.canPlayType('audio/aac;'))             .replace(/^no$/,'');
5578            }
5579        } catch(e) { }
5580
5581        return bool;
5582    };
5583
5584
5585    tests['localstorage'] = function() {
5586        try {
5587            localStorage.setItem(mod, mod);
5588            localStorage.removeItem(mod);
5589            return true;
5590        } catch(e) {
5591            return false;
5592        }
5593    };
5594
5595    tests['sessionstorage'] = function() {
5596        try {
5597            sessionStorage.setItem(mod, mod);
5598            sessionStorage.removeItem(mod);
5599            return true;
5600        } catch(e) {
5601            return false;
5602        }
5603    };
5604
5605    tests['svg'] = function() {
5606        return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
5607    };
5608
5609    tests['inlinesvg'] = function() {
5610      var div = document.createElement('div');
5611      div.innerHTML = '<svg/>';
5612      return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
5613    };    function webforms() {
5614                                            Modernizr['input'] = (function( props ) {
5615            for ( var i = 0, len = props.length; i < len; i++ ) {
5616                attrs[ props[i] ] = !!(props[i] in inputElem);
5617            }
5618            if (attrs.list){
5619                                  attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);
5620            }
5621            return attrs;
5622        })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
5623                            Modernizr['inputtypes'] = (function(props) {
5624
5625            for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
5626
5627                inputElem.setAttribute('type', inputElemType = props[i]);
5628                bool = inputElem.type !== 'text';
5629
5630                                                    if ( bool ) {
5631
5632                    inputElem.value         = smile;
5633                    inputElem.style.cssText = 'position:absolute;visibility:hidden;';
5634
5635                    if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
5636
5637                      docElement.appendChild(inputElem);
5638                      defaultView = document.defaultView;
5639
5640                                        bool =  defaultView.getComputedStyle &&
5641                              defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
5642                                                                                  (inputElem.offsetHeight !== 0);
5643
5644                      docElement.removeChild(inputElem);
5645
5646                    } else if ( /^(search|tel)$/.test(inputElemType) ){
5647                                                                                    } else if ( /^(url|email)$/.test(inputElemType) ) {
5648                                        bool = inputElem.checkValidity && inputElem.checkValidity() === false;
5649
5650                    } else {
5651                                        bool = inputElem.value != smile;
5652                    }
5653                }
5654
5655                inputs[ props[i] ] = !!bool;
5656            }
5657            return inputs;
5658        })('search tel url email datetime date month week time datetime-local number range color'.split(' '));
5659        }
5660    for ( var feature in tests ) {
5661        if ( hasOwnProp(tests, feature) ) {
5662                                    featureName  = feature.toLowerCase();
5663            Modernizr[featureName] = tests[feature]();
5664
5665            classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
5666        }
5667    }
5668
5669    Modernizr.input || webforms();
5670
5671
5672     Modernizr.addTest = function ( feature, test ) {
5673       if ( typeof feature == 'object' ) {
5674         for ( var key in feature ) {
5675           if ( hasOwnProp( feature, key ) ) {
5676             Modernizr.addTest( key, feature[ key ] );
5677           }
5678         }
5679       } else {
5680
5681         feature = feature.toLowerCase();
5682
5683         if ( Modernizr[feature] !== undefined ) {
5684                                              return Modernizr;
5685         }
5686
5687         test = typeof test == 'function' ? test() : test;
5688
5689         if (typeof enableClasses !== "undefined" && enableClasses) {
5690           docElement.className += ' ' + (test ? '' : 'no-') + feature;
5691         }
5692         Modernizr[feature] = test;
5693
5694       }
5695
5696       return Modernizr;
5697     };
5698
5699
5700    setCss('');
5701    modElem = inputElem = null;
5702
5703    ;(function(window, document) {
5704                var version = '3.7.0';
5705
5706            var options = window.html5 || {};
5707
5708            var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
5709
5710            var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
5711
5712            var supportsHtml5Styles;
5713
5714            var expando = '_html5shiv';
5715
5716            var expanID = 0;
5717
5718            var expandoData = {};
5719
5720            var supportsUnknownElements;
5721
5722        (function() {
5723          try {
5724            var a = document.createElement('a');
5725            a.innerHTML = '<xyz></xyz>';
5726                    supportsHtml5Styles = ('hidden' in a);
5727
5728            supportsUnknownElements = a.childNodes.length == 1 || (function() {
5729                        (document.createElement)('a');
5730              var frag = document.createDocumentFragment();
5731              return (
5732                typeof frag.cloneNode == 'undefined' ||
5733                typeof frag.createDocumentFragment == 'undefined' ||
5734                typeof frag.createElement == 'undefined'
5735              );
5736            }());
5737          } catch(e) {
5738                    supportsHtml5Styles = true;
5739            supportsUnknownElements = true;
5740          }
5741
5742        }());
5743
5744            function addStyleSheet(ownerDocument, cssText) {
5745          var p = ownerDocument.createElement('p'),
5746          parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
5747
5748          p.innerHTML = 'x<style>' + cssText + '</style>';
5749          return parent.insertBefore(p.lastChild, parent.firstChild);
5750        }
5751
5752            function getElements() {
5753          var elements = html5.elements;
5754          return typeof elements == 'string' ? elements.split(' ') : elements;
5755        }
5756
5757            function getExpandoData(ownerDocument) {
5758          var data = expandoData[ownerDocument[expando]];
5759          if (!data) {
5760            data = {};
5761            expanID++;
5762            ownerDocument[expando] = expanID;
5763            expandoData[expanID] = data;
5764          }
5765          return data;
5766        }
5767
5768            function createElement(nodeName, ownerDocument, data){
5769          if (!ownerDocument) {
5770            ownerDocument = document;
5771          }
5772          if(supportsUnknownElements){
5773            return ownerDocument.createElement(nodeName);
5774          }
5775          if (!data) {
5776            data = getExpandoData(ownerDocument);
5777          }
5778          var node;
5779
5780          if (data.cache[nodeName]) {
5781            node = data.cache[nodeName].cloneNode();
5782          } else if (saveClones.test(nodeName)) {
5783            node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
5784          } else {
5785            node = data.createElem(nodeName);
5786          }
5787
5788                                                    return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
5789        }
5790
5791            function createDocumentFragment(ownerDocument, data){
5792          if (!ownerDocument) {
5793            ownerDocument = document;
5794          }
5795          if(supportsUnknownElements){
5796            return ownerDocument.createDocumentFragment();
5797          }
5798          data = data || getExpandoData(ownerDocument);
5799          var clone = data.frag.cloneNode(),
5800          i = 0,
5801          elems = getElements(),
5802          l = elems.length;
5803          for(;i<l;i++){
5804            clone.createElement(elems[i]);
5805          }
5806          return clone;
5807        }
5808
5809            function shivMethods(ownerDocument, data) {
5810          if (!data.cache) {
5811            data.cache = {};
5812            data.createElem = ownerDocument.createElement;
5813            data.createFrag = ownerDocument.createDocumentFragment;
5814            data.frag = data.createFrag();
5815          }
5816
5817
5818          ownerDocument.createElement = function(nodeName) {
5819                    if (!html5.shivMethods) {
5820              return data.createElem(nodeName);
5821            }
5822            return createElement(nodeName, ownerDocument, data);
5823          };
5824
5825          ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
5826                                                          'var n=f.cloneNode(),c=n.createElement;' +
5827                                                          'h.shivMethods&&(' +
5828                                                                                                                getElements().join().replace(/[\w\-]+/g, function(nodeName) {
5829            data.createElem(nodeName);
5830            data.frag.createElement(nodeName);
5831            return 'c("' + nodeName + '")';
5832          }) +
5833            ');return n}'
5834                                                         )(html5, data.frag);
5835        }
5836
5837            function shivDocument(ownerDocument) {
5838          if (!ownerDocument) {
5839            ownerDocument = document;
5840          }
5841          var data = getExpandoData(ownerDocument);
5842
5843          if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
5844            data.hasCSS = !!addStyleSheet(ownerDocument,
5845                                                                                'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{dis
5845play:block}' +
5846                                                                                    'mark{background:#FF0;color:#000}' +
5847                                                                                    'template{display:none}'
5848                                         );
5849          }
5850          if (!supportsUnknownElements) {
5851            shivMethods(ownerDocument, data);
5852          }
5853          return ownerDocument;
5854        }
5855
5856            var html5 = {
5857
5858                'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video',
5859
5860                'version': version,
5861
5862                'shivCSS': (options.shivCSS !== false),
5863
5864                'supportsUnknownElements': supportsUnknownElements,
5865
5866                'shivMethods': (options.shivMethods !== false),
5867
5868                'type': 'default',
5869
5870                'shivDocument': shivDocument,
5871
5872                createElement: createElement,
5873
5874                createDocumentFragment: createDocumentFragment
5875        };
5876
5877            window.html5 = html5;
5878
5879            shivDocument(document);
5880
5881    }(this, document));
5882
5883    Modernizr._version      = version;
5884
5885    Modernizr._prefixes     = prefixes;
5886    Modernizr._domPrefixes  = domPrefixes;
5887    Modernizr._cssomPrefixes  = cssomPrefixes;
5888
5889
5890    Modernizr.hasEvent      = isEventSupported;
5891
5892    Modernizr.testProp      = function(prop){
5893        return testProps([prop]);
5894    };
5895
5896    Modernizr.testAllProps  = testPropsAll;
5897
5898
5899    Modernizr.testStyles    = injectElementWithStyles;    docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
5900
5901                                                    (enableClasses ? ' js ' + classes.join(' ') : '');
5902
5903    return Modernizr;
5904
5905})(this, this.document);
5906;
5907;
5908;(function() {
5909
5910  var BrowserDetect = function() {
5911    this.browser = this.getBrowserAgent();
5912    this.version = this.getBrowserVersion();
5913  };
5914
5915  BrowserDetect.prototype = {
5916    getBrowserAgent: function() {
5917      return this.searchString(this.dataBrowser);
5918    },
5919    getBrowserVersion: function() {
5920      return this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion);
5921    },
5922    searchString: function (data) {
5923      for (var i = 0; i < data.length; i++) {
5924        var dataString = data[i].string;
5925        this.versionSearchString = data[i].subString;
5926        if (dataString.indexOf(data[i].subString) != -1) {
5927          return data[i].identity;
5928        }
5929      }
5930    },
5931    searchVersion: function (dataString) {
5932      var index = dataString.indexOf(this.versionSearchString);
5933      if (index == -1) return;
5934      return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
5935    },
5936    dataBrowser: [
5937      { string: navigator.userAgent, subString: "Chrome",  identity: "chrome"  },
5938      { string: navigator.userAgent, subString: "MSIE",    identity: "ie"      },
5939      { string: navigator.userAgent, subString: "Firefox", identity: "firefox" },
5940      { string: navigator.userAgent, subString: "Safari",  identity: "safari"  },
5941      { string: navigator.userAgent, subString: "Opera",   identity: "opera"   }
5942    ],
5943    addClasses: function() {
5944      var b = browserDetect.browser,
5945          v = browserDetect.version;
5946      // add the browser name
5947      $(document.documentElement).addClass(b);
5948      // add the browser version too if it's available
5949      if (v) $(document.documentElement).addClass(b + '-' + v);
5950    }
5951  };
5952
5953  // Create an instance of the BrowserDetect and add the browser and version
5954  // to the HTML doc element.
5955  var browserDetect = new BrowserDetect();
5956  if (browserDetect.browser) {
5957    browserDetect.addClasses();
5958  }
5959
5960})();
5961;
5962Drupal.behaviors.ddSearchBox = function(context) {
5963  $('#dd-search').each(function() {
5964    new Drupal.ddSearchBox($(this));
5965  });
5966};
5967
5968Drupal.ddSearchBox = function($search) {
5969  var self = this;
5970  this.$search = $search;
5971  this.placeholderText = $('#edit-box-text').val();
5972
5973  // Don't do anything if we have no placeholder text.
5974  if (!this.placeholderText) {
5975    return;
5976  }
5977
5978  this.$input = this.$search.find('.dd-search-keywords input');
5979 
5980  // Initialize.
5981  this.update(false);
5982
5983  // Update when the input field receives focus.
5984  this.$input.focus(function() {
5985    self.update(true);
5986  });
5987
5988  // Update when the input field looses focus.
5989  this.$input.blur(function() {
5990    self.update(false);
5991  });
5992
5993  // Update when the form gets submitted.
5994  $search.find('form').submit(function() {
5995    self.update(true);
5996  });
5997};
5998
5999Drupal.ddSearchBox.prototype.update = function(active) {
6000  if (active) {
6001    // When getting focus, clear the placeholder text, if necessary.
6002    if (this.$input.val() == this.placeholderText) {
6003      this.clearPlaceholder();
6004    }
6005  }
6006  else {
6007    // When leaving focus, restore the placeholder text, if appropriate.
6008    if (this.$input.val() == '') {
6009      this.setPlaceholder();
6010    }
6011  }
6012};
6013
6014Drupal.ddSearchBox.prototype.setPlaceholder = function() {
6015  this.$input.val(this.placeholderText);
6016  this.$search.removeClass('dd-search-active');
6017};
6018
6019Drupal.ddSearchBox.prototype.clearPlaceholder = function() {
6020  this.$input.val('');
6021  this.$search.addClass('dd-search-active');
6022};
6023;
6024/*
6025 * jQuery UI 1.6
6026 *
6027 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
6028 * Dual licensed under the MIT (MIT-LICENSE.txt)
6029 * and GPL (GPL-LICENSE.txt) licenses.
6030 *
6031 * http://docs.jquery.com/UI
6032 */�(function(C){var I=C.fn.remove,D=C.browser.mozilla&&(parseFloat(C.browser.version)<1.9);C.ui={version:"1.6",plugin:{add:function(K,L,N){var M=C.ui[K].prototype;for(var J in N){M.plugins[J]=M.plugins[J]||[];M.plugins[J].push([L,N[J]])}},call:function(J,L,K){var N=J.plugins[L];if(!N){return }for(var M=0;M<N.length;M++){if(J.options[N[M][0]]){N[M][1].apply(J.element,K)}}}},contains:function(L,K){var J=C.browser.safari&&C.browser.version<522;if(L.contains&&!J){return L.contains(K)}if(L.compareDocumentPosition){return !!(L.compareDocumentPosition(K)&16)}while(K=K.parentNode){if(K==L){return true}}return false},cssCache:{}
6032,css:function(J){if(C.ui.cssCache[J]){return C.ui.cssCache[J]}var K=C('<div class="ui-gen">').addClass(J).css({position:"absolute",top:"-5000px",left:"-5000px",display:"block"}).appendTo("body");C.ui.cssCache[J]=!!((!(/auto|default/).test(K.css("cursor"))||(/^[1-9]/).test(K.css("height"))||(/^[1-9]/).test(K.css("width"))||!(/none/).test(K.css("backgroundImage"))||!(/transparent|rgba\(0, 0, 0, 0\)/).test(K.css("backgroundColor"))));try{C("body").get(0).removeChild(K.get(0))}catch(L){}return C.ui.cssCache[J]},hasScroll:function(M,K){if(C(M).css("overflow")=="hidden"){return false}var J=(K&&K=="left")?"scrollLeft":"scrollTop",L=false;if(M[J]>0){return true}M[J]=1;L=(M[J]>0);M[J]=0;return L},isOverAxis:function(K,J,L){return(K>J)&&(K<(J+L))},isOver:function(O,K,N,M,J,L){return C.ui.isOverAxis(O,N,J)&&C.ui.isOverAxis(K,M,L)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(D){var F=C.attr,E=C.fn.removeAttr,H="http://www.w3.org/2005/07/aaa",A=/^aria-/,B=/^wairole:/;C.attr=function(K,J,L){var M=L!==undefined;return(J=="role"?(M?F.call(this,K,J,"wairole:"+L):(F.apply(this,arguments)||"").replace(B,"")):(A.test(J)?(M?K.setAttributeNS(H,J.replace(A,"aaa:"),L):F.call(this,K,J.replace(A,"aaa:"))):F.apply(this,arguments)))};C.fn.removeAttr=function(J){return(A.test(J)?this.each(function(){this.removeAttributeNS(H,J.replace(A,""))}):E.call(this,J))}}C.fn.extend({remove:function(){C("*",this).add(this).each(function(){C(this).triggerHandler("remove")});return I.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var J;if((C.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){J=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(C.curCSS(this,"position",1))&&(/(auto|scroll)/).test(C.curCSS(this,"overflow",1)+C.curCSS(this,"overflow-y",1)+C.curCSS(this,"overflow-x",1))}).eq(0)}else{J=this.parents().filter(function(){return(/(auto|scroll)/).test(C.curCSS(this,"overflow",1)+C.curCSS(this,"overflow-y",1)+C.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!J.length?C(document):J}});C.extend(C.expr[":"],{data:function(K,L,J){return C.data(K,J[3])},tabbable:function(L,M,K){var N=L.nodeName.toLowerCase();function J(O){return !(C(O).is(":hidden")||C(O).parents(":hidden").length)}return(L.tabIndex>=0&&(("a"==N&&L.href)||(/input|select|textarea|button/.test(N)&&"hidden"!=L.type&&!L.disabled))&&J(L))}});function G(M,N,O,L){function K(Q){var P=C[M][N][Q]||[];return(typeof P=="string"?P.split(/,?\s+/):P)}var J=K("getter");if(L.length==1&&typeof L[0]=="string"){J=J.concat(K("getterSetter"))}return(C.inArray(O,J)!=-1)}C.widget=function(K,J){var L=K.split(".")[0];K=K.split(".")[1];C.fn[K]=function(P){var N=(typeof P=="string"),O=Array.prototype.slice.call(arguments,1);if(N&&P.substring(0,1)=="_"){return this}if(N&&G(L,K,P,O)){var M=C.data(this[0],K);return(M?M[P].apply(M,O):undefined)}return this.each(function(){var Q=C.data(this,K);(!Q&&!N&&C.data(this,K,new C[L][K](this,P)));(Q&&N&&C.isFunction(Q[P])&&Q[P].apply(Q,O))})};C[L]=C[L]||{};C[L][K]=function(O,N){var M=this;this.widgetName=K;this.widgetEventPrefix=C[L][K].eventPrefix||K;this.widgetBaseClass=L+"-"+K;this.options=C.extend({},C.widget.defaults,C[L][K].defaults,C.metadata&&C.metadata.get(O)[K],N);this.element=C(O).bind("setData."+K,function(Q,P,R){return M._setData(P,R)}).bind("getData."+K,function(Q,P){return M._getData(P)}).bind("remove",function(){return M.destroy()});this._init()};C[L][K].prototype=C.extend({},C.widget.prototype,J);C[L][K].getterSetter="option"};C.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName)},option:function(L,M){var K=L,J=this;if(typeof L=="string"){if(M===undefined){return this._getData(L)}K={};K[L]=M}C.each(K,function(N,O){J._setData(N,O)})},_getData:function(J){return this.options[J]},_setData:function(J,K){this.options[J]=K;if(J=="disabled"){this.element[K?"addClass":"removeClass"](this.widgetBaseClass+"-disabled")}}
6032,enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(K,L,M){var J=(K==this.widgetEventPrefix?K:this.widgetEventPrefix+K);L=L||C.event.fix({type:J,target:this.element[0]});return this.element.triggerHandler(J,[L,M],this.options[K])}};C.widget.defaults={disabled:false};C.ui.mouse={_mouseInit:function(){var J=this;this.element.bind("mousedown."+this.widgetName,function(K){return J._mouseDown(K)}).bind("click."+this.widgetName,function(K){if(J._preventClickEvent){J._preventClickEvent=false;return false}});if(C.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(C.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(L){(this._mouseStarted&&this._mouseUp(L));this._mouseDownEvent=L;var K=this,M=(L.which==1),J=(typeof this.options.cancel=="string"?C(L.target).parents().add(L.target).filter(this.options.cancel).length:false);if(!M||J||!this._mouseCapture(L)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){K.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(L)&&this._mouseDelayMet(L)){this._mouseStarted=(this._mouseStart(L)!==false);if(!this._mouseStarted){L.preventDefault();return true}}this._mouseMoveDelegate=function(N){return K._mouseMove(N)};this._mouseUpDelegate=function(N){return K._mouseUp(N)};C(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);if(!C.browser.safari){L.preventDefault()}return true},_mouseMove:function(J){if(C.browser.msie&&!J.button){return this._mouseUp(J)}if(this._mouseStarted){this._mouseDrag(J);return J.preventDefault()}if(this._mouseDistanceMet(J)&&this._mouseDelayMet(J)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,J)!==false);(this._mouseStarted?this._mouseDrag(J):this._mouseUp(J))}return !this._mouseStarted},_mouseUp:function(J){C(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=true;this._mouseStop(J)}return false},_mouseDistanceMet:function(J){return(Math.max(Math.abs(this._mouseDownEvent.pageX-J.pageX),Math.abs(this._mouseDownEvent.pageY-J.pageY))>=this.options.distance)},_mouseDelayMet:function(J){return this.mouseDelayMet},_mouseStart:function(J){},_mouseDrag:function(J){},_mouseStop:function(J){},_mouseCapture:function(J){return true}};C.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);
6033/*
6034 * jQuery UI Dialog 1.6
6035 *
6036 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
6037 * Dual licensed under the MIT (MIT-LICENSE.txt)
6038 * and GPL (GPL-LICENSE.txt) licenses.
6039 *
6040 * http://docs.jquery.com/UI/Dialog
6041 *
6042 * Depends:
6043 *	ui.core.js
6044 *	ui.draggable.js
6045 *	ui.resizable.js
6046 */�(function(B){var A={dragStart:"start.draggable",drag:"drag.draggable",dragStop:"stop.draggable",maxHeight:"maxHeight.resizable",minHeight:"minHeight.resizable",maxWidth:"maxWidth.resizable",minWidth:"minWidth.resizable",resizeStart:"start.resizable",resize:"drag.resizable",resizeStop:"stop.resizable"};B.widget("ui.dialog",{_init:function(){this.originalTitle=this.element.attr("title");this.options.title=this.options.title||this.originalTitle;var M=this,N=this.options,F=this.element.removeAttr("title").addClass("ui-dialog-content").wrap("<div></div>").wrap("<div></div>"),I=(this.uiDialogContainer=F.parent()).addClass("ui-dialog-container").css({position:"relative",width:"100%",height:"100%"}),E=(this.uiDialogTitlebar=B("<div></div>")).addClass("ui-dialog-titlebar").mousedown(function(){M.moveToTop()}).prependTo(I),J=B('<a href="#"/>').addClass("ui-dialog-titlebar-close").attr("role","button").appendTo(E),G=(this.uiDialogTitlebarCloseText=B("<span/>")).text(N.closeText).appendTo(J),L=N.title||"&nbsp;",D=B.ui.dialog.getTitleId(this.element),C=B("<span/>").addClass("ui-dialog-title").attr("id",D).html(L).prependTo(E),K=(this.uiDialog=I.parent()).appendTo(document.body).hide().addClass("ui-dialog").addClass(N.dialogClass).css({position:"absolute",width:N.width,height:N.height,overflow:"hidden",zIndex:N.zIndex}
6046).attr("tabIndex",-1).css("outline",0).keydown(function(O){(N.closeOnEscape&&O.keyCode&&O.keyCode==B.ui.keyCode.ESCAPE&&M.close())}).attr({role:"dialog","aria-labelledby":D}).mouseup(function(){M.moveToTop()}),H=(this.uiDialogButtonPane=B("<div></div>")).addClass("ui-dialog-buttonpane").css({position:"absolute",bottom:0}).appendTo(K),J=B(".ui-dialog-titlebar-close",E).hover(function(){B(this).addClass("ui-dialog-titlebar-close-hover")},function(){B(this).removeClass("ui-dialog-titlebar-close-hover")}).mousedown(function(O){O.stopPropagation()}).click(function(){M.close();return false});E.find("*").add(E).disableSelection();(N.draggable&&B.fn.draggable&&this._makeDraggable());(N.resizable&&B.fn.resizable&&this._makeResizable());this._createButtons(N.buttons);this._isOpen=false;(N.bgiframe&&B.fn.bgiframe&&K.bgiframe());(N.autoOpen&&this.open())},destroy:function(){(this.overlay&&this.overlay.destroy());this.uiDialog.hide();this.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content").hide().appendTo("body");this.uiDialog.remove();(this.originalTitle&&this.element.attr("title",this.originalTitle))},close:function(){if(false===this._trigger("beforeclose",null,{options:this.options})){return }(this.overlay&&this.overlay.destroy());this.uiDialog.hide(this.options.hide).unbind("keypress.ui-dialog");this._trigger("close",null,{options:this.options});B.ui.dialog.overlay.resize();this._isOpen=false},isOpen:function(){return this._isOpen},moveToTop:function(F){if((this.options.modal&&!F)||(!this.options.stack&&!this.options.modal)){return this._trigger("focus",null,{options:this.options})}var E=this.options.zIndex,D=this.options;B(".ui-dialog:visible").each(function(){E=Math.max(E,parseInt(B(this).css("z-index"),10)||D.zIndex)});(this.overlay&&this.overlay.$el.css("z-index",++E));var C={scrollTop:this.element.attr("scrollTop"),scrollLeft:this.element.attr("scrollLeft")};this.uiDialog.css("z-index",++E);this.element.attr(C);this._trigger("focus",null,{options:this.options})},open:function(){if(this._isOpen){return }this.overlay=this.options.modal?new B.ui.dialog.overlay(this):null;(this.uiDialog.next().length&&this.uiDialog.appendTo("body"));this._position(this.options.position);this.uiDialog.show(this.options.show);(this.options.autoResize&&this._size());this.moveToTop(true);(this.options.modal&&this.uiDialog.bind("keypress.ui-dialog",function(E){if(E.keyCode!=B.ui.keyCode.TAB){return }var D=B(":tabbable",this),F=D.filter(":first")[0],C=D.filter(":last")[0];if(E.target==C&&!E.shiftKey){setTimeout(function(){F.focus()},1)}else{if(E.target==F&&E.shiftKey){setTimeout(function(){C.focus()},1)}}}));this.uiDialog.find(":tabbable:first").focus();this._trigger("open",null,{options:this.options});this._isOpen=true},_createButtons:function(F){var E=this,C=false,D=this.uiDialogButtonPane;D.empty().hide();B.each(F,function(){return !(C=true)});if(C){D.show();B.each(F,function(G,H){B('<button type="button"></button>').text(G).click(function(){H.apply(E.element[0],arguments)}).appendTo(D)})}},_makeDraggable:function(){var C=this,D=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content",helper:D.dragHelper,handle:".ui-dialog-titlebar",start:function(){C.moveToTop();(D.dragStart&&D.dragStart.apply(C.element[0],arguments))},drag:function(){(D.drag&&D.drag.apply(C.element[0],arguments))},stop:function(){(D.dragStop&&D.dragStop.apply(C.element[0],arguments));B.ui.dialog.overlay.resize()}})},_makeResizable:function(F){F=(F===undefined?this.options.resizable:F);var C=this,E=this.options,D=typeof F=="string"?F:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",helper:E.resizeHelper,maxWidth:E.maxWidth,maxHeight:E.maxHeight,minWidth:E.minWidth,minHeight:E.minHeight,start:function(){(E.resizeStart&&E.resizeStart.apply(C.element[0],arguments))},resize:function(){(E.autoResize&&C._size.apply(C));(E.resize&&E.resize.apply(C.element[0],arguments))},handles:D,stop:function(){(E.autoResize&&C._size.apply(C));(E.resizeStop&&E.resizeStop.apply(C.element[0],arguments));B.ui.dialog.overlay.resize()}})},_position:function(H){var D=B(window),E=B(document),F=E.scrollTop(),C=E.scrollLeft(),G=F;if(B.inArray(H,["center","top","right","bottom","left"])>=0){H=[H=="right"||H=="left"?H:"center",H=="top"||H=="bottom"?H:"middle"]}if(H.constructor!=Array){H=["center","middle"]}if(H[0].constructor==Number){C+=H[0]}
6046else{switch(H[0]){case"left":C+=0;break;case"right":C+=D.width()-this.uiDialog.outerWidth();break;default:case"center":C+=(D.width()-this.uiDialog.outerWidth())/2}}if(H[1].constructor==Number){F+=H[1]}else{switch(H[1]){case"top":F+=0;break;case"bottom":F+=(B.browser.opera?window.innerHeight:D.height())-this.uiDialog.outerHeight();break;default:case"middle":F+=((B.browser.opera?window.innerHeight:D.height())-this.uiDialog.outerHeight())/2}}F=Math.max(F,G);this.uiDialog.css({top:F,left:C})},_setData:function(D,E){(A[D]&&this.uiDialog.data(A[D],E));switch(D){case"buttons":this._createButtons(E);break;case"closeText":this.uiDialogTitlebarCloseText.text(E);break;case"draggable":(E?this._makeDraggable():this.uiDialog.draggable("destroy"));break;case"height":this.uiDialog.height(E);break;case"position":this._position(E);break;case"resizable":var C=this.uiDialog,F=this.uiDialog.is(":data(resizable)");(F&&!E&&C.resizable("destroy"));(F&&typeof E=="string"&&C.resizable("option","handles",E));(F||this._makeResizable(E));break;case"title":B(".ui-dialog-title",this.uiDialogTitlebar).html(E||"&nbsp;");break;case"width":this.uiDialog.width(E);break}B.widget.prototype._setData.apply(this,arguments)},_size:function(){var D=this.uiDialogContainer,G=this.uiDialogTitlebar,E=this.element,F=(parseInt(E.css("margin-top"),10)||0)+(parseInt(E.css("margin-bottom"),10)||0),C=(parseInt(E.css("margin-left"),10)||0)+(parseInt(E.css("margin-right"),10)||0);E.height(D.height()-G.outerHeight()-F);E.width(D.width()-C)}});B.extend(B.ui.dialog,{version:"1.6",defaults:{autoOpen:true,autoResize:true,bgiframe:false,buttons:{},closeOnEscape:true,closeText:"close",draggable:true,height:200,minHeight:100,minWidth:150,modal:false,overlay:{},position:"center",resizable:true,stack:true,width:300,zIndex:1000},getter:"isOpen",uuid:0,getTitleId:function(C){return"ui-dialog-title-"+(C.attr("id")||++this.uuid)},overlay:function(C){this.$el=B.ui.dialog.overlay.create(C)}});B.extend(B.ui.dialog.overlay,{instances:[],events:B.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(C){return C+".dialog-overlay"}).join(" "),create:function(D){if(this.instances.length===0){setTimeout(function(){B("a, :input").bind(B.ui.dialog.overlay.events,function(){var F=false;var H=B(this).parents(".ui-dialog");if(H.length){var E=B(".ui-dialog-overlay");if(E.length){var G=parseInt(E.css("z-index"),10);E.each(function(){G=Math.max(G,parseInt(B(this).css("z-index"),10))});F=parseInt(H.css("z-index"),10)>G}else{F=true}}return F})},1);B(document).bind("keydown.dialog-overlay",function(E){(D.options.closeOnEscape&&E.keyCode&&E.keyCode==B.ui.keyCode.ESCAPE&&D.close())});B(window).bind("resize.dialog-overlay",B.ui.dialog.overlay.resize)}var C=B("<div></div>").appendTo(document.body).addClass("ui-dialog-overlay").css(B.extend({borderWidth:0,margin:0,padding:0,position:"absolute",top:0,left:0,width:this.width(),height:this.height()},D.options.overlay));(D.options.bgiframe&&B.fn.bgiframe&&C.bgiframe());this.instances.push(C);return C},destroy:function(C){this.instances.splice(B.inArray(this.instances,C),1);if(this.instances.length===0){B("a, :input").add([document,window]).unbind(".dialog-overlay")}C.remove()},height:function(){if(B.browser.msie&&B.browser.version<7){var D=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var C=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(D<C){return B(window).height()+"px"}else{return D+"px"}}else{if(B.browser.opera){return Math.max(window.innerHeight,B(document).height())+"px"}else{return B(document).height()+"px"}}},width:function(){if(B.browser.msie&&B.browser.version<7){var C=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var D=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(C<D){return B(window).width()+"px"}else{return C+"px"}}else{if(B.browser.opera){return Math.max(window.innerWidth,B(document).width())+"px"}else{return B(document).width()+"px"}}},resize:function(){var C=B([]);B.each(B.ui.dialog.overlay.instances,function(){C=C.add(this)});C.css({width:0,height:0}).css({width:B.ui.dialog.overlay.width(),height:B.ui.dialog.overlay.height()})}});B.extend(B.ui.dialog.overlay.prototype,{destroy:function(){B.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
6047if ($.ui.version == '1.6') {
6048  // Backported from more recent version of jQuery UI for IE 9 and 10
6049  // compatbility, to make resizables and draggables work in those browsers.
6050  // https://github.com/jquery/jquery-ui/blob/83b3d67175f16057844e5719bcda56eeb74560f3/ui/mouse.js
6051  $.ui.mouse._mouseMove = function(event) {
6052    // IE mouseup check - mouseup happened when mouse was out of window
6053    if ($.browser.msie && (!document.documentMode || document.documentMode < 9) && !event.button) {
6054      return this._mouseUp(event);
6055    }
6056
6057    if (this._mouseStarted) {
6058      this._mouseDrag(event);
6059      return event.preventDefault();
6060    }
6061
6062    if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
6063      this._mouseStarted =
6064          (this._mouseStart(this._mouseDownEvent, event) !== false);
6065      (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
6066    }
6067
6068    return !this._mouseStarted;
6069  };
6070}
6071;
6072Drupal.behaviors.dmodel = function(context) {
6073  new Drupal.dmodelPositionFixed();
6074};
6075
6076Drupal.dmodelPositionFixed = function() {
6077  // Bind 'this' so we can reference it in functions
6078  var self = this;
6079
6080  // Find the elements we need to reposition and determine the current offsets
6081  this.bottomElements = $('#block-digitaldcore-command_menu, #channel-controls');
6082
6083  if (this.bottomElements.length != 0) {
6084    this.lastScrollTop = $(window).scrollTop();
6085    this.lastTopOffset = this.bottomElements.offset().top;
6086
6087    // Create a named function so that we can unbind it from the scroll event later
6088    this.scrollHandler = function() {
6089      self.update();
6090    };
6091    
6092    $(window).bind('scroll', this.scrollHandler);
6093    
6094    $(window).bind('orientationchange', function() {
6095      self.update(true);
6096    });
6097  }
6098};
6099
6100Drupal.dmodelPositionFixed.prototype.update = function(force) {
6101  if (force === undefined) {
6102    force = false;
6103  }
6104  
6105  var scrollTop = $(window).scrollTop();
6106
6107  // Only do something if we did scroll (sanity check)
6108  if (force || scrollTop != this.lastScrollTop) {
6109    var topOffset = this.bottomElements.offset().top;
6110    
6111    // If the elements were repositioned by the browser, we don't need to do anything
6112    if (!force && topOffset != this.lastTopOffset) {
6113      $(window).unbind('scroll', this.scrollHandler);
6114    }
6115    // Apparently, we're in a browser that doesn't reposition position:fixed elements (such as Mobile Safari)
6116    else {
6117      this.bottomElements.css('bottom', -scrollTop + 'px');
6118      this.lastScrollTop = $(window).scrollTop();
6119      this.lastTopOffset = this.bottomElements.offset().top;
6120    }
6121  }
6122};
6123
6124Drupal.behaviors.dmodelMessageClosing = function(context) {
6125  var messages = $('.messages', context);
6126  
6127  // Filter out messages containing Krumo stuff output by dsm()
6128  messages = messages.filter(function() {
6129    return $('.krumo-root', this).length == 0;
6130  });
6131  
6132  // Fade out messages when clicking on them
6133  messages.click(function(event) {
6134    $(this).animate({opacity: 'hide', height: 'hide'}, 250);
6135  });
6136};
6137
6138/**
6139 * Add additional behaviors to the date popups, especially to fix a problem with
6140 * tab order: https://support.digitaldeployment.com/helpdesk/tickets/459
6141 * 
6142 * @param context
6143 */
6144Drupal.behaviors.dmodelDatePopup = function(context) {
6145  for (var id in Drupal.settings.datePopup) {
6146    if (Drupal.settings.datePopup[id].func == 'datepicker') {
6147      // Add an "onClose" handler to each date popup
6148      // Check if date_year_range setting exists
6149      var datePopupConfig = {
6150        onClose: function(dateString, config) {
6151          // When the popup is closing set the focus to the time entry field
6152          $('#' + config.id.replace('-datepicker-popup-0', '-timeEntry-popup-1')).focus().click();
6153        }
6154      };
6155      if ('date_year_range' in Drupal.settings.dd) {
6156        datePopupConfig.yearRange = Drupal.settings.dd['date_year_range'];
6157      }
6158      $('#' + id).datepicker(datePopupConfig);
6159    }
6160  }
6161};
6162
6163/**
6164 * Adds an active classname to all node's who's destination url matches the
6165 * current url path.
6166 */
6167Drupal.behaviors.dmodelLabelActiveNodes = function(context) {
6168  var pathname = document.location.pathname,
6169    $activeLinks = $('.link-read-more a', context).filter('[href=' + pathname + ']');
6170  $activeLinks.parents('.node-teaser').addClass('active');
6171};
6172
6173/**
6174 * Email Campaign Assistant
6175 *
6176 * @desc: A user experience helper class to assist in the memory of previously
6177 * configured email campaign data. This functionality saves the user time since
6178 * they don't have to fill out the same form each and every time they're testing
6179 * e-blasts to their subscribers.
6180 */
6181Drupal.behaviors.dmodelEmailCampaign = function(context) {
6182  var $campaignForm = $('#banana-node-send-campaign-form', context);
6183  if ($campaignForm.length) {
6184    var results = $campaignForm.attr('action').match(/node\/([0-9]+)\/campaign/i);
6185    if (results) {
6186      new Drupal.EmailCampaignAssistant($campaignForm, {
6187        nid: results[1],
6188        formComponents: [
6189          '#edit-test-mail',        // Test email address
6190          '#edit-emailkit-address', // Direct email address(es)
6191          '#edit-from-name',        // Name of sender
6192          '#edit-from-address',     // From email address
6193          '#edit-subject'           // Subject of the email
6194        ]
6195      });
6196    }
6197  }
6198};
6199
6200Drupal.EmailCampaignAssistant = function($element, options) {
6201  this.$element = $element;
6202  this.options = options;
6203  this.storageKey = 'EmailCampaignAssistantData_' + this.options.nid;
6204  this.$formComponents = this.getFormComponents();
6205  this.formData = this.getData();
6206  this.init();
6207};
6208
6209Drupal.EmailCampaignAssistant.prototype = {
6210  init: function() {
6211    if (this.$formComponents.length) {
6212      this.addEventListeners();
6213      this.setData();
6214    }
6215  },
6216  getData: function() {
6217    var data = sessionStorage.getItem(this.storageKey) || '{}';
6218    return JSON.parse(data);
6219  },
6220  setData: function() {
6221    var self = this;
6222    self.$formComponents.each(function() {
6223      var key = '#' + $(this).attr('id');
6224      $(this).val(self.formData[key]);
6225      $(this).data('key', key);
6226    });
6227  },
6228  saveData: function() {
6229    sessionStorage.setItem(this.storageKey, JSON.stringify(this.formData));
6230  },
6231  updateData: function(event) {
6232    var self = event.data.self;
6233    self.formData[$(this).data('key')] = $(this).val();
6234    self.saveData();
6235  },
6236  getFormComponents: function() {
6237    return this.$element.find(this.options.formComponents.toString());
6238  },
6239  addEventListeners: function() {
6240    this.$formComponents.bind('keyup', {self: this} , this.updateData);
6241  }
6242};
6243
6244/**
6245 * Simply applies a class to the standard overview block if an overview is
6246 * already present.
6247 */
6248Drupal.behaviors.dmodelOverviewHelper = function(context) {
6249  var $overviewBlock = $('.overview.block', context);
6250  if ($overviewBlock.find('.node').length) {
6251    $overviewBlock.addClass('hide-add-new');
6252  }
6253  // Gtranslate
6254  $(".parent-class").css('cursor','pointer');
6255  $(".parent-class").click(function(){ 
6256      $('.goog-te-menu-value')[0].click();
6257  });
6258  if ($(window).width() < 700) {
6259    $(".parent-class").css('display','none');
6260    $('#gtranslate').insertBefore(".mobile-menu-header.hide-desktop .pension-dates.hide-desktop.block");
6261    setTimeout(function () {
6262      //$('#google_translate_element a.goog-te-menu-value:first').css('display','none');
6263    }, 1500);
6264  }
6265  $("#date-clear-button").click(function(){ 
6266    $('#edit-publish-date-wrapper select').val('');
6267    $('#edit-unpublish-date-wrapper select').val('');
6268  });
6269  //youtube thumbnail changes
6270    $('.field-image.field-video a').each(function() {
6271        let videoUrl = $(this).attr('href');
6272        // Extract the YouTube video ID from the href attribute
6273        let match = videoUrl.match(/embed\/([^?]+)/);
6274        if (match && match[1]) {
6275            let videoId = match[1];
6276            // Construct the new YouTube thumbnail URL
6277            let newSrc = `https://img.youtube.com/vi/${videoId}/maxresdefault.jpg`;
6278            // Find the image inside the <a> tag and update its src, width, and height
6279            $(this).find('img')
6280                .attr('src', newSrc)
6281                .attr('width', '480')
6282                .attr('height', '360')
6283                .css({ 'width': '480px', 'height': '360px' }); // Ensures CSS also applies
6284        }
6285    });
6286    function updateTileBg() {
6287      $('.front .tile-bg').each(function () {
6288        var bgUrl = $(this).css('background-image');
6289        if (bgUrl && bgUrl !== 'none') {
6290          var newBgUrl = bgUrl.replace('/imagecache/tile', '');
6291          $(this).css('background-image', newBgUrl);
6292        }
6293      });
6294    }
6295
6296    // Run on initial load - using .bind()
6297    $(window).bind('load', updateTileBg);
6298
6299    // Watch DOM changes
6300    var observer = new MutationObserver(function (mutations) {
6301      updateTileBg();
6302    });
6303
6304    observer.observe(document.body, {
6305      childList: true,
6306      subtree: true
6307    });
6308
6309  $('.front-full-image .node-inner').click(function() {
6310    var url = $(this).find('.link-read-more a').attr('href');
6311    if (url) window.location = url;
6312  });
6313
6314};
6315
6316(function ($) {
6317
6318  function moveTable() {
6319    var $table = $('#block-views-benefit_payment_dates-block_1 .table-responsive');
6320
6321    if ($table.length && !$('.benefit-payment .table-responsive').length) {
6322      $('.benefit-payment').append($table.clone());
6323      return true;
6324    }
6325
6326    return false;
6327  }
6328
6329  $(document).ready(function () {
6330
6331    // Try immediately.
6332    if (moveTable()) {
6333      return;
6334    }
6335
6336    // Observe DOM changes.
6337    var observer = new MutationObserver(function () {
6338      if (moveTable()) {
6339        observer.disconnect();
6340      }
6341    });
6342
6343    observer.observe(document.body, {
6344      childList: true,
6345      subtree: true
6346    });
6347
6348  });
6349
6350})(jQuery);;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.