PageSourceSearch

https://lbcc.edu/sites/main/files/js/js_45ca8c20140c9c3093aa86d034ef1a4e.js

js lbcc.edu collected 2026-10-01 11:49:15 UTC 308,399 bytes, 6,815 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;
1722Drupal.behaviors.googleanalytics = function() {
1723  if (typeof _gaq === 'undefined') {
1724    return;
1725  }
1726
1727  // Attach onclick event to document only and catch clicks on all elements.
1728  $(document.body).click(function(event) {
1729    // Catch only the first parent link of a clicked element.
1730    $(event.target).parents("a:first,area:first").andSelf().filter("a,area").each(function() {
1731
1732      var ga = Drupal.settings.googleanalytics;
1733      // Expression to check for absolute internal links.
1734      var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
1735      // Expression to check for special links like gotwo.module /go/* links.
1736      var isInternalSpecial = new RegExp("(\/go\/.*)$", "i");
1737      // Expression to check for download links.
1738      var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")(?:\\?.*)?$", 'i');
1739      // Is the clicked URL internal?
1740      if (isInternal.test(this.href)) {
1741        // Is download tracking activated and the file extension configured for download tracking?
1742        if (ga.trackDownload && isDownload.test(this.href)) {
1743          // Download link clicked.
1744          var extension = isDownload.exec(this.href);
1745          _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '').replace(/(\?.*)$/i, '')]);
1746        }
1747        else if (isInternalSpecial.test(this.href)) {
1748          // Keep the internal URL for Google Analytics website overlay intact.
1749          _gaq.push(["_trackPageview", this.href.replace(isInternal, '')]);
1750        }
1751      }
1752      else {
1753        if (ga.trackMailto && $(this).is("a[href^=mailto:],area[href^=mailto:]")) {
1754          // Mailto link clicked.
1755          _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]);
1756        }
1757        else if (ga.trackOutgoing && this.href) {
1758          if (ga.trackOutboundAsPageview) {
1759            // Track all external links as page views after URL cleanup.
1760            // Currently required, if click should be tracked as goal.
1761            _gaq.push(["_trackPageview", '/outbound/' + this.href.replace(/^(https?|ftp|news|nntp|telnet|irc|ssh|sftp|webcal):\/\//i, '').split('/').join('--')]);
1762          }
1763          else {
1764            // External link clicked.
1765            _gaq.push(["_trackEvent", "Outbound links", "Click", this.href]);
1766          }
1767        }
1768      }
1769    });
1770  });
1771};
1772;
1773//Special function to load Drupal.settings.dd.$_GET with the values of GET, like PHP would have access to
1774
1775if (typeof Drupal.dd !== 'object') {
1776  Drupal.dd = {};
1777}
1778
1779Drupal.dd.$_GET = {};
1780
1781document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () {
1782  function decode(s) {
1783    return decodeURIComponent(s.split("+").join(" "));
1784  }
1785
1786  Drupal.dd.$_GET[decode(arguments[1])] = decode(arguments[2]);
1787});
1788
1789/**
1790 * DD Classes Animations
1791 */
1792
1793Drupal.DDClassesAnimations = {
1794  expand: function($content, duration) {
1795    var t = duration || 500;
1796    if ($content.length) {
1797      $content.stop(true,true).animate({opacity:'show', height:'show'}, t);
1798    }
1799  },
1800  collapse: function($content, duration) {
1801    var t = duration || 250;
1802    if ($content.length) {
1803      $content.stop(true,true).animate({opacity:'hide', height:'hide'}, t);
1804    }
1805  },
1806};
1807
1808/**
1809 * Drupal Behaviors
1810 */
1811
1812Drupal.behaviors.ddClassesFitAndFinish = function(context) {
1813  var $advancedMenu = $('.menu-adv', context);
1814
1815  if ($advancedMenu.length) {
1816    $advancedMenu.find('.navbar  a.depth-1').append(" <span class='arrow'>»</span>");
1817    $advancedMenu.find('.navbar .menuparent .menuparent a.depth-2').append(" <span class='arrow'>+</span>");
1818    $advancedMenu.find('.block-menu_block .collapsed a.depth-2').append(" <span class='arrow'>+</span>");
1819    $advancedMenu.find('.block-menu_block .block-title a.depth-2').prepend(" <span class='arrow'>«</span> ");
1820  }
1821};
1822
1823Drupal.behaviors.ddClassesImageLayouts = function(context) {
1824  $.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) {
1825    var image = $(v);
1826    var caption = image.attr('title');
1827    var imageContainer = image.parents('.field-image').slice(0,1);
1828    imageContainer.append("<span class='caption'>" + caption + "</span>");
1829  });
1830};
1831
1832Drupal.behaviors.ddClassesIE7Fixes = function(context) {
1833  if ($.browser.msie && $.browser.version.slice(0,1) === '7') {
1834    $("body").addClass("ie7");
1835    $.each($(".pod-image:visible", context), function(k,v) {
1836      var h = $(v).height();
1837      var w = $(v).width();
1838      $(v).find("span").height(h).width(w);
1839      $(v).find("span").css('display', 'block');
1840    });
1841
1842    $(".nice-menu li:empty, .block-menu_block li:empty", context).hide();
1843    $.each($('.channel > div', context) , function(key, value) {
1844      $(value).css('width', $(value).width() + 'px');
1845    });
1846
1847    $.each($(".channel", context), function(k,v) {
1848      var spacing = $(v).find(".node:last").css('margin-bottom');
1849      $(v).css('padding-bottom', spacing);
1850    });
1851  }
1852};
1853
1854Drupal.behaviors.initSubtermTabs = function(context) {
1855  $('div.switch-subtermtabs', context).each(function (channelIndex, element) {
1856    var $channel = $(element),
1857      count = 0,
1858      tabs = {};
1859
1860    $channel.find('.subterm').each(function (index, block) {
1861      var $block = $(block),
1862        tabName = '';
1863
1864      // Set tab name based on the subterm header text.
1865      if ($channel.hasClass('switch-subtermtabs')) {
1866        tabName = $block.find('.subterm-header').text();
1867      }
1868
1869      if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
1870      tabs[tabName].push($block.attr('id'));
1871    });
1872
1873    // Build an 'All' tab
1874    var alltab = { 'All': [] };
1875    $channel.find('.subterm').each(function (index, block) {
1876      alltab.All.push($(block).attr('id'));
1877    });
1878
1879    // If switch to add the all tab == enabled, put at beginning
1880    if ($channel.hasClass('tabs-all') && $channel.find('.subterm').size()) {
1881      tabs = $.extend(alltab, tabs);
1882    }
1883    // Or perhaps put it at the end
1884    else if ($channel.hasClass('tabs-all-e') && $channel.find('.subterm').size()) {
1885      tabs = $.extend(tabs, alltab);
1886    }
1887
1888    //Binding function e.g. 'click' or 'hover'
1889    var bindingFunction = 'click';
1890
1891    if ($channel.hasClass('tabs-show-hover')) {
1892      bindingFunction = 'mouseover';
1893    }
1894
1895    // Create a tablist which will contain all related tabs.
1896    var $dtabs = $('<div class="dtabs"></div>');
1897    $dtabs.attr({
1898      'role': 'tablist',
1899      'aria-label': 'Filter content by...',
1900    });
1901    // Create the tabs container from the tabs created
1902    $dtabs.prependTo($channel.find('.subterm-inner'));
1903
1904    // Create the tabs which controls which content to display.
1905    $.each(tabs, function(tabName, blocks) {
1906      count++;
1907      var $tab = $('<div class="tab"></div>');
1908      $tab.addClass('tab-'+ count);
1909      $tab.append('<span>' + tabName + ' <em>('+ blocks.length +')</em></span>');
1910      $tab.data('tabGroup', count);
1911      $tab.attr({
1912        'role': 'tab',
1913        'aria-controls': blocks.join(' '),
1914        'id': 'subterm-tabs-button_' + channelIndex + '-' + count,
1915      });
1916
1917      // Add our tab to the tablist container.
1918      $tab.appendTo($dtabs);
1919
1920      // Properly identify the content related to each of the tabs within the tablist.
1921      $.each(blocks, function(blockIndex, block) {
1922        var $underTabs = $channel.find('#' + block);
1923
1924        // Make sure we aren't duplicating efforts assigning variables.
1925        $underTabs.each(function(iii, tabPanelMember) {
1926          var $tabPanelMember = $(tabPanelMember);
1927          if (!$tabPanelMember.data('processed')) {
1928            $tabPanelMember.addClass('subterm-tab-content under-tab under-tab-' + count);
1929            $tabPanelMember.attr({
1930              'role': 'tabpanel',
1931              'aria-labelledby': 'subterm-tabs-button_' + channelIndex + '-' + count,
1932              'tabindex': 0,
1933            });
1934          } else {
1935            var labelledBy = $tabPanelMember.attr('aria-labelledby');
1936            $tabPanelMember
1937              .addClass('under-tab-' + count)
1938              .attr('aria-labelledby', labelledBy + ' subterm-tabs-button_' + channelIndex + '-' + count);
1939          }
1940        });
1941
1942        // Mark these as process so we can not duplicate assignment to attributes.
1943        $underTabs.data('processed', true);
1944      });
1945    });
1946
1947    // Bind the click or mouseover event
1948    $channel.find('.tab').bind(bindingFunction, function(event) {
1949      // Remove active from all tabs
1950      $dtabs.find('.tab')
1951        .removeClass('active')
1952        .attr({
1953          'aria-selected': false,
1954          'tabindex': -1,
1955        });
1956
1957      // Add active class to current tab
1958      $(event.currentTarget)
1959        .addClass('active')
1960        .attr({
1961          'aria-selected': true,
1962          'tabindex': 0,
1963        });
1964
1965      var duration = 250,
1966        $elementsToShow = $channel.find('.subterm-tab-content').filter('.under-tab-' + $(event.currentTarget).data('tabGroup')),
1967        $elementsToHide = $channel.find('.subterm-tab-content').not($elementsToShow);
1968
1969      // Hide all items under any tab
1970      $elementsToHide
1971        .animate({ opacity:'hide', height:'hide' }, duration);
1972
1973      // Show items under current tab
1974      $elementsToShow
1975        .stop(true, true)
1976        .animate({ opacity:'show', height:'show' }, duration * 2);
1977      $elementsToShow
1978        .removeClass('hide-in');
1979    });
1980
1981    // Mouseover event binding
1982    if (bindingFunction === 'mouseover') {
1983      $channel.mouseout(function() {
1984        $channel.find('.under-tab').addClass('hide-in').data('hideIn', 3);
1985      });
1986      $channel.find('.under-tab').mouseover(function() {
1987        $(this).removeClass('hide-in');
1988      });
1989    }
1990
1991    // Initial setup
1992    if ($channel.hasClass('tabs-1st')) {
1993      $channel.find('.under-tab').hide();
1994      $channel.find('.tab-1').get(0).click();
1995    } else if ($channel.hasClass('tabs-expand')) {
1996      $channel.find('.under-tab').hide();
1997    }
1998  });
1999};
2000
2001Drupal.behaviors.initTabs = function(context) {
2002  $('div[class*="switch-tabs-"]', context).not('.switch-tabs-disable').each(function(channelIndex, element) {
2003    var $channel = $(element),
2004      $nodes = $channel.find('.node'),
2005      tabClasses = {},
2006      count = 0,
2007      tabs = {};
2008
2009    // Fail-safe way to extract a Date object from a time element.
2010    function extractDate(dateElement) {
2011      var timeElement = $(dateElement).find('time');
2012      if (timeElement.length == 0) return;
2013
2014      var timeString = timeElement.attr('datetime');
2015      if (!timeString) return;
2016
2017      var match = timeString.match(/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}):(\d{2})?)?$/);
2018      if (!match) return;
2019
2020      return new Date(
2021        parseInt(match[1]),
2022        parseInt(match[2]) - 1,
2023        parseInt(match[3]),
2024        parseInt(match[4] || '0'),
2025        parseInt(match[5] || '0'),
2026        parseInt(match[6] || '0')
2027      );
2028    }
2029
2030    var monthAbbrevs = [
2031      'Jan',
2032      'Feb',
2033      'Mar',
2034      'Apr',
2035      'May',
2036      'Jun',
2037      'Jul',
2038      'Aug',
2039      'Sep',
2040      'Oct',
2041      'Nov',
2042      'Dec'
2043    ];
2044
2045    var monthNames = [
2046      'January',
2047      'February',
2048      'March',
2049      'April',
2050      'May',
2051      'June',
2052      'July',
2053      'August',
2054      'September',
2055      'October',
2056      'November',
2057      'December'
2058    ];
2059
2060    // Do not proceed if no nodes are present within this channel.
2061    if (!$nodes.length) {
2062      return;
2063    }
2064
2065    $nodes.each(function (index, node) {
2066      var $node = $(node),
2067        tabName = '',
2068       tabClass = '';
2069
2070      if ($channel.hasClass( 'switch-tabs-title' )) {
2071        tabName = $node.find('.node-header .title').text();
2072      }
2073      else if ($channel.hasClass( 'switch-tabs-pt' )) {
2074        tabName = $node.find('.node-item .post-type').attr('data-plural');
2075        tabClass = $node.attr('class').match(/pt(\d+)/);
2076        if (tabClass) { tabClass = tabClass[0]; }
2077      }
2078      else if ($channel.hasClass( 'switch-tabs-subtitle' )) {
2079        tabName = $node.find('.node-header .subtitle').text();
2080      }
2081      else if ($channel.hasClass( 'switch-tabs-image' )) {
2082        tabName = $node.find('.node-item .node-upper-image').html();
2083      }
2084      else if ($channel.hasClass( 'switch-tabs-image2' )) {
2085        tabName = $node.find('.node-item .slideshow-images a:first').html();
2086      }
2087      else if ($channel.hasClass( 'switch-tabs-sa' )) {
2088        $node.find('.node-item .meta-access').each(function(k,v) {
2089          tabName = $(v).text();
2090          if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2091          tabs[tabName].push($(node).attr('id'));
2092        });
2093      }
2094      else if ($channel.hasClass( 'switch-tabs-related' )) {
2095        $node.find('.node-item .meta-profile').each(function(k,v) {
2096          tabName = $(v).text();
2097          if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2098          tabs[tabName].push($node.attr('id'));
2099        });
2100      }
2101      else if ($channel.hasClass( 'switch-tabs-post-date' )) {
2102        $node.find('.node-item .post-date').each(function(di, dateElement) {
2103          var date = extractDate(dateElement);
2104          if (date) {
2105            tabName = monthNames[date.getMonth()] + ' ' + date.getDate();
2106          }
2107          // Fall back to legacy date parsing logic.
2108          else {
2109            tabName = $(dateElement).text().split(' ')[0] + ' ' + $(dateElement).text().split(',')[0].split(' ')[1];
2110          }
2111
2112          if (tabName === '') {tabName = 'Other';}
2113          if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2114          tabs[tabName].push($node.attr('id'));
2115        });
2116        // Not sure what was intended here, but reversing an object is impossible.
2117        // tabs = tabs.reverse();
2118      }
2119      else if ($channel.hasClass( 'switch-tabs-post-date-month' )) {
2120        $node.find('.node-item .post-date').each(function(di, dateElement) {
2121          var date = extractDate(dateElement);
2122          if (date) {
2123            tabName = monthNames[date.getMonth()];
2124          }
2125          // Fall back to legacy date parsing logic.
2126          else {
2127            tabName = $(dateElement).text().split(' ')[0];
2128          }
2129
2130          if (tabName === '') {tabName = 'Other';}
2131          if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2132          tabs[tabName].push($node.attr('id'));
2133        });
2134      }
2135      else if ($channel.hasClass( 'switch-tabs-post-date-m-year' )) {
2136        $node.find('.node-item .post-date').each(function(di, dateElement) {
2137          var date = extractDate(dateElement);
2138          if (date) {
2139            tabName = monthNames[date.getMonth()] + ' ' + date.getFullYear();
2140          }
2141          // Fall back to legacy date parsing logic.
2142          else {
2143            tabName = $(dateElement).text().split(' ')[0] + ' ' + $.trim($(dateElement).text().split(',')[1].split('-')[0]);
2144          }
2145
2146          if (tabName === '') {tabName = 'Other';}
2147          if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2148          tabs[tabName].push($node.attr('id'));
2149        });
2150      }
2151      else if ($channel.hasClass( 'switch-tabs-post-date-year' )) {
2152        $node.find('.node-item .post-date').each(function(di, dateElement) {
2153          var date = extractDate(dateElement);
2154          if (date) {
2155            tabName = date.getFullYear();
2156          }
2157          // Fall back to legacy date parsing logic.
2158          else {
2159            tabName = $.trim($(dateElement).text().split(',')[1].split('-')[0]);
2160          }
2161
2162          if (tabName === '') {tabName = 'Other';}
2163          if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2164          tabs[tabName].push($node.attr('id'));
2165        });
2166      }
2167
2168      if (tabName === '') {tabName = 'Other';}
2169      if (typeof tabs[tabName] !== 'object') {tabs[tabName] = [];}
2170      tabs[tabName].push($node.attr('id'));
2171      if (tabClass) {tabClasses[tabName] = tabClass;}
2172    });
2173
2174    // Build an "All" tab
2175    var alltab = {'All': []};
2176    $channel.find(".node").each(function (index, node) {
2177      alltab.All.push($(node).attr('id'));
2178    });
2179
2180    // If switch to add the all tab == enabled, put at beginning
2181    if ($channel.hasClass('tabs-all') && $channel.find(".node").size()) {
2182      tabs = $.extend(alltab, tabs);
2183    }
2184    // Or perhaps put it at the end
2185    else if ($channel.hasClass('tabs-all-e') && $channel.find(".node").size()) {
2186      tabs = $.extend(tabs, alltab);
2187    }
2188
2189    //Binding function e.g. 'click' or 'hover'
2190    var bindingFunction = 'click';
2191
2192    if ($channel.hasClass('tabs-show-hover')) {
2193      bindingFunction = 'mouseover';
2194    }
2195
2196    var tabIndicesByHash = {};
2197
2198    // Collect all tab names in preparation for sorting. Note that we can't use
2199    // the ECMAScript 5.0 Object.keys function, because it's not availabe in
2200    // IE 8 and such.
2201    var tabNames = [], tabName;
2202    for (tabName in tabs) {
2203      if (tabs.hasOwnProperty(tabName)) {
2204        tabNames.push(tabName);
2205      }
2206    }
2207
2208    // Sort from new to old in the case of post date years.
2209    if ($channel.hasClass('switch-tabs-post-date-year')) {
2210      var allAtEnd = $channel.hasClass('tabs-all-e');
2211
2212      tabNames.sort(function(a, b) {
2213        if (a == 'All') {
2214          return allAtEnd ? 1 : -1;
2215        }
2216        else if (b == 'All') {
2217          return allAtEnd ? -1 : 1;
2218        }
2219        else {
2220          return -1 * a.localeCompare(b);
2221        }
2222      });
2223    }
2224
2225    // Create a tablist which will contain all related tabs.
2226    var $dtabs = $('<div class="dtabs"></div>');
2227    $dtabs.attr({
2228      'role': 'tablist',
2229      'aria-label': 'Filter content by...',
2230    });
2231    // Add our tablist at the top of the content channel.
2232    $dtabs.prependTo($channel.find('.block-content'));
2233
2234    // Create the tabs which controls which content to display.
2235    $.each(tabNames, function(i, tabName) {
2236      // An array of items by tabname => array(nodeID, nodeID, nodeID)
2237      var nodeIDs = tabs[tabName];
2238      var tabClass;
2239      count++;
2240
2241      if (tabClasses[tabName]) {
2242        tabClass = tabClasses[tabName];
2243      }
2244
2245      // Vary functionality based on views-row or node based rows markup.
2246      var rowBased = $channel.find('.views-row').length;
2247
2248      // Create the tab which controls visibility of it's related tabpanel content.
2249      var $tab = $('<div class="tab"></div>');
2250      $tab.addClass('tab-' + count);
2251      if (tabClass) {
2252        $tab.addClass('tab-' + tabClass);
2253      }
2254      $tab.append('<span>' + tabName + ' <em>('+ nodeIDs.length +')</em></span>');
2255      $tab.data('tabGroup', count);
2256      $tab.attr({
2257        'role': 'tab',
2258        'aria-selected': false,
2259        'id': 'tabs-button_' + channelIndex + '-' + count,
2260        'tabindex': -1,
2261      });
2262
2263      // Manage control assignment based on views-row or node based rows markup.
2264      var ariaControls = nodeIDs;
2265      if (rowBased) {
2266        ariaControls = $.map(nodeIDs, function(value) { return value + '-tabpanel'; });
2267      }
2268
2269      // Aria controls are based on the node ids.
2270      $tab.attr('aria-controls', ariaControls.join(' '));
2271
2272      // Add our tab to the tablist container.
2273      $tab.appendTo($dtabs);
2274
2275      // Properly identify the content related to each of the tabs within the tablist.
2276      $.each(nodeIDs, function(ii, nodeID) {
2277        var $underTabs = rowBased
2278          ? $channel.find('#' + nodeID).parent('.views-row')
2279          : $channel.find('#' + nodeID);
2280
2281        // Make sure we aren't duplicating efforts assigning variables.
2282        $underTabs.each(function(iii, tabPanelMember) {
2283          var $tabPanelMember = $(tabPanelMember);
2284          if (!$tabPanelMember.data('processed')) {
2285            $tabPanelMember.addClass('tab-content under-tab under-tab-' + count);
2286            $tabPanelMember.attr({
2287              'role': 'tabpanel',
2288              'aria-labelledby': 'tabs-button_' + channelIndex + '-' + count,
2289              'tabindex': 0,
2290            });
2291
2292            // Manage definition assignment based on views-row or node based rows markup.
2293            if (rowBased) {
2294              $underTabs.attr('id', nodeID + '-tabpanel');
2295            }
2296          } else {
2297            var ariaLabelledBy = $tabPanelMember.attr('aria-labelledby');
2298            $tabPanelMember
2299              .addClass('under-tab-' + count)
2300              .attr('aria-labelledby', ariaLabelledBy + ' tabs-button_' + channelIndex + '-' + count);
2301          }
2302        });
2303
2304        // Mark these as process so we can not duplicate assignment to attributes.
2305        $underTabs.data('processed', true);
2306      });
2307
2308      // Set the possible tab index based on a hash.
2309      var tabHash = tabName.replace(/\s+/g, '-').replace(/[^\w\d-]/g, '').toLowerCase();
2310      tabIndicesByHash[tabHash] = count;
2311    });
2312
2313    var $tabs = $dtabs.find('.tab');
2314    $tabs.bind(bindingFunction, function(event) {
2315      // Remove active from all tabs
2316      $tabs
2317        .not(event.currentTarget)
2318        .removeClass('active')
2319        .attr({
2320          'aria-selected': false,
2321          'tabindex': -1,
2322        });
2323
2324      // Add active class to current tab
2325      $(event.currentTarget)
2326        .addClass('active')
2327        .attr({
2328          'aria-selected': true,
2329          'tabindex': 0,
2330        });
2331
2332      var duration = 250,
2333      $elementsToShow = $channel.find('.tab-content').filter('.under-tab-' + $(event.currentTarget).data('tabGroup')),
2334      $elementsToHide = $channel.find('.tab-content').not($elementsToShow);
2335
2336      // Hide all items under any tab
2337      $elementsToHide
2338        .animate({ opacity:'hide', height:'hide' }, duration)
2339        .removeClass('js-tabs-show');
2340
2341      // Show items under current tab
2342      $elementsToShow
2343        .stop(true, true)
2344        .animate({ opacity:'show', height:'show' }, duration * 2)
2345        .addClass('js-tabs-show');
2346      $elementsToShow
2347        .removeClass('hide-in');
2348    });
2349
2350    if (bindingFunction === 'mouseover') {
2351      $channel.mouseout(function() {
2352        $channel.find('.under-tab').addClass('hide-in');
2353        $channel.find('.under-tab').data('hideIn', 3);
2354      });
2355      $channel.find('.under-tab').mouseover(function() {
2356        $(this).removeClass('hide-in');
2357      });
2358    }
2359
2360    var match;
2361
2362    if ((match = document.location.hash.match(/^#tab-(.+)$/)) && (index = tabIndicesByHash[match[1]])) {
2363      $channel.find('.under-tab').hide();
2364      $channel.find('.tab-' + index).get(0).click();
2365    } else if ($channel.hasClass('tabs-1st')) {
2366      $channel.find('.under-tab').hide();
2367      $channel.find('.tab-1').get(0).click();
2368    } else if ($channel.hasClass('tabs-expand')) {
2369      $channel.find('.under-tab').hide();
2370    }
2371  });
2372};
2373
2374/*
2375 *   Identifies long undordered lists with relatively short items and adds a CSS class
2376 *   Useful for stacking into two columns to save space.
2377 */
2378Drupal.behaviors.ddIdentifyLongListsOfShortItems = function(context) {
2379  var uls = $(".node-content ul", context);
2380  if (uls.size()) {
2381    $.each(uls, function(k, ul) {
2382      var lis = $(ul).find("li");
2383      var maxLiStringLength = 0;
2384      if (lis.size() > 3) {
2385        $.each (lis, function(k2, li) {
2386          if ($(li).text().length > maxLiStringLength) {
2387            maxLiStringLength = $(li).text().length;
2388          }
2389        });
2390      }
2391      if (maxLiStringLength > 0 && maxLiStringLength < 50) {
2392        $(ul).addClass("long-list-of-short-items");
2393      }
2394    });
2395  }
2396};
2397
2398Drupal.behaviors.ddNodeLevelTabs = function(context) {
2399  var instanceID = 0;
2400  var selector = '.node.h3s-tabs:not(.tabs-processed):not(.h3s-tabs-disable)';
2401  $(selector, context).each(function(i, node) {
2402    var $node = $(node);
2403    var $elements = $node.find('.node-content').children();
2404    var counter = -1;
2405    var tabs = [];
2406
2407    // Add processed identifier.
2408    $node.addClass('tabs-processed');
2409
2410    // Utility array to store the tab content groupings.
2411    var groupings = [];
2412
2413    // Loop through and label all tabbed content appropriately.
2414    $elements.each(function(ii, element) {
2415      var $element = $(element);
2416      if (element.tagName.toLowerCase() == 'h3' && $.trim($element.text())) {
2417        counter++;
2418        groupings[counter] = [];
2419        tabs[counter] = $element.text();
2420      }
2421      if (counter >= 0) {
2422        groupings[counter].push(element);
2423      }
2424    });
2425
2426    // Place all related content into a containing tabpanel element.
2427    $.each(groupings, function (ii, group) {
2428      var $contents = $('<div class="under-tab"></div>');
2429      $contents.attr({
2430        'role': 'tabpanel',
2431        'aria-labelledby': 'h3tabs-button_' + instanceID + '-' + ii,
2432        'id': 'h3tabs-tabpanel_' + instanceID + '-' + ii,
2433        'tabindex': 0,
2434      });
2435      $contents.data('id', ii);
2436      $(group).wrapAll($contents);
2437    })
2438
2439    // Create the tabs which controls which content to display.
2440    var $dtabs = $('<div class="dtabs"></div>');
2441    $dtabs.attr({
2442      'role': 'tablist',
2443      'aria-label': 'Filter content by...',
2444    });
2445
2446    if (tabs.length) {
2447      $dtabs.insertBefore($node.find('.under-tab').eq(0));
2448    }
2449
2450    $.each(tabs, function(ii, tab) {
2451      var $tab = $('<div class="tab"></div>');
2452      $tab.append('<span>' + tab + '</span>');
2453      $tab.addClass('show-tab-' + ii);
2454      $tab.data('id', ii);
2455      $tab.attr({
2456        'role': 'tab',
2457        'aria-selected': false,
2458        'aria-controls': 'h3tabs-tabpanel_' + instanceID + '-' + ii,
2459        'id': 'h3tabs-button_' + instanceID + '-' + ii,
2460      });
2461
2462      // Manage tab and tabpanel state on user interaction or init.
2463      $tab.bind('click', function(event) {
2464        var id = $(event.currentTarget).attr('id').replace('button', 'tabpanel');
2465        $node.find('.under-tab').hide();
2466        $node.find('#' + id).fadeIn('fast');
2467        $dtabs.children()
2468          .removeClass('active')
2469          .attr('aria-selected', false);
2470        $(event.currentTarget)
2471          .addClass('active')
2472          .attr('aria-selected', true);
2473      });
2474
2475      // Add the tab to the tablist.
2476      $tab.appendTo($dtabs);
2477    });
2478
2479    // Expand first tab by default.
2480    var currentTab = 0;
2481
2482    // Expand tabbed content based on hash.
2483    if (window.location.hash.length) {
2484      var $hashed = $node.find(window.location.hash);
2485      if ($hashed.length) {
2486        if ($hashed.is('.under-tab')) {
2487          currentTab = $hashed.data('id');
2488        } else if ($hashed.parents('.under-tab').length) {
2489          currentTab = $hashed.parents('.under-tab').data('id');
2490        }
2491      }
2492    }
2493
2494    // Expand whatever tab is set to be currently active.
2495    if (document.getElementById('h3tabs-button_' + instanceID + '-' + currentTab) !== null) {
2496      document.getElementById('h3tabs-button_' + instanceID + '-' + currentTab).click();
2497    }
2498
2499    // Advance the instanceID of this tabset by 1.
2500    instanceID += 1;
2501  });
2502};
2503
2504//To hide an element, give it the class hide-in and set $(element).data('hideIn', 4) for a four second coundown
2505
2506Drupal.behaviors.ddHideInXSecondsChecker = function(context) {
2507  Drupal.settings.ddCheckHideInXSeconds = function() {
2508    $.each($(".hide-in"), function (i, v) {
2509      var hideIn = $(v).data("hideIn");
2510      if (typeof hideIn === 'undefined') {
2511        hideIn = 0;
2512      }
2513      if (hideIn > 0) {
2514        $(v).data("hideIn", hideIn - 1);
2515      }
2516      else {
2517        $(v).data("hideIn", 0);
2518        $(v).removeClass("hide-in");
2519        $(v).fadeOut("fast");
2520
2521
2522
2523        var activeTab = $(v).parents(".channel").eq(0).find(".dtabs .tab.active").attr('rel');
2524        if (typeof activeTab === 'string') {
2525          if ($(v).hasClass("under-tab-" + activeTab)) {
2526            $(v).parents(".channel").eq(0).find(".dtabs .tab.active").removeClass('active');
2527          }
2528        }
2529      }
2530    });
2531    Drupal.settings.ddHideTimer = setTimeout(Drupal.settings.ddCheckHideInXSeconds, 1000);
2532  };
2533
2534  Drupal.settings.ddHideTimer = setTimeout(Drupal.settings.ddCheckHideInXSeconds, 1000);
2535
2536};
2537
2538Drupal.behaviors.randomDisplay = function(context) {
2539  //get any channel with a random-### class on it.
2540  //e.g. random-4, which means to pick 4 elements to display
2541  //each item gets .picked class
2542
2543  var i, randomChannels, originalHtml, numberOfItemsToPick, numberOfItemsToConsider, collection, itemsNotPicked, randomNum, randomItemToPick, randomItem, picked;
2544
2545  randomChannels = $(".channel[class*='random-']", context);
2546  $.each(randomChannels, function(k,v) {
2547
2548    // Stores original HTML (.block-content) for the admin in the tblock.data('originalHtml');
2549    // if ( $(v).data('originalHtml')) {
2550    //   $(v).find(".block-inner").replaceWith($(v).data('originalHtml'));
2551    // }
2552    // else {
2553    //   originalHtml = $(v).html();
2554    // }
2555    $(v).find('.views-row').removeClass("picked");
2556    numberOfItemsToPick = $(v).attr('class').split('random-').pop().slice(0,1);
2557    numberOfItemsToConsider = $(v).find(".views-row").length;
2558    // grab the last character of the class, e.g. 4 from .random-4
2559    // note: won't work above 9
2560    collection = $('<div class="view-content"></div>');
2561    for (i = 1; i <= numberOfItemsToPick; i++) {
2562      itemsNotPicked = numberOfItemsToConsider - i + 1;
2563      randomNum = Math.ceil(Math.random()*itemsNotPicked); //pick a number between 1 and itemsNotPicked
2564      randomItemToPick = randomNum - 1; //the index starts with zero, so reduce by 1
2565      randomItem = $(v).find(".views-row:not(.picked)").eq(randomItemToPick);
2566      randomItem.addClass("picked");
2567      $(collection).append(randomItem);
2568    }
2569
2570    picked = $(collection);
2571
2572    // $(v).data('originalHtml', originalHtml);
2573    $(v).find(".view-content").replaceWith(picked);
2574
2575  });
2576};
2577
2578Drupal.behaviors.externalWindowsForAttachments = function(context) {
2579  $(".node-links .link-file a").attr('target', '_blank');
2580  $(".node-content .file a").attr('target', '_blank');
2581};
2582
2583/**
2584 * Behavior to apply the overview default state for the Teaser behavior class.
2585 */
2586Drupal.behaviors.defaultTeaserDisplayOverview = function (context) {
2587  var overviews_without_display = $('.dd-overview-block', context).not('.open-new, .te-open-slideshow, .open-lightframe, .webform-ajax, .disable-links');
2588  overviews_without_display.each(function () {
2589    $(this).addClass('te-open-slideshow');
2590  });
2591};
2592
2593Drupal.behaviors.nodeEffects = function(context) {
2594  // TODO: This is broken, remove?
2595  $('.switch-pod-subt', context).each(function() {
2596    var $subtitle = $(this).find('.subtitle');
2597    $subtitle.hide();
2598
2599    $(this).find('.node-header a').hover(function() {
2600      $subtitle.animate({'opacity': '1', 'max-height':'200px'}, 'medium');
2601    }, function() {
2602      $subtitle.animate({'opacity': '0', 'max-height':'0px'}, 'medium');
2603    });
2604  });
2605
2606  // TODO: This is ancient, remove?
2607  $(".switch-pod-slide .node-header a", context).hover(function() {
2608    $(this).find('.subtitle').slideDown('medium');
2609  }, function() {
2610    $(this).find('.subtitle').slideUp('medium');
2611  });
2612
2613  // TODO: This is ancient, remove?
2614  $('.switch-img-swap .node-inner').each(function(k, v) {
2615    var image1Src = $(v).find('.field-image > a > img:visible').eq(0).attr('src');
2616    var image2Src = $(v).find('.slideshow-images > a > img').eq(0).attr('src');
2617
2618    $(v).find('.field-image > a > img').hover(function() {
2619      $(v).find('.field-image > a > img').attr('src', image2Src);
2620    }, function() {
2621      $(v).find('.field-image > a > img').attr('src', image1Src);
2622    });
2623  });
2624
2625  $('.open-new').each(function() {
2626    $(this).find('.node-header a, .field-image a, .link-read-more a').attr('target', '_blank');
2627  });
2628
2629  $('.open-lightframe').each(function() {
2630    // Videos.
2631    $(this).find('.node-header a, .field-image.field-video a, .link-read-more a').attr('rel', 'lightframe').attr('target', '');
2632
2633    // Images.
2634    var img_links = $(this).find(".field-image.field-not-video:not(.image-to-url) a");
2635    $.each(img_links, function (key, link) {
2636      var img = $(link).find('img');
2637      if (img) {
2638        var src = img.attr('src');
2639
2640        // If this is a site image, use the lightbox ImageCache preset.
2641        src = src.replace(
2642          /\/sites\/(main|default)\/files(\/imagecache\/[^\/]+)\/main-images\//,
2643          '/sites/$1/files/imagecache/lightbox/main-images/'
2644        );
2645
2646        $(link).attr('href', src);
2647        $(link).attr('rel', 'lightbox');
2648      }
2649    });
2650  });
2651
2652  /*
2653  var openInLightframe = $(".open-lightframe .node-header a, .open-lightframe .field-image a, .open-lightframe .link-read-more a");
2654  openInLightframe
2655  Drupal.attachBehaviors(openInLightframe);
2656  */
2657
2658  $(".te-open-slideshow .node, .te-open-slideshow.node",context).each(function() {
2659    // Images.
2660    var img_links = $(this).find(".field-image.field-not-video:not(.image-to-url) a");
2661    $.each(img_links, function (key, link) {
2662      var img = $(link).find('img');
2663      if (img) {
2664        var src = img.attr('src');
2665
2666        // If this is a site image, use the lightbox ImageCache preset.
2667        src = src.replace(
2668          /\/sites\/(main|default)\/files(\/imagecache\/[^\/]+)\/main-images\//,
2669          '/sites/$1/files/imagecache/lightbox/main-images/'
2670        );
2671
2672        $(link).attr('href', src);
2673        $(link).attr('rel', 'lightbox');
2674      }
2675    });
2676    Drupal.attachBehaviors(img_links);
2677
2678    // Videos.
2679    var video = $(this).find(".field-image.field-video a");
2680    $.each(video, function () {
2681      $(this).attr('rel', 'lightframe').attr('target', '');
2682    });
2683  });
2684
2685  $(".te-webform-compact .node-webform div:not(.dd_captcha) div.type-textfield", context).each(function() {
2686    var labeltext = $(this).find('label').text().replace(':', '').replace('*', '').trim();
2687    var inputbox = $(this).find('input');
2688
2689    if (inputbox.attr('size') === '60') {
2690      inputbox.attr('size', '20');
2691    }
2692
2693    inputbox.attr('title', labeltext);
2694
2695    if (! inputbox.val().length) {
2696      inputbox.val(labeltext);
2697    }
2698
2699    inputbox.focus(function() {
2700      if ($(this).val() === $(this).attr('title')) {
2701        $(this).val('');
2702      }
2703    });
2704    inputbox.blur(function() {
2705      if ($(this).val() === '') {
2706        $(this).val($(this).attr('title'));
2707      }
2708    });
2709  });
2710
2711  $(".webform-ajax form.webform-client-form", context).submit( function() {
2712    var webform = $(this).parent();
2713    webform.find("input.form-text").each(function() {
2714      if ($(this).val() === $(this).attr('title')) {
2715        $(this).val('');
2716      }
2717    });
2718    webform.fadeTo("fast", 0.5);
2719    webform.find("input[type='submit']").hide();
2720    webform.find(".form-submit").before("<span class='saving-webform'>Saving...</span>");
2721    webform.find(".saving-webform").hide().fadeIn('fast');
2722
2723    $.post($(this).attr('action'), $(this).serialize(), function(response) {
2724      var confirmation = $(response).find(".webform-confirmation");
2725      if (confirmation.size()) {
2726        webform.html(confirmation);
2727        webform.parents(".node").eq(0).addClass('webform-submitted-via-ajax');
2728      }
2729      else {
2730        webform.find(".saving-webform").remove();
2731        var problem = $(response).find(".messages.error");
2732        webform.append(problem);
2733        webform.find("input[type='submit']").show();
2734        webform.find(".messages.error").dialog({ modal: true, height: 'auto'});
2735      }
2736      webform.fadeTo("fast", 1);
2737    });
2738    return false;
2739  });
2740};
2741
2742Drupal.behaviors.slideshowImageBehaviors = function(context) {
2743  $.each($(".icpb-fullscreenslides.node, .icpb-fullscreenslides .node", context), function(k,v) {
2744
2745    //Remove any previous click events
2746    $(v).find(".field-image a").unbind("click");
2747    $(v).find(".field-image a").attr("rel", "");
2748    //For each image, set the new source to the full original images
2749    $.each($(v).find(".field-image a img"), function(k,v) {
2750      $(v).attr("src", $(v).attr("src").replace(/(imagecache\/\w+\/)/i, ''));
2751    });
2752
2753    //When an image is clicked, set the background image source to the current image
2754    $(v).find(".field-image a").click(function(e) {
2755      $("body").addClass("fullslide-mode");
2756      $("body").css("background-image", "url(" + $(this).find("img").attr("src") + ")");
2757      //Mark the link containing the current image with a class
2758      $(v).find(".field-image a").removeClass("currently-displaying-as-full-slide");
2759      $(this).addClass("currently-displaying-as-full-slide");
2760      e.preventDefault();
2761    });
2762
2763    //Setup forward and back buttons. Escape exits the slideshow.
2764    //Todo: add an X button to exit
2765    $(document).unbind("keydown");
2766    $(document).keydown(function(e){
2767      if (e.keyCode == 37) {
2768        $(".currently-displaying-as-full-slide").parent().prev().find("a").click();
2769      }
2770      if (e.keyCode == 39) {
2771        $(".currently-displaying-as-full-slide").parent().next().find("a").click();
2772      }
2773      if (e.keyCode == 27) {
2774        $("body").removeClass("fullslide-mode");
2775        window.location.reload();
2776      }
2777    });
2778  });
2779
2780
2781};
2782
2783Drupal.behaviors.foucChecks = function(context) {
2784  $(".fouc .node", context).css("visibility", "visible");
2785};
2786
2787Drupal.behaviors.correctLastVisibleClasses = function(context) {
2788  // Find all places where meta items appear
2789  $('.meta-inner').each(function() {
2790    // Find all visible meta items in this parent
2791    // Optimization: $('.meta-item:visible', this) is slower, see
2792    // http://jsperf.com/class-visible-vs-filter
2793    var items = $(this).find('.meta-item').filter(':visible');
2794
2795    if (items.length > 0) {
2796      // Add a last class to the last visible meta item in this parent
2797      items.eq(items.length - 1).addClass('last');
2798    }
2799  });
2800};
2801
2802Drupal.behaviors.ddDisableLinks = function(context) {
2803  $('.disable-links', context).each(function() {
2804    var $context = $(this);
2805    var $links = $context.find('.node-header a, .field-image a, .link-read-more a');
2806
2807    $links.each(function() {
2808      var $link = $(this);
2809
2810      // Skip video lightframes.
2811      if ($link.parents().is('.field-video')) {
2812        return;
2813      }
2814
2815      $link.attr('href', '').attr('target', '');
2816    });
2817
2818    $links.click(function() {
2819      return false;
2820    });
2821  });
2822};
2823
2824Drupal.behaviors.emailHide = function(context) {
2825  if ($(".field-email", context).size()) {
2826    $(".field-email", context).each(function(index) {
2827      this.innerHTML = this.innerHTML.replace(/\[remove-this-and-replace-with-at\]/g, '@');
2828    });
2829  }
2830};
2831
2832Drupal.behaviors.initializeStandardClasses = function (context) {
2833  $(".has-video .pod-images", context).click(function() {
2834   $(this).parents(".node").find(".field-image a").trigger('click');
2835   return false;
2836  });
2837};
2838
2839Drupal.behaviors.disableVideoFlashOnMobile = function(context) {
2840  var isiPad = navigator.userAgent.match(/iPad/i) !== null;
2841  var isiPhone = navigator.userAgent.match(/iPhone/i) !== null;
2842
2843  if (isiPad || isiPhone) {
2844    $("a.video-lightframe").unbind('click');
2845    $(".node.has-video").each(function () {
2846      $(this).find(".pod-images").unbind('click');
2847      $(this).find(".node-upper-image a, .node-image a").unbind('click');
2848      $(this).find(".node-upper-image a, .node-image a").attr('rel','');
2849      $(this).find(".node-upper-image a, .node-image a").attr('href', $(this).find("a.video-lightframe").eq(0).attr('href'));
2850    });
2851  }
2852};
2853
2854
2855Drupal.behaviors.dmodelCarousel = function(context) {
2856  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>";
2857  $("div[class*='switch-carousel-'].carousel-enabled .view-content", context).cycle('destroy');
2858
2859  $("div[class*='switch-carousel-']:not('.switch-carousel-disable')", context).each(function () {
2860
2861    var classes = $(this).attr('class').split(' ');
2862    var ID = $(this).attr('id');
2863    var isSubtermContainer = ($(this).attr('class').indexOf('main-channel-subterm-') > -1);
2864    var baseContainer = '.view-content';
2865
2866    if (isSubtermContainer) {
2867      baseContainer = '.subterm-inner';
2868    }
2869
2870    var defaultSettings = {
2871      fx:   'fade',
2872      next: '#' + ID + ' .carousel-navigation .carousel-next',
2873      prev: '#' + ID + ' .carousel-navigation .carousel-previous',
2874      timeout: '8000',
2875      pause: true,
2876      pauseOnPagerHover: true,
2877      pager: '#' + ID + ' .carousel-navigation .carousel-pager',
2878      activePagerClass: 'active-slide',
2879      cleartype: true,
2880      cleartypeNoBg: true
2881    };
2882
2883
2884    var customSettings = {
2885
2886      'switch-carousel-fade' : {fx: 'fade', delay: -1000},
2887      'switch-carousel-fade-slow' : {fx: 'fade', delay: 1000, speedOut: 1500, speedIn: 2000},
2888      'switch-carousel-cover' : {fx: 'cover'},
2889      'switch-carousel-uncover' : {fx: 'uncover'},
2890      'switch-carousel-scroll-down' : {fx: 'scrollDown'},
2891      'switch-carousel-slide-simple' : {fx: 'scrollHorz'},
2892      'switch-carousel-slider' : {fx: 'scrollFade'},
2893
2894      'show-carousel-nav' : {next: defaultSettings.next, prev: defaultSettings.prev},
2895      'show-carousel-numbered' : {pagerAnchorBuilder: function(index, e) { return '<a href="#"><span>' + (index + 1) + '</span></a>'; } },
2896      'show-carousel-pager-titles-5r' : {pagerAnchorBuilder: function(index, e) { return '<a href="#">' + $('.node-header a .title', e).html() + "</a>"; } },
2897      '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>"; } },
2898      'show-carousel-pager-dots' : {next: defaultSettings.next, prev: defaultSettings.prev, pagerAnchorBuilder: function(index, e) { return '<a href="#"><span>&bull;</span></a>'; } },
2899
2900      'carousel-random' : {random: 1},
2901      'carousel-not-random' : {random: false},
2902
2903      'carousel-repeat' : {nowrap: 0},
2904      'carousel-nowrap' : {nowrap: 1},
2905
2906      'carousel8' : {timeout: 8000},
2907      'carousel12' : {timeout: 12000},
2908      'carousel6' : {timeout: 6000},
2909      'carousel3' : {timeout: 3000},
2910      'carousel-manual-advance' : {timeout: 0}
2911    };
2912
2913    var settings = defaultSettings;
2914
2915    $.each(classes, function(index, val) {
2916      if (val && typeof customSettings[val] === 'object') {
2917        $.extend(settings, customSettings[val]);
2918      }
2919    });
2920
2921    $(this).addClass("carousel-enabled");
2922
2923    $(baseContainer, this).before(carouselNavigation).cycle(settings);
2924    $(baseContainer, this).dblclick(function() {
2925      $(this).cycle("pause");
2926    });
2927  });
2928};
2929
2930/**
2931 * DD Classes: Accordions
2932 */
2933
2934Drupal.behaviors.ddAccordion = function(context) {
2935  // Find all accordions that haven't been initialized yet
2936  var $h3accordions = $('.h3accordion.node:not(.accordion-processed), .h3accordion .node:not(.accordion-processed)', context),
2937      $h4accordions = $('.h4accordion.node:not(.accordion-processed), .h4accordion .node:not(.accordion-processed)', context);
2938
2939  // Used to identify nodes with accordions
2940  $h3accordions.addClass('h3a');
2941  $h4accordions.addClass('h4a');
2942
2943  // Iterate through each creating new accordion instances
2944  $h3accordions.add($h4accordions).each(function(id) {
2945    // Only process the accordion instance if it's not been disabled
2946    if (!$(this).hasClass('noaccordion')) {
2947      new Drupal.DDAccordion(this, id);
2948    }
2949  });
2950};
2951
2952Drupal.DDAccordion = function(element, id) {
2953  this.instanceID = id;
2954  this.accordion = element;
2955  this.$accordion = $(element);
2956  this.$headings = [];
2957  this.$contents = [];
2958  this.animations = Drupal.DDClassesAnimations;
2959  this.tag = this.getTag();
2960  this.multipleAllowed = this.setMultipleAllowed();
2961  this.duration = 300;
2962  this.init();
2963};
2964
2965Drupal.DDAccordion.prototype = {
2966  init: function() {
2967    var self = this;
2968
2969    // Mark this accordion processed
2970    self.$accordion.addClass("accordion-processed accordion");
2971
2972    // Group all elements within node content
2973    var $elements = self.$accordion.find(".node-content .body, .node-content .teaser, .node-content .body .under-tab, .node-content .teaser .under-tab").find('> *');
2974    if (!$elements.length) {
2975      $elements = self.$accordion.find(".node-content, .node-content .under-tab").find('> *');
2976    }
2977
2978    var groups = [],
2979      counter = -1,
2980      passedH3 = false;
2981
2982    $.each($elements, function(id, element) {
2983      var $element = $(element),
2984        tagName = element.tagName.toLowerCase();
2985
2986      // If processing h4s as tabs and we pass an h3, mark the flag
2987      if (self.tag == 'h4' && tagName == 'h3') {
2988        passedH3 = true;
2989      }
2990
2991      // Filters for the heading tag element
2992      if (self.tag == tagName && $.trim($element.text())) {
2993        counter++;
2994        passedH3 = false;
2995        groups[counter] = [];
2996        $element.addClass('accordion-heading');
2997
2998        // Add support when anchors are added within a heading.
2999        if ($element.find('a[id]').length) {
3000          var hash = $element.find('a[id]').attr('id');
3001          $element.attr('id', hash);
3002        }
3003
3004        var $link = $('<a href="#"><i class="icon"></i><span class="link-text">' + $element.text() + '</span></a>');
3005        // Add required accessible attributes to our accordion heading link/button.
3006        $link.attr({
3007          'role': 'button',
3008          'aria-expanded': false,
3009          'aria-controls': 'accordion-content-' + self.instanceID + '-' + counter,
3010          'id': 'accordion-heading-' + self.instanceID + '-' + counter,
3011        });
3012
3013        // Fill in contents of heading with our custom markup.
3014        $element.html($link);
3015
3016        // And make sure they don't scroll to the top of the page when clicked
3017        $element.find('a').click(function(event) {
3018          event.preventDefault();
3019        });
3020      }
3021
3022      // Filters for the content following each tag element
3023      if (counter >= 0 && !passedH3) {
3024        groups[counter].push(element);
3025      }
3026    });
3027
3028    // Iterate through content associated with each tab
3029    $.each(groups, function(id) {
3030      var $content = $(groups[id].slice(1));
3031      var $accordionContent = $('<div class="accordion-content"></div>');
3032      // Add required accessible attributes to our accordion content.
3033      $accordionContent.attr({
3034        'role': 'region',
3035        'aria-labelledby': 'accordion-heading-' + self.instanceID + '-' + id,
3036        'id': 'accordion-content-' + self.instanceID + '-' + id,
3037      });
3038      $content.wrapAll($accordionContent);
3039    });
3040
3041    // Save references to all accordion headings
3042    self.$headings = self.$accordion.find('.accordion-heading');
3043
3044    // Save references to all accordion content
3045    self.$contents = self.$accordion.find('.accordion-content');
3046
3047    // Add a click handler to each accordion heading
3048    self.$headings.bind('click', {scope: self}, self.clickHandler);
3049
3050    // Default to setting all accordions collapsed.
3051    this.deactivate(self.$headings);
3052    self.animations.collapse(self.$contents, self.duration);
3053
3054    // If it has the 1st class, expand the first accordion.
3055    if (self.$accordion.hasClass('accordion-1st') || self.$accordion.parents('.accordion-1st').length) {
3056      this.$headings.eq(0).click();
3057    }
3058
3059    // Expand accordions based on a hash.
3060    if (window.location.hash.length) {
3061      // Expand accordion if heading id matches the hash.
3062      self.$headings.filter(window.location.hash).click();
3063
3064      // Expand accordion if content contains an identified element matching the hash.
3065      self.$contents.find(window.location.hash)
3066        .parents('.accordion-content')
3067        .prev('.accordion-heading')
3068        .click();
3069    }
3070  },
3071  clickHandler: function(event) {
3072    var self = event.data.scope,
3073      $heading = $(this),
3074      $content = $heading.next('.accordion-content');
3075
3076    if ($content) {
3077      // Muliple open at once
3078      if (self.multipleAllowed) {
3079        if ($heading.is('.active')) {
3080          self.deactivate($heading);
3081          self.animations.collapse($content, self.duration);
3082        } else {
3083          self.activate($heading);
3084          self.animations.expand($content, self.duration);
3085        }
3086      } else {
3087        // One open at a time
3088        if ($heading.is('.active')) {
3089          // Deactive these elements
3090          self.deactivate($heading);
3091          self.animations.collapse($content, self.duration);
3092        } else {
3093          // Activate these elements
3094          self.activate($heading);
3095          self.animations.expand($content, self.duration);
3096          // Deactivate these elements
3097          self.deactivate(self.$headings.not($heading));
3098          self.animations.collapse(self.$contents.not($content), self.duration);
3099        }
3100      }
3101    }
3102  },
3103  // Manages the 'active' state of our accordion headings.
3104  activate: function($elements) {
3105    $elements.addClass('active');
3106    $elements.find('[role="button"]').attr('aria-expanded', true);
3107  },
3108  // Manages the 'inactive' state of our accordion headings.
3109  deactivate: function($elements) {
3110    $elements.removeClass('active');
3111    $elements.find('[role="button"]').attr('aria-expanded', false);
3112  },
3113  getTag: function () {
3114    var tag = 'h3';
3115
3116    if (this.$accordion.hasClass('h4a')) {
3117      tag = 'h4';
3118    }
3119
3120    return tag;
3121  },
3122  setMultipleAllowed: function() {
3123    // Set multi flag
3124    return this.$accordion.hasClass('accordion-multi') || this.$accordion.parents('.accordion-multi').length;
3125  }
3126};
3127
3128/*
3129 * Function to append TOC to the sidebar if node has class toc-right or toc-left.
3130 */
3131function appendTocToSidebar(context) {
3132  var leftSidebar = $('aside.page-left',context).find('div.page-sidebar.inner');
3133  var rightSidebar = $('aside.page-right',context).find('div.page-sidebar.inner');
3134  var tocRight = $('.toc-right');
3135  var tocLeft = $('.toc-left');
3136
3137  tocRight.find('#toc-wrapper').appendTo(rightSidebar).addClass('sidebar-toc');
3138  tocLeft.find('#toc-wrapper').appendTo(leftSidebar).addClass('sidebar-toc');
3139}
3140
3141Drupal.behaviors.switchTableOfContents = function(context) {
3142
3143  $("#toc-wrapper").remove();
3144
3145  $("#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>");
3146  $("#node-full.s-toc #toc", context).hide().tableOfContents(
3147    $("#node-full.s-toc"),      // Scoped to this element
3148    {
3149      startLevel: 3,    // H2 and up
3150      depth:      2,    // H2 through H4,
3151      topLinks:   true // Add "Top" Links to Each Header
3152    }
3153  ).slideDown("slow");
3154
3155  $(".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>");
3156  $(".channel.s-toc #toc", context).hide().tableOfContents(
3157    $("#toc-wrapper ~"),      // Scoped to this element
3158    {
3159      startLevel: 2,    // H2 and up
3160      depth:      3,    // H2 through H4,
3161      topLinks:   true // Add "Top" Links to Each Header
3162    }
3163  ).slideDown("slow");
3164
3165  //Legacy switch-toc support for help and other areas
3166
3167  $(".switch-toc", context).prepend("<div id='toc-wrapper'><h2 id='toc-top' class='toc-title'>In this section</h2><ul id='toc'></ul></div>");
3168  $(".switch-toc #toc", context).hide().tableOfContents(
3169    $(".switch-toc"),      // Scoped to this element
3170    {
3171      startLevel: 3,    // H2 and up
3172      depth:      2,    // H2 through H4,
3173      topLinks:   true // Add "Top" Links to Each Header
3174    }
3175  ).slideDown("slow");
3176
3177  // TOC position.
3178  // If we have class toc-right or toc-left it will append TOC to the sidebar.
3179  // Otherwise it will stay on top of the node.
3180  if($(window).width() >= 1025) {
3181    appendTocToSidebar(context);
3182  }
3183
3184  $(window).resize(function() {
3185    var toc = $('#toc-wrapper');
3186    if ($(this).width() >= 1025) {
3187      appendTocToSidebar(context);
3188    }
3189    else {
3190      $("#node-full.s-toc .node-content", context).prepend(toc);
3191      toc.removeClass('sidebar-toc');
3192    }
3193  });
3194};
3195
3196Drupal.behaviors.fixLightbox = function(context) {
3197  (function() {
3198    if (typeof Lightbox !== 'undefined') {
3199      Lightbox.filterXSS = function(str, allowed_tags) {
3200        return str.replace(/<\/?[^>]+(>|$)/g, "");
3201      };
3202      Lightbox.alternative_layout = 1;
3203      Lightbox.isSlideshow = true;
3204      Lightbox.togglePlayPause('lightshowPause', 'lightshowPlay');
3205    }
3206  }());
3207};
3208
3209
3210Drupal.behaviors.forceRowsToHaveSameHeight = function(context) {
3211
3212  var channels = $(".channel.force-rows", context);
3213
3214  $.each(channels, function (channel_k, channel_v) {
3215    var nodes = $(channel_v).find(".node");
3216    var numberOfNodesInChannel = $(channel_v).size();
3217    var lastTop = 0;
3218    var maxH = 1;
3219    var rowCount = 0;
3220
3221    //Reset height
3222    $(channel_v).find(".dd-row").height("");
3223
3224    $.each(nodes, function (k,v) {
3225      var itemHeight = $(v).height();
3226      var currentPosition = $(v).position();
3227
3228      if (currentPosition.top != lastTop) {
3229        rowCount++;
3230        lastTop = currentPosition.top;
3231        if (rowCount == 1) {
3232          $(channel_v).find(".dd-current-row").addClass("dd-first-row");
3233        }
3234        if (k == numberOfNodesInChannel) {
3235          $(channel_v).find(".dd-current-row").addClass("dd-last-row");
3236        }
3237
3238        $(channel_v).find(".dd-current-row").height(maxH);
3239        $(channel_v).find(".dd-current-row").removeClass("dd-current-row");
3240        maxH = 0;
3241      }
3242      $(v).addClass('dd-current-row').addClass('dd-row');
3243      if (itemHeight > maxH) {
3244        maxH = itemHeight;
3245      }
3246
3247
3248    });
3249  });
3250
3251};
3252
3253Drupal.behaviors.ddClassesImageGalleryPlugin = function(context) {
3254  // Elements identified by the image-gallery classname.
3255  $('.image-gallery', context).each(function() {
3256    var $instance = $(this),
3257      classes = $instance.attr('class').split(/\s/),
3258      options = {};
3259
3260    // Available plugins configurable options manipulated by classnames.
3261    var customSettings = {
3262      // Autoplay
3263      'gallery-ap':   {autoPlay: true},
3264      'gallery-no-ap':{autoPlay: false},
3265      // Progress bar
3266      'gallery-pb':   {showProgressBar: true},
3267      'gallery-no-pb':{showProgressBar: false},
3268      // Aspect ratio
3269      'gallery-ar43': {aspectRatio: '4:3'},
3270      'gallery-ar34': {aspectRatio: '3:4'},
3271      'gallery-ar32': {aspectRatio: '3:2'},
3272      'gallery-ar11': {aspectRatio: '1:1'},
3273      'gallery-ar169':{aspectRatio: '16:9'},
3274      // Animation duration
3275      'gallery-ad4':  {duration: 400},
3276      'gallery-ad6':  {duration: 600},
3277      'gallery-ad8':  {duration: 800},
3278      'gallery-ad10': {duration: 1000},
3279      // Duration between slides
3280      'gallery-sd4':  {slideshowDuration: 4000},
3281      'gallery-sd6':  {slideshowDuration: 6000},
3282      'gallery-sd8':  {slideshowDuration: 8000},
3283      'gallery-sd10': {slideshowDuration: 10000},
3284      'gallery-sd12': {slideshowDuration: 12000}
3285    };
3286
3287    // See if one of the classnames is an object key.
3288    $.each(classes, function(key, value) {
3289      if (value && typeof customSettings[value] === 'object') {
3290        $.extend(options, customSettings[value]);
3291      }
3292    });
3293
3294    // Create image gallery instances.
3295    $instance.gallery(options);
3296  });
3297};
3298
3299/**
3300 * Enables expanding overviews on term pages when "read more" is clicked.
3301 */
3302Drupal.behaviors.ddClassesExpanding = function(context) {
3303  $('.oexpanding .expanding', context).each(function() {
3304    var teaser = $(this).find('.teaser'),
3305        body = $(this).find('.body'),
3306        readmore = $(this).parents('div.node-inner').find('.link-read-more');
3307    readmore.find('a').click(function(e) {
3308      e.preventDefault();
3309      teaser.hide();
3310      body.show();
3311      readmore.hide();
3312      $(this).parents('div.node').removeClass('has-more');
3313    });
3314  });
3315};
3316
3317/*
3318(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);
3319
3320*/
3321
3322/*
3323  TableOfContents Plugin for jQuery
3324
3325  Programmed by Doug Neiner
3326  Edited by Dennis Stevense for Digital Deployment
3327
3328  Version: 0.8-digitaldeployment
3329
3330  Based on code and concept by Janko Jovanovic
3331    in his article: http://www.jankoatwarpspeed.com/post/2009/08/20/Table-of-contents-using-jQuery.aspx
3332
3333  This plugin is offered under the MIT license:
3334
3335  (c) 2009 by Doug Neiner, http://dougneiner.com
3336
3337  Permission is hereby granted, free of charge, to any person obtaining
3338    a copy of this software and associated documentation files (the
3339    "Software"), to deal in the Software without restriction, including
3340    without limitation the rights to use, copy, modify, merge, publish,
3341    distribute, sublicense, and/or sell copies of the Software, and to
3342    permit persons to whom the Software is furnished to do so, subject to
3343    the following conditions:
3344
3345    The above copyright notice and this permission notice shall be
3346    included in all copies or substantial portions of the Software.
3347
3348    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
3349    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3350    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
3351    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
3352    LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
3353    OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
3354    WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3355
3356*/
3357
3358
3359(function($){
3360
3361    $.TableOfContents = function(el, scope, options){
3362        // To avoid scope issues, use 'base' instead of 'this'
3363        // to reference this class from internal events and functions.
3364        var base = this;
3365
3366        // Access to jQuery and DOM versions of element
3367        base.$el = $(el);
3368        base.el = el;
3369
3370    base.toc = "";                               // We use this to build our TOC;
3371    base.listStyle = null;                       // This will store the type of list
3372    base.tags = ["h1","h2","h3","h4","h5","h6"]; // The six header tags
3373
3374
3375        base.init = function(){
3376      // Merge the defaultOptions with any options passed in
3377            base.options = $.extend({},$.TableOfContents.defaultOptions, options);
3378
3379      // Gets the scope. Defaults to the entire document if not specified
3380            if(typeof(scope) == "undefined" || scope == null) scope = document.body;
3381            base.$scope = $(scope);
3382
3383      // Find the first heading withing the scope
3384      var $first = base.$scope.find(base.tags.join(', ')).filter(':first');
3385
3386      // If no headings were found, stop building the TOC
3387      if($first.length !== 1) return;
3388
3389      // Set the starting depth
3390      base.starting_depth = base.options.startLevel;
3391
3392      // Quick validation on depth
3393      if(base.options.depth < 1) base.options.depth = 1;
3394
3395      // Get only the tags starting with startLevel, and counting the depth
3396      var filtered_tags = base.tags.splice(base.options.startLevel - 1, base.options.depth);
3397
3398      // Cache all the headings that match our new filter
3399      base.$headings = base.findHeadings(base.$scope, filtered_tags.join(', '));
3400
3401      // If topLinks is enabled, set/get an id for the body element
3402      if(base.options.topLinks !== false){
3403        var id = $(document.body).attr('id');
3404        if(id == "") {
3405          id = base.options.topBodyId;
3406          //document.body.id = id;
3407        }
3408
3409        // Cache the id locally
3410        base.topLinkId = id;
3411      }
3412
3413
3414      // Find out which list style to use
3415      if(base.$el.is('ul')){
3416        base.listStyle = 'ul';
3417      } else if (base.$el.is('ol')){
3418        base.listStyle = 'ol';
3419      }
3420
3421
3422      base.buildTOC();
3423
3424      if(base.options.proportionateSpacing === true && !base.tieredList()){
3425        base.addSpacing();
3426      }
3427
3428      return base; // Return this object for memory cleanup
3429        };
3430
3431    base.findHeadings = function($element, selector, $headings) {
3432      // If no headings are given, default to an empty jQuery set
3433      if ($headings === undefined) {
3434        $headings = $([]);
3435      }
3436
3437      // Iterate the children in order
3438      $element.children().each(function(i, child) {
3439        $child = $(child);
3440
3441        if ($child.is(selector)) {
3442          // We found a header, add it
3443          $headings = $headings.add($child);
3444        }
3445        else {
3446          // Recurse
3447          $headings = base.findHeadings($child, selector, $headings);
3448        }
3449      });
3450
3451      return $headings;
3452    };
3453
3454    // Helper function that returns true for both OL and UL lists
3455    base.tieredList = function(){
3456      return (base.listStyle === 'ul' || base.listStyle === 'ol');
3457    };
3458
3459    base.buildTOC = function(){
3460      base.current_depth = base.starting_depth;
3461
3462      base.$headings.each(function(i,element){
3463        // Get current depth base on h1, h2, h3, etc.
3464        var depth = parseInt(this.nodeName.toLowerCase().substr(1, 1));
3465
3466        // This changes depth, or adds separators, only if not the first item
3467        if(i > 0 || ( i === 0 && depth !== base.current_depth)){
3468          base.changeDepth(depth);
3469        }
3470
3471        // Add the TOC link
3472        base.toc += base.formatLink(this, depth, i) + "\n";
3473
3474        // Add the topLink if enabled
3475        if(base.options.topLinks !== false) base.addTopLink(this);
3476      });
3477
3478      // Close up any nested list
3479      base.changeDepth(base.starting_depth, true);
3480
3481      // Wrap entire TOC in an LI if item was nested.
3482      if(base.tieredList()) base.toc = "<li>\n" + base.toc + "</li>\n";
3483
3484      // Update the TOC element with the completed TOC
3485      base.$el.html(base.toc);
3486    };
3487
3488    base.addTopLink = function(element){
3489      // Get the text for the link (if topLinks === true, it defaults to "Top")
3490      var text = (base.options.topLinks === true ? "Back to contents" : base.options.topLinks );
3491      var $a = $("<a href='#" + base.topLinkId + "' class='" + base.options.topLinkClass + "'></a>")
3492        .html('<span>
3492' + text + '</span>');
3493
3494      // Append to the current Header element
3495      $(element).prepend($a);
3496    };
3497
3498    base.formatLink = function(element, depth, index){
3499      // Get the current id of the header element
3500      var id, a;
3501      id = element.id;
3502
3503      // If no id exisits, create a unique one
3504      if(id === ""){
3505        id = base.buildSlug($(element).text());
3506        element.id = id;
3507      }
3508
3509      // Start building the a link
3510      a = "<a href='#" + id + "'";
3511
3512      // If this isn't a tiered list, we need to add the depth class
3513      if(!base.tieredList()) { a += " class='" + base.depthClass(depth) + "'"; }
3514
3515      // Finish building the link
3516      if ($(element).find("a").size()) {
3517        a += ">" + base.options.levelText.replace('%', $(element).find("a").html()) + '</a>';
3518      }
3519      else {
3520        a += ">" + base.options.levelText.replace('%', $(element).html()) + '</a>';
3521      }
3522      return a;
3523    };
3524
3525    base.changeDepth = function(new_depth, last){
3526      var i, opening_tags, closing_tags, li;
3527
3528      if(last !== true) { last = false; }
3529
3530      // If straight links, just change depth and return
3531      if(!base.tieredList()){
3532        base.current_depth = new_depth;
3533        return true;
3534      }
3535
3536      // If nested
3537      if(new_depth > base.current_depth){
3538        // Add enough opening tags to step into the heading
3539        // as it is possible that a poorly built document
3540        // steps from h1 to h3 without an h2
3541        opening_tags = [];
3542        for(i = base.current_depth; i < new_depth; i++){
3543          opening_tags.push('<' + base.listStyle + '>' + "\n");
3544        }
3545       li = "<li>\n";
3546
3547        // Add the code to our TOC and an opening LI
3548        base.toc += opening_tags.join(li) + li;
3549
3550      } else if (new_depth < base.current_depth){
3551        // Close all the loops
3552        closing_tags = [];
3553        for(i = base.current_depth; i > new_depth; i--){
3554          closing_tags.push('</' + base.listStyle + '>' + "\n");
3555        }
3556
3557        // Add closing LI and any additional closing tags
3558        base.toc += "</li>\n" + closing_tags.join('</li>' + "\n");
3559
3560        // Open next block
3561        if (!last) {
3562          base.toc += "</li>\n<li>\n";
3563        }
3564      } else {
3565        // Just close a tag and open a new one
3566        // since the depth has not changed
3567        if (!last) {
3568          base.toc += "</li>\n<li>\n";
3569        }
3570      }
3571
3572      // Store the new depth
3573      base.current_depth = new_depth;
3574    };
3575
3576    base.buildSlug = function(text){
3577      text = text.toLowerCase().replace(/[^a-z0-9 \-]/gi,'').replace(/ /gi,'-');
3578      text = text.substr(0,50);
3579      return text;
3580    };
3581
3582    base.depthClass = function(depth){
3583      // Normalizes the depths to always start at 1, even if the starting tier is a h4
3584      return base.options.levelClass.replace('%', (depth - ( base.starting_depth - 1 ) ) );
3585    };
3586
3587    base.addSpacing = function(){
3588      var start = base.$headings.filter(':first').position().top;
3589
3590      base.$headings.each(function(i,el){
3591        var $a = base.$el.find('a:eq(' + i + ')');
3592        var pos = (
3593            ( $(this).position().top - start ) /
3594            ( base.$scope.height()   - start )
3595          ) * base.$el.height();
3596        $a.css({
3597          position: "absolute",
3598          top: pos
3599        });
3600      });
3601    };
3602
3603        return base.init();
3604    };
3605
3606
3607    $.TableOfContents.defaultOptions = {
3608    // One option is set by the container element, and not by changing
3609    // a setting here. That is the type of TOC to output. For a nested ordered list
3610    // make sure your wrapping element is an <ol>. For a nested bulleted list
3611    // make sure your wrapping element is an <ul>. For a straight outputting of links
3612    // use any other element.
3613
3614    // Which H tags should be the root items. h1 = 1, h2 = 2, etc.
3615    startLevel: 1,
3616
3617    // How many levels of H tags should be shown, including the startLevel
3618    // startLevel: 1, depth: 3 = h1, h2, h3
3619    // startLevel: 2, depth: 3 = h2, h3, h4
3620        depth: 3,
3621
3622    // Each link in a straight set is give a class designating how deep it is.
3623    // You can change the class by changing this option,
3624    // but you must include a % sign where you want the number to go.
3625    // Nested lists do not add classes, as you can determine their depth with straight css
3626    levelClass: "toc-depth-%",
3627
3628    // When each link is formed, you can supply additional html or text to be formatted
3629    // with the text of the header. % represents the text of the header
3630    levelText: "%",
3631
3632    // This plugin can add "To Top" links to each header element if you want.
3633    // Set topLinks to true to use the text "Top" or set it to some text or html
3634    // content you wish to use as the body of the link
3635    topLinks: false,
3636
3637    // If topLinks is either true or a text/html value, you can also set the following options:
3638
3639    // Class of the link that is added to the headers
3640    topLinkClass: "toc-top-link",
3641
3642    // Which class should be added to the body element if it does not
3643    // already have an id associated with it
3644    topBodyId: "toc-top",
3645
3646    // To have the TOC spaced proportionatly to the spacing of the headings,
3647    // you must have a fixed height on the TOC wrapper, and it must "haveLayout"
3648    // either position = fixed | absolute | relative
3649    // Finally, the TOC wrapper must not be a UL or an LI or this setting will
3650    // have no effect
3651    proportionateSpacing: false
3652
3653    };
3654
3655
3656    $.fn.tableOfContents = function(scope, options){
3657        return this.each(function(){
3658            var toc = new $.TableOfContents(this, scope, options);
3659      delete toc; // Free memory
3660        });
3661    };
3662
3663
3664})(jQuery);
3665
3666/*
3667 * jQuery Cycle Plugin (with Transition Definitions)
3668 * Examples and documentation at: http://jquery.malsup.com/cycle/
3669 * Copyright (c) 2007-2010 M. Alsup
3670 * Version: 2.88 (08-JUN-2010)
3671 * Dual licensed under the MIT and GPL licenses.
3672 * http://jquery.malsup.com/license.html
3673 * Requires: jQuery v1.2.6 or later
3674 */
3675(function($){var ver="2.88";
3675if($.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);}
3675else{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];
3675if(!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);}}
3675$.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}
3675;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);
3676/*
3677 * jQuery Cycle Plugin Transition Definitions
3678 * This script is a plugin for the jQuery Cycle Plugin
3679 * Examples and documentation at: http://malsup.com/jquery/cycle/
3680 * Copyright (c) 2007-2010 M. Alsup
3681 * Version:  2.72
3682 * Dual licensed under the MIT and GPL licenses:
3683 * http://www.opensource.org/licenses/mit-license.php
3684 * http://www.gnu.org/licenses/gpl.html
3685 */
3686(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}
3686;};$.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};};
3687 $.fn.cycle.transitions.scrollFade = function($cont, $slides, opts) {
3688 $cont.css('overflow','visible').width();
3689 opts.before.push(function(curr, next, opts, fwd) {
3690   opts.cssBefore.opacity = 0;
3691   $.fn.cycle.commonReset(curr,next,opts);
3692   opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
3693   opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
3694 });
3695 opts.cssFirst = { left: 0 };
3696 opts.cssBefore= { top: 0, opacity: 0};
3697 opts.animIn   = { left: 0, opacity: 1};
3698 opts.animOut  = { top: 0, opacity: 0};
3699 };
3700
3701$.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();
3701var 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);
3702;
3703/*
3704 * jQuery doTimeout: Like setTimeout, but better! - v1.0 - 3/3/2010
3705 * http://benalman.com/projects/jquery-dotimeout-plugin/
3706 *
3707 * Copyright (c) 2010 "Cowboy" Ben Alman
3708 * Dual licensed under the MIT and GPL licenses.
3709 * http://benalman.com/about/license/
3710 */
3711(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);;
3712/**
3713 * @plugin gallery
3714 * @desc Creates a slideshow of images by way of many structured template formats.
3715 * todo: extend this to be nodes and a full node page.
3716 * */
3717;(function($, window, document, undefined) {
3718
3719  "use strict";
3720
3721  var pluginName = "gallery",
3722    defaults = {
3723      autoPlay: true,
3724      width: null,
3725      height: null,
3726      duration: 600,
3727      aspectRatio: '4:3', // (default '4:3'), '3:4', '3:2', '1:1', '16:9'
3728      galleryBorderWidth: 5,
3729      slideshowDuration: 6000,
3730      navArrowWidth: 30,
3731      showProgressBar: true,
3732      filmstripMarkerWidth: 50,
3733      userInteruptsSlideshow: true,
3734      // sets alternate image cache preset's sizing for all image uses.
3735      imageSizing: {
3736        zoomed: 'lightbox',
3737        slide:  'gallery',
3738        marker: 'thumbnail'
3739      },
3740      // used to replace values from imageSizing within classes and src attr's.
3741      icpPathRegEx: /files\/imagecache\/([^\/]+)/,
3742      icpClassRegEx: /field-image-preset-([^ ]+)/
3743    };
3744
3745  function Plugin(element, options) {
3746    this.element = element;
3747    this.$element = $(element);
3748    this._name = pluginName;
3749    this._defaults = defaults;
3750    this.options = $.extend({}, defaults, options);
3751
3752    // allows for ratios or defined width/height's.
3753    if ( !this.options.width || !this.options.height ) {
3754      this.options.width = this.$element.width() - this.options.galleryBorderWidth * 2;
3755      switch (this.options.aspectRatio) {
3756        case '3:4' : this.options.height = this.options.width / 3 * 4;  break;
3757        case '3:2' : this.options.height = this.options.width / 3 * 2;  break;
3758        case '1:1' : this.options.height = this.options.width * 1.00;   break;
3759        case '16:9': this.options.height = this.options.width * 0.5625; break;
3760        default    : this.options.height = this.options.width * 0.75;
3761      }
3762    }
3763
3764    this.$images = this.getImages();
3765    this.isPlaying = false;
3766    this.currentPage = 0;
3767    this.currentIndex = 0;
3768    this.currentCaption = '';
3769    this.totalImages = this.$images.length;
3770    this.markersPerPage = Math.floor((this.options.width - this.options.navArrowWidth * 2)/this.options.filmstripMarkerWidth);
3771    this.markerWidth = Math.floor((this.options.width - this.options.navArrowWidth * 2)/this.markersPerPage);
3772    this.pageWidth = this.markersPerPage * this.markerWidth;
3773    this.totalPages = Math.ceil(this.$images.length/this.markersPerPage);
3774
3775    // creates the gallery.
3776    this.$gallery = this.render('gallery');
3777    this.$gallery.insertBefore(this.$images.eq(0));
3778
3779    // wraps images with the gallery div.
3780    this.$galleryImages = this.render('galleryImages');
3781    this.$galleryImages.appendTo(this.$gallery);
3782    this.$images.appendTo(this.$galleryImages);
3783
3784    // creates all buttons for the gallery controls.
3785    this.controls = this.render('controls');
3786    this.controls.$wrapper.appendTo(this.$gallery);
3787
3788    // creates a caption container for passing captions for each image.
3789    this.$caption = this.render('caption');
3790    this.$caption.appendTo(this.$gallery);
3791
3792    // creates a progress bar which visually animates the autoplay duration.
3793    this.$progress = this.render('progress');
3794    this.$progress.appendTo(this.$gallery);
3795
3796    // creates a filmstrip and appends it to the gallery.
3797    this.$filmstrip = this.render('filmstrip');
3798    this.$filmstrip.appendTo(this.$gallery);
3799
3800    // this is references the showcase which is used for zoom/lightbox feature.
3801    this.$showcase = this.render('showcase');
3802
3803    // Add helper class to simplify gallery if there is only one image.
3804    if (this.totalImages <= 1) {
3805      this.$gallery.addClass('simple');
3806      // Assure elimination of the autoPlay feature.
3807      this.options.autoPlay = false;
3808    }
3809
3810    // initialize.
3811    this.init();
3812  }
3813
3814  Plugin.prototype = {
3815    init: function() {
3816      var plugin = this;
3817
3818      // Fire up the carousel with the first indexed image.
3819      plugin.$filmstrip.find('.marker').eq(plugin.currentIndex).trigger('click');
3820
3821      // Automatically start slideshow?
3822      if (plugin.options.autoPlay) {
3823        plugin.controls.$playBtn.trigger('click');
3824      }
3825
3826      // set element resize event handler.
3827      plugin.$element.bind('resize.gallery', {scope: plugin}, plugin.events.resize);
3828    },
3829    // -------------------------------------------------------------------------
3830    // Smart get of image resources to use within the gallery.
3831    // -------------------------------------------------------------------------
3832    getImages: function() {
3833      var plugin = this, $images;
3834      $images = plugin.$element.find('.node-image .field-image, .node-upper-image .field-image');
3835      $images.each(function(key, image) {
3836        var $image = $(image),
3837          src, href, classes;
3838        src = $image.find('img').attr('src');
3839        href = $image.find('a').attr('href');
3840        classes = $image.attr('class');
3841        // swap out imagecache paths according to passed imageSizing options.
3842        $image.attr('class', classes.replace(plugin.options.icpClassRegEx.exec(classes)[1], plugin.options.imageSizing.slide));
3843        if ( !$image.hasClass('field-video') ) {
3844          $image.find('a').attr('href', href.replace(plugin.options.icpPathRegEx.exec(href)[1], plugin.options.imageSizing.zoomed));
3845        }
3846        $image.find('img').attr('src', src.replace(plugin.options.icpPathRegEx.exec(src)[1], plugin.options.imageSizing.slide));
3847      });
3848
3849      // @todo: extend this to be nodes and a full node page.
3850      /*
3851       // node page
3852      if (plugin.$element.hasClass('node-full')) {
3853        // @note already implemented above ^
3854      }
3855      // views-blocks
3856      else if (plugin.$element.hasClass('views-block')) {
3857        $images = plugin.$element.find('.views-row');
3858      }
3859       */
3860      return $images;
3861    },
3862    // -------------------------------------------------------------------------
3863    // Sets plugin indexes for images and pages.
3864    // -------------------------------------------------------------------------
3865    setCurrentIndex: function(index) {
3866      var plugin = this;
3867      if (index <= 0) {
3868        index = plugin.totalImages;
3869      }
3870      else if (index > plugin.totalImages) {
3871        index = 1;
3872      }
3873      plugin.currentIndex = index;
3874      plugin.setActiveItems(index);
3875      var page = Math.ceil(index/plugin.markersPerPage);
3876      if (page !== plugin.currentPage) {
3877        plugin.gotoPage(page, false);
3878      }
3879      return index;
3880    },
3881    // -------------------------------------------------------------------------
3882    // Controls styling of active items.
3883    // -------------------------------------------------------------------------
3884    setActiveItems: function(index) {
3885      var plugin = this;
3886      // markers.
3887      plugin.$filmstrip.find('.active').removeClass('active');
3888      plugin.$filmstrip.find('.marker').eq(index - 1).addClass('active');
3889    },
3890    // -------------------------------------------------------------------------
3891    // Update current image.
3892    // -------------------------------------------------------------------------
3893    gotoImage: function(origin, destination, clickEvent) {
3894      var plugin = this,
3895        // -1 because the images are an array, index starts at 1.
3896        $origin = plugin.$images.eq(origin-1),
3897        $destination = plugin.$images.eq(destination-1);
3898      // resets the slideshow timer if caused by user interaction.
3899      if (clickEvent && plugin.isPlaying) {
3900        plugin.options.userInteruptsSlideshow
3901          ? plugin.controls.$pauseBtn.trigger('click')
3902          : plugin.options.userInteruptsSlideshow();
3903      }
3904      // shuffle images.
3905      $origin.css('z-index', 2).stop(true,true).animate({opacity:'hide'}, plugin.options.duration);
3906      $destination.css('z-index', 3).stop(true,true).animate({opacity:'show'}, plugin.options.duration);
3907      plugin.$images.not($origin).not($destination).css('z-index', 1).hide();
3908      // set caption.
3909      var $captionText = plugin.$caption.find('.gallery-caption-text'),
3910        prevHeight = $captionText.outerHeight();
3911      plugin.currentCaption = $destination.find('img').attr('title') || '';
3912      $captionText.stop(true,true).animate({opacity:'hide'}, plugin.options.duration/2, function() {
3913        $captionText.html(plugin.currentCaption);
3914        if (plugin.currentCaption.length > 0) {
3915          var newHeight = $captionText.outerHeight();
3916          plugin.$caption.height(prevHeight).stop(true,true).animate({height: newHeight}, plugin.options.duration/2);
3917          $captionText.animate({opacity:'show'}, plugin.options.duration/2);
3918        }
3919        else {
3920          plugin.$caption.stop(true,true).animate({height: 0}, plugin.options.duration/2);
3921        }
3922      });
3923    },
3924    // -------------------------------------------------------------------------
3925    // Update current filmstrip page.
3926    // -------------------------------------------------------------------------
3927    gotoPage: function(destination, clickEvent) {
3928      var plugin = this,
3929        origin = plugin.currentPage,
3930        difference = destination - origin,
3931        distance = plugin.markerWidth * plugin.markersPerPage,
3932        $content = plugin.$filmstrip.find('.markers-content'),
3933        duration = plugin.options.duration / 2,
3934        callback = function(){return true;};
3935      // resets the slideshow timer if caused by user interaction.
3936      if (clickEvent && plugin.isPlaying) {
3937        plugin.options.userInteruptsSlideshow
3938          ? plugin.controls.$pauseBtn.trigger('click')
3939          : plugin.options.userInteruptsSlideshow();
3940      }
3941      // is the destination greater than 1 page.
3942      if (difference <= -1 && difference >= 1) {
3943        distance = 0;
3944        if (difference > 0) {
3945          distance = -(plugin.totalPages - 1) * plugin.pageWidth;
3946        }
3947        duration = 50 * (plugin.totalPages - 1);
3948      }
3949      // next page.
3950      else if (destination > origin) {
3951        if (destination <= plugin.totalPages ) {
3952          distance = (destination - 1) * -distance;
3953        }
3954        else {
3955          duration = 100;
3956          distance = -(distance * (plugin.totalPages - 1)) - plugin.options.navArrowWidth;
3957          callback = function() {
3958            $content.animate({left: -(plugin.pageWidth * (plugin.totalPages - 1))}, 100);
3959          };
3960          destination = plugin.currentPage;
3961        }
3962      }
3963      // prev page.
3964      else if (destination < origin) {
3965        if (destination > 0) {
3966          distance = (destination - 1) * -distance;
3967        }
3968        else {
3969          duration = 100;
3970          distance = plugin.options.navArrowWidth;
3971          callback = function() {
3972            $content.animate({left: 0}, 100);
3973          };
3974          destination = plugin.currentPage;
3975        }
3976      }
3977      plugin.currentPage = destination;
3978      $content.animate({left: distance}, duration, callback);
3979    },
3980    // -------------------------------------------------------------------------
3981    // Slideshow Timer
3982    // -------------------------------------------------------------------------
3983    startSlideshowTimer: function() {
3984      var plugin = this;
3985      plugin.startProgressBar();
3986      $.doTimeout('slideshow', plugin.options.slideshowDuration, function() {
3987        var origin = plugin.currentIndex,
3988          destination = plugin.setCurrentIndex(plugin.currentIndex + 1);
3989        plugin.startProgressBar();
3990        plugin.gotoImage(origin, destination, false);
3991        return true;
3992      });
3993    },
3994    stopSlideshowTimer: function() {
3995      var plugin = this;
3996      $.doTimeout('slideshow');
3997      plugin.stopProgressBar();
3998    },
3999    // -------------------------------------------------------------------------
4000    // Progress Bar
4001    // -------------------------------------------------------------------------
4002    startProgressBar: function() {
4003      var plugin = this;
4004      if (plugin.options.showProgressBar) {
4005        plugin.$progress.width(0).show();
4006        plugin.$progress.stop(true).animate({width: plugin.options.width}, plugin.options.slideshowDuration, 'linear');
4007      }
4008    },
4009    stopProgressBar: function() {
4010      var plugin = this;
4011      if (plugin.options.showProgressBar) {
4012        plugin.$progress.stop(true,true).hide();
4013      }
4014    },
4015    // -------------------------------------------------------------------------
4016    // Event Handlers
4017    // -------------------------------------------------------------------------
4018    events: {
4019      resize: function(event) {
4020        console.log(event.type);
4021      },
4022      marker: function(event) {
4023        var plugin = event.data.scope,
4024          origin = plugin.currentIndex,
4025          destination = Number($(this).data('index'));
4026        if (origin != destination) {
4027          plugin.setCurrentIndex(destination);
4028          plugin.gotoImage(origin, destination, true);
4029        }
4030        event.preventDefault();
4031      },
4032      nextPage: function(event) {
4033        var plugin = event.data.scope;
4034        plugin.gotoPage(plugin.currentPage + 1, true);
4035      },
4036      prevPage: function(event) {
4037        var plugin = event.data.scope;
4038        plugin.gotoPage(plugin.currentPage - 1, true);
4039      },
4040      play: function(event) {
4041        var plugin = event.data.scope;
4042        if ( !plugin.isPlaying ) {
4043          $(this).hide();
4044          plugin.isPlaying = true;
4045          plugin.controls.$pauseBtn.show();
4046          plugin.startSlideshowTimer();
4047        }
4048      },
4049      pause: function(event) {
4050        var plugin = event.data.scope;
4051        if ( plugin.isPlaying ) {
4052          $(this).hide();
4053          plugin.isPlaying = false;
4054          plugin.controls.$playBtn.show();
4055          plugin.stopSlideshowTimer();
4056        }
4057      },
4058      prev: function(event) {
4059        var plugin = event.data.scope,
4060          origin = plugin.currentIndex,
4061          destination = plugin.setCurrentIndex(plugin.currentIndex - 1);
4062        plugin.gotoImage(origin, destination, true);
4063      },
4064      next: function(event) {
4065        var plugin = event.data.scope,
4066          origin = plugin.currentIndex,
4067          destination = plugin.setCurrentIndex(plugin.currentIndex + 1);
4068        plugin.gotoImage(origin, destination, true);
4069      },
4070      zoom: function(event) {
4071        var plugin = event.data.scope;
4072        // fire off the lightbox2 behavior.
4073        plugin.$images.eq(plugin.currentIndex-1).find('a').trigger('click');
4074      }
4075    },
4076    // -------------------------------------------------------------------------
4077    // jQuery Template Renderer
4078    // -------------------------------------------------------------------------
4079    render: function(name, args, args2, args3) {
4080      var plugin = this,
4081      templates = {
4082        gallery: function() {
4083          var $gallery = $('<div class="gallery"></div>');
4084          $gallery
4085            .addClass(pluginName)
4086            .width(plugin.options.width)
4087            .height(plugin.options.height)
4088            .css({
4089              border: plugin.options.galleryBorderWidth + 'px solid white',
4090              'margin-bottom': (plugin.options.galleryBorderWidth + 75) + 'px'
4091            });
4092          return $gallery;
4093        },
4094        galleryImages: function() {
4095          return $('<div class="gallery-images"></div>');
4096        },
4097        caption: function() {
4098          return $('<div class="gallery-caption"><div class="gallery-caption-text"></div></div>');
4099        },
4100        showcase: function() {
4101          var $showcase = $('#gallery-showcase');
4102          if ($showcase.length <= 0) {
4103            $showcase = $('<div id="gallery-showcase"></div>');
4104            plugin.$element.parents('body').append($showcase);
4105          }
4106          return $showcase;
4107        },
4108        button: function(type) {
4109          return $('<div class="btn-'+type+'"><span></span></div>');
4110        },
4111        controls: function() {
4112          var $wrapper = $('<div class="gallery-controls"></div>'),
4113            buttons = ['pause', 'play', 'zoom', 'next', 'prev'],
4114            controls = {};
4115          $.each(buttons, function(key, type) {
4116            var $btn = plugin.render('button', type);
4117            $btn.bind('click', {scope: plugin}, plugin.events[type]);
4118            $btn.appendTo($wrapper);
4119            controls['$'+type+'Btn'] = $btn;
4120          });
4121          controls.$wrapper = $wrapper;
4122          return controls;
4123        },
4124        markers: function() {
4125          var $markers = $('<div class="markers"></div>'),
4126            $inner = $('<div class="markers-content"></div>');
4127          $.each(plugin.$images, function(key, image) {
4128            var $marker = $('<a href="#" class="marker"></a>'),
4129              $wrap = $('<span class="marker-image"></span>'),
4130              $image = $(image).find('img').clone(),
4131              src = $image.attr('src');
4132            $image.attr('src', src.replace(plugin.options.icpPathRegEx.exec(src)[1], plugin.options.imageSizing.marker));
4133            $marker.data('index', key+1).width(plugin.markerWidth).bind('click', {scope: plugin}, plugin.events.marker);
4134            $image.prependTo($wrap);
4135            $wrap.prependTo($marker);
4136            $marker.appendTo($inner);
4137          });
4138          $inner.width(Math.ceil(plugin.pageWidth * plugin.totalPages));
4139          $inner.appendTo($markers);
4140          $markers.width(plugin.options.width - (plugin.options.navArrowWidth * 2));
4141          return $markers;
4142        },
4143        filmstrip: function() {
4144          var $filmstrip = $('<div class="gallery-filmstrip"></div>'),
4145            $inner = $('<div class="gallery-filmstrip-inner"></div>'),
4146            $links = plugin.render('markers'),
4147            $prev  = plugin.render('button', 'prev-page'),
4148            $next  = plugin.render('button', 'next-page');
4149          if (plugin.totalImages > 1) {
4150            $prev.appendTo($inner).bind('click', {scope: plugin}, plugin.events.prevPage);
4151            $next.appendTo($inner).bind('click', {scope: plugin}, plugin.events.nextPage);
4152            plugin.controls.$prevPageBtn = $prev;
4153            plugin.controls.$nextPageBtn = $next;
4154            $links.css({'margin': '0 '+plugin.options.navArrowWidth+'px'});
4155          }
4156          $inner.css({top: plugin.options.galleryBorderWidth+'px'});
4157          $links.appendTo($inner);
4158          $inner.appendTo($filmstrip);
4159          return $filmstrip;
4160        },
4161        progress: function() {
4162          return $('<div class="gallery-progress"></div>');
4163        }
4164      };
4165
4166      return templates[name](args, args2, args3);
4167    }
4168  };
4169
4170  $.fn[pluginName] = function (options) {
4171    return this.each(function () {
4172      if ( !$.data(this, "plugin_" + pluginName )) {
4173        $.data(this, "plugin_" + pluginName, new Plugin(this, options));
4174      }
4175    });
4176  };
4177
4178})(jQuery, window, document);
4179;
4180Drupal.behaviors.ddAddDateToCalendarWidget = function(context) {
4181  if (Drupal.settings.ddCreate && Drupal.settings.ddCreate.addDateToCalendarWidget) {
4182    var attach = function() {
4183      $('#calpopup .node-teaser:has(.first-upcoming):not(:has(a.add))').each(function() {
4184        var $teaser = $(this);
4185        var $date = $teaser.find(".first-upcoming");
4186        var nodeId = $teaser.attr("id").replace(/(node-)|(-teaser)/g, "");
4187
4188        var $addLink = $('<a class="add"></a>');
4189        var $addPopup = $('<div class="add-calendar-popup">Loading...</div>');
4190
4191        $date.append($addLink).append($addPopup);
4192        $addLink.toggle(function() {
4193          // Hide any existing popups.
4194          $('.add-calendar-popup:visible').fadeOut('fast');
4195
4196          $addPopup.fadeIn("fast").load(Drupal.settings.basePath + 'node/' + nodeId + ' #block-dd_create-calendar', function() {
4197            $addPopup.find("a").attr("target", "_blank");
4198          });
4199        }, function() {
4200          $addPopup.fadeOut("fast");
4201        });
4202      });
4203    };
4204
4205    attach();
4206
4207    $(document).ajaxComplete(function() {
4208      attach();
4209    });
4210  }
4211};
4212
4213/**
4214 * Handles adding the "node-advanced" class to navigation terms which should be
4215 * hidden on the node edit/create form.
4216 */
4217Drupal.behaviors.ddNavTermVisibility = function(context) {
4218  if (Drupal.settings.pt_nav_terms_hidden) { 
4219    var el = $('#edit-taxonomy-2-wrapper', context);
4220    for (var i = 0; i < Drupal.settings.pt_nav_terms_hidden.length; i++) {
4221      var tid = Drupal.settings.pt_nav_terms_hidden[i]; 
4222      var li = $('#edit-taxonomy-2-' + tid).parents('li');
4223      if (li.length) {
4224        $(li[0]).addClass('node-advanced');
4225      }
4226    }
4227  }
4228};
4229
4230/**
4231 * Handles the cloning form elements visiblity.
4232 */
4233Drupal.behaviors.ddClonePostVisibility = function(context) {
4234  if (Drupal.settings.clone_post) {
4235    // Hide tabs.
4236    $('.tabs').css("display","none");
4237  }
4238};
4239
4240/**
4241 * Disable URL Alias and show warning message when creating/editing overviews.
4242 */
4243Drupal.behaviors.ddOverviewVisibility = function(context) {
4244  var urlAlias = $('.vertical-tabs-path', context);
4245  var clonedUrlAlias = urlAlias.html();
4246  var postSelect = $('#edit-taxonomy-1');
4247  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>.";
4248
4249  var postType = postSelect.find(":selected").text();
4250  if(postType == 'Overview') {
4251    urlAlias.html('<div style="white-space: normal;" class="messages warning no-attachment-text disable-url">' + warningMessage + '</div>');
4252  }
4253
4254  // On post type change.
4255  postSelect.change(function() {
4256    if($(this).find(":selected").text() == 'Overview') {
4257      $('.vertical-tabs-path').html('<div style="white-space: normal;" class="messages warning no-attachment-text disable-url">' + warningMessage + '</div>');
4258    }
4259    else {
4260      $('.vertical-tabs-path').html(clonedUrlAlias);
4261      // Remove the additional legend.
4262      $('.vertical-tabs-path').find('legend').remove();
4263    }
4264  });
4265
4266  $(".disable-url").unbind( "click" );
4267};
4268
4269/**
4270 * Show Visibility to unauthorized users when we have peeking enabled.
4271 */
4272Drupal.behaviors.VisibillityUnauthorizedUsers= function(context) {
4273  var accessDefaultt = $('#edit-dd-access-default', context);
4274  var accessEveryone = $('#edit-dd-access-rids-0', context);
4275  var visibilityDiv = $('#edit-dd-access-peeking-wrapper', context);
4276
4277  // Default state.
4278  if(accessEveryone.is(':checked')) {
4279    visibilityDiv.hide();
4280  }
4281
4282  // Everyone change
4283  accessEveryone.change(function() {
4284    if(!$(this).is(":checked")) {
4285      visibilityDiv.show();
4286    }
4287    else {
4288      visibilityDiv.hide();
4289    }
4290  });
4291
4292  // Default change
4293  accessDefaultt.change(function() {
4294    if(accessEveryone.is(":checked")) {
4295      visibilityDiv.hide();
4296    }
4297    else {
4298      visibilityDiv.show();
4299    }
4300  });
4301};
4302
4303/**
4304 * Autocomplete the calendar end date.
4305 */
4306Drupal.behaviors.setCalendarEndDate = function(context) {
4307  $("input[name^='field_date['][name*='[value]']", context).change(function autocompleteEndDate() {
4308    // Only get the date field.
4309    if($(this).hasClass('hasDatepicker')) {
4310      const name = this.name.split('[');
4311      const fieldId = name[1].split(']');
4312      $("input[name='field_date["+ fieldId[0] +"][value2][date]']").val($(this).val());
4313    }
4314  });
4315};
4316
4317/**
4318 * Handles temporary lat/lon field to be displayed under location.
4319 */
4320Drupal.behaviors.LatitudeLongitudeFields = function(context) {
4321  var latitude = $('#edit-location-x-wrapper');
4322  var longitude = $('#edit-location-y-wrapper');
4323  var locationField = $('#edit-field-location-0-text');
4324  // Place the inputs.
4325  longitude.insertBefore(locationField);
4326  latitude.insertBefore(locationField);
4327  // Display them.
4328  latitude.css('display','inline-block');
4329  longitude.css('display','inline-block');
4330};
4331;
4332Drupal.behaviors.ddLoginInit = function(context) {
4333  var $loginBlock = $('body.not-logged-in #block-dd_login-login', context);
4334  if ($loginBlock.size() == 0) {
4335    return;
4336  }
4337
4338  $loginBlock.dialog({ modal: true, height: 'auto', autoOpen: false, dialogClass: 'dd-login'}); 
4339
4340  $("body.not-logged-in a[href$='/user/login'], body.not-logged-in a[href$='/user']", context).click(function() {
4341    openLoginDialog();
4342    return false;
4343  });
4344
4345  if (location.hash == '#dd-login') {
4346    openLoginDialog();
4347  }
4348
4349  function openLoginDialog() {
4350    // Redirect to HTTPS, if necessary.
4351    if (Drupal.settings.ddForceHttpsAuthenticated && location.protocol != 'https:') {
4352      location.assign('https://' + location.hostname + location.pathname + location.search + '#dd-login');
4353      return;
4354    }
4355
4356    $loginBlock.dialog('open');
4357    $loginBlock.find('#edit-name').focus();
4358  }
4359};
4360;
4361Drupal.behaviors.ddPoll = function(context) {
4362  // Optimization: first search for .dd-poll-node, then search for the rest.
4363  $('.dd-poll-node', context).each(function() {
4364    var $node = $(this);
4365
4366    if ($node.find('.vote form').length) {
4367      new Drupal.ddPollNodeVote($node);
4368    }
4369    else if ($node.find('.results table').length) {
4370      new Drupal.ddPollNodeResults($node);
4371    }
4372  });
4373
4374  // Draw charts, if any, once all other behaviors are done processing.
4375  setTimeout(function() {
4376    Drupal.ddPollNodeResultsGraph.ready = true;
4377    Drupal.ddPollNodeResultsGraph.drawCharts();
4378  }, 0);
4379};
4380
4381Drupal.ddPollNodeVote = function($element) {
4382  var self = this;
4383  this.$element = $element;
4384  this.nid = this.$element.find('input[name=nid]').val();
4385  this.vid = this.getVid();
4386
4387  // If we couldn't establish a unique voter ID, leave the poll disabled.
4388  if (!this.vid) {
4389    this.$element.addClass('initialized');
4390    return;
4391  }
4392
4393  // Enable the poll.
4394  this.setMessage();
4395
4396  // Enable the submit button.
4397  this.$element.find('input.form-submit')
4398    .attr('disabled', false)
4399    .attr('data-disabled', false);
4400
4401  // Remove the dd_mobile 'disabled' button theme.
4402  this.$element.find('.ui-submit')
4403    .removeClass('ui-disabled')
4404    .attr('aria-disabled', false)
4405    .attr('data-disabled', false);
4406
4407  this.$element.addClass('initialized');
4408
4409  // Load the poll results if the voter has already voted for this poll.
4410  var nids = self.getVotedNids();
4411
4412  if ($.inArray(this.nid, nids) != -1) {
4413    this.$element.addClass('in-progress');
4414
4415    // Request the results.
4416    $.ajax({
4417      type: "GET",
4418      url: Drupal.settings.ddPoll['resultsURI'],
4419      data: { nid: this.nid, vid: this.vid },
4420      dataType: 'html',
4421      success: function(data) {
4422        self.setResults(data);
4423      },
4424      complete: function() {
4425        self.$element.removeClass('in-progress');
4426      }
4427    });
4428  }
4429
4430  // Submit the vote when the form is submitted.
4431  this.$element.find('form').submit(function() {
4432    var $form = $(this);
4433
4434    // Throw a fit if no answer has been selected.
4435    if ($form.find('input[name=aid]:checked').length == 0) {
4436      self.setMessage('Please select an answer in order to vote.', 'warning');
4437      return false;
4438    }
4439
4440    // Populate the voter ID.
4441    $form.find('input[name=vid]').val(self.vid);
4442
4443    // Disable the submit button.
4444    $form.find('input.form-submit')
4445      .attr('disabled', true)
4446      .attr('data-disabled', true);
4447
4448    // Adds the dd_mobile 'disabled' button theme.
4449    $form.find('.ui-submit')
4450      .addClass('ui-disabled')
4451      .attr('aria-disabled', true)
4452      .attr('data-disabled', true);
4453
4454    // Show something's going on.
4455    self.$element.addClass('in-progress');
4456
4457    $.ajax({
4458      type: "POST",
4459      url: $form.attr('action'),
4460      data: $form.serialize(),
4461      dataType: 'json',
4462      success: function(data) {
4463        // Remember this poll has been voted on.
4464        if (data['voted']) {
4465          var nids = self.getVotedNids();
4466
4467          if ($.inArray(self.nid, nids) == -1) {
4468            nids.push(self.nid);
4469          }
4470
4471          self.setVotedNids(nids);
4472        }
4473
4474        // Show a message, if necessary.
4475        if (data['message'] && data['messageType']) {
4476          self.setMessage(data['message'], data['messageType']);
4477        }
4478
4479        // Show the poll results, if available.
4480        if (data['results']) {
4481          self.setResults(data['results']);
4482        }
4483      },
4484      complete: function() {
4485        self.$element.removeClass('in-progress');
4486      }
4487    });
4488
4489    return false;
4490  });
4491};
4492
4493Drupal.ddPollNodeVote.prototype.setMessage = function(message, type) {
4494  var $element = this.$element.find('div.message');
4495
4496  // Reset the message element's classes.
4497  $element.attr('class', '');
4498  $element.addClass('message');
4499
4500  // Set the message.
4501  if (message) {
4502    $element.html(message);
4503
4504    if (!type) {
4505      type = 'notice';
4506    }
4507    $element.addClass('message-' + type);
4508  }
4509  else {
4510    $element.empty();
4511  }
4512};
4513
4514Drupal.ddPollNodeVote.prototype.setResults = function(results) {
4515  this.$element.find('div.vote').empty();
4516  this.$element.find('div.results').empty();
4517  this.$element.find('div.results').append(results);
4518
4519  new Drupal.ddPollNodeResults(this.$element);
4520};
4521
4522Drupal.ddPollNodeVote.prototype.getVid = function() {
4523  var vid = this.getPrimitiveVid();
4524
4525  if (!vid) {
4526    var randomVid = this.generateRandomVid();
4527    this.setVid(randomVid);
4528
4529    // Check whether we were actually able to save the
4530    if (this.getPrimitiveVid() == randomVid) {
4531      vid = randomVid;
4532    }
4533  }
4534
4535  return vid;
4536};
4537
4538Drupal.ddPollNodeVote.prototype.generateRandomVid = function() {
4539  // Generates a random two-byte integer.
4540  var randomWord = function() {
4541    return (Math.random() * 0x10000) | 0;
4542  };
4543
4544  // Formats a two-byte integer into a padded hex string.
4545  var formatWord = function(word) {
4546    var string = word.toString(16);
4547    while (string.length < 4) string = '0' + string;
4548    return string;
4549  };
4550
4551  // Generate a v4 UUID.
4552  var words = [null, null, null, null, null, null, null, null];
4553  words = $.map(words, randomWord);
4554  words[3] = words[3] & 0x0FFF | 0x4000;
4555  words[4] = words[4] & 0x3FFF | 0x8000;
4556
4557  return $.map(words, formatWord).join('');
4558};
4559
4560Drupal.ddPollNodeVote.prototype.setVid = function(vid) {
4561  if (typeof window.localStorage != 'undefined') {
4562    window.localStorage.setItem('VSESSIONID', vid);
4563  }
4564  else {
4565    document.cookie = "VSESSIONID=" + vid + "; expires=Sat, 1 Jan 2050 00:00:00 UTC; path=/";
4566  }
4567};
4568
4569Drupal.ddPollNodeVote.prototype.getPrimitiveVid = function() {
4570  var vid = undefined;
4571
4572  if (typeof window.localStorage != 'undefined') {
4573    vid = window.localStorage.getItem('VSESSIONID');
4574  }
4575
4576  if (vid === undefined) {
4577    var name = "VSESSIONID=";
4578
4579    $.each(document.cookie.split(';'), function(index, cookie) {
4580      cookie = $.trim(cookie);
4581
4582      if (cookie.indexOf(name) == 0) {
4583        vid = cookie.substring(name.length, cookie.length);
4584      }
4585    });
4586  }
4587
4588  if (typeof(vid) != 'string' || vid.length != 32) {
4589    vid = undefined;
4590  }
4591
4592  return vid;
4593};
4594
4595Drupal.ddPollNodeVote.prototype.setVotedNids = function(nids) {
4596  if ((typeof window.localStorage != 'undefined') && (typeof window.JSON != 'undefined')) {
4597    window.localStorage.setItem('ddPollVotedNids', JSON.stringify(nids));
4598  }
4599  else {
4600    document.cookie = "ddPollVotedNids=" + nids.join(',') + "; expires=Sat, 1 Jan 2050 00:00:00 UTC; path=/";
4601  }
4602};
4603
4604Drupal.ddPollNodeVote.prototype.getVotedNids = function() {
4605  var nids = undefined;
4606
4607  if ((typeof window.localStorage != 'undefined') && (typeof window.JSON != 'undefined')) {
4608    try {
4609      nids = JSON.parse(window.localStorage.getItem('ddPollVotedNids'));
4610    }
4611    catch(e) {
4612      // Ignore
4613    }
4614  }
4615
4616  if (nids == undefined) {
4617    var name = "ddPollVotedNids=";
4618
4619    $.each(document.cookie.split(';'), function(index, cookie) {
4620      cookie = $.trim(cookie);
4621
4622      if (cookie.indexOf(name) == 0) {
4623        nids = cookie.substring(name.length, cookie.length);
4624      }
4625    });
4626
4627    if (nids) {
4628      nids = nids.split(',');
4629    }
4630  }
4631
4632  if (typeof(nids) != 'object' || !(nids instanceof Array)) {
4633    nids = [];
4634  }
4635
4636  return nids;
4637};
4638
4639Drupal.ddPollNodeResults = function($element) {
4640//  var self = this;
4641  this.$element = $element;
4642
4643  // Add this to the array of results to be graphed and trigger them to be
4644  // drawn.
4645  Drupal.ddPollNodeResultsGraph.results.push(this);
4646  Drupal.ddPollNodeResultsGraph.drawCharts();
4647
4648  $element.addClass('initialized');
4649};
4650
4651Drupal.ddPollNodeResults.prototype.drawChart = function() {
4652  //noinspection JSUnresolvedFunction,JSUnresolvedVariable
4653  var data = new google.visualization.DataTable();
4654  //noinspection JSUnresolvedFunction
4655  data.addColumn('string', 'Answer');
4656  //noinspection JSUnresolvedFunction
4657  data.addColumn('number', 'Votes');
4658
4659  var $table = this.$element.find('table.dd-poll-results');
4660
4661  $table.find('tbody tr').each(function() {
4662    var $columns = $(this).find('td');
4663
4664    if ($columns.length == 2) {
4665      var answer = $columns.eq(0).text();
4666      var percent = parseFloat($columns.eq(1).text().replace('%', ''));
4667      //noinspection JSUnresolvedFunction
4668      data.addRow([answer, percent]);
4669    }
4670  });
4671
4672  var options = {
4673    width: '100%',
4674    height: 200,
4675    chartArea: {
4676      width: '100%'
4677    },
4678    legend: {
4679      position: 'bottom'
4680    },
4681    tooltip: {
4682      text: 'percentage'
4683    },
4684    backgroundColor: 'transparent',
4685    // So that slices with 0 votes still show up in the legend.
4686    sliceVisibilityThreshold: 0
4687  };
4688
4689  if (Drupal.ddPollNodeResultsGraphOptionsAlter) {
4690    Drupal.ddPollNodeResultsGraphOptionsAlter(this.$element, options);
4691  }
4692
4693  // Make a div to hold the chart, replacing the table.
4694  var $chartDiv = $('<div></div>');
4695  $table.css('display', 'none').after($chartDiv);
4696
4697  //noinspection JSUnresolvedFunction,JSUnresolvedVariable
4698  var chart = new google.visualization.PieChart($chartDiv.get(0));
4699  //noinspection JSUnresolvedFunction
4700  chart.draw(data, options);
4701};
4702
4703Drupal.ddPollNodeResultsGraph = {
4704  // Wether all graphs have been initialized.
4705  ready: false,
4706  // Whether the graph API has been loaded.
4707  prepared: false,
4708  // The results that need to be graphed.
4709  results: []
4710};
4711
4712Drupal.ddPollNodeResultsGraph.prepareCharts = function() {
4713  // Don't attempt to load the API more than once.
4714  if (Drupal.ddPollNodeResultsGraph.prepared) {
4715    return;
4716  }
4717
4718  var autoload = '{"modules":[{"name":"visualization","version":"1.0","packages":["corechart"],"callback":"Drupal.ddPollNodeResultsGraph.chartsPrepared"}]}';
4719
4720  // We don't use $.getScript, because it does unnecessary cache breaking.
4721  $.ajax({
4722    url: 'https://www.google.com/jsapi?autoload=' + encodeURIComponent(autoload),
4723    dataType: 'script',
4724    cache: true
4725  });
4726};
4727
4728Drupal.ddPollNodeResultsGraph.chartsPrepared = function() {
4729  // Now that the graph API has been loaded, re-trigger graphs to be drawn.
4730  Drupal.ddPollNodeResultsGraph.prepared = true;
4731  Drupal.ddPollNodeResultsGraph.drawCharts();
4732};
4733
4734Drupal.ddPollNodeResultsGraph.drawCharts = function() {
4735  // Abort if we're not ready yet or if there's nothing to draw.
4736  if (!Drupal.ddPollNodeResultsGraph.ready || Drupal.ddPollNodeResultsGraph.results.length == 0) {
4737    return;
4738  }
4739
4740  // Load the graph API first, if necessary.
4741  if (!Drupal.ddPollNodeResultsGraph.prepared) {
4742    Drupal.ddPollNodeResultsGraph.prepareCharts();
4743    return;
4744  }
4745
4746  while (Drupal.ddPollNodeResultsGraph.results.length > 0) {
4747    Drupal.ddPollNodeResultsGraph.results.pop().drawChart();
4748  }
4749};
4750;
4751// Get all cookieconsent cookies on a a site.
4752function getAllConsentCookies() {
4753  var theCookies = document.cookie.split(';');
4754  var cookieconsent_cookies = [];
4755
4756  $.each( theCookies, function( key, value ) {
4757    // if(value.includes('cookieconsent_status_')) { // fix this for IE 11 on Win 7
4758    if(value.indexOf('cookieconsent_status_') > -1) {
4759      cookieconsent_cookies.push(value.split("=")[0].replace(/ /g,''));
4760    }
4761  });
4762  return cookieconsent_cookies;
4763}
4764
4765// Retrieve an array key out of Drupal.settings.dd_sitewide_message_notification for a specific cookie.
4766function getArrayKey(name) {
4767  var cookie_key = null;
4768
4769  $.each(Drupal.settings.dd_sitewide_message_notification.dd_sitewide_message_cookie_name, function( key, value ) {
4770    if(value == name) {
4771      cookie_key = key;
4772    }
4773  });
4774  return cookie_key;
4775}
4776
4777// Get a cookie by name
4778function getCookie(name) {
4779  var value = "; " + document.cookie;
4780  var parts = value.split("; " + name + "=");
4781  if (parts.length == 2) return parts.pop().split(";").shift();
4782}
4783
4784// Delete a cookie by setting expire date to the past.
4785function deleteCookie(name) {
4786  document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
4787}
4788
4789Drupal.behaviors.dd_sitewide_message_reset_notifications = function (context) {
4790  // Check if we have any data.
4791  if( typeof Drupal.settings.dd_sitewide_message_notification === "undefined") {
4792    return;
4793  }
4794
4795  // Iterate over cookie consent cookies and check if needs to be reset.
4796  $.each( getAllConsentCookies(), function( key, value ) {
4797    var existing_cookie_version = getCookie(value).split(',')[1];
4798    var cookieArrayKey = getArrayKey(value);
4799    var cookie_version = Drupal.settings.dd_sitewide_message_notification.dd_sitewide_message_cookie_version;
4800
4801    // Check if we have more than one message.
4802    if (typeof(cookie_version) === 'object') {
4803      current_cookie_version = cookie_version[cookieArrayKey];
4804    } else {
4805      current_cookie_version = cookie_version;
4806    }
4807
4808    // Delete the cookie so it will re-appear.
4809    if (existing_cookie_version != current_cookie_version) {
4810      deleteCookie(value);
4811    }
4812  });
4813};
4814;
4815Drupal.behaviors.ddTwitterFeed = function(context) {
4816  var $feedBlock = $('.dd-twitter-feed', context);
4817  // See if there is a DD Twitter Feed Block present.
4818  if ($feedBlock.length > 0) {
4819    new Drupal.DDTwitterFeedTweets($feedBlock);
4820  }
4821};
4822
4823Drupal.DDTwitterFeedTweets = function($element) {
4824  var self = this;
4825  this.$element = $element;
4826
4827  // Add helper class for theming the load of tweets.
4828  this.$element.addClass('loading-tweets');
4829
4830  // Request the tweets.
4831  $.ajax({
4832    type: 'GET',
4833    cache: true,
4834    url: Drupal.settings.ddTwitterFeed['getTweetsURI'],
4835    dataType: 'html',
4836    success: function(data) {
4837      self.$element.find('.dd-twitter-feed-tweets').html(data);
4838      self.animateResults();
4839    },
4840    complete: function() {
4841      self.$element.removeClass('loading-tweets');
4842    }
4843  });
4844};
4845
4846Drupal.DDTwitterFeedTweets.prototype.animateResults = function() {
4847  var $tweets = this.$element.find('.dd-twitter-feed-tweet'),
4848        count = 0,
4849        total = $tweets.length,
4850        delay = 5500;
4851
4852  // show the first tweet.
4853  $tweets.eq(count).show();
4854
4855  // only animate if there is more than one tweet.
4856  if (total > 1) {
4857    window.setInterval(function() {
4858      // fade out current tweet.
4859      $tweets.eq(count).animate({opacity:'hide'}, 200, function() {
4860        count++;
4861        // keeps count in bounds.
4862        if (count >= total) count = 0;
4863        // fade in the next tweet.
4864        $tweets.eq(count).animate({opacity:'show'}, 300);
4865      });
4866    }, delay);
4867  }
4868};
4869;
4870// $Id: extlink.js,v 1.4.2.12 2010/05/26 01:25:56 quicksketch Exp $
4871
4872// This is unnecessary and breaks webwraps in IE
4873//(function ($) {
4874
4875function extlinkAttach(context) {
4876  // Strip the host name down, removing ports, subdomains, or www.
4877  var pattern = /^(([^\/:]+?\.)*)([^\.:]{4,})((\.[a-z]{1,4})*)(:[0-9]{1,5})?$/;
4878  var host = window.location.host.replace(pattern, '$3$4');
4879  var subdomain = window.location.host.replace(pattern, '$1');
4880
4881  // Determine what subdomains are considered internal.
4882  if (Drupal.settings.extlink.extSubdomains) {
4883    var subdomains = "([^/]*\\.)?";
4884  }
4885  else if (subdomain == 'www.' || subdomain == '') {
4886    var subdomains = "(www\\.)?";
4887  }
4888  else {
4889    var subdomains = subdomain.replace(".", "\\.");
4890  }
4891
4892  // Build regular expressions that define an internal link.
4893  var internal_link = new RegExp("^https?://" + subdomains + host, "i");
4894
4895  // Extra internal link matching.
4896  var extInclude = false;
4897  if (Drupal.settings.extlink.extInclude) {
4898    extInclude = new RegExp(Drupal.settings.extlink.extInclude.replace(/\\/, '\\'));
4899  }
4900
4901  // Extra external link matching.
4902  var extExclude = false;
4903  if (Drupal.settings.extlink.extExclude) {
4904    extExclude = new RegExp(Drupal.settings.extlink.extExclude.replace(/\\/, '\\'));
4905  }
4906
4907  // Find all links which are NOT internal and begin with http (as opposed
4908  // to ftp://, javascript:, etc. other kinds of links.
4909  // When operating on the 'this' variable, the host has been appended to
4910  // all links by the browser, even local ones.
4911  // In jQuery 1.1 and higher, we'd use a filter method here, but it is not
4912  // available in jQuery 1.0 (Drupal 5 default).
4913  var external_links = new Array();
4914  var mailto_links = new Array();
4915  $("a:not(." + Drupal.settings.extlink.extClass + ", ." + Drupal.settings.extlink.mailtoClass + ")", context).each(function(el) {
4916    try {
4917      var url = this.href.toLowerCase();
4918      if (url.indexOf('http') == 0 && (!url.match(internal_link) || (extInclude && url.match(extInclude))) && !(extExclude && url.match(extExclude))) {
4919        external_links.push(this);
4920      }
4921      else if (url.indexOf('mailto:') == 0) {
4922        mailto_links.push(this);
4923      }
4924    }
4925    // IE7 throws errors often when dealing with irregular links, such as:
4926    // <a href="node/10"></a> Empty tags.
4927    // <a href="http://user:[email protected]">example</a> User:pass syntax.
4928    catch(error) {
4929      return false;
4930    }
4931  });
4932
4933  if (Drupal.settings.extlink.extClass) {
4934    // Apply the "ext" class to all links not containing images.
4935    if (parseFloat($().jquery) < 1.2) {
4936      $(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>'); });
4937    }
4938    else {
4939      $(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>'); });
4940    }
4941  }
4942
4943  if (Drupal.settings.extlink.mailtoClass) {
4944    // Apply the "mailto" class to all mailto links not containing images.
4945    if (parseFloat($().jquery) < 1.2) {
4946      $(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>'); });
4947    }
4948    else {
4949      $(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>'); });
4950    }
4951  }
4952
4953  if (Drupal.settings.extlink.extTarget) {
4954    // Apply the target attribute to all links.
4955    $(external_links).attr('target', Drupal.settings.extlink.extTarget);
4956  }
4957
4958  if (Drupal.settings.extlink.extAlert) {
4959    // Add pop-up click-through dialog.
4960    $(external_links).click(function(e) {
4961     return confirm(Drupal.settings.extlink.extAlertText);
4962    });
4963  }
4964
4965  // Work around for Internet Explorer box model problems.
4966  if (($.support && !($.support.boxModel === undefined) && !$.support.boxModel) || ($.browser.msie && parseInt($.browser.version) <= 7)) {
4967    $('span.ext, span.mailto').css('display', 'inline-block');
4968  }
4969}
4970
4971Drupal.behaviors.extlink = function(context) {
4972  extlinkAttach(context);
4973}
4974
4975//})(jQuery);
4976;
4977
4978/**
4979 * Manage the active and inactive states of the commands menu.
4980 */
4981
4982Drupal.DigitaldCoreCommandsMenu = function(element, options) {
4983  var self = this;
4984  self.element = element;
4985  self.$element = $(element);
4986  self._defaults = {delay: 300};
4987  self.settings = $.extend({}, true, this._defaults, options);
4988  self.init();
4989};
4990
4991Drupal.DigitaldCoreCommandsMenu.prototype = {
4992  init: function() {
4993    this.addListeners();
4994  },
4995  hide: function($element) {
4996    // Set the element(s) inactive
4997    $element.removeClass('active');
4998  },
4999  show: function($element) {
5000    // Set the element(s) active
5001    $element.addClass('active');
5002    // Cancel the timeout delay for the element(s)
5003    $element.doTimeout('deactivate');
5004  },
5005  on: function(event) {
5006    var self = event.data.self;
5007    var $this = $(this);
5008    if ($this.is('.active')) {
5009      self.show($this);
5010    }
5011  },
5012  off: function(event) {
5013    var self = event.data.self;
5014    var $this = $(this);
5015    // Add a delay before deactivating the menu
5016    $this.doTimeout('deactivate', self.settings.delay, function() {
5017      self.hide($this);
5018    });
5019  },
5020  click: function(event) {
5021    var self = event.data.self;
5022    if (self.$element.is('.active')) {
5023      self.hide(self.$element);
5024    }
5025    else {
5026      self.show(self.$element);
5027    }
5028  },
5029  addListeners: function() {
5030    // Add a click event to toggle the display of the menu
5031    this.$element.find('.block-title').bind('click', {self: this}, this.click);
5032    // Add a listener to hide/show the menu if the user hovers on/off of it.
5033    this.$element.bind('mouseenter', {self: this}, this.on);
5034    this.$element.bind('mouseleave', {self: this}, this.off);
5035  }
5036};
5037
5038Drupal.behaviors.digitaldcoreCommandsMenu = function(context) {
5039  $('#block-digitaldcore-command_menu', context).each(function(i, element) {
5040    if (!element.digitaldcoreCommandsMenu) {
5041      element.digitaldcoreCommandsMenu = new Drupal.DigitaldCoreCommandsMenu(element);
5042    }
5043  });
5044};
5045
5046Drupal.behaviors.digitaldcoreInitialize = function(context) {
5047  $("body.page-manage-content-advanced .admin-content .view-filters > form > div", context).before("<div class='filter-title'>Filter and search content</div>");
5048  
5049  $("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>');
5050  
5051  $("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>");
5052
5053  // Create a sitemap using the default site navigation menu (.navbar)
5054
5055  var sitemap = $("#site-map", context);
5056  var navbar = $(".navbar .block-content", context);
5057
5058  if (sitemap.length && navbar.length) {
5059    Drupal.digitaldcoreCreateSiteMap(sitemap, navbar);
5060  }
5061};
5062
5063/**
5064 * Function that creates a sitemap display using the main site navigation menu
5065 *
5066 * @param $sitemap (jQuery element) Sitemap container
5067 * @param $navbar (jQuery element) Main site navigation menu
5068 */
5069
5070Drupal.digitaldcoreCreateSiteMap = function($sitemap, $navbar) {
5071  // Get reference to the sitemap message
5072  var message = $('.site-map-message', $sitemap).html();
5073
5074  // Clear out any existing content within the sitemap container
5075  $sitemap.empty();
5076
5077  // If a message was found, add that back into the new sitemap content
5078  if (message) {
5079    $sitemap.before('<div id="site-map-message">' + message + '</div>');
5080  }
5081
5082  // Convert the crazy long menu item classname to cleaner alternative
5083  $sitemap.append($navbar.html().replace(/menu-path-taxonomy-term-/ig, 'tid-'));
5084  $sitemap.find('a[href="/"]').removeClass('hidden');
5085
5086  // Remove hidden term links
5087  $sitemap.find('a.hidden').remove();
5088
5089  // Remove hidden terms associated to a hidden navigation term
5090  $sitemap.find('li').map(function() {
5091    if(!$(this).children('a').length) {
5092      return this;
5093    }
5094  }).remove();
5095
5096  // Remove class names from lists
5097  $sitemap.find('ul').removeAttr('class');
5098
5099  // Remove inline styling, titles, ids, and focus from any sitemap element
5100  $sitemap.find("*").removeAttr('style').removeAttr('title').removeAttr('id').removeAttr('hidefocus');
5101
5102  // Add an RSS feed icon which links to each menu items RSS output
5103  $sitemap.find('a.menu-link:not(.ext)').each(function() {
5104    var link = $(this);
5105    var match = link.attr('class').match(/\btid-(\d+)\b/);
5106    if (!match) {
5107      return;
5108    }
5109    var tid = match[1];
5110    link.after(link.clone());
5111    link.html('<img src="/misc/feed.png" alt="RSS Feed" />');
5112    link.addClass('sitemap-rss');
5113    link.attr('href', Drupal.settings.basePath + 'taxonomy/term/' + tid + '/0/feed');
5114  });
5115};
5116
5117Drupal.behaviors.digitaldcoreInterrupt = function(context) {
5118  var showDialog = true;
5119
5120  // Take care of the multivariateness
5121  if (Drupal.settings.ddCreatePopup) {
5122    var winner = null;
5123    var accumulator = 0.0;
5124    var threshold = Math.random();
5125
5126    $.each(Drupal.settings.ddCreatePopup, function(key, popup) {
5127      var probability = parseFloat(popup.probability);
5128      accumulator += probability;
5129
5130      if (accumulator > threshold) {
5131        winner = popup.content_nid;
5132        return false;
5133      }
5134    });
5135
5136    if (winner) {
5137      $('#block-digitaldcore-interrupt .node-teaser').hide();
5138      $('#block-digitaldcore-interrupt .node-teaser.node-' + winner).show();
5139    }
5140    else {
5141      showDialog = false;
5142    }
5143  }
5144
5145  if (showDialog && $('#block-digitaldcore-interrupt', context).size()) {
5146    setTimeout(function() {
5147      // Ensure that the plugin is still available, since being called via setTimeout
5148      if (typeof $.fn.dialog === 'function') {
5149        $('#block-digitaldcore-interrupt', context).dialog({ dialogClass: 'dd-interrupt', modal: true, width: 550, height: 400 });
5150      }
5151    }, 3000);  // 6 second delay will work with every browser
5152    
5153    $('#block-digitaldcore-interrupt .dd-hover-expand', context).click(function() {
5154      $('.ui-dialog-overlay').fadeOut();
5155    });
5156    $('#block-digitaldcore-interrupt .dd-hover-wrapper').css({ left:'100px', right:'auto' });
5157  }
5158  else {
5159    $('#block-digitaldcore-interrupt', context).hide();
5160  }
5161};
5162
5163Drupal.behaviors.ddCalendarAttachBehaviors = function(context) {
5164  $('body.section-calendar article header .event-date .date-display-single', context).each(function () {
5165    if (this.children.length === 0 && $(this).text() === '12:00am') {
5166      $(this).hide();
5167    }
5168  });
5169  $("body.section-calendar", context).ajaxComplete(function() {
5170    Drupal.attachBehaviors($("#calpopup", context));
5171  });
5172};
5173
5174/**
5175 * Force all links to common files (pdf, doc, etc) to open in a new window.
5176 */
5177Drupal.behaviors.fileLinks = function(context) {
5178  var pattern = /\.(pdf|doc|docx|xls|xlsx|csv|txt|rtf|odf|ppt|pptx|xml)$/; 
5179  $('#main a', context).each(function() {
5180    if (this.href.match(pattern)) {
5181      this.target = "_blank";
5182    }
5183  });
5184};
5185
5186Drupal.behaviors.webformDuplicateSubmissions = function(context) {
5187  $('form.webform-client-form', context).submit(function(event) {
5188    if (event.defaultPrevented) {
5189      return;
5190    }
5191
5192    var $submit = $('input#edit-submit', this);
5193
5194    // Disable the button asynchronously, so that its value still gets submitted
5195    // to the server. This is important for webforms with multiple buttons, such
5196    // as multipage webforms or webforms that support drafts.
5197    setTimeout(function() {
5198      $submit.attr('disabled', 'disabled');
5199    }, 1);
5200
5201    // Change the button label after a delay, so that it only shows up if the
5202    // form submission is slower.
5203    setTimeout(function() {
5204      $submit.attr('value', 'Please wait...');
5205    }, 2500);
5206  });
5207};
5208;
5209/* Modernizr 2.8.3 (Custom Build) | MIT & BSD
5210 * 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
5211 */
5212;
5213
5214
5215
5216window.Modernizr = (function( window, document, undefined ) {
5217
5218    var version = '2.8.3',
5219
5220    Modernizr = {},
5221
5222    enableClasses = true,
5223
5224    docElement = document.documentElement,
5225
5226    mod = 'modernizr',
5227    modElem = document.createElement(mod),
5228    mStyle = modElem.style,
5229
5230    inputElem  = document.createElement('input')  ,
5231
5232    smile = ':)',
5233
5234    toString = {}.toString,
5235
5236    prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),
5237
5238
5239
5240    omPrefixes = 'Webkit Moz O ms',
5241
5242    cssomPrefixes = omPrefixes.split(' '),
5243
5244    domPrefixes = omPrefixes.toLowerCase().split(' '),
5245
5246    ns = {'svg': 'http://www.w3.org/2000/svg'},
5247
5248    tests = {},
5249    inputs = {},
5250    attrs = {},
5251
5252    classes = [],
5253
5254    slice = classes.slice,
5255
5256    featureName,
5257
5258
5259    injectElementWithStyles = function( rule, callback, nodes, testnames ) {
5260
5261      var style, ret, node, docOverflow,
5262          div = document.createElement('div'),
5263                body = document.body,
5264                fakeBody = body || document.createElement('body');
5265
5266      if ( parseInt(nodes, 10) ) {
5267                      while ( nodes-- ) {
5268              node = document.createElement('div');
5269              node.id = testnames ? testnames[nodes] : mod + (nodes + 1);
5270              div.appendChild(node);
5271          }
5272      }
5273
5274                style = ['&#173;','<style id="s', mod, '">', rule, '</style>'].join('');
5275      div.id = mod;
5276          (body ? div : fakeBody).innerHTML += style;
5277      fakeBody.appendChild(div);
5278      if ( !body ) {
5279                fakeBody.style.background = '';
5280                fakeBody.style.overflow = 'hidden';
5281          docOverflow = docElement.style.overflow;
5282          docElement.style.overflow = 'hidden';
5283          docElement.appendChild(fakeBody);
5284      }
5285
5286      ret = callback(div, rule);
5287        if ( !body ) {
5288          fakeBody.parentNode.removeChild(fakeBody);
5289          docElement.style.overflow = docOverflow;
5290      } else {
5291          div.parentNode.removeChild(div);
5292      }
5293
5294      return !!ret;
5295
5296    },
5297
5298
5299
5300    isEventSupported = (function() {
5301
5302      var TAGNAMES = {
5303        'select': 'input', 'change': 'input',
5304        'submit': 'form', 'reset': 'form',
5305        'error': 'img', 'load': 'img', 'abort': 'img'
5306      };
5307
5308      function isEventSupported( eventName, element ) {
5309
5310        element = element || document.createElement(TAGNAMES[eventName] || 'div');
5311        eventName = 'on' + eventName;
5312
5313            var isSupported = eventName in element;
5314
5315        if ( !isSupported ) {
5316                if ( !element.setAttribute ) {
5317            element = document.createElement('div');
5318          }
5319          if ( element.setAttribute && element.removeAttribute ) {
5320            element.setAttribute(eventName, '');
5321            isSupported = is(element[eventName], 'function');
5322
5323                    if ( !is(element[eventName], 'undefined') ) {
5324              element[eventName] = undefined;
5325            }
5326            element.removeAttribute(eventName);
5327          }
5328        }
5329
5330        element = null;
5331        return isSupported;
5332      }
5333      return isEventSupported;
5334    })(),
5335
5336
5337    _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;
5338
5339    if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {
5340      hasOwnProp = function (object, property) {
5341        return _hasOwnProperty.call(object, property);
5342      };
5343    }
5344    else {
5345      hasOwnProp = function (object, property) {
5346        return ((property in object) && is(object.constructor.prototype[property], 'undefined'));
5347      };
5348    }
5349
5350
5351    if (!Function.prototype.bind) {
5352      Function.prototype.bind = function bind(that) {
5353
5354        var target = this;
5355
5356        if (typeof target != "function") {
5357            throw new TypeError();
5358        }
5359
5360        var args = slice.call(arguments, 1),
5361            bound = function () {
5362
5363            if (this instanceof bound) {
5364
5365              var F = function(){};
5366              F.prototype = target.prototype;
5367              var self = new F();
5368
5369              var result = target.apply(
5370                  self,
5371                  args.concat(slice.call(arguments))
5372              );
5373              if (Object(result) === result) {
5374                  return result;
5375              }
5376              return self;
5377
5378            } else {
5379
5380              return target.apply(
5381                  that,
5382                  args.concat(slice.call(arguments))
5383              );
5384
5385            }
5386
5387        };
5388
5389        return bound;
5390      };
5391    }
5392
5393    function setCss( str ) {
5394        mStyle.cssText = str;
5395    }
5396
5397    function setCssAll( str1, str2 ) {
5398        return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));
5399    }
5400
5401    function is( obj, type ) {
5402        return typeof obj === type;
5403    }
5404
5405    function contains( str, substr ) {
vendor: 16,484 bytes, lines 5406-5896
5406        return !!~('' + str).indexOf(substr);
5407    }
5408
5409    function testProps( props, prefixed ) {
5410        for ( var i in props ) {
5411            var prop = props[i];
5412            if ( !contains(prop, "-") && mStyle[prop] !== undefined ) {
5413                return prefixed == 'pfx' ? prop : true;
5414            }
5415        }
5416        return false;
5417    }
5418
5419    function testDOMProps( props, obj, elem ) {
5420        for ( var i in props ) {
5421            var item = obj[props[i]];
5422            if ( item !== undefined) {
5423
5424                            if (elem === false) return props[i];
5425
5426                            if (is(item, 'function')){
5427                                return item.bind(elem || obj);
5428                }
5429
5430                            return item;
5431            }
5432        }
5433        return false;
5434    }
5435
5436    function testPropsAll( prop, prefixed, elem ) {
5437
5438        var ucProp  = prop.charAt(0).toUpperCase() + prop.slice(1),
5439            props   = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');
5440
5441            if(is(prefixed, "string") || is(prefixed, "undefined")) {
5442          return testProps(props, prefixed);
5443
5444            } else {
5445          props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');
5446          return testDOMProps(props, prefixed, elem);
5447        }
5448    }    tests['flexbox'] = function() {
5449      return testPropsAll('flexWrap');
5450    };
5451
5452
5453    tests['flexboxlegacy'] = function() {
5454        return testPropsAll('boxDirection');
5455    };
5456
5457
5458    tests['canvas'] = function() {
5459        var elem = document.createElement('canvas');
5460        return !!(elem.getContext && elem.getContext('2d'));
5461    };
5462
5463    tests['canvastext'] = function() {
5464        return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));
5465    };
5466    tests['touch'] = function() {
5467        var bool;
5468
5469        if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
5470          bool = true;
5471        } else {
5472          injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) {
5473            bool = node.offsetTop === 9;
5474          });
5475        }
5476
5477        return bool;
5478    };
5479
5480
5481
5482    tests['geolocation'] = function() {
5483        return 'geolocation' in navigator;
5484    };
5485
5486
5487
5488    tests['draganddrop'] = function() {
5489        var div = document.createElement('div');
5490        return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
5491    };
5492
5493
5494
5495    tests['rgba'] = function() {
5496        setCss('background-color:rgba(150,255,150,.5)');
5497
5498        return contains(mStyle.backgroundColor, 'rgba');
5499    };
5500
5501
5502    tests['multiplebgs'] = function() {
5503                setCss('background:url(https://),url(https://),red url(https://)');
5504
5505            return (/(url\s*\(.*?){3}/).test(mStyle.background);
5506    };    tests['backgroundsize'] = function() {
5507        return testPropsAll('backgroundSize');
5508    };    tests['borderradius'] = function() {
5509        return testPropsAll('borderRadius');
5510    };
5511
5512    tests['boxshadow'] = function() {
5513        return testPropsAll('boxShadow');
5514    };
5515
5516    tests['textshadow'] = function() {
5517        return document.createElement('div').style.textShadow === '';
5518    };
5519
5520
5521    tests['opacity'] = function() {
5522                setCssAll('opacity:.55');
5523
5524                    return (/^0.55$/).test(mStyle.opacity);
5525    };
5526
5527
5528    tests['cssanimations'] = function() {
5529        return testPropsAll('animationName');
5530    };
5531
5532
5533    tests['csscolumns'] = function() {
5534        return testPropsAll('columnCount');
5535    };
5536
5537
5538    tests['cssgradients'] = function() {
5539        var str1 = 'background-image:',
5540            str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',
5541            str3 = 'linear-gradient(left top,#9f9, white);';
5542
5543        setCss(
5544                       (str1 + '-webkit- '.split(' ').join(str2 + str1) +
5545                       prefixes.join(str3 + str1)).slice(0, -str1.length)
5546        );
5547
5548        return contains(mStyle.backgroundImage, 'gradient');
5549    };    tests['csstransforms'] = function() {
5550        return !!testPropsAll('transform');
5551    };
5552
5553
5554    tests['csstransforms3d'] = function() {
5555
5556        var ret = !!testPropsAll('perspective');
5557
5558                        if ( ret && 'webkitPerspective' in docElement.style ) {
5559
5560                      injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {
5561            ret = node.offsetLeft === 9 && node.offsetHeight === 3;
5562          });
5563        }
5564        return ret;
5565    };
5566
5567
5568    tests['csstransitions'] = function() {
5569        return testPropsAll('transition');
5570    };
5571
5572
5573
5574    tests['fontface'] = function() {
5575        var bool;
5576
5577        injectElementWithStyles('@font-face {font-family:"font";src:url("https://")}', function( node, rule ) {
5578          var style = document.getElementById('smodernizr'),
5579              sheet = style.sheet || style.styleSheet,
5580              cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '';
5581
5582          bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0;
5583        });
5584
5585        return bool;
5586    };
5587
5588    tests['generatedcontent'] = function() {
5589        var bool;
5590
5591        injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:"',smile,'";visibility:hidden;font:3px/1 a}'].join(''), function( node ) {
5592          bool = node.offsetHeight >= 3;
5593        });
5594
5595        return bool;
5596    };
5597    tests['video'] = function() {
5598        var elem = document.createElement('video'),
5599            bool = false;
5600
5601            try {
5602            if ( bool = !!elem.canPlayType ) {
5603                bool      = new Boolean(bool);
5604                bool.ogg  = elem.canPlayType('video/ogg; codecs="theora"')      .replace(/^no$/,'');
5605
5606                            bool.h264 = elem.canPlayType('video/mp4; codecs="avc1.42E01E"') .replace(/^no$/,'');
5607
5608                bool.webm = elem.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,'');
5609            }
5610
5611        } catch(e) { }
5612
5613        return bool;
5614    };
5615
5616    tests['audio'] = function() {
5617        var elem = document.createElement('audio'),
5618            bool = false;
5619
5620        try {
5621            if ( bool = !!elem.canPlayType ) {
5622                bool      = new Boolean(bool);
5623                bool.ogg  = elem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,'');
5624                bool.mp3  = elem.canPlayType('audio/mpeg;')               .replace(/^no$/,'');
5625
5626                                                    bool.wav  = elem.canPlayType('audio/wav; codecs="1"')     .replace(/^no$/,'');
5627                bool.m4a  = ( elem.canPlayType('audio/x-m4a;')            ||
5628                              elem.canPlayType('audio/aac;'))             .replace(/^no$/,'');
5629            }
5630        } catch(e) { }
5631
5632        return bool;
5633    };
5634
5635
5636    tests['localstorage'] = function() {
5637        try {
5638            localStorage.setItem(mod, mod);
5639            localStorage.removeItem(mod);
5640            return true;
5641        } catch(e) {
5642            return false;
5643        }
5644    };
5645
5646    tests['sessionstorage'] = function() {
5647        try {
5648            sessionStorage.setItem(mod, mod);
5649            sessionStorage.removeItem(mod);
5650            return true;
5651        } catch(e) {
5652            return false;
5653        }
5654    };
5655
5656    tests['svg'] = function() {
5657        return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;
5658    };
5659
5660    tests['inlinesvg'] = function() {
5661      var div = document.createElement('div');
5662      div.innerHTML = '<svg/>';
5663      return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;
5664    };    function webforms() {
5665                                            Modernizr['input'] = (function( props ) {
5666            for ( var i = 0, len = props.length; i < len; i++ ) {
5667                attrs[ props[i] ] = !!(props[i] in inputElem);
5668            }
5669            if (attrs.list){
5670                                  attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);
5671            }
5672            return attrs;
5673        })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));
5674                            Modernizr['inputtypes'] = (function(props) {
5675
5676            for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {
5677
5678                inputElem.setAttribute('type', inputElemType = props[i]);
5679                bool = inputElem.type !== 'text';
5680
5681                                                    if ( bool ) {
5682
5683                    inputElem.value         = smile;
5684                    inputElem.style.cssText = 'position:absolute;visibility:hidden;';
5685
5686                    if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {
5687
5688                      docElement.appendChild(inputElem);
5689                      defaultView = document.defaultView;
5690
5691                                        bool =  defaultView.getComputedStyle &&
5692                              defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&
5693                                                                                  (inputElem.offsetHeight !== 0);
5694
5695                      docElement.removeChild(inputElem);
5696
5697                    } else if ( /^(search|tel)$/.test(inputElemType) ){
5698                                                                                    } else if ( /^(url|email)$/.test(inputElemType) ) {
5699                                        bool = inputElem.checkValidity && inputElem.checkValidity() === false;
5700
5701                    } else {
5702                                        bool = inputElem.value != smile;
5703                    }
5704                }
5705
5706                inputs[ props[i] ] = !!bool;
5707            }
5708            return inputs;
5709        })('search tel url email datetime date month week time datetime-local number range color'.split(' '));
5710        }
5711    for ( var feature in tests ) {
5712        if ( hasOwnProp(tests, feature) ) {
5713                                    featureName  = feature.toLowerCase();
5714            Modernizr[featureName] = tests[feature]();
5715
5716            classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);
5717        }
5718    }
5719
5720    Modernizr.input || webforms();
5721
5722
5723     Modernizr.addTest = function ( feature, test ) {
5724       if ( typeof feature == 'object' ) {
5725         for ( var key in feature ) {
5726           if ( hasOwnProp( feature, key ) ) {
5727             Modernizr.addTest( key, feature[ key ] );
5728           }
5729         }
5730       } else {
5731
5732         feature = feature.toLowerCase();
5733
5734         if ( Modernizr[feature] !== undefined ) {
5735                                              return Modernizr;
5736         }
5737
5738         test = typeof test == 'function' ? test() : test;
5739
5740         if (typeof enableClasses !== "undefined" && enableClasses) {
5741           docElement.className += ' ' + (test ? '' : 'no-') + feature;
5742         }
5743         Modernizr[feature] = test;
5744
5745       }
5746
5747       return Modernizr;
5748     };
5749
5750
5751    setCss('');
5752    modElem = inputElem = null;
5753
5754    ;(function(window, document) {
5755                var version = '3.7.0';
5756
5757            var options = window.html5 || {};
5758
5759            var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
5760
5761            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;
5762
5763            var supportsHtml5Styles;
5764
5765            var expando = '_html5shiv';
5766
5767            var expanID = 0;
5768
5769            var expandoData = {};
5770
5771            var supportsUnknownElements;
5772
5773        (function() {
5774          try {
5775            var a = document.createElement('a');
5776            a.innerHTML = '<xyz></xyz>';
5777                    supportsHtml5Styles = ('hidden' in a);
5778
5779            supportsUnknownElements = a.childNodes.length == 1 || (function() {
5780                        (document.createElement)('a');
5781              var frag = document.createDocumentFragment();
5782              return (
5783                typeof frag.cloneNode == 'undefined' ||
5784                typeof frag.createDocumentFragment == 'undefined' ||
5785                typeof frag.createElement == 'undefined'
5786              );
5787            }());
5788          } catch(e) {
5789                    supportsHtml5Styles = true;
5790            supportsUnknownElements = true;
5791          }
5792
5793        }());
5794
5795            function addStyleSheet(ownerDocument, cssText) {
5796          var p = ownerDocument.createElement('p'),
5797          parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
5798
5799          p.innerHTML = 'x<style>' + cssText + '</style>';
5800          return parent.insertBefore(p.lastChild, parent.firstChild);
5801        }
5802
5803            function getElements() {
5804          var elements = html5.elements;
5805          return typeof elements == 'string' ? elements.split(' ') : elements;
5806        }
5807
5808            function getExpandoData(ownerDocument) {
5809          var data = expandoData[ownerDocument[expando]];
5810          if (!data) {
5811            data = {};
5812            expanID++;
5813            ownerDocument[expando] = expanID;
5814            expandoData[expanID] = data;
5815          }
5816          return data;
5817        }
5818
5819            function createElement(nodeName, ownerDocument, data){
5820          if (!ownerDocument) {
5821            ownerDocument = document;
5822          }
5823          if(supportsUnknownElements){
5824            return ownerDocument.createElement(nodeName);
5825          }
5826          if (!data) {
5827            data = getExpandoData(ownerDocument);
5828          }
5829          var node;
5830
5831          if (data.cache[nodeName]) {
5832            node = data.cache[nodeName].cloneNode();
5833          } else if (saveClones.test(nodeName)) {
5834            node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
5835          } else {
5836            node = data.createElem(nodeName);
5837          }
5838
5839                                                    return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
5840        }
5841
5842            function createDocumentFragment(ownerDocument, data){
5843          if (!ownerDocument) {
5844            ownerDocument = document;
5845          }
5846          if(supportsUnknownElements){
5847            return ownerDocument.createDocumentFragment();
5848          }
5849          data = data || getExpandoData(ownerDocument);
5850          var clone = data.frag.cloneNode(),
5851          i = 0,
5852          elems = getElements(),
5853          l = elems.length;
5854          for(;i<l;i++){
5855            clone.createElement(elems[i]);
5856          }
5857          return clone;
5858        }
5859
5860            function shivMethods(ownerDocument, data) {
5861          if (!data.cache) {
5862            data.cache = {};
5863            data.createElem = ownerDocument.createElement;
5864            data.createFrag = ownerDocument.createDocumentFragment;
5865            data.frag = data.createFrag();
5866          }
5867
5868
5869          ownerDocument.createElement = function(nodeName) {
5870                    if (!html5.shivMethods) {
5871              return data.createElem(nodeName);
5872            }
5873            return createElement(nodeName, ownerDocument, data);
5874          };
5875
5876          ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
5877                                                          'var n=f.cloneNode(),c=n.createElement;' +
5878                                                          'h.shivMethods&&(' +
5879                                                                                                                getElements().join().replace(/[\w\-]+/g, function(nodeName) {
5880            data.createElem(nodeName);
5881            data.frag.createElement(nodeName);
5882            return 'c("' + nodeName + '")';
5883          }) +
5884            ');return n}'
5885                                                         )(html5, data.frag);
5886        }
5887
5888            function shivDocument(ownerDocument) {
5889          if (!ownerDocument) {
5890            ownerDocument = document;
5891          }
5892          var data = getExpandoData(ownerDocument);
5893
5894          if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
5895            data.hasCSS = !!addStyleSheet(ownerDocument,
5896                                                                                'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{dis
5896play:block}' +
5897                                                                                    'mark{background:#FF0;color:#000}' +
5898                                                                                    'template{display:none}'
5899                                         );
5900          }
5901          if (!supportsUnknownElements) {
5902            shivMethods(ownerDocument, data);
5903          }
5904          return ownerDocument;
5905        }
5906
5907            var html5 = {
5908
5909                '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',
5910
5911                'version': version,
5912
5913                'shivCSS': (options.shivCSS !== false),
5914
5915                'supportsUnknownElements': supportsUnknownElements,
5916
5917                'shivMethods': (options.shivMethods !== false),
5918
5919                'type': 'default',
5920
5921                'shivDocument': shivDocument,
5922
5923                createElement: createElement,
5924
5925                createDocumentFragment: createDocumentFragment
5926        };
5927
5928            window.html5 = html5;
5929
5930            shivDocument(document);
5931
5932    }(this, document));
5933
5934    Modernizr._version      = version;
5935
5936    Modernizr._prefixes     = prefixes;
5937    Modernizr._domPrefixes  = domPrefixes;
5938    Modernizr._cssomPrefixes  = cssomPrefixes;
5939
5940
5941    Modernizr.hasEvent      = isEventSupported;
5942
5943    Modernizr.testProp      = function(prop){
5944        return testProps([prop]);
5945    };
5946
5947    Modernizr.testAllProps  = testPropsAll;
5948
5949
5950    Modernizr.testStyles    = injectElementWithStyles;    docElement.className = docElement.className.replace(/(^|\s)no-js(\s|$)/, '$1$2') +
5951
5952                                                    (enableClasses ? ' js ' + classes.join(' ') : '');
5953
5954    return Modernizr;
5955
5956})(this, this.document);
5957;
5958;
5959;(function() {
5960
5961  var BrowserDetect = function() {
5962    this.browser = this.getBrowserAgent();
5963    this.version = this.getBrowserVersion();
5964  };
5965
5966  BrowserDetect.prototype = {
5967    getBrowserAgent: function() {
5968      return this.searchString(this.dataBrowser);
5969    },
5970    getBrowserVersion: function() {
5971      return this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion);
5972    },
5973    searchString: function (data) {
5974      for (var i = 0; i < data.length; i++) {
5975        var dataString = data[i].string;
5976        this.versionSearchString = data[i].subString;
5977        if (dataString.indexOf(data[i].subString) != -1) {
5978          return data[i].identity;
5979        }
5980      }
5981    },
5982    searchVersion: function (dataString) {
5983      var index = dataString.indexOf(this.versionSearchString);
5984      if (index == -1) return;
5985      return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
5986    },
5987    dataBrowser: [
5988      { string: navigator.userAgent, subString: "Chrome",  identity: "chrome"  },
5989      { string: navigator.userAgent, subString: "MSIE",    identity: "ie"      },
5990      { string: navigator.userAgent, subString: "Firefox", identity: "firefox" },
5991      { string: navigator.userAgent, subString: "Safari",  identity: "safari"  },
5992      { string: navigator.userAgent, subString: "Opera",   identity: "opera"   }
5993    ],
5994    addClasses: function() {
5995      var b = browserDetect.browser,
5996          v = browserDetect.version;
5997      // add the browser name
5998      $(document.documentElement).addClass(b);
5999      // add the browser version too if it's available
6000      if (v) $(document.documentElement).addClass(b + '-' + v);
6001    }
6002  };
6003
6004  // Create an instance of the BrowserDetect and add the browser and version
6005  // to the HTML doc element.
6006  var browserDetect = new BrowserDetect();
6007  if (browserDetect.browser) {
6008    browserDetect.addClasses();
6009  }
6010
6011})();
6012;
6013Drupal.behaviors.ddSearchBox = function(context) {
6014  $('#dd-search').each(function() {
6015    new Drupal.ddSearchBox($(this));
6016  });
6017};
6018
6019Drupal.ddSearchBox = function($search) {
6020  var self = this;
6021  this.$search = $search;
6022  this.placeholderText = $('#edit-box-text').val();
6023
6024  // Don't do anything if we have no placeholder text.
6025  if (!this.placeholderText) {
6026    return;
6027  }
6028
6029  this.$input = this.$search.find('.dd-search-keywords input');
6030 
6031  // Initialize.
6032  this.update(false);
6033
6034  // Update when the input field receives focus.
6035  this.$input.focus(function() {
6036    self.update(true);
6037  });
6038
6039  // Update when the input field looses focus.
6040  this.$input.blur(function() {
6041    self.update(false);
6042  });
6043
6044  // Update when the form gets submitted.
6045  $search.find('form').submit(function() {
6046    self.update(true);
6047  });
6048};
6049
6050Drupal.ddSearchBox.prototype.update = function(active) {
6051  if (active) {
6052    // When getting focus, clear the placeholder text, if necessary.
6053    if (this.$input.val() == this.placeholderText) {
6054      this.clearPlaceholder();
6055    }
6056  }
6057  else {
6058    // When leaving focus, restore the placeholder text, if appropriate.
6059    if (this.$input.val() == '') {
6060      this.setPlaceholder();
6061    }
6062  }
6063};
6064
6065Drupal.ddSearchBox.prototype.setPlaceholder = function() {
6066  this.$input.val(this.placeholderText);
6067  this.$search.removeClass('dd-search-active');
6068};
6069
6070Drupal.ddSearchBox.prototype.clearPlaceholder = function() {
6071  this.$input.val('');
6072  this.$search.addClass('dd-search-active');
6073};
6074;
6075/*
6076 * jQuery UI 1.6
6077 *
6078 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
6079 * Dual licensed under the MIT (MIT-LICENSE.txt)
6080 * and GPL (GPL-LICENSE.txt) licenses.
6081 *
6082 * http://docs.jquery.com/UI
6083 */�(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:{}
6083,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")}}
6083,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);
6084/*
6085 * jQuery UI Dialog 1.6
6086 *
6087 * Copyright (c) 2008 AUTHORS.txt (http://ui.jquery.com/about)
6088 * Dual licensed under the MIT (MIT-LICENSE.txt)
6089 * and GPL (GPL-LICENSE.txt) licenses.
6090 *
6091 * http://docs.jquery.com/UI/Dialog
6092 *
6093 * Depends:
6094 *	ui.core.js
6095 *	ui.draggable.js
6096 *	ui.resizable.js
6097 */�(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}
6097).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]}
6097else{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);
6098if ($.ui.version == '1.6') {
6099  // Backported from more recent version of jQuery UI for IE 9 and 10
6100  // compatbility, to make resizables and draggables work in those browsers.
6101  // https://github.com/jquery/jquery-ui/blob/83b3d67175f16057844e5719bcda56eeb74560f3/ui/mouse.js
6102  $.ui.mouse._mouseMove = function(event) {
6103    // IE mouseup check - mouseup happened when mouse was out of window
6104    if ($.browser.msie && (!document.documentMode || document.documentMode < 9) && !event.button) {
6105      return this._mouseUp(event);
6106    }
6107
6108    if (this._mouseStarted) {
6109      this._mouseDrag(event);
6110      return event.preventDefault();
6111    }
6112
6113    if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
6114      this._mouseStarted =
6115          (this._mouseStart(this._mouseDownEvent, event) !== false);
6116      (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
6117    }
6118
6119    return !this._mouseStarted;
6120  };
6121}
6122;
6123
6124/**
6125 * JavaScript behaviors for the front-end display of webforms.
6126 */
6127
6128(function ($) {
6129
6130Drupal.behaviors.webform = function(context) {
6131  // Calendar datepicker behavior.
6132  Drupal.webform.datepicker(context);
6133};
6134
6135Drupal.webform = Drupal.webform || {};
6136
6137Drupal.webform.datepicker = function(context) {
6138  $('div.webform-datepicker').each(function() {
6139    var $webformDatepicker = $(this);
6140    var $calendar = $webformDatepicker.find('input.webform-calendar');
6141    var startYear = $calendar[0].className.replace(/.*webform-calendar-start-(\d+).*/, '$1');
6142    var endYear = $calendar[0].className.replace(/.*webform-calendar-end-(\d+).*/, '$1');
6143    var firstDay = $calendar[0].className.replace(/.*webform-calendar-day-(\d).*/, '$1');
6144
6145    // Ensure that start comes before end for datepicker.
6146    if (startYear > endYear) {
6147      var greaterYear = startYear;
6148      startYear = endYear;
6149      endYear = greaterYear;
6150    }
6151
6152    // Set up the jQuery datepicker element.
6153    $calendar.datepicker({
6154      dateFormat: 'yy-mm-dd',
6155      yearRange: startYear + ':' + endYear,
6156      firstDay: parseInt(firstDay),
6157      onSelect: function(dateText, inst) {
6158        var date = dateText.split('-');
6159        $webformDatepicker.find('select.year, input.year').val(+date[0]);
6160        $webformDatepicker.find('select.month').val(+date[1]);
6161        $webformDatepicker.find('select.day').val(+date[2]);
6162      },
6163      beforeShow: function(input, inst) {
6164        // Get the select list values.
6165        var year = $webformDatepicker.find('select.year, input.year').val();
6166        var month = $webformDatepicker.find('select.month').val();
6167        var day = $webformDatepicker.find('select.day').val();
6168
6169        // If empty, default to the current year/month/day in the popup.
6170        var today = new Date();
6171        year = year ? year : today.getFullYear();
6172        month = month ? month : today.getMonth() + 1;
6173        day = day ? day : today.getDate();
6174
6175        // Make sure that the default year fits in the available options.
6176        year = (year < startYear || year > endYear) ? startYear : year;
6177
6178        // jQuery UI Datepicker will read the input field and base its date off
6179        // of that, even though in our case the input field is a button.
6180        $(input).val(year + '-' + month + '-' + day);
6181      }
6182    });
6183
6184    // Prevent the calendar button from submitting the form.
6185    $calendar.click(function(event) {
6186      $(this).focus();
6187      event.preventDefault();
6188    });
6189  });
6190}
6191
6192})(jQuery);;
6193Drupal.behaviors.dmodel = function(context) {
6194  new Drupal.dmodelPositionFixed();
6195};
6196
6197Drupal.dmodelPositionFixed = function() {
6198  // Bind 'this' so we can reference it in functions
6199  var self = this;
6200
6201  // Find the elements we need to reposition and determine the current offsets
6202  this.bottomElements = $('#block-digitaldcore-command_menu, #channel-controls');
6203
6204  if (this.bottomElements.length != 0) {
6205    this.lastScrollTop = $(window).scrollTop();
6206    this.lastTopOffset = this.bottomElements.offset().top;
6207
6208    // Create a named function so that we can unbind it from the scroll event later
6209    this.scrollHandler = function() {
6210      self.update();
6211    };
6212    
6213    $(window).bind('scroll', this.scrollHandler);
6214    
6215    $(window).bind('orientationchange', function() {
6216      self.update(true);
6217    });
6218  }
6219};
6220
6221Drupal.dmodelPositionFixed.prototype.update = function(force) {
6222  if (force === undefined) {
6223    force = false;
6224  }
6225  
6226  var scrollTop = $(window).scrollTop();
6227
6228  // Only do something if we did scroll (sanity check)
6229  if (force || scrollTop != this.lastScrollTop) {
6230    var topOffset = this.bottomElements.offset().top;
6231    
6232    // If the elements were repositioned by the browser, we don't need to do anything
6233    if (!force && topOffset != this.lastTopOffset) {
6234      $(window).unbind('scroll', this.scrollHandler);
6235    }
6236    // Apparently, we're in a browser that doesn't reposition position:fixed elements (such as Mobile Safari)
6237    else {
6238      this.bottomElements.css('bottom', -scrollTop + 'px');
6239      this.lastScrollTop = $(window).scrollTop();
6240      this.lastTopOffset = this.bottomElements.offset().top;
6241    }
6242  }
6243};
6244
6245Drupal.behaviors.dmodelMessageClosing = function(context) {
6246  var messages = $('.messages', context);
6247  
6248  // Filter out messages containing Krumo stuff output by dsm()
6249  messages = messages.filter(function() {
6250    return $('.krumo-root', this).length == 0;
6251  });
6252  
6253  // Fade out messages when clicking on them
6254  messages.click(function(event) {
6255    $(this).animate({opacity: 'hide', height: 'hide'}, 250);
6256  });
6257};
6258
6259/**
6260 * Add additional behaviors to the date popups, especially to fix a problem with
6261 * tab order: https://support.digitaldeployment.com/helpdesk/tickets/459
6262 * 
6263 * @param context
6264 */
6265Drupal.behaviors.dmodelDatePopup = function(context) {
6266  for (var id in Drupal.settings.datePopup) {
6267    if (Drupal.settings.datePopup[id].func == 'datepicker') {
6268      // Add an "onClose" handler to each date popup
6269      // Check if date_year_range setting exists
6270      var datePopupConfig = {
6271        onClose: function(dateString, config) {
6272          // When the popup is closing set the focus to the time entry field
6273          $('#' + config.id.replace('-datepicker-popup-0', '-timeEntry-popup-1')).focus().click();
6274        }
6275      };
6276      if ('date_year_range' in Drupal.settings.dd) {
6277        datePopupConfig.yearRange = Drupal.settings.dd['date_year_range'];
6278      }
6279      $('#' + id).datepicker(datePopupConfig);
6280    }
6281  }
6282};
6283
6284/**
6285 * Adds an active classname to all node's who's destination url matches the
6286 * current url path.
6287 */
6288Drupal.behaviors.dmodelLabelActiveNodes = function(context) {
6289  var pathname = document.location.pathname,
6290    $activeLinks = $('.link-read-more a', context).filter('[href=' + pathname + ']');
6291  $activeLinks.parents('.node-teaser').addClass('active');
6292};
6293
6294/**
6295 * Email Campaign Assistant
6296 *
6297 * @desc: A user experience helper class to assist in the memory of previously
6298 * configured email campaign data. This functionality saves the user time since
6299 * they don't have to fill out the same form each and every time they're testing
6300 * e-blasts to their subscribers.
6301 */
6302Drupal.behaviors.dmodelEmailCampaign = function(context) {
6303  var $campaignForm = $('#banana-node-send-campaign-form', context);
6304  if ($campaignForm.length) {
6305    var results = $campaignForm.attr('action').match(/node\/([0-9]+)\/campaign/i);
6306    if (results) {
6307      new Drupal.EmailCampaignAssistant($campaignForm, {
6308        nid: results[1],
6309        formComponents: [
6310          '#edit-test-mail',        // Test email address
6311          '#edit-emailkit-address', // Direct email address(es)
6312          '#edit-from-name',        // Name of sender
6313          '#edit-from-address',     // From email address
6314          '#edit-subject'           // Subject of the email
6315        ]
6316      });
6317    }
6318  }
6319};
6320
6321Drupal.EmailCampaignAssistant = function($element, options) {
6322  this.$element = $element;
6323  this.options = options;
6324  this.storageKey = 'EmailCampaignAssistantData_' + this.options.nid;
6325  this.$formComponents = this.getFormComponents();
6326  this.formData = this.getData();
6327  this.init();
6328};
6329
6330Drupal.EmailCampaignAssistant.prototype = {
6331  init: function() {
6332    if (this.$formComponents.length) {
6333      this.addEventListeners();
6334      this.setData();
6335    }
6336  },
6337  getData: function() {
6338    var data = sessionStorage.getItem(this.storageKey) || '{}';
6339    return JSON.parse(data);
6340  },
6341  setData: function() {
6342    var self = this;
6343    self.$formComponents.each(function() {
6344      var key = '#' + $(this).attr('id');
6345      $(this).val(self.formData[key]);
6346      $(this).data('key', key);
6347    });
6348  },
6349  saveData: function() {
6350    sessionStorage.setItem(this.storageKey, JSON.stringify(this.formData));
6351  },
6352  updateData: function(event) {
6353    var self = event.data.self;
6354    self.formData[$(this).data('key')] = $(this).val();
6355    self.saveData();
6356  },
6357  getFormComponents: function() {
6358    return this.$element.find(this.options.formComponents.toString());
6359  },
6360  addEventListeners: function() {
6361    this.$formComponents.bind('keyup', {self: this} , this.updateData);
6362  }
6363};
6364
6365/**
6366 * Simply applies a class to the standard overview block if an overview is
6367 * already present.
6368 */
6369Drupal.behaviors.dmodelOverviewHelper = function(context) {
6370  var $overviewBlock = $('.overview.block', context);
6371  if ($overviewBlock.find('.node').length) {
6372    $overviewBlock.addClass('hide-add-new');
6373  }
6374  $('.node-full .field-image.field-not-video a').each(function() {
6375    var currentHref = $(this).attr('href');
6376    var timestamp = new Date().getTime(); // Generate a timestamp
6377    // Append the timestamp directly with a '?' before it
6378    var newHref = currentHref.includes('?') ? currentHref + timestamp : currentHref + '?' + timestamp;
6379    $(this).attr('href', newHref);
6380  });
6381  // microsite tab changes
6382  if ($('.microsite .js-tabs-show').length) {
6383  string = $('.microsite .js-tabs-show article').attr("class");   
6384  result = string.match(/(\bmicro-t\S+\b)/ig);
6385  $(".block-views_blocks article").each(function() { 
6386    if ($(this).hasClass(result[1])) {
6387        $(this).css('display','block');
6388    }else{
6389        $(this).css('display','none');
6390    }
6391    $('.microsite .block-views_blocks.microsite-student-percentage article').css('display','block');
6392    $('.microsite .block-views_blocks.microsite-strategies article').css('display','block');
6393  });
6394   $(".microsite-student-percentage.tab-1").show();
6395   $(".microsite-student-percentage.tab-2").hide();
6396   $(".microsite-student-percentage.tab-3").hide();
6397   $(".microsite-student-percentage.tab-4").hide();
6398
6399   $(".microsite-strategies.tab-1").show();
6400   $(".microsite-strategies.tab-2").hide();
6401   $(".microsite-strategies.tab-3").hide();
6402   $(".microsite-strategies.tab-4").hide();
6403
6404
6405   $(".microsite-strategies.tab-1").show();
6406
6407  $(".microsite .dtabs").click(function(){
6408    string = $('.microsite .js-tabs-show article').attr("class");   
6409    result = string.match(/(\bmicro-t\S+\b)/ig);
6410    $(".microsite .block-views_blocks article").each(function() { 
6411      if ($(this).hasClass(result[1])) {
6412          $(this).css('display','block');
6413      }else{
6414          $(this).css('display','none');
6415      }
6416    });
6417    $('.microsite .block-views_blocks.microsite-student-percentage article').css('display','block');
6418    $('.microsite .block-views_blocks.microsite-strategies article').css('display','block');
6419
6420
6421  });
6422  
6423
6424  $("#tabs-button_0-1").click(function(){
6425	$(".dtabs").addClass("dtabs-1");
6426	$(".dtabs").removeClass("dtabs-2");
6427	$(".dtabs").removeClass("dtabs-3");
6428	$(".dtabs").removeClass("dtabs-4");
6429	
6430	$(".microsite-main-content").addClass("microsite-main-content-1");
6431	$(".microsite-main-content").removeClass("microsite-main-content-2");
6432	$(".microsite-main-content").removeClass("microsite-main-content-3");
6433	$(".microsite-main-content").removeClass("microsite-main-content-4");
6434	
6435	$(".microsite-student-percentage").addClass("microsite-student-percentage-1");
6436	$(".microsite-student-percentage").removeClass("microsite-student-percentage-2");
6437	$(".microsite-student-percentage").removeClass("microsite-student-percentage-3");
6438	$(".microsite-student-percentage").removeClass("microsite-student-percentaget-4");
6439	
6440	$(".microsite-discover").addClass("microsite-discover-1");
6441	$(".microsite-discover").removeClass("microsite-discover-2");
6442	$(".microsite-discovere").removeClass("microsite-discover-3");
6443	$(".microsite-discover").removeClass("microsite-discover-4");
6444	
6445	$(".microsite-strategies").addClass("microsite-strategies-1");
6446	$(".microsite-strategies").removeClass("microsite-strategies-2");
6447	$(".microsite-strategies").removeClass("microsite-strategies-3");
6448	$(".microsite-strategies").removeClass("microsite-strategies-4");
6449	
6450	$(".micro-strategies-title").addClass("micro-strategies-title-1");
6451	$(".micro-strategies-title").removeClass("micro-strategies-title-2");
6452	$(".micro-strategies-title").removeClass("micro-strategies-title-3");
6453	$(".micro-strategies-title").removeClass("micro-strategies-title-4");
6454  }); 
6455  
6456  $("#tabs-button_0-2").click(function(){
6457	$(".dtabs").addClass("dtabs-2");
6458	$(".dtabs").removeClass("dtabs-1");
6459	$(".dtabs").removeClass("dtabs-3");
6460	$(".dtabs").removeClass("dtabs-4");
6461	
6462	$(".microsite-main-content").addClass("microsite-main-content-2");
6463	$(".microsite-main-content").removeClass("microsite-main-content-1");
6464	$(".microsite-main-content").removeClass("microsite-main-content-3");
6465	$(".microsite-main-content").removeClass("microsite-main-content-4");
6466	
6467	$(".microsite-student-percentage").addClass("microsite-student-percentage-2");
6468	$(".microsite-student-percentage").removeClass("microsite-student-percentage-1");
6469	$(".microsite-student-percentage").removeClass("microsite-student-percentage-3");
6470	$(".microsite-student-percentage").removeClass("microsite-student-percentaget-4");
6471	
6472	$(".microsite-discover").addClass("microsite-discover-2");
6473	$(".microsite-discover").removeClass("microsite-discover-1");
6474	$(".microsite-discovere").removeClass("microsite-discover-3");
6475	$(".microsite-discover").removeClass("microsite-discover-4");
6476	
6477	$(".microsite-strategies").addClass("microsite-strategies-2");
6478	$(".microsite-strategies").removeClass("microsite-strategies-1");
6479	$(".microsite-strategies").removeClass("microsite-strategies-3");
6480	$(".microsite-strategies").removeClass("microsite-strategies-4");
6481	
6482	$(".micro-strategies-title").addClass("micro-strategies-title-2");
6483	$(".micro-strategies-title").removeClass("micro-strategies-title-1");
6484	$(".micro-strategies-title").removeClass("micro-strategies-title-3");
6485	$(".micro-strategies-title").removeClass("micro-strategies-title-4");
6486  }); 
6487  
6488  $("#tabs-button_0-3").click(function(){
6489	$(".dtabs").addClass("dtabs-3");
6490	$(".dtabs").removeClass("dtabs-1");
6491	$(".dtabs").removeClass("dtabs-2");
6492	$(".dtabs").removeClass("dtabs-4");
6493	
6494	$(".microsite-main-content").addClass("microsite-main-content-3");
6495	$(".microsite-main-content").removeClass("microsite-main-content-1");
6496	$(".microsite-main-content").removeClass("microsite-main-content-2");
6497	$(".microsite-main-content").removeClass("microsite-main-content-4");
6498	
6499	$(".microsite-student-percentage").addClass("microsite-student-percentage-3");
6500	$(".microsite-student-percentage").removeClass("microsite-student-percentage-1");
6501	$(".microsite-student-percentage").removeClass("microsite-student-percentage-2");
6502	$(".microsite-student-percentage").removeClass("microsite-student-percentaget-4");
6503	
6504	$(".microsite-discover").addClass("microsite-discover-3");
6505	$(".microsite-discover").removeClass("microsite-discover-1");
6506	$(".microsite-discovere").removeClass("microsite-discover-2");
6507	$(".microsite-discover").removeClass("microsite-discover-4");
6508	
6509	$(".microsite-strategies").addClass("microsite-strategies-3");
6510	$(".microsite-strategies").removeClass("microsite-strategies-1");
6511	$(".microsite-strategies").removeClass("microsite-strategies-2");
6512	$(".microsite-strategies").removeClass("microsite-strategies-4");
6513	
6514	$(".micro-strategies-title").addClass("micro-strategies-title-3");
6515	$(".micro-strategies-title").removeClass("micro-strategies-title-1");
6516	$(".micro-strategies-title").removeClass("micro-strategies-title-2");
6517	$(".micro-strategies-title").removeClass("micro-strategies-title-4");
6518  }); 
6519
6520$("#tabs-button_0-4").click(function(){
6521	$(".dtabs").addClass("dtabs-4");
6522	$(".dtabs").removeClass("dtabs-1");
6523	$(".dtabs").removeClass("dtabs-2");
6524	$(".dtabs").removeClass("dtabs-3");
6525	
6526	$(".microsite-main-content").addClass("microsite-main-content-4");
6527	$(".microsite-main-content").removeClass("microsite-main-content-1");
6528	$(".microsite-main-content").removeClass("microsite-main-content-2");
6529	$(".microsite-main-content").removeClass("microsite-main-content-3");
6530	
6531	$(".microsite-student-percentage").addClass("microsite-student-percentage-4");
6532	$(".microsite-student-percentage").removeClass("microsite-student-percentage-1");
6533	$(".microsite-student-percentage").removeClass("microsite-student-percentage-2");
6534	$(".microsite-student-percentage").removeClass("microsite-student-percentaget-3");
6535	
6536	$(".microsite-discover").addClass("microsite-discover-4");
6537	$(".microsite-discover").removeClass("microsite-discover-1");
6538	$(".microsite-discovere").removeClass("microsite-discover-2");
6539	$(".microsite-discover").removeClass("microsite-discover-3");
6540	
6541	$(".microsite-strategies").addClass("microsite-strategies-4");
6542	$(".microsite-strategies").removeClass("microsite-strategies-1");
6543	$(".microsite-strategies").removeClass("microsite-strategies-2");
6544	$(".microsite-strategies").removeClass("microsite-strategies-3");
6545	
6546	$(".micro-strategies-title").addClass("micro-strategies-title-4");
6547	$(".micro-strategies-title").removeClass("micro-strategies-title-1");
6548	$(".micro-strategies-title").removeClass("micro-strategies-title-2");
6549	$(".micro-strategies-title").removeClass("micro-strategies-title-3");
6550  }); 
6551  
6552
6553
6554	 
6555  $("#tabs-button_0-1").click(function(){
6556    $(".slick-prev").click();
6557		$(".microsite-student-percentage.tab-2").hide();
6558		$(".microsite-student-percentage.tab-3").hide();
6559		$(".microsite-student-percentage.tab-4").hide();
6560    $(".slick-prev").click();
6561    $(".microsite-student-percentage.tab-1").show();
6562	 }); 
6563	 
6564	 $("#tabs-button_0-2").click(function(){
6565    $(".slick-prev").click();
6566		$(".microsite-student-percentage.tab-1").hide();
6567		$(".microsite-student-percentage.tab-3").hide();
6568		$(".microsite-student-percentage.tab-4").hide();
6569    $(".slick-prev").click();
6570    $(".microsite-student-percentage.tab-2").show();
6571	 }); 
6572	 $("#tabs-button_0-3").click(function(){
6573    $(".slick-prev").click();
6574		$(".microsite-student-percentage.tab-1").hide();
6575		$(".microsite-student-percentage.tab-2").hide();
6576		$(".microsite-student-percentage.tab-4").hide();
6577    $(".slick-prev").click();
6578    $(".microsite-student-percentage.tab-3").show();
6579	 }); 
6580	 $("#tabs-button_0-4").click(function(){
6581    $(".slick-prev").click();
6582		$(".microsite-student-percentage.tab-1").hide();
6583		$(".microsite-student-percentage.tab-2").hide();
6584		$(".microsite-student-percentage.tab-3").hide();
6585    $(".slick-prev").click();
6586		$(".microsite-student-percentage.tab-4").show();
6587	 });
6588	 
6589	 
6590	 
6591	 $("#tabs-button_0-1").click(function(){
6592    setTimeout(function () {
6593      $(".slick-prev").click();
6594     }, 1000);
6595	  $(".microsite-strategies.tab-1").show();
6596		$(".microsite-strategies.tab-2").hide();
6597		$(".microsite-strategies.tab-3").hide();
6598		$(".microsite-strategies.tab-4").hide();
6599	 }); 
6600	 
6601	 $("#tabs-button_0-2").click(function(){
6602    setTimeout(function () {
6603      $(".slick-prev").click();
6604     }, 1000);
6605		$(".microsite-strategies.tab-1").hide();
6606		$(".microsite-strategies.tab-2").show();
6607		$(".microsite-strategies.tab-3").hide();
6608		$(".microsite-strategies.tab-4").hide();
6609	 }); 
6610	 $("#tabs-button_0-3").click(function(){
6611    setTimeout(function () {
6612      $(".slick-prev").click();
6613     }, 1000);
6614		$(".microsite-strategies.tab-1").hide();
6615		$(".microsite-strategies.tab-2").hide();
6616		$(".microsite-strategies.tab-3").show();
6617		$(".microsite-strategies.tab-4").hide();
6618	 }); 
6619	 $("#tabs-button_0-4").click(function(){
6620    setTimeout(function () {
6621      $(".slick-prev").click();
6622     }, 1000);
6623		$(".microsite-strategies.tab-1").hide();
6624		$(".microsite-strategies.tab-2").hide();
6625		$(".microsite-strategies.tab-3").hide();
6626		$(".microsite-strategies.tab-4").show();
6627	 });
6628
6629   setTimeout(function () {
6630    $(".slick-prev").click();
6631   }, 1500);
6632  if ($("#tabs-button_0-1").hasClass("active")) {
6633   $('div#frameContainer').css('border-top','15px solid #f1c435')
6634  }
6635  if ($("#tabs-button_0-2").hasClass("active")) {
6636    $('div#frameContainer').css('border-top','15px solid #8b1639')
6637   }
6638   if ($("#tabs-button_0-3").hasClass("active")) {
6639    $('div#frameContainer').css('border-top','15px solid #64bfae')
6640   }
6641   if ($("#tabs-button_0-4").hasClass("active")) {
6642    $('div#frameContainer').css('border-top','15px solid #ec6721')
6643   }
6644  //  scroll to top
6645   $('<a href="#" class="scrollup">Scroll</a>').insertBefore('.microsite .page-footer');
6646   $(window).scroll(function(){
6647    if ($(this).scrollTop() > 700) {
6648      $('.scrollup').fadeIn();
6649    } else {
6650      $('.scrollup').fadeOut();
6651    }
6652  }); 
6653
6654  $('.scrollup').click(function(){
6655    $("html, body").animate({ scrollTop: 0 }, 600);
6656    return false;
6657  });
6658  
6659  
6660  
6661  
6662  setTimeout(function () {
6663  if ($("#tabs-button_0-1").hasClass("active")) {
6664    $('div#lightbox').removeClass();
6665    $('div#lightbox').addClass('popup-color-yellow');
6666  }
6667  if ($("#tabs-button_0-2").hasClass("active")) {
6668    $('div#lightbox').removeClass();
6669    $('div#lightbox').addClass('popup-color-red');
6670   }
6671   if ($("#tabs-button_0-3").hasClass("active")) {
6672    $('div#lightbox').removeClass();
6673    $('div#lightbox').addClass('popup-color-green');
6674   }
6675   if ($("#tabs-button_0-4").hasClass("active")) {
6676    $('div#lightbox').removeClass();
6677    $('div#lightbox').addClass('popup-color-orange');
6678   }
6679  }, 2000);
6680   $(".dtabs .tab").click(function(){
6681    if ($("#tabs-button_0-1").hasClass("active")) {
6682      $('div#lightbox').removeClass();
6683      $('div#lightbox').addClass('popup-color-yellow');
6684    }
6685    if ($("#tabs-button_0-2").hasClass("active")) {
6686      $('div#lightbox').removeClass();
6687      $('div#lightbox').addClass('popup-color-red');
6688     }
6689     if ($("#tabs-button_0-3").hasClass("active")) {
6690      $('div#lightbox').removeClass();
6691      $('div#lightbox').addClass('popup-color-green');
6692     }
6693     if ($("#tabs-button_0-4").hasClass("active")) {
6694      $('div#lightbox').removeClass();
6695      $('div#lightbox').addClass('popup-color-orange');
6696     }
6697	 });
6698   //$('.microsite-student-percentage').addClass('events');
6699   
6700   $('.microsite .page-footer').addClass('ready'); 
6701   $('.micro-slick-nav ul').not(":first-child").hide();
6702   setTimeout(function () {
6703     $('.percentage.slider.tab-1 .slick-dots li:first-child').addClass('active');
6704     $('.percentage.slider.tab-2 .slick-dots li:first-child').addClass('active');
6705     $('.percentage.slider.tab-3 .slick-dots li:first-child').addClass('active');
6706     $('.percentage.slider.tab-4 .slick-dots li:first-child').addClass('active');
6707
6708     $(".percentage.slider.tab-1 .slick-dots li").click(function(){
6709       $(".percentage.slider.tab-1 .slick-dots li.active").removeClass("active"); 
6710       $(this).addClass("active"); 
6711     });
6712     $(".percentage.slider.tab-2 .slick-dots li").click(function(){
6713       $(".percentage.slider.tab-2 .slick-dots li.active").removeClass("active"); 
6714       $(this).addClass("active"); 
6715     });
6716     $(".percentage.slider.tab-3 .slick-dots li").click(function(){
6717       $(".percentage.slider.tab-3 .slick-dots li.active").removeClass("active"); 
6718       $(this).addClass("active"); 
6719     });
6720    $(".percentage.slider.tab-4 .slick-dots li").click(function(){
6721     $(".percentage.slider.tab-4 .slick-dots li.active").removeClass("active"); 
6722     $(this).addClass("active"); 
6723   });
6724 }, 3000);
6725  
6726}
6727$('#block-views_blocks-term-block_1-30 .show-upcoming-2').each(function() {
6728  var parent = $(this).parent();
6729  while (parent.length && !parent.hasClass('views-row')) {
6730      parent = parent.parent();
6731  }
6732  if (parent.length) {
6733      parent.css('display', 'none');
6734  }
6735});
6736window.addEventListener('scroll', function() {
6737  var block = document.getElementById('block-views_blocks-term-block_1-76');
6738  var offset = block.offsetTop;
6739
6740  if (window.scrollY > offset) {
6741      block.classList.add('fixed');
6742  } else {
6743      block.classList.remove('fixed');
6744  }
6745});
6746$(document).ready(function() {
6747  // Smooth scrolling for anchor links
6748  $('#block-views_blocks-term-block_1-76 .node-inner h2 a').bind('click', function(event) {
6749      // Prevent the default anchor click behavior
6750      event.preventDefault();
6751
6752      // Get the target element's ID from the href attribute
6753      var targetID = $(this).attr('href').split('#')[1];
6754      var targetElement = $('#' + targetID);
6755
6756      // Check if the target element exists
6757      if (targetElement.length) {
6758        var extraMargin = 100; // Default extra margin value
6759    
6760        // Check if the fixed block exists and has the 'fixed' class
6761        if ($('#block-views_blocks-term-block_1-76.fixed').length) {
6762            // Scroll to the target element with animation
6763            $('html, body').animate({
6764                scrollTop: targetElement.offset().top - $('#block-views_blocks-term-block_1-76').height()
6765            }, 800); // Adjust the duration as needed
6766        } else {
6767            // Scroll to the target element with extra margin
6768            $('html, body').animate({
6769                scrollTop: targetElement.offset().top - $('#block-views_blocks-term-block_1-76').height() - extraMargin
6770            }, 800); // Adjust the duration as needed
6771        }
6772    }
6773    
6774  });
6775    //youtube thumbnail changes
6776    $('.ttc-feature .field-image.field-video a').each(function() {
6777      let videoUrl = $(this).attr('href');
6778      let match = videoUrl.match(/embed\/([^?]+)/);
6779      if (match && match[1]) {
6780        let videoId = match[1];
6781        let newSrc = `https://img.youtube.com/vi/${videoId}/maxresdefault.jpg`;
6782    
6783        $(this).find('img')
6784          .attr('src', newSrc)
6785          .removeAttr('width')
6786          .removeAttr('height');
6787      }
6788    });        
6789});
6790
6791$(document).ready(function () {
6792
6793    var $videoHero = $('.hero.ttc-hero');
6794    var $imageHero = $('.hero.ttc-hero-images');
6795
6796    var showVideo = $videoHero.find('.background-video video').length &&
6797                    !$videoHero.find('article.node-unpublished').length;
6798
6799    if (showVideo) {
6800        // Valid published video exists
6801        $imageHero.find('.block-content.content').hide();
6802        $('body').addClass('ttc-video-only');
6803    } else {
6804        // No video OR video is unpublished
6805        $videoHero.find('.block-content.content').hide();
6806        $imageHero.find('.block-content.content').show();
6807        $('body').removeClass('ttc-video-only');
6808    }
6809
6810});
6811
6812};
6813
6814
6815;

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.