function closeWindow(divWindow){

	GetId(divWindow).style.display='none';
	return false;
	}
function showWindow(divWindow){
	
	GetId(divWindow).style.display='';
	centerDivWindow(divWindow);
	return false;
	}
function hideAllWindows(){
	GetId('win250').style.display='none';
	GetId('win300').style.display='none';
	GetId('win350').style.display='none';
	GetId('win400').style.display='none';
	GetId('win500').style.display='none';
	GetId('win600').style.display='none';
	GetId('win700').style.display='none';
}
function makeDragg(id){

	try{ventanax.destroy();}catch(except){}
	ventanax=new Draggable(id,{endEffect:'Highlight', scroll:window});

}
	function chkCheck(obj1,obj2){
	if(obj1.checked==""){
		obj2.value='0';
		}else{
			obj2.value='1';
			}
	}
function showSignUp(){
	putIn('winTit500','Sign Up');
	goAJAX('winCont500','engines/users/users.ajax.php','controller=showSignUp','centerDivWindow(\'win500\');');
	showWindow('win500');
//	window.location = 'sign.up.php';
	return false;
	}
function trySignUp(){
	goAJAX('frmSignUp','engines/users/users.ajax.php','controller=showSignUp&'+akiSfrm('frmSignUp'));
	return false;
	}
function tryUpdateAccount(){
	goAJAX('frmUpdateAccount','engines/users/users.ajax.php','controller=showAdminMyProfile&'+akiSfrm('frmUpdateAccount'));
	return false;
	}
function loadUserbox(){
	goAJAX('sUserBox','engines/users/users.ajax.php','controller=loadUserbox');
	return false;
	}
function userLogged(){
	hideAllWindows();
	loadUserbox();
	return false;
	}
function trySignIn(frmId){
	goAJAX(frmId,'engines/users/users.ajax.php','controller=trySignIn&frmId='+ frmId + '&' + akiSfrm(frmId));
	return false;
	}
function showSignInWindow(){
	hideAllWindows();
	putIn('winTit250','Sign In')
	goAJAX('winCont250','engines/users/users.ajax.php','controller=showSignInWindow','centerDivWindow(\'win250\');');
	showWindow('win250');
	return false;
	}

function showRemember(){
	hideAllWindows();
	putIn('winTit300','Remember my password')
	goAJAX('winCont300','engines/users/users.ajax.php','controller=showRemember','centerDivWindow(\'win300\');');
	showWindow('win300');
	return false;
	}
function showRememberPass(){
	hideAllWindows();
	putIn('winTit300','Remember my password')
	goAJAX('winCont300','engines/users/users.ajax.php','controller=showRemember','centerDivWindow(\'win300\');');
	showWindow('win300');
	return false;
	}
function tryRemember(){
	goAJAX('frmRemember','engines/users/users.ajax.php','controller=showRemember&'+akiSfrm('frmRemember'));
	return false;
	}
function showAdminMyBlogs(){
	hideAllWindows();
	putIn('winTit700','Manage My Blog')
	goAJAX('winCont700','admins/My.Blogs.php','ajax=true','centerDivWindow(\'win700\');');
	showWindow('win700');
	return false;
	}
function showAdminMyProfile(){
	hideAllWindows();
/*	putIn('winTit600','My Profile')
	goAJAX('winCont600','engines/users/users.ajax.php','controller=showAdminMyProfile','centerDivWindow(\'win600\');');
	showWindow('win600');*/
		window.location = 'my.profile.php';

	return false;
	}

// ADDED BY BETOS: VIDEO ENGINE
function trySignInFromVideo(frmId){
	goAJAX(frmId,'engines/users/users.ajax.php','controller=trySignInFromVideo&frmId='+ frmId + '&' + akiSfrm(frmId));
	return false;
}	
	eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('G 1k={dv:"1.5.1",1Z:{4j:!!(1p.8i&&!1p.4m),bD:!!1p.4m,47:5h.70.2G("n6/")>-1,7Q:5h.70.2G("7Q")>-1&&5h.70.2G("gD")==-1},67:{cb:!!1d.3M,7V:!!1p.7L,bk:(1d.23("2Q").80!==1d.23("1V").80)},8O:"<7l[^>]*>([\\nz-\\n5]*?)</7l>",hl:/^\\/\\*-mc-\\s*(.*)\\s*\\*\\/\\s*$/,4b:D(){},K:D(x){E x}};G 1H={1D:D(){E D(){C.1Q.41(C,1b)}}};G 32=18 V();V.O=D(a,b){1g(G c in b){a[c]=b[c]}E a};V.O(V,{2i:D(a){2D{if(a===1P){E"1P"}if(a===1h){E"1h"}E a.2i?a.2i():a.3K()}2L(e){if(e 4E np){E"..."}2u e;}},3c:D(a){G b=1m a;4V(b){1F"1P":1F"D":1F"m5":E;1F"m0":E a.3K()}if(a===1h){E"1h"}if(a.3c){E a.3c()}if(a.cR===1d){E}G c=[];1g(G d in a){G e=V.3c(a[d]);if(e!==1P){c.1f(d.3c()+": "+e)}}E"{"+c.2j(", ")+"}"},bJ:D(a){G b=[];1g(G c in a){b.1f(c)}E b},29:D(a){G b=[];1g(G c in a){b.1f(a[c])}E b},3X:D(a){E V.O({},a)}});g1.1c.1o=D(){G a=C,4u=$A(1b),3R=4u.9x();E D(){E a.41(3R,4u.2f($A(1b)))}};g1.1c.2T=D(b){G c=C,4u=$A(1b),b=4u.9x();E D(a){E c.41(b,[a||1p.4e].2f(4u))}};V.O(6V.1c,{6P:D(){E C.5s(2,16)},bz:D(){E C+1},9l:D(a){$R(0,C,19).1j(a);E C},5s:D(a,b){G c=C.3K(b||10);E"0".9l(a-c.Y)+c},3c:D(){E jO(C)?C.3K():"1h"}});7D.1c.3c=D(){E"\\""+C.jB()+"-"+(C.jr()+1).5s(2)+"-"+C.jj().5s(2)+"T"+C.j2().5s(2)+":"+C.iS().5s(2)+":"+C.iN().5s(2)+"\\""};G dX={dU:D(){G a;1g(G i=0,Y=1b.Y;i<Y;i++){G b=1b[i];2D{a=b();1C}2L(e){}}E a}};G dN=1H.1D();dN.1c={1Q:D(a,b){C.3o=a;C.4r=b;C.8T=17;C.68()},68:D(){C.4d=8N(C.54.1o(C),C.4r*2W)},2H:D(){if(!C.4d){E}dt(C.4d);C.4d=1h},54:D(){if(!C.8T){2D{C.8T=19;C.3o(C)}nF{C.8T=17}}}};V.O(2F,{dk:D(a){E a==1h?"":2F(a)},hF:{"\\b":"\\\\b","\\t":"\\\\t","\\n":"\\\\n","\\f":"\\\\f","\\r":"\\\\r","\\\\":"\\\\\\\\"}});V.O(2F.1c,{3L:D(a,b){G c="",5D=C,1E;b=1b.a5.d4(b);1R(5D.Y>0){if(1E=5D.1E(a)){c+=5D.3G(0,1E.2p);c+=2F.dk(b(1E));5D=5D.3G(1E.2p+1E[0].Y)}1e{c+=5D,5D=""}}E c},h2:D(b,c,d){c=C.3L.d4(c);d=d===1P?1:d;E C.3L(b,D(a){if(--d<0){E a[0]}E c(a)})},gV:D(a,b){C.3L(a,b);E C},lY:D(a,b){a=a||30;b=b===1P?"...":b;E C.Y>a?C.3G(0,a-b.Y)+b:C},5e:D(){E C.1M(/^\\s+/,"").1M(/\\s+$/,"")},9O:D(){E C.1M(/<\\/?[^>]+>/gi,"")},4v:D(){E C.1M(18 3n(1k.8O,"gn"),"")},gl:D(){G b=18 3n(1k.8O,"gn");G c=18 3n(1k.8O,"im");E(C.1E(b)||[]).1O(D(a){E(a.1E(c)||["",""])[1]})},4T:D(){E C.gl().1O(D(a){E 85(a)})},87:D(){G a=1b.a5;a.4g.fX=C;E a.2Q.2q},fQ:D(){G c=1d.23("2Q");c.2q=C.9O();E c.2k[0]?(c.2k.Y>1?$A(c.2k).4A("",D(a,b){E a+b.5v}):c.2k[0].5v):""},a0:D(e){G f=C.5e().1E(/([^?#]*)(#.*)?$/);if(!f){E{}}E f[1].5j(e||"&").4A({},D(a,b){if((b=b.5j("="))[0]){G c=fD(b.9x());G d=b.Y>1?b.2j("="):b[0];if(d!=1P){d=fD(d)}if(c in a){if(a[c].5y!=1W){a[c]=[a[c]]}a[c].1f(d)}1e{a[c]=d}}E a})},3Q:D(){E C.5j("")},bz:D(){E C.3G(0,C.Y-1)+2F.hq(C.fg(C.Y-1)+1)},9l:D(a){G b="";1g(G i=0;i<a;i++){b+=C}E b},7f:D(){G a=C.5j("-"),82=a.Y;if(82==1){E a[0]}G b=C.6o(0)=="-"?a[0].6o(0).2h()+a[0].7j(1):a[0];1g(G i=1;i<82;i++){b+=a[i].6o(0).2h()+a[i].7j(1)}E b},dq:D(){E C.6o(0).2h()+C.7j(1).2s()},ko:D(){E C.3L(/::/,"/").3L(/([A-Z]+)([A-Z][a-z])/,"#{1}3T#{2}").3L(/([a-z\\d])([A-Z])/,"#{1}3T#{2}").3L(/-/,"3T").2s()},eP:D(){E C.3L(/3T/,"-")},2i:D(c){G d=C.3L(/[\\kh-\\ke\\\\]/,D(a){G b=2F.hF[a[0]];E b?b:"\\\\kb"+a[0].fg().5s(2,16)});if(c){E"\\""+d.1M(/"/g,"\\\\\\"")+"\\""}E"\'"+d.1M(/\'/g,"\\\\\'")+"\'"},3c:D(){E C.2i(19)},by:D(a){E C.h2(a||1k.hl,"#{1}")},9m:D(a){G b=C.by();2D{if(!a||(18 3n("^(\\"(\\\\\\\\.|[^\\"\\\\\\\\\\\\n\\\\r])"+"*"+"?\\"|[,:{}\\\\[\\\\]0-9.\\\\-+k0-u \\\\n\\\\r\\\\t])+?$").48(b))){E 85("("+b+")")}}2L(e){}2u 18 jS("jR jQ ey 2J: "+C.2i());},25:D(a){E C.2G(a)>-1},er:D(a){E C.2G(a)===0},ej:D(a){G d=C.Y-a.Y;E d>=0&&C.eh(a)===d},7y:D(){E C==""},ee:D(){E/^\\s*$/.48(C)}});if(1k.1Z.47||1k.1Z.4j){V.O(2F.1c,{87:D(){E C.1M(/&/g,"&ed;").1M(/</g,"&lt;").1M(/>/g,"&gt;")},fQ:D(){E C.1M(/&ed;/g,"&").1M(/&lt;/g,"<").1M(/&gt;/g,">")}})}2F.1c.3L.d4=D(b){if(1m b=="D"){E b}G c=18 2V(b);E D(a){E c.3M(a)}};2F.1c.jq=2F.1c.a0;V.O(2F.1c.87,{2Q:1d.23("2Q"),4g:1d.4M("")});5Q(2F.1c.87){2Q.24(4g)}G 2V=1H.1D();2V.e1=/(^|.|\\r|\\n)(#\\{(.*?)\\})/;2V.1c={1Q:D(a,b){C.7I=a.3K();C.e0=b||2V.e1},3M:D(c){E C.7I.3L(C.e0,D(a){G b=a[1];if(b=="\\\\"){E a[2]}E b+2F.dk(c[a[3]])})}};G $1C={};G $3S=18 dZ("\\"2u $3S\\" is iL, iK \\"E\\" iG");G 3k={1j:D(b){G c=0;2D{C.3B(D(a){b(a,c++)})}2L(e){if(e!=$1C){2u e;}}E C},dS:D(a,b){G c=-a,aX=[],6x=C.3Q();1R((c+=a)<6x.Y){aX.1f(6x.3G(c,c+a))}E aX.1O(b)},it:D(c){G d=19;C.1j(D(a,b){d=d&&!!(c||1k.K)(a,b);if(!d){2u $1C;}});E d},ip:D(c){G d=17;C.1j(D(a,b){if(d=!!(c||1k.K)(a,b)){2u $1C;}});E d},7w:D(c){G d=[];C.1j(D(a,b){d.1f((c||1k.K)(a,b))});E d},6w:D(c){G d;C.1j(D(a,b){if(c(a,b)){d=a;2u $1C;}});E d},aR:D(c){G d=[];C.1j(D(a,b){if(c(a,b)){d.1f(a)}});E d},il:D(d,e){G f=[];C.1j(D(a,b){G c=a.3K();if(c.1E(d)){f.1f((e||1k.K)(a,b))}});E f},25:D(b){G c=17;C.1j(D(a){if(a==b){c=19;2u $1C;}});E c},ii:D(b,c){c=c===1P?1h:c;E C.dS(b,D(a){1R(a.Y<b){a.1f(c)}E a})},4A:D(c,d){C.1j(D(a,b){c=d(c,a,b)});E c},89:D(b){G c=$A(1b).3G(1);E C.1O(D(a){E a[b].41(a,c)})},5J:D(c){G d;C.1j(D(a,b){a=(c||1k.K)(a,b);if(d==1P||a>=d){d=a}});E d},8d:D(c){G d;C.1j(D(a,b){a=(c||1k.K)(a,b);if(d==1P||a<d){d=a}});E d},ib:D(c){G d=[],aJ=[];C.1j(D(a,b){((c||1k.K)(a,b)?d:aJ).1f(a)});E[d,aJ]},69:D(c){G d=[];C.1j(D(a,b){d.1f(a[c])});E d},6u:D(c){G d=[];C.1j(D(a,b){if(!c(a,b)){d.1f(a)}});E d},aF:D(e){E C.1O(D(a,b){E{1l:a,8j:e(a,b)}}).i4(D(c,d){G a=c.8j,b=d.8j;E a<b?-1:a>b?1:0}).69("1l")},3Q:D(){E C.1O()},i3:D(){G c=1k.K,4u=$A(1b);if(1m 4u.2t()=="D"){c=4u.i1()}G d=[C].2f(4u).1O($A);E C.1O(D(a,b){E c(d.69(b))})},8K:D(){E C.3Q().Y},2i:D(){E"#<3k:"+C.3Q().2i()+">"}};V.O(3k,{1O:3k.7w,hX:3k.6w,2A:3k.aR,nH:3k.25,nE:3k.3Q});G $A=1W.31=D(a){if(!a){E[]}if(a.3Q){E a.3Q()}1e{G b=[];1g(G i=0,Y=a.Y;i<Y;i++){b.1f(a[i])}E b}};if(1k.1Z.47){$A=1W.31=D(a){if(!a){E[]}if(!(1m a=="D"&&a=="[3R nA]")&&a.3Q){E a.3Q()}1e{G b=[];1g(G i=0,Y=a.Y;i<Y;i++){b.1f(a[i])}E b}}}V.O(1W.1c,3k);if(!1W.1c.dm){1W.1c.dm=1W.1c.6q}V.O(1W.1c,{3B:D(a){1g(G i=0,Y=C.Y;i<Y;i++){a(C[i])}},hK:D(){C.Y=0;E C},3D:D(){E C[0]},2t:D(){E C[C.Y-1]},nt:D(){E C.2A(D(a){E a!=1h})},4f:D(){E C.4A([],D(a,b){E a.2f(b&&b.5y==1W?b.4f():[b])})},df:D(){G b=$A(1b);E C.2A(D(a){E!b.25(a)})},2G:D(a){1g(G i=0,Y=C.Y;i<Y;i++){if(C[i]==a){E i}}E-1},6q:D(a){E(a!==17?C:C.3Q()).dm()},ng:D(){E C.Y>1?C:C[0]},na:D(d){E C.4A([],D(a,b,c){if(0==c||(d?a.2t()!=b:!a.25(b))){a.1f(b)}E a})},3X:D(){E[].2f(C)},8K:D(){E C.Y},2i:D(){E"["+C.1O(V.2i).2j(", ")+"]"},3c:D(){G c=[];C.1j(D(a){G b=V.3c(a);if(b!==1P){c.1f(b)}});E"["+c.2j(", ")+"]"}});1W.1c.3Q=1W.1c.3X;D $w(a){a=a.5e();E a?a.5j(/\\s+/):[]}if(1k.1Z.bD){1W.1c.2f=D(){G a=[];1g(G i=0,Y=C.Y;i<Y;i++){a.1f(C[i])}1g(G i=0,Y=1b.Y;i<Y;i++){if(1b[i].5y==1W){1g(G j=0,hy=1b[i].Y;j<hy;j++){a.1f(1b[i][j])}}1e{a.1f(1b[i])}}E a}}G 2K=D(a){if(a 4E 2K){C.hr(a)}1e{V.O(C,a||{})}};V.O(2K,{5U:D(d){G e=[];e.49=1b.a5.hn;C.1c.3B.a7(d,D(b){if(!b.4n){E}G c=b.1l;if(c&&1m c=="3R"){if(c.5y==1W){c.1j(D(a){e.49(b.4n,a)})}E}e.49(b.4n,c)});E e.2j("&")},3c:D(c){G d=[];C.1c.3B.a7(c,D(a){G b=V.3c(a.1l);if(b!==1P){d.1f(a.4n.3c()+": "+b)}});E"{"+d.2j(", ")+"}"}});2K.5U.hn=D(a,b,c){a=4X(a);if(b===1P){C.1f(a)}1e{C.1f(a+"="+(b==1h?"":4X(b)))}};V.O(2K.1c,3k);V.O(2K.1c,{3B:D(a){1g(G b in C){G c=C[b];if(c&&c==2K.1c[b]){3S}G d=[b,c];d.4n=b;d.1l=c;a(d)}},bJ:D(){E C.69("4n")},29:D(){E C.69("1l")},hr:D(c){E $H(c).4A(C,D(a,b){a[b.4n]=b.1l;E a})},3C:D(){G a;1g(G i=0,Y=1b.Y;i<Y;i++){G b=C[1b[i]];if(b!==1P){if(a===1P){a=b}1e{if(a.5y!=1W){a=[a]}a.1f(b)}}a2 C[1b[i]]}E a},5U:D(){E 2K.5U(C)},2i:D(){E"#<2K:{"+C.1O(D(a){E a.1O(V.2i).2j(": ")}).2j(", ")+"}>"},3c:D(){E 2K.3c(C)}});D $H(a){if(a 4E 2K){E a}E 18 2K(a)}if(D(){G i=0,d1=D(a){C.4n=a};d1.1c.4n="me";1g(G b in 18 d1("mb")){i++}E i>1}()){2K.1c.3B=D(a){G b=[];1g(G c in C){G d=C[c];if((d&&d==2K.1c[c])||b.25(c)){3S}b.1f(c);G e=[c,d];e.4n=c;e.1l=d;a(e)}}}9Z=1H.1D();V.O(9Z.1c,3k);V.O(9Z.1c,{1Q:D(a,b,c){C.1T=a;C.3r=b;C.h4=c},3B:D(a){G b=C.1T;1R(C.25(b)){a(b);b=b.bz()}},25:D(a){if(a<C.1T){E 17}if(C.h4){E a<C.3r}E a<=C.3r}});G $R=D(a,b,c){E 18 9Z(a,b,c)};G 1u={cU:D(){E dX.dU(D(){E 18 gZ()},D(){E 18 gY("lZ.gS")},D(){E 18 gY("gP.gS")})||17},cS:0};1u.77={8o:[],3B:D(a){C.8o.3B(a)},9T:D(a){if(!C.25(a)){C.8o.1f(a)}},cO:D(a){C.8o=C.8o.df(a)},9P:D(b,c,d,f){C.1j(D(a){if(1m a[b]=="D"){2D{a[b].41(a,[c,d,f])}2L(e){}}})}};V.O(1u.77,3k);1u.77.9T({9h:D(){1u.cS++},2e:D(){1u.cS--}});1u.2E=D(){};1u.2E.1c={6h:D(a){C.J={2S:"8m",6f:19,gr:"cE/x-lI-1V-lE",cA:"ly-8",3g:""};V.O(C.J,a||{});C.J.2S=C.J.2S.2s();if(1m C.J.3g=="2J"){C.J.3g=C.J.3g.a0()}}};1u.4Y=1H.1D();1u.4Y.gb=["lr","g8","ll","lk","cq"];1u.4Y.1c=V.O(18 1u.2E(),{cp:17,1Q:D(a,b){C.2o=1u.cU();C.6h(b);C.9G(a)},9G:D(a){C.2Z=a;C.2S=C.J.2S;G b=V.3X(C.J.3g);if(!["6X","8m"].25(C.2S)){b["lf"]=C.2S;C.2S="8m"}C.3g=b;if(b=2K.5U(b)){if(C.2S=="6X"){C.2Z+=(C.2Z.25("?")?"&":"?")+b}1e{if(/lc|lb|gD/.48(5h.70)){b+="&3T="}}}2D{if(C.J.9h){C.J.9h(C.2o)}1u.77.9P("9h",C,C.2o);C.2o.l9(C.2S.2h(),C.2Z,C.J.6f);if(C.J.6f){3A(D(){C.c9(1)}.1o(C),10)}C.2o.fK=C.c8.1o(C);C.fI();C.26=C.2S=="8m"?(C.J.kZ||b):1h;C.2o.kX(C.26);if(!C.J.6f&&C.2o.fC){C.c8()}}2L(e){C.86(e)}},c8:D(){G a=C.2o.fA;if(a>1&&!((a==4)&&C.cp)){C.c9(C.2o.fA)}},fI:D(){G b={"X-kP-kO":"gZ","X-1k-dv":1k.dv,"kM":"4g/fl, 4g/kK, cE/fj, 4g/fj, */*"};if(C.2S=="8m"){b["fe-1N"]=C.J.gr+(C.J.cA?"; kF="+C.J.cA:"");if(C.2o.fC&&(5h.70.1E(/7Q\\/(\\d{4})/)||[0,fd])[1]<fd){b["kE"]="kC"}}if(1m C.J.f8=="3R"){G c=C.J.f8;if(1m c.1f=="D"){1g(G i=0,Y=c.Y;i<Y;i+=2){b[c[i]]=c[i+1]}}1e{$H(c).1j(D(a){b[a.4n]=a.1l})}}1g(G d in b){C.2o.ky(d,b[d])}},56:D(){E!C.2o.an||(C.2o.an>=f1&&C.2o.an<kt)},c9:D(a){G b=1u.4Y.gb[a];G c=C.2o,9s=C.9m();if(b=="cq"){2D{C.cp=19;(C.J["61"+C.2o.an]||C.J["61"+(C.56()?"kp":"kn")]||1k.4b)(c,9s)}2L(e){C.86(e)}G d=C.bH("fe-1N");if(d&&d.5e().1E(/^(4g|cE)\\/(x-)?(km|kk)7l(;.*)?$/i)){C.eW()}}2D{(C.J["61"+b]||1k.4b)(c,9s);1u.77.9P("61"+b,C,c,9s)}2L(e){C.86(e)}if(b=="cq"){C.2o.fK=1k.4b}},bH:D(a){2D{E C.2o.kj(a)}2L(e){E 1h}},9m:D(){2D{G a=C.bH("X-ey");E a?a.9m():1h}2L(e){E 1h}},eW:D(){2D{E 85((C.2o.60||"").by())}2L(e){C.86(e)}},86:D(a){(C.J.eR||1k.4b)(C,a);1u.77.9P("eR",C,a)}});1u.9o=1H.1D();V.O(V.O(1u.9o.1c,1u.4Y.1c),{1Q:D(c,d,e){C.5z={56:(c.56||c),7X:(c.7X||(c.56?1h:c))};C.2o=1u.cU();C.6h(e);G f=C.J.2e||1k.4b;C.J.2e=(D(a,b){C.eO();f(a,b)}).1o(C);C.9G(d)},eO:D(){G a=C.5z[C.56()?"56":"7X"];G b=C.2o.60;if(!C.J.4T){b=b.4v()}if(a=$(a)){if(C.J.eN){18 C.J.eN(a,b)}1e{a.1G(b)}}if(C.56()){if(C.2e){3A(C.2e.1o(C),10)}}}});1u.eM=1H.1D();1u.eM.1c=V.O(18 1u.2E(),{1Q:D(a,b,c){C.6h(c);C.2e=C.J.2e;C.4r=(C.J.4r||2);C.5Y=(C.J.5Y||1);C.bA={};C.5z=a;C.2Z=b;C.1T()},1T:D(){C.J.2e=C.eK.1o(C);C.54()},2H:D(){C.bA.J.2e=1P;9n(C.4d);(C.2e||1k.4b).41(C,1b)},eK:D(a){if(C.J.5Y){C.5Y=(a.60==C.eJ?C.5Y*C.J.5Y:1);C.eJ=a.60}C.4d=3A(C.54.1o(C),C.5Y*C.4r*2W)},54:D(){C.bA=18 1u.9o(C.5z,C.2Z,C.J)}});D $(a){if(1b.Y>1){1g(G i=0,8v=[],Y=1b.Y;i<Y;i++){8v.1f($(1b[i]))}E 8v}if(1m a=="2J"){a=1d.k4(a)}E N.O(a)}if(1k.67.cb){1d.bw=D(a,b){G c=[];G d=1d.3M(a,$(b)||1d,1h,jZ.jY,1h);1g(G i=0,Y=d.jX;i<Y;i++){c.1f(d.jV(i))}E c};1d.6L=D(a,b){G q=".//*[7K(2f(\' \', @7J, \' \'), \' "+a+" \')]";E 1d.bw(q,b)}}1e{1d.6L=D(a,b){G c=($(b)||1d.26).3Y("*");G d=[],22;1g(G i=0,Y=c.Y;i<Y;i++){22=c[i];if(N.9i(22,a)){d.1f(N.O(22))}}E d}}if(!1p.N){G N={}}N.O=D(a){G F=1k.67;if(!a||!a.1L||a.3O==3||a.ew||F.bk||a==1p){E a}G b={},1L=a.1L,7G=N.O.7G,T=N.1v.59;if(!F.7V){V.O(b,N.1v),V.O(b,N.1v.9e)}if(T[1L]){V.O(b,T[1L])}1g(G c in b){G d=b[c];if(1m d=="D"&&!(c in a)){a[c]=7G.bn(d)}}a.ew=1k.4b;E a};N.O.7G={bn:D(a){E C[a]=C[a]||D(){E a.41(1h,[C].2f($A(1b)))}}};N.1v={9d:D(a){E $(a).12.3q!="3W"},bj:D(a){a=$(a);N[N.9d(a)?"21":"2w"](a);E a},21:D(a){$(a).12.3q="3W";E a},2w:D(a){$(a).12.3q="";E a},3C:D(a){a=$(a);a.1z.7E(a);E a},1G:D(a,b){b=1m b=="1P"?"":b.3K();$(a).2q=b.4v();3A(D(){b.4T()},10);E a},1M:D(a,b){a=$(a);b=1m b=="1P"?"":b.3K();if(a.bg){a.bg=b.4v()}1e{G c=a.cR.ec();c.bf(a);a.1z.jA(c.e9(b.4v()),a)}3A(D(){b.4T()},10);E a},2i:D(d){d=$(d);G e="<"+d.1L.2s();$H({"id":"id","2B":"7J"}).1j(D(a){G b=a.3D(),5O=a.2t();G c=(d[b]||"").3K();if(c){e+=" "+5O+"="+c.2i(19)}});E e+">"},98:D(a,b){a=$(a);G c=[];1R(a=a[b]){if(a.3O==1){c.1f(N.O(a))}}E c},e7:D(a){E $(a).98("1z")},e6:D(a){E $A($(a).3Y("*")).1j(N.O)},e5:D(a){a=$(a).4s;1R(a&&a.3O!=1){a=a.5K}E $(a)},e2:D(a){if(!(a=$(a).4s)){E[]}1R(a&&a.3O!=1){a=a.5K}if(a){E[a].2f($(a).7C())}E[]},b8:D(a){E $(a).98("b7")},7C:D(a){E $(a).98("5K")},j5:D(a){a=$(a);E a.b8().6q().2f(a.7C())},1E:D(a,b){if(1m b=="2J"){b=18 1i(b)}E b.1E($(a))},iZ:D(a,b,c){a=$(a);if(1b.Y==1){E $(a.1z)}G d=a.e7();E b?1i.5o(d,b,c):d[c||0]},3b:D(a,b,c){a=$(a);if(1b.Y==1){E a.e5()}G d=a.e6();E b?1i.5o(d,b,c):d[c||0]},iR:D(a,b,c){a=$(a);if(1b.Y==1){E $(1i.2l.7A(a))}G d=a.b8();E b?1i.5o(d,b,c):d[c||0]},iO:D(a,b,c){a=$(a);if(1b.Y==1){E $(1i.2l.7S(a))}G d=a.7C();E b?1i.5o(d,b,c):d[c||0]},iM:D(){G a=$A(1b),M=$(a.9x());E 1i.b4(M,a)},6L:D(a,b){E 1d.6L(b,a)},b3:D(a,b){a=$(a);if(1k.1Z.4j){if(!a.dW){E 1h}G t=N.8Z;if(t.29[b]){E t.29[b](a,b)}if(t.8Y[b]){b=t.8Y[b]}G c=a.dW[b];E c?c.5v:1h}E a.dV(b)},iA:D(a){E $(a).64().1r},iy:D(a){E $(a).64().1A},6R:D(a){E 18 N.8W(a)},9i:D(a,b){if(!(a=$(a))){E}G c=a.2B;if(c.Y==0){E 17}if(c==b||c.1E(18 3n("(^|\\\\s)"+b+"(\\\\s|$)"))){E 19}E 17},4w:D(a,b){if(!(a=$(a))){E}N.6R(a).49(b);E a},6c:D(a,b){if(!(a=$(a))){E}N.6R(a).3C(b);E a},ir:D(a,b){if(!(a=$(a))){E}N.6R(a)[a.9i(b)?"3C":"49"](b);E a},1X:D(){1a.1X.41(1a,1b);E $A(1b).3D()},2C:D(){1a.2C.41(1a,1b);E $A(1b).3D()},6T:D(a){a=$(a);G b=a.4s;1R(b){G c=b.5K;if(b.3O==3&&!/\\S/.48(b.5v)){a.7E(b)}b=c}E a},7y:D(a){E $(a).2q.ee()},8U:D(a,b){a=$(a),b=$(b);1R(a=a.1z){if(a==b){E 19}}E 17},7v:D(a){a=$(a);G b=1x.3E(a);1p.7v(b[0],b[1]);E a},1t:D(a,b){a=$(a);b=b=="aP"?"9y":b.7f();G c=a.12[b];if(!c){G d=1d.ih.ig(a,1h);c=d?d[b]:1h}if(b=="2d"){E c?3x(c):1}E c=="8S"?1h:c},8c:D(a){E $(a).1t("2d")},1J:D(a,b,c){a=$(a);G d=a.12;1g(G e in b){if(e=="2d"){a.6v(b[e])}1e{d[(e=="aP"||e=="9y")?(d.aK===1P?"9y":"aK"):(c?e:e.7f())]=b[e]}}E a},6v:D(a,b){a=$(a);a.12.2d=(b==1||b==="")?"":(b<0.aI)?0:b;E a},64:D(a){a=$(a);G b=$(a).1t("3q");if(b!="3W"&&b!=1h){E{1A:a.3v,1r:a.3h}}G c=a.12;G d=c.5I;G e=c.1B;G f=c.3q;c.5I="5x";c.1B="3i";c.3q="i9";G g=a.7r;G h=a.53;c.3q=f;c.1B=e;c.5I=d;E{1A:g,1r:h}},3u:D(a){a=$(a);G b=N.1t(a,"1B");if(b=="aC"||!b){a.aB=19;a.12.1B="74";if(1p.4m){a.12.1q=0;a.12.1s=0}}E a},4D:D(a){a=$(a);if(a.aB){a.aB=1P;a.12.1B=a.12.1q=a.12.1s=a.12.3z=a.12.5F=""}E a},4B:D(a){a=$(a);if(a.7m){E a}a.7m=a.12.ay||"8S";if((N.1t(a,"ay")||"9d")!="5x"){a.12.ay="5x"}E a},4x:D(a){a=$(a);if(!a.7m){E a}a.12.ay=a.7m=="8S"?"":a.7m;a.7m=1h;E a}};V.O(N.1v,{hT:N.1v.8U,nJ:N.1v.e2});if(1k.1Z.bD){N.1v.ds=N.1v.1t;N.1v.1t=D(a,b){4V(b){1F"1s":1F"1q":1F"5F":1F"3z":if(N.ds(a,"1B")=="aC"){E 1h}dr:E N.ds(a,b)}}}1e{if(1k.1Z.4j){N.1v.1t=D(a,b){a=$(a);b=(b=="aP"||b=="9y")?"aK":b.7f();G c=a.12[b];if(!c&&a.at){c=a.at[b]}if(b=="2d"){if(c=(a.1t("8I")||"").1E(/ar\\(2d=(.*)\\)/)){if(c[1]){E 3x(c[1])/3I}}E 1}if(c=="8S"){if((b=="1A"||b=="1r")&&(a.1t("3q")!="3W")){E a["2y"+b.dq()]+"1K"}E 1h}E c};N.1v.6v=D(a,b){a=$(a);G c=a.1t("8I"),12=a.12;if(b==1||b===""){12.8I=c.1M(/ar\\([^\\)]*\\)/gi,"");E a}1e{if(b<0.aI){b=0}}12.8I=c.1M(/ar\\([^\\)]*\\)/gi,"")+"ar(2d="+(b*3I)+")";E a};N.1v.1G=D(b,c){b=$(b);c=1m c=="1P"?"":c.3K();G d=b.1L.2h();if(["8H","79","7k","8F"].25(d)){G e=1d.23("2Q");4V(d){1F"8H":1F"79":e.2q="<2I><5E>"+c.4v()+"</5E></2I>";al=2;1C;1F"7k":e.2q="<2I><5E><ak>"+c.4v()+"</ak></5E></2I>";al=3;1C;1F"8F":e.2q="<2I><5E><ak><hG>"+c.4v()+"</hG></ak></5E></2I>";al=4}$A(b.2k).1j(D(a){b.7E(a)});al.9l(D(){e=e.4s});$A(e.2k).1j(D(a){b.24(a)})}1e{b.2q=c.4v()}3A(D(){c.4T()},10);E b}}1e{if(1k.1Z.7Q){N.1v.6v=D(a,b){a=$(a);a.12.2d=(b==1)?0.nq:(b==="")?"":(b<0.aI)?0:b;E a}}}}N.8Z={8Y:{nn:"nm",nl:"nj",nf:"nc",n9:"n8",n4:"n2",n1:"n0",mZ:"mY",mX:"mW",hs:"mT",mQ:"mN"},29:{a9:D(a,b){E a.dV(b,2)},7q:D(a,b){E $(a).4S(b)?b:1h},12:D(a){E a.12.hm.2s()},d8:D(a){G b=a.hk("d8");E b.d6?b.5v:1h}}};(D(){V.O(C,{aQ:C.a9,93:C.a9,1N:C.a9,2v:C.7q,63:C.7q,hs:C.7q,hh:C.7q})}).a7(N.8Z.29);N.1v.9e={4S:D(a,b){G t=N.8Z,14;b=t.8Y[b]||b;14=$(a).hk(b);E 14&&14.d6}};N.1v.59={};V.O(N,N.1v);if(!1k.67.7V&&1d.23("2Q").80){1p.7L={};1p.7L.1c=1d.23("2Q").80;1k.67.7V=19}N.4S=D(a,b){if(a.4S){E a.4S(b)}E N.1v.9e.4S(a,b)};N.d3=D(g){G F=1k.67,T=N.1v.59;if(!g){V.O(1w,1w.1v);V.O(1w.N,1w.N.1v);V.O(N.1v.59,{"hg":V.3X(1w.1v),"b2":V.3X(1w.N.1v),"d0":V.3X(1w.N.1v),"90":V.3X(1w.N.1v)})}if(1b.Y==2){G h=g;g=1b[1]}if(!h){V.O(N.1v,g||{})}1e{if(h.5y==1W){h.1j(O)}1e{O(h)}}D O(a){a=a.2h();if(!N.1v.59[a]){N.1v.59[a]={}}V.O(N.1v.59[a],g)}D a1(a,b,c){c=c||17;G d=N.O.7G;1g(G e in a){G f=a[e];if(!c||!(e in b)){b[e]=d.bn(f)}}}D hc(a){G b;G c={"cZ":"m9","90":"m8","P":"m7","h9":"m6","h7":"m4","h3":"m3","h1":"m2","h0":"m1","gX":"6C","gU":"6C","gT":"6C","gR":"6C","gQ":"6C","gO":"6C","Q":"lV","gM":"gL","gK":"gL","A":"lT","gI":"lS","cP":"lR","cN":"gE","cM":"gE","8H":"cL","cJ":"cL","79":"cL","7k":"lP","bv":"gA","8F":"gA","gz":"lO","gy":"lN"};if(c[a]){b="9L"+c[a]+"N"}if(1p[b]){E 1p[b]}b="9L"+a+"N";if(1p[b]){E 1p[b]}b="9L"+a.dq()+"N";if(1p[b]){E 1p[b]}1p[b]={};1p[b].1c=1d.23(a).80;E 1p[b]}if(F.7V){a1(N.1v,7L.1c);a1(N.1v.9e,7L.1c,19)}if(F.bk){1g(G i in N.1v.59){G j=hc(i);if(1m j=="1P"){3S}a1(T[i],j.1c)}}V.O(N,N.1v);a2 N.59};G lL={3q:N.bj};32.2M=D(a){C.cH=a};32.2M.1c={1Q:D(a,b){C.M=$(a);C.7W=b.4v();if(C.cH&&C.M.gs){2D{C.M.gs(C.cH,C.7W)}2L(e){G c=C.M.1L.2h();if(["79","7k"].25(c)){C.7i(C.gq())}1e{2u e;}}}1e{C.28=C.M.cR.ec();if(C.6Q){C.6Q()}C.7i([C.28.e9(C.7W)])}3A(D(){b.4T()},10)},gq:D(){G a=1d.23("2Q");a.2q="<2I><5E>"+C.7W+"</5E></2I>";E $A(a.2k[0].2k[0].2k)}};G 2M=18 V();2M.gm=1H.1D();2M.gm.1c=V.O(18 32.2M("lH"),{6Q:D(){C.28.lG(C.M)},7i:D(b){b.1j((D(a){C.M.1z.4P(a,C.M)}).1o(C))}});2M.gj=1H.1D();2M.gj.1c=V.O(18 32.2M("lD"),{6Q:D(){C.28.bf(C.M);C.28.gg(19)},7i:D(b){b.6q(17).1j((D(a){C.M.4P(a,C.M.4s)}).1o(C))}});2M.cz=1H.1D();2M.cz.1c=V.O(18 32.2M("lx"),{6Q:D(){C.28.bf(C.M);C.28.gg(C.M)},7i:D(b){b.1j((D(a){C.M.24(a)}).1o(C))}});2M.cw=1H.1D();2M.cw.1c=V.O(18 32.2M("lw"),{6Q:D(){C.28.lv(C.M)},7i:D(b){b.1j((D(a){C.M.1z.4P(a,C.M.5K)}).1o(C))}});N.8W=1H.1D();N.8W.1c={1Q:D(a){C.M=$(a)},3B:D(b){C.M.2B.5j(/\\s+/).2A(D(a){E a.Y>0}).3B(b)},ct:D(a){C.M.2B=a},49:D(a){if(C.25(a)){E}C.ct($A(C).2f(a).2j(" "))},3C:D(a){if(!C.25(a)){E}C.ct($A(C).df(a).2j(" "))},3K:D(){E $A(C).2j(" ")}};V.O(N.8W.1c,3k);G 1i=1H.1D();1i.1c={1Q:D(a){C.5A=a.5e();C.ge()},ge:D(){if(1k.67.cb&&!(/\\[[\\w-]*?:/).48(C.5A)){E C.ga()}G e=C.5A,6W=1i.9H,h=1i.2l,c=1i.8j,le,p,m;if(1i.65[e]){C.4a=1i.65[e];E}C.4a=["C.4a = D(g5) {","G r = g5, h = 1i.2l, c = 17, n;"];1R(e&&le!=e&&(/\\S/).48(e)){le=e;1g(G i in 6W){p=6W[i];if(m=e.1E(p)){C.4a.1f(1m c[i]=="D"?c[i](m):18 2V(c[i]).3M(m));e=e.1M(m[0],"");1C}}}C.4a.1f("E h.cg(n);\\n}");85(C.4a.2j("\\n"));1i.65[C.5A]=C.4a},ga:D(){G e=C.5A,6W=1i.9H,x=1i.2x,le,m;if(1i.65[e]){C.2x=1i.65[e];E}C.4a=[".//*"];1R(e&&le!=e&&(/\\S/).48(e)){le=e;1g(G i in 6W){if(m=e.1E(6W[i])){C.4a.1f(1m x[i]=="D"?x[i](m):18 2V(x[i]).3M(m));e=e.1M(m[0],"");1C}}}C.2x=C.4a.2j("");1i.65[C.5A]=C.2x},4p:D(a){a=a||1d;if(C.2x){E 1d.bw(C.2x,a)}E C.4a(a)},1E:D(a){E C.4p(1d).25(a)},3K:D(){E C.5A},2i:D(){E"#<1i:"+C.5A.2i()+">"}};V.O(1i,{65:{},2x:{5c:"//*",22:"/*",71:"/8f-5f::*[1]",8g:"/8f-5f::*",1L:D(m){if(m[1]=="*"){E""}E"[fV-3a()=\'"+m[1].2s()+"\' cs fV-3a()=\'"+m[1].2h()+"\']"},2B:"[7K(2f(\' \', @7J, \' \'), \' #{1} \')]",id:"[@id=\'#{1}\']",8h:"[@#{1}]",5b:D(m){m[3]=m[5]||m[6];E 18 2V(1i.2x.9J[m[2]]).3M(m)},7Z:D(m){G h=1i.2x.2r[m[1]];if(!h){E""}if(1m h==="D"){E h(m)}E 18 2V(1i.2x.2r[m[1]]).3M(m)},9J:{"=":"[@#{1}=\'#{3}\']","!=":"[@#{1}!=\'#{3}\']","^=":"[la-5Q(@#{1}, \'#{3}\')]","$=":"[7j(@#{1}, (2J-Y(@#{1}) - 2J-Y(\'#{3}\') + 1))=\'#{3}\']","*=":"[7K(@#{1}, \'#{3}\')]","~=":"[7K(2f(\' \', @#{1}, \' \'), \' #{3} \')]","|=":"[7K(2f(\'-\', @#{1}, \'-\'), \'-#{3}-\')]"},2r:{"3D-22":"[4W(cc-5f::*)]","2t-22":"[4W(8f-5f::*)]","3Z-22":"[4W(cc-5f::* cs 8f-5f::*)]","7y":"[9M(*) = 0 ca (9M(4g()) = 0 cs l5(4g(), \' \\t\\r\\n\', \'\') = \'\')]","63":"[@63]","2v":"[@2v]","gG":"[4W(@2v)]","4W":D(m){G e=m[6],p=1i.9H,x=1i.2x,le,m,v;G a=[];1R(e&&le!=e&&(/\\S/).48(e)){le=e;1g(G i in p){if(m=e.1E(p[i])){v=1m x[i]=="D"?x[i](m):18 2V(x[i]).3M(m);a.1f("("+v.7j(1,v.Y-1)+")");e=e.1M(m[0],"");1C}}}E"[4W("+a.2j(" ca ")+")]"},"2b-22":D(m){E 1i.2x.2r.2b("(9M(./cc-5f::*) + 1) ",m)},"2b-2t-22":D(m){E 1i.2x.2r.2b("(9M(./8f-5f::*) + 1) ",m)},"2b-2N-1N":D(m){E 1i.2x.2r.2b("1B() ",m)},"2b-2t-2N-1N":D(m){E 1i.2x.2r.2b("(2t() + 1 - 1B()) ",m)},"3D-2N-1N":D(m){m[6]="1";E 1i.2x.2r["2b-2N-1N"](m)},"2t-2N-1N":D(m){m[6]="1";E 1i.2x.2r["2b-2t-2N-1N"](m)},"3Z-2N-1N":D(m){G p=1i.2x.2r;E p["3D-2N-1N"](m)+p["2t-2N-1N"](m)},2b:D(c,m){G d,5P=m[6],bc;if(5P=="h8"){5P="2n+0"}if(5P=="fG"){5P="2n+1"}if(d=5P.1E(/^(\\d+)$/)){E"["+c+"= "+d[1]+"]"}if(d=5P.1E(/^(-?\\d*)?n(([+-])(\\d+))?/)){if(d[1]=="-"){d[1]=-1}G a=d[1]?6V(d[1]):1;G b=d[2]?6V(d[2]):0;bc="[((#{c4} - #{b}) kY #{a} = 0) ca "+"((#{c4} - #{b}) 2Q #{a} >= 0)]";E 18 2V(bc).3M({c4:c,a:a,b:b})}}}},8j:{1L:"n = h.1L(n, r, \\"#{1}\\", c);   c = 17;",2B:"n = h.2B(n, r, \\"#{1}\\", c); c = 17;",id:"n = h.id(n, r, \\"#{1}\\", c);        c = 17;",8h:"n = h.8h(n, r, \\"#{1}\\"); c = 17;",5b:D(m){m[3]=(m[5]||m[6]);E 18 2V("n = h.5b(n, r, \\"#{1}\\", \\"#{3}\\", \\"#{2}\\"); c = 17;").3M(m)},7Z:D(m){if(m[6]){m[6]=m[6].1M(/"/g,"\\\\\\"")}E 18 2V("n = h.7Z(n, \\"#{1}\\", \\"#{6}\\", r, c); c = 17;").3M(m)},5c:"c = \\"5c\\";",22:"c = \\"22\\";",71:"c = \\"71\\";",8g:"c = \\"8g\\";"},9H:{8g:18 3n("^\\\\s"+"*"+"~\\\\s*"),22:18 3n("^\\\\s"+"*"+">\\\\s*"),71:18 3n("^\\\\s"+"*"+"\\\\+\\\\s*"),5c:/^\\s/,1L:18 3n("^\\\\s*"+"(\\\\"+"*|[\\\\w\\\\-]+)(\\\\b|$)?"),id:18 3n("^#([\\\\w\\\\-\\\\"+"*]+)(\\\\b|$)"),2B:18 3n("^\\\\.([\\\\w\\\\-\\\\"+"*]+)(\\\\b|$)"),7Z:18 3n("^:((3D|2t|2b|2b-2t|3Z)(-22|-2N-1N)|7y|63|(en|kW)kV|4W)(\\\\((.*?)\\\\))?(\\\\b|$|\\\\s||(?=:))"),8h:18 3n("^\\\\[([\\\\w]+)\\\\]"),5b:18 3n("\\\\[((?:[\\\\w-]*:)?[\\\\w-]+)\\\\s*(?:([!^$*~|]?=)\\\\s*(([\'\\"])([^\\\\]]*?)\\\\4|([^\'\\"][^\\\\]]*?)))?\\\\]")},2l:{2f:D(a,b){1g(G i=0,14;14=b[i];i++){a.1f(14)}E a},5Z:D(a){1g(G i=0,14;14=a[i];i++){14.4t=19}E a},5n:D(a){1g(G i=0,14;14=a[i];i++){14.4t=1P}E a},2p:D(a,b,c){a.4t=19;if(b){1g(G d=a.2k,i=d.Y-1,j=1;i>=0;i--){14=d[i];if(14.3O==1&&(!c||14.4t)){14.8X=j++}}}1e{1g(G i=0,j=1,d=a.2k;14=d[i];i++){if(14.3O==1&&(!c||14.4t)){14.8X=j++}}}},cg:D(a){if(a.Y==0){E a}G b=[],n;1g(G i=0,l=a.Y;i<l;i++){if(!(n=a[i]).4t){n.4t=19;b.1f(N.O(n))}}E 1i.2l.5n(b)},5c:D(a){G h=1i.2l;1g(G i=0,1n=[],14;14=a[i];i++){h.2f(1n,14.3Y("*"))}E 1n},22:D(a){G h=1i.2l;1g(G i=0,1n=[],14;14=a[i];i++){1g(G j=0,6j=[],22;22=14.2k[j];j++){if(22.3O==1&&22.1L!="!"){1n.1f(22)}}}E 1n},71:D(a){1g(G i=0,1n=[],14;14=a[i];i++){G b=C.7S(14);if(b){1n.1f(b)}}E 1n},8g:D(a){G h=1i.2l;1g(G i=0,1n=[],14;14=a[i];i++){h.2f(1n,N.7C(14))}E 1n},7S:D(a){1R(a=a.5K){if(a.3O==1){E a}}E 1h},7A:D(a){1R(a=a.b7){if(a.3O==1){E a}}E 1h},1L:D(a,b,c,d){c=c.2h();G e=[],h=1i.2l;if(a){if(d){if(d=="5c"){1g(G i=0,14;14=a[i];i++){h.2f(e,14.3Y(c))}E e}1e{a=C[d](a)}if(c=="*"){E a}}1g(G i=0,14;14=a[i];i++){if(14.1L.2h()==c){e.1f(14)}}E e}1e{E b.3Y(c)}},id:D(a,b,c,d){G e=$(c),h=1i.2l;if(!a&&b==1d){E e?[e]:[]}if(a){if(d){if(d=="22"){1g(G i=0,14;14=a[i];i++){if(e.1z==14){E[e]}}}1e{if(d=="5c"){1g(G i=0,14;14=a[i];i++){if(N.8U(e,14)){E[e]}}}1e{if(d=="71"){1g(G i=0,14;14=a[i];i++){if(1i.2l.7A(e)==14){E[e]}}}1e{a=h[d](a)}}}}1g(G i=0,14;14=a[i];i++){if(14==e){E[e]}}E[]}E(e&&N.8U(e,b))?[e]:[]},2B:D(a,b,c,d){if(a&&d){a=C[d](a)}E 1i.2l.fy(a,b,c)},fy:D(a,b,c){if(!a){a=1i.2l.5c([b])}G d=" "+c+" ";1g(G i=0,1n=[],14,8y;14=a[i];i++){8y=14.2B;if(8y.Y==0){3S}if(8y==c||(" "+8y+" ").25(d)){1n.1f(14)}}E 1n},8h:D(a,b,c){G d=[];1g(G i=0,14;14=a[i];i++){if(N.4S(14,c)){d.1f(14)}}E d},5b:D(a,b,c,d,e){if(!a){a=b.3Y("*")}G f=1i.9J[e],1n=[];1g(G i=0,14;14=a[i];i++){G g=N.b3(14,c);if(g===1h){3S}if(f(g,d)){1n.1f(14)}}E 1n},7Z:D(a,b,c,d,e){if(a&&e){a=C[e](a)}if(!a){a=d.3Y("*")}E 1i.2r[b](a,c,d)}},2r:{"3D-22":D(a,b,c){1g(G i=0,1n=[],14;14=a[i];i++){if(1i.2l.7A(14)){3S}1n.1f(14)}E 1n},"2t-22":D(a,b,c){1g(G i=0,1n=[],14;14=a[i];i++){if(1i.2l.7S(14)){3S}1n.1f(14)}E 1n},"3Z-22":D(a,b,c){G h=1i.2l;1g(G i=0,1n=[],14;14=a[i];i++){if(!h.7A(14)&&!h.7S(14)){1n.1f(14)}}E 1n},"2b-22":D(a,b,c){E 1i.2r.2b(a,b,c)},"2b-2t-22":D(a,b,c){E 1i.2r.2b(a,b,c,19)},"2b-2N-1N":D(a,b,c){E 1i.2r.2b(a,b,c,17,19)},"2b-2t-2N-1N":D(a,b,c){E 1i.2r.2b(a,b,c,19,19)},"3D-2N-1N":D(a,b,c){E 1i.2r.2b(a,"1",c,17,19)},"2t-2N-1N":D(a,b,c){E 1i.2r.2b(a,"1",c,19,19)},"3Z-2N-1N":D(a,b,c){G p=1i.2r;E p["2t-2N-1N"](p["3D-2N-1N"](a,b,c),b,c)},fv:D(a,b,d){if(a==0){E b>0?[b]:[]}E $R(1,d).4A([],D(c,i){if(0==(i-b)%a&&(i-b)/a>=0){c.1f(i)}E c})},2b:D(c,d,e,f,g){if(c.Y==0){E[]}if(d=="h8"){d="2n+0"}if(d=="fG"){d="2n+1"}G h=1i.2l,1n=[],d5=[],m;h.5Z(c);1g(G i=0,14;14=c[i];i++){if(!14.1z.4t){h.2p(14.1z,f,g);d5.1f(14.1z)}}if(d.1E(/^\\d+$/)){d=6V(d);1g(G i=0,14;14=c[i];i++){if(14.8X==d){1n.1f(14)}}}1e{if(m=d.1E(/^(-?\\d*)?n(([+-])(\\d+))?/)){if(m[1]=="-"){m[1]=-1}G a=m[1]?6V(m[1]):1;G b=m[2]?6V(m[2]):0;G k=1i.2r.fv(a,b,c.Y);1g(G i=0,14,l=k.Y;14=c[i];i++){1g(G j=0;j<l;j++){if(14.8X==k[j]){1n.1f(14)}}}}}h.5n(c);h.5n(d5);E 1n},"7y":D(a,b,c){1g(G i=0,1n=[],14;14=a[i];i++){if(14.1L=="!"||(14.4s&&!14.2q.1E(/^\\s*$/))){3S}1n.1f(14)}E 1n},"4W":D(a,b,c){G h=1i.2l,kN,m;G d=18 1i(b).4p(c);h.5Z(d);1g(G i=0,1n=[],14;14=a[i];i++){if(!14.4t){1n.1f(14)}}h.5n(d);E 1n},"gG":D(a,b,c){1g(G i=0,1n=[],14;14=a[i];i++){if(!14.2v){1n.1f(14)}}E 1n},"2v":D(a,b,c){1g(G i=0,1n=[],14;14=a[i];i++){if(14.2v){1n.1f(14)}}E 1n},"63":D(a,b,c){1g(G i=0,1n=[],14;14=a[i];i++){if(14.63){1n.1f(14)}}E 1n}},9J:{"=":D(a,v){E a==v},"!=":D(a,v){E a!=v},"^=":D(a,v){E a.er(v)},"$=":D(a,v){E a.ej(v)},"*=":D(a,v){E a.25(v)},"~=":D(a,v){E(" "+a+" ").25(" "+v+" ")},"|=":D(a,v){E("-"+a.2h()+"-").25("-"+v.2h()+"-")}},fp:D(a,b){G c=18 1i(b).4p(),h=1i.2l;h.5Z(c);1g(G i=0,1n=[],M;M=a[i];i++){if(M.4t){1n.1f(M)}}h.5n(c);E 1n},5o:D(a,b,c){if(1m b=="aO"){c=b;b=17}E 1i.fp(a,b||"*")[c||0]},b4:D(a,b){G c=b.2j(","),b=[];c.gV(/(([\\w#:.~>+()\\s-]+|\\*|\\[.*?\\])+)\\s*(,|$)/,D(m){b.1f(m[1].5e())});G d=[],h=1i.2l;1g(G i=0,l=b.Y,6l;i<l;i++){6l=18 1i(b[i].5e());h.2f(d,6l.4p(a))}E(l>1)?h.cg(d):d}});D $$(){E 1i.b4(1d,$A(1b))}G 1w={7s:D(a){$(a).7s();E a},ht:D(d,e){G f=d.4A({},D(a,b){if(!b.2v&&b.3a){G c=b.3a,1l=$(b).3s();if(1l!=1h){if(c in a){if(a[c].5y!=1W){a[c]=[a[c]]}a[c].1f(1l)}1e{a[c]=1l}}}E a});E e?f:2K.5U(f)}};1w.1v={4J:D(a,b){E 1w.ht(1w.7c(a),b)},7c:D(c){E $A($(c).3Y("*")).4A([],D(a,b){if(1w.N.7T[b.1L.2s()]){a.1f(N.O(b))}E a})},kG:D(a,b,c){a=$(a);G d=a.3Y("6r");if(!b&&!c){E $A(d).1O(N.O)}1g(G i=0,bW=[],Y=d.Y;i<Y;i++){G e=d[i];if((b&&e.1N!=b)||(c&&e.3a!=c)){3S}bW.1f(N.O(e))}E bW},aa:D(a){a=$(a);1w.7c(a).89("aa");E a},az:D(a){a=$(a);1w.7c(a).89("az");E a},fc:D(b){E $(b).7c().hX(D(a){E a.1N!="5x"&&!a.2v&&["6r","2A","5L"].25(a.1L.2s())})},kD:D(a){a=$(a);a.fc().5k();E a},9G:D(a,b){a=$(a),b=V.3X(b||{});G c=b.3g;b.3g=a.4J(19);if(c){if(1m c=="2J"){c=c.a0()}V.O(b.3g,c)}if(a.4S("2S")&&!b.2S){b.2S=a.2S}E 18 1u.4Y(a.b3("kB"),b)}};1w.N={7g:D(a){$(a).7g();E a},2A:D(a){$(a).2A();E a}};1w.N.1v={4J:D(a){a=$(a);if(!a.2v&&a.3a){G b=a.3s();if(b!=1P){G c={};c[a.3a]=b;E 2K.5U(c)}}E""},3s:D(a){a=$(a);G b=a.1L.2s();E 1w.N.7T[b](a)},hK:D(a){$(a).1l="";E a},kz:D(a){E $(a).1l!=""},5k:D(a){a=$(a);2D{a.7g();if(a.2A&&(a.1L.2s()!="6r"||!["de","7s","dg"].25(a.1N))){a.2A()}}2L(e){}E a},aa:D(a){a=$(a);a.f6();a.2v=19;E a},az:D(a){a=$(a);a.2v=17;E a}};G 8E=1w.N;G $F=1w.N.1v.3s;1w.N.7T={6r:D(a){4V(a.1N.2s()){1F"f5":1F"f3":E 1w.N.7T.f2(a);dr:E 1w.N.7T.5L(a)}},f2:D(a){E a.63?a.1l:1h},5L:D(a){E a.1l},2A:D(a){E C[a.1N=="2A-kv"?"hO":"eZ"](a)},hO:D(a){G b=a.kr;E b>=0?C.bL(a.J[b]):1h},eZ:D(a){G b,Y=a.Y;if(!Y){E 1h}1g(G i=0,b=[];i<Y;i++){G c=a.J[i];if(c.62){b.1f(C.bL(c))}}E b},bL:D(a){E N.O(a).4S("1l")?a.1l:a.4g}};32.9r=D(){};32.9r.1c={1Q:D(a,b,c){C.4r=b;C.M=$(a);C.3o=c;C.3l=C.3s();C.68()},68:D(){8N(C.54.1o(C),C.4r*2W)},54:D(){G a=C.3s();G b=("2J"==1m C.3l&&"2J"==1m a?C.3l!=a:2F(C.3l)!=2F(a));if(b){C.3o(C.M,a);C.3l=a}}};1w.N.9q=1H.1D();1w.N.9q.1c=V.O(18 32.9r(),{3s:D(){E 1w.N.3s(C.M)}});1w.9q=1H.1D();1w.9q.1c=V.O(18 32.9r(),{3s:D(){E 1w.4J(C.M)}});32.5u=D(){};32.5u.1c={1Q:D(a,b){C.M=$(a);C.3o=b;C.3l=C.3s();if(C.M.1L.2s()=="1V"){C.eY()}1e{C.68(C.M)}},bI:D(){G a=C.3s();if(C.3l!=a){C.3o(C.M,a);C.3l=a}},eY:D(){1w.7c(C.M).1j(C.68.1o(C))},68:D(a){if(a.1N){4V(a.1N.2s()){1F"f5":1F"f3":1a.1X(a,"6Z",C.bI.1o(C));1C;dr:1a.1X(a,"8b",C.bI.1o(C));1C}}}};1w.N.5u=1H.1D();1w.N.5u.1c=V.O(18 32.5u(),{3s:D(){E 1w.N.3s(C.M)}});1w.5u=1H.1D();1w.5u.1c=V.O(18 32.5u(),{3s:D(){E 1w.4J(C.M)}});if(!1p.1a){G 1a=18 V()}V.O(1a,{kl:8,bG:9,bF:13,bE:27,eV:37,eU:38,eS:39,eQ:40,ki:46,kg:36,kf:35,kd:33,kc:34,M:D(a){E $(a.ka||a.k9)},bC:D(a){E(((a.eL)&&(a.eL==1))||((a.de)&&(a.de==1)))},5X:D(a){E a.k8||(a.k7+(1d.3m.42||1d.26.42))},5W:D(a){E a.k6||(a.k5+(1d.3m.3N||1d.26.3N))},2H:D(a){if(a.eI){a.eI();a.k3()}1e{a.k2=17;a.k1=19}},5o:D(a,b){G c=1a.M(a);1R(c.1z&&(!c.1L||(c.1L.2h()!=b.2h()))){c=c.1z}E c},2U:17,eH:D(a,b,c,d){if(!C.2U){C.2U=[]}if(a.eG){C.2U.1f([a,b,c,d]);a.eG(b,c,d)}1e{if(a.8i){C.2U.1f([a,b,c,d]);a.8i("61"+b,c)}}},eF:D(){if(!1a.2U){E}1g(G i=0,Y=1a.2U.Y;i<Y;i++){1a.2C.41(C,1a.2U[i]);1a.2U[i][0]=1h}1a.2U=17},1X:D(a,b,c,d){a=$(a);d=d||17;if(b=="7R"&&(1k.1Z.47||a.8i)){b="eE"}1a.eH(a,b,c,d)},2C:D(a,b,c,d){a=$(a);d=d||17;if(b=="7R"&&(1k.1Z.47||a.8i)){b="eE"}if(a.eD){a.eD(b,c,d)}1e{if(a.eC){2D{a.eC("61"+b,c)}2L(e){}}}}});if(1k.1Z.4j){1a.1X(1p,"jW",1a.eF,17)}G 1x={eB:17,4R:D(){C.7N=1p.jU||1d.3m.42||1d.26.42||0;C.7M=1p.jT||1d.3m.3N||1d.26.3N||0},bt:D(a){G b=0,2R=0;do{b+=a.3N||0;2R+=a.42||0;a=a.1z}1R(a);E[2R,b]},3E:D(a){G b=0,2R=0;do{b+=a.57||0;2R+=a.5p||0;a=a.4G}1R(a);E[2R,b]},eA:D(a){G b=0,2R=0;do{b+=a.57||0;2R+=a.5p||0;a=a.4G;if(a){if(a.1L=="9j"){1C}G p=N.1t(a,"1B");if(p=="74"||p=="3i"){1C}}}1R(a);E[2R,b]},4G:D(a){if(a.4G){E a.4G}if(a==1d.26){E a}1R((a=a.1z)&&a!=1d.26){if(N.1t(a,"1B")!="aC"){E a}}E 1d.26},bs:D(a,x,y){if(C.eB){E C.ez(a,x,y)}C.8D=x;C.7H=y;C.2y=C.3E(a);E(y>=C.2y[1]&&y<C.2y[1]+a.3h&&x>=C.2y[0]&&x<C.2y[0]+a.3v)},ez:D(a,x,y){G b=C.bt(a);C.8D=x+b[0]-C.7N;C.7H=y+b[1]-C.7M;C.2y=C.3E(a);E(C.7H>=C.2y[1]&&C.7H<C.2y[1]+a.3h&&C.8D>=C.2y[0]&&C.8D<C.2y[0]+a.3v)},3H:D(a,b){if(!a){E 0}if(a=="6J"){E((C.2y[1]+b.3h)-C.7H)/b.3h}if(a=="9g"){E((C.2y[0]+b.3v)-C.8D)/b.3v}},9f:D(a){G b=0,2R=0;G c=a;do{b+=c.57||0;2R+=c.5p||0;if(c.4G==1d.26){if(N.1t(c,"1B")=="3i"){1C}}}1R(c=c.4G);c=a;do{if(!1p.4m||c.1L=="9j"){b-=c.3N||0;2R-=c.42||0}}1R(c=c.1z);E[2R,b]},3X:D(a,b){G c=V.O({ev:19,bq:19,eu:19,bp:19,57:0,5p:0},1b[2]||{});a=$(a);G p=1x.9f(a);b=$(b);G d=[0,0];G e=1h;if(N.1t(b,"1B")=="3i"){e=1x.4G(b);d=1x.9f(e)}if(e==1d.26){d[0]-=1d.26.5p;d[1]-=1d.26.57}if(c.ev){b.12.1s=(p[0]-d[0]+c.5p)+"1K"}if(c.bq){b.12.1q=(p[1]-d[1]+c.57)+"1K"}if(c.eu){b.12.1A=a.3v+"1K"}if(c.bp){b.12.1r=a.3h+"1K"}},bo:D(a){a=$(a);if(a.12.1B=="3i"){E}1x.4R();G b=1x.eA(a);G c=b[1];G d=b[0];G e=a.7r;G f=a.53;a.et=d-3x(a.12.1s||0);a.es=c-3x(a.12.1q||0);a.eq=a.12.1A;a.ep=a.12.1r;a.12.1B="3i";a.12.1q=c+"1K";a.12.1s=d+"1K";a.12.1A=e+"1K";a.12.1r=f+"1K"},eo:D(a){a=$(a);if(a.12.1B=="74"){E}1x.4R();a.12.1B="74";G b=3x(a.12.1q||0)-(a.es||0);G c=3x(a.12.1s||0)-(a.et||0);a.12.1q=b+"1K";a.12.1s=c+"1K";a.12.1r=a.ep;a.12.1A=a.eq}};if(1k.1Z.47){1x.3E=D(a){G b=0,2R=0;do{b+=a.57||0;2R+=a.5p||0;if(a.4G==1d.26){if(N.1t(a,"1B")=="3i"){1C}}a=a.4G}1R(a);E[2R,b]}}N.d3();G 4Q={el:{ek:"1O",cP:"2I",cN:"2I",cM:"2I",ei:"jP",cZ:"2A",bm:"2A",eg:"3R",79:"2I",8F:"2I",cJ:"2I",bv:"2I",8H:"2I",7k:"2I"},14:D(a){a=a.2h();G b=C.el[a]||"2Q";G c=1d.23(b);2D{c.2q="<"+a+"></"+a+">"}2L(e){}G d=c.4s||1h;if(d&&(d.1L.2h()!=a)){d=d.3Y(a)[0]}if(!d){d=1d.23(a)}if(!d){E}if(1b[1]){if(C.9b(1b[1])||(1b[1]4E 1W)||1b[1].1L){C.bl(d,1b[1])}1e{G f=C.ef(1b[1]);if(f.Y){2D{c.2q="<"+a+" "+f+"></"+a+">"}2L(e){}d=c.4s||1h;if(!d){d=1d.23(a);1g(5b in 1b[1]){d[5b=="7J"?"2B":5b]=1b[1][5b]}}if(d.1L.2h()!=a){d=c.3Y(a)[0]}}}}if(1b[2]){C.bl(d,1b[2])}E d},bi:D(a){E 1d.4M(a)},bh:{"2B":"7J","jN":"1g"},ef:D(a){G b=[];1g(5O in a){b.1f((5O in C.bh?C.bh[5O]:5O)+"=\\""+a[5O].3K().87().3L(/"/,"&jM;")+"\\"")}E b.2j(" ")},bl:D(a,b){if(b.1L){a.24(b);E}if(1m b=="3R"){b.4f().1j(D(e){if(1m e=="3R"){a.24(e)}1e{if(4Q.9b(e)){a.24(4Q.bi(e))}}})}1e{if(4Q.9b(b)){a.24(4Q.bi(b))}}},9b:D(a){E(1m a=="2J"||1m a=="aO")},jL:D(a){G b=C.14("2Q");$(b).1G(a.5e());E b.3b()},jK:D(b){if(1m b!="3R"&&1m b!="D"){b=1p}G c=("A jJ jI jH jG ek B jF jE jD jC jz 9j "+"jy ea cP jx jw jv cN cM ju gK jt h0 e8 h1 jp jo h9 "+"jn hg jm gz gX gU gT gR gQ gO jl jk 9L I gy gI b2 gM ji "+"jh jg ei b9 jf je jd jc jb ja j9 h3 cZ bm P "+"eg j8 Q S j7 j6 d0 j4 j3 j1 j0 iY iX iW iV 79 8F "+"90 cJ bv 8H iU 7k iT U h7 iQ").5j(/\\s+/);c.1j(D(a){b[a]=D(){E 4Q.14.41(4Q,[a].2f($A(1b)))}})}};2F.1c.5g=D(){G a="#";if(C.3G(0,4)=="iP("){G b=C.3G(4,C.Y-1).5j(",");G i=0;do{a+=4F(b[i]).6P()}1R(++i<3)}1e{if(C.3G(0,1)=="#"){if(C.Y==4){1g(G i=1;i<4;i++){a+=(C.6o(i)+C.6o(i)).2s()}}if(C.Y==7){a=C.2s()}}}E(a.Y==7?a:(1b[0]||C))};N.94=D(b){E $A($(b).2k).7w(D(a){E(a.3O==3?a.5v:(a.b6()?N.94(a):""))}).4f().2j("")};N.92=D(b,c){E $A($(b).2k).7w(D(a){E(a.3O==3?a.5v:((a.b6()&&!N.9i(a,c))?N.92(a,c):""))}).4f().2j("")};N.dY=D(a,b){a=$(a);a.1J({5M:(b/3I)+"em"});if(1k.1Z.47){1p.b5(0,0)}E a};N.4N=D(a){E $(a).12.2d||""};N.bZ=D(a){2D{a=$(a);G n=1d.4M(" ");a.24(n);a.7E(n)}2L(e){}};1W.1c.a7=D(){G a=1b;C.1j(D(f){f.41(C,a)})};G 11={6z:{3a:"iJ",iI:"iH d6 iF M iE 4W iD, iC is iB 1g C 6y 3p iz"},dT:D(c){if(1m 4Q=="1P"){2u("11.dT b1 b0 7l.bN.aZ\' ix.js aY");}G d="1B:74";if(1k.1Z.4j){d+=";aW:1"}c=$(c);$A(c.2k).1j(D(b){if(b.3O==3){b.5v.3Q().1j(D(a){c.4P(4Q.14("iw",{12:d},a==" "?2F.hq(iv):a),b)});N.3C(b)}})},hh:D(c,d){G e;if(((1m c=="3R")||(1m c=="D"))&&(c.Y)){e=c}1e{e=$(c).2k}G f=V.O({dR:0.1,3J:0},1b[2]||{});G g=f.3J;$A(e).1j(D(a,b){18 d(a,V.O(f,{3J:b*f.dR+g}))})},aV:{"iu":["dQ","dP"],"iq":["dO","fm"],"dM":["8V","aU"]},bj:D(a,b){a=$(a);b=(b||"dM").2s();G c=V.O({3w:{1B:"3r",7x:(a.id||"84"),aT:1}},1b[2]||{});11[a.9d()?11.aV[b][1]:11.aV[b][0]](a,c)}};G io=11;11.3U={dL:1k.K,5T:D(a){E(-1S.aS(a*1S.c0)/2)+0.5},6q:D(a){E 1-a},dK:D(a){G a=((-1S.aS(a*1S.c0)/4)+0.75)+1S.ik()/4;E(a>1?1:a)},ij:D(a){E(-1S.aS(a*1S.c0*(9*a))/2)+0.5},dJ:D(a,b){b=b||5;E(1S.3e((a%(1/b))*b)==0?((a*b*2)-1S.dI(a*b*2)):1-((a*b*2)-1S.dI(a*b*2)))},3W:D(a){E 0},dH:D(a){E 1}};11.aM=1H.1D();V.O(V.O(11.aM.1c,3k),{1Q:D(){C.1Y=[];C.7u=1h},3B:D(a){C.1Y.3B(a)},49:D(a){G b=18 7D().dG();G c=(1m a.J.3w=="2J")?a.J.3w:a.J.3w.1B;4V(c){1F"ie":C.1Y.aR(D(e){E e.6Y=="aL"}).1j(D(e){e.5q+=a.5w;e.5w+=a.5w});1C;1F"5Q-2t":b=C.1Y.69("5q").5J()||b;1C;1F"3r":b=C.1Y.69("5w").5J()||b;1C}a.5q+=b;a.5w+=b;if(!a.J.3w.aT||(C.1Y.Y<a.J.3w.aT)){C.1Y.1f(a)}if(!C.7u){C.7u=8N(C.72.1o(C),15)}},3C:D(a){C.1Y=C.1Y.6u(D(e){E e==a});if(C.1Y.Y==0){dt(C.7u);C.7u=1h}},72:D(){G a=18 7D().dG();1g(G i=0,82=C.1Y.Y;i<82;i++){C.1Y[i]&&C.1Y[i].72(a)}}});11.8R={8Q:$H(),6X:D(a){if(1m a!="2J"){E a}if(!C.8Q[a]){C.8Q[a]=18 11.aM()}E C.8Q[a]}};11.ic=11.8R.6X("84");11.dF={3y:11.3U.5T,2m:1,dE:3I,3f:17,31:0,3p:1,3J:0,3w:"ia"};11.2E=D(){};11.2E.1c={1B:1h,1T:D(c){D 8e(a,b){E((a[b+"8P"]?"C.J."+b+"8P(C);":"")+(a[b]?"C.J."+b+"(C);":""))}if(c.3y===17){c.3y=11.3U.dL}C.J=V.O(V.O({},11.dF),c||{});C.aH=0;C.6Y="aL";C.5q=C.J.3J*2W;C.5w=C.5q+(C.J.2m*2W);C.dD=C.J.3p-C.J.31;C.dC=C.5w-C.5q;C.dB=C.J.dE*C.J.2m;85("C.4z = D(7t){ "+"if(C.6Y==\\"aL\\"){C.6Y=\\"dA\\";"+8e(c,"6b")+(C.6d?"C.6d();":"")+8e(c,"aG")+"};if(C.6Y==\\"dA\\"){"+"7t=C.J.3y(7t)*"+C.dD+"+"+C.J.31+";"+"C.1B=7t;"+8e(c,"i8")+(C.1G?"C.1G(7t);":"")+8e(c,"i7")+"}}");C.4e("i6");if(!C.J.3f){11.8R.6X(1m C.J.3w=="2J"?"84":C.J.3w.7x).49(C)}},72:D(a){if(a>=C.5q){if(a>=C.5w){C.4z(1);C.7b();C.4e("dz");if(C.5H){C.5H()}C.4e("aE");E}G b=(a-C.5q)/C.dC,aD=1S.3e(b*C.dB);if(aD>C.aH){C.4z(b);C.aH=aD}}},7b:D(){if(!C.J.3f){11.8R.6X(1m C.J.3w=="2J"?"84":C.J.3w.7x).3C(C)}C.6Y="i5"},4e:D(a){if(C.J[a+"8P"]){C.J[a+"8P"](C)}if(C.J[a]){C.J[a](C)}},2i:D(){G a=$H();1g(8M in C){if(1m C[8M]!="D"){a[8M]=C[8M]}}E"#<11:"+a.2i()+",J:"+$H(C.J).2i()+">"}};11.5G=1H.1D();V.O(V.O(11.5G.1c,11.2E.1c),{1Q:D(a){C.1Y=a||[];C.1T(1b[1])},1G:D(a){C.1Y.89("4z",a)},5H:D(b){C.1Y.1j(D(a){a.4z(1);a.7b();a.4e("dz");if(a.5H){a.5H(b)}a.4e("aE")})}});11.1a=1H.1D();V.O(V.O(11.1a.1c,11.2E.1c),{1Q:D(){G a=V.O({2m:0},1b[0]||{});C.1T(a)},1G:1k.4b});11.4i=1H.1D();V.O(V.O(11.4i.1c,11.2E.1c),{1Q:D(a){C.M=$(a);if(!C.M){2u(11.6z);}if(1k.1Z.4j&&(!C.M.at.dy)){C.M.1J({aW:1})}G b=V.O({31:C.M.8c()||0,3p:1},1b[1]||{});C.1T(b)},1G:D(a){C.M.6v(a)}});11.3d=1H.1D();V.O(V.O(11.3d.1c,11.2E.1c),{1Q:D(a){C.M=$(a);if(!C.M){2u(11.6z);}G b=V.O({x:0,y:0,dx:"74"},1b[1]||{});C.1T(b)},6d:D(){C.M.3u();C.7p=3x(C.M.1t("1s")||"0");C.7o=3x(C.M.1t("1q")||"0");if(C.J.dx=="3i"){C.J.x=C.J.x-C.7p;C.J.y=C.J.y-C.7o}},1G:D(a){C.M.1J({1s:1S.3e(C.J.x*a+C.7p)+"1K",1q:1S.3e(C.J.y*a+C.7o)+"1K"})}});11.i2=D(a,b,c){E 18 11.3d(a,V.O({x:c,y:b},1b[3]||{}))};11.3P=1H.1D();V.O(V.O(11.3P.1c,11.2E.1c),{1Q:D(a,b){C.M=$(a);if(!C.M){2u(11.6z);}G c=V.O({4q:19,7n:19,4I:19,8L:17,58:"aA",6g:3I,hZ:b},1b[2]||{});C.1T(c)},6d:D(){C.43=C.J.43||17;C.hY=C.M.1t("1B");C.du={};["1q","1s","1A","1r","5M"].1j(D(k){C.du[k]=C.M.12[k]}.1o(C));C.7o=C.M.57;C.7p=C.M.5p;G b=C.M.1t("nK-8K")||"3I%";["em","1K","%","hW"].1j(D(a){if(b.2G(a)>0){C.5M=3x(b);C.hV=a}}.1o(C));C.hU=(C.J.hZ-C.J.6g)/3I;C.4h=1h;if(C.J.58=="aA"){C.4h=[C.M.3h,C.M.3v]}if(/^7W/.48(C.J.58)){C.4h=[C.M.hS,C.M.nI]}if(!C.4h){C.4h=[C.J.58.aw,C.J.58.av]}},1G:D(a){G b=(C.J.6g/3I)+(C.hU*a);if(C.J.4I&&C.5M){C.M.1J({5M:C.5M*b+C.hV})}C.hR(C.4h[0]*b,C.4h[1]*b)},5H:D(a){if(C.43){C.M.1J(C.du)}},hR:D(a,b){G d={};if(C.J.4q){d.1A=1S.3e(b)+"1K"}if(C.J.7n){d.1r=1S.3e(a)+"1K"}if(C.J.8L){G c=(a-C.4h[0])/2;G e=(b-C.4h[1])/2;if(C.hY=="3i"){if(C.J.7n){d.1q=C.7o-c+"1K"}if(C.J.4q){d.1s=C.7p-e+"1K"}}1e{if(C.J.7n){d.1q=-c+"1K"}if(C.J.4q){d.1s=-e+"1K"}}}C.M.1J(d)}});11.au=1H.1D();V.O(V.O(11.au.1c,11.2E.1c),{1Q:D(a){C.M=$(a);if(!C.M){2u(11.6z);}G b=V.O({9V:"#nD"},1b[1]||{});C.1T(b)},6d:D(){if(C.M.1t("3q")=="3W"){C.7b();E}C.dp={};if(!C.J.nC){C.dp.hP=C.M.1t("as-nB");C.M.1J({hP:"3W"})}if(!C.J.aq){C.J.aq=C.M.1t("as-55").5g("#hN")}if(!C.J.ap){C.J.ap=C.M.1t("as-55")}C.dn=$R(0,2).1O(D(i){E 4F(C.J.9V.3G(i*2+1,i*2+3),16)}.1o(C));C.hM=$R(0,2).1O(D(i){E 4F(C.J.aq.3G(i*2+1,i*2+3),16)-C.dn[i]}.1o(C))},1G:D(a){C.M.1J({51:$R(0,2).4A("#",D(m,v,i){E m+(1S.3e(C.dn[i]+(C.hM[i]*a)).6P())}.1o(C))})},5H:D(){C.M.1J(V.O(C.dp,{51:C.J.ap}))}});11.hL=1H.1D();V.O(V.O(11.hL.1c,11.2E.1c),{1Q:D(a){C.M=$(a);C.1T(1b[1]||{})},6d:D(){1x.4R();G a=1x.3E(C.M);if(C.J.2y){a[1]+=C.J.2y}G b=1p.dl?1p.1r-1p.dl:1d.26.hS-(1d.3m.53?1d.3m.53:1d.26.53);C.cW=1x.7M;C.7a=(a[1]>b?b:a[1])-C.cW},1G:D(a){1x.4R();1p.7v(1x.7N,C.cW+(a*C.7a))}});11.aU=D(b){b=$(b);G c=b.4N();G d=V.O({31:b.8c()||1,3p:0,2a:D(a){if(a.J.3p!=0){E}a.M.21().1J({2d:c})}},1b[1]||{});E 18 11.4i(b,d)};11.8V=D(b){b=$(b);G c=V.O({31:(b.1t("3q")=="3W"?0:b.8c()||0),3p:1,2a:D(a){a.M.bZ()},6b:D(a){a.M.6v(a.J.31).2w()}},1b[1]||{});E 18 11.4i(b,c)};11.ny=D(b){b=$(b);G c={2d:b.4N(),1B:b.1t("1B"),1q:b.12.1q,1s:b.12.1s,1A:b.12.1A,1r:b.12.1r};E 18 11.5G([18 11.3P(b,f1,{3f:19,8L:19,4I:19,43:19}),18 11.4i(b,{3f:19,3p:0})],V.O({2m:1,nx:D(a){1x.bo(a.1Y[0].M)},2a:D(a){a.1Y[0].M.21().1J(c)}},1b[1]||{}))};11.fm=D(b){b=$(b);b.4B();E 18 11.3P(b,0,V.O({4I:17,4q:17,43:19,2a:D(a){a.M.21().4x()}},1b[1]||{}))};11.dO=D(b){b=$(b);G c=b.64();E 18 11.3P(b,3I,V.O({4I:17,4q:17,6g:0,58:{aw:c.1r,av:c.1A},43:19,aG:D(a){a.M.4B().1J({1r:"dj"}).2w()},2a:D(a){a.M.4x()}},1b[1]||{}))};11.nw=D(c){c=$(c);G d=c.4N();E 18 11.8V(c,V.O({2m:0.4,31:0,3y:11.3U.dK,2a:D(b){18 11.3P(b.M,1,{2m:0.3,8L:19,4q:17,4I:17,43:19,6b:D(a){a.M.3u().4B()},2a:D(a){a.M.21().4x().4D().1J({2d:d})}})}},1b[1]||{}))};11.nv=D(b){b=$(b);G c={1q:b.1t("1q"),1s:b.1t("1s"),2d:b.4N()};E 18 11.5G([18 11.3d(b,{x:0,y:3I,3f:19}),18 11.4i(b,{3f:19,3p:0})],V.O({2m:0.5,6b:D(a){a.1Y[0].M.3u()},2a:D(a){a.1Y[0].M.21().4D().1J(c)}},1b[1]||{}))};11.nu=D(g){g=$(g);G h={1q:g.1t("1q"),1s:g.1t("1s")};E 18 11.3d(g,{x:20,y:0,2m:0.hJ,2a:D(f){18 11.3d(f.M,{x:-40,y:0,2m:0.1,2a:D(e){18 11.3d(e.M,{x:40,y:0,2m:0.1,2a:D(d){18 11.3d(d.M,{x:-40,y:0,2m:0.1,2a:D(c){18 11.3d(c.M,{x:40,y:0,2m:0.1,2a:D(b){18 11.3d(b.M,{x:-20,y:0,2m:0.hJ,2a:D(a){a.M.4D().1J(h)}})}})}})}})}})}})};11.dQ=D(b){b=$(b).6T();G c=b.3b().1t("3z");G d=b.64();E 18 11.3P(b,3I,V.O({4I:17,4q:17,6g:1p.4m?0:1,58:{aw:d.1r,av:d.1A},43:19,aG:D(a){a.M.3u();a.M.3b().3u();if(1p.4m){a.M.1J({1q:""})}a.M.4B().1J({1r:"dj"}).2w()},hI:D(a){a.M.3b().1J({3z:(a.4h[0]-a.M.53)+"1K"})},2a:D(a){a.M.4x().4D();a.M.3b().4D().1J({3z:c})}},1b[1]||{}))};11.dP=D(b){b=$(b).6T();G c=b.3b().1t("3z");E 18 11.3P(b,1p.4m?0:1,V.O({4I:17,4q:17,58:"aA",6g:3I,43:19,hH:D(a){a.M.3u();a.M.3b().3u();if(1p.4m){a.M.1J({1q:""})}a.M.4B().2w()},hI:D(a){a.M.3b().1J({3z:(a.4h[0]-a.M.53)+"1K"})},2a:D(a){a.M.21().4x().4D().1J({3z:c});a.M.3b().4D()}},1b[1]||{}))};11.ns=D(b){E 18 11.3P(b,1p.4m?1:0,{43:19,6b:D(a){a.M.4B()},2a:D(a){a.M.21().4x()}})};11.nr=D(c){c=$(c);G d=V.O({aj:"ai",ah:11.3U.5T,ag:11.3U.5T,af:11.3U.dH},1b[1]||{});G e={1q:c.12.1q,1s:c.12.1s,1r:c.12.1r,1A:c.12.1A,2d:c.4N()};G f=c.64();G g,6n;G h,3t;4V(d.aj){1F"1q-1s":g=6n=h=3t=0;1C;1F"1q-5F":g=f.1A;6n=3t=0;h=-f.1A;1C;1F"3z-1s":g=h=0;6n=f.1r;3t=-f.1r;1C;1F"3z-5F":g=f.1A;6n=f.1r;h=-f.1A;3t=-f.1r;1C;1F"ai":g=f.1A/2;6n=f.1r/2;h=-f.1A/2;3t=-f.1r/2;1C}E 18 11.3d(c,{x:g,y:6n,2m:0.nk,6b:D(a){a.M.21().4B().3u()},2a:D(b){18 11.5G([18 11.4i(b.M,{3f:19,3p:1,31:0,3y:d.af}),18 11.3d(b.M,{x:h,y:3t,3f:19,3y:d.ah}),18 11.3P(b.M,3I,{58:{aw:f.1r,av:f.1A},3f:19,6g:1p.4m?1:0,3y:d.ag,43:19})],V.O({6b:D(a){a.1Y[0].M.1J({1r:"dj"}).2w()},2a:D(a){a.1Y[0].M.4x().4D().1J(e)}},d))}})};11.ni=D(b){b=$(b);G c=V.O({aj:"ai",ah:11.3U.5T,ag:11.3U.5T,af:11.3U.3W},1b[1]||{});G d={1q:b.12.1q,1s:b.12.1s,1r:b.12.1r,1A:b.12.1A,2d:b.4N()};G e=b.64();G f,3t;4V(c.aj){1F"1q-1s":f=3t=0;1C;1F"1q-5F":f=e.1A;3t=0;1C;1F"3z-1s":f=0;3t=e.1r;1C;1F"3z-5F":f=e.1A;3t=e.1r;1C;1F"ai":f=e.1A/2;3t=e.1r/2;1C}E 18 11.5G([18 11.4i(b,{3f:19,3p:0,31:1,3y:c.af}),18 11.3P(b,1p.4m?1:0,{3f:19,3y:c.ag,43:19}),18 11.3d(b,{x:f,y:3t,3f:19,3y:c.ah})],V.O({hH:D(a){a.1Y[0].M.3u().4B()},2a:D(a){a.1Y[0].M.21().4x().4D().1J(d)}},c))};11.nh=D(b){b=$(b);G c=1b[1]||{};G d=b.4N();G e=c.3y||11.3U.5T;G f=D(a){E e(1-11.3U.dJ(a,c.ne))};f.1o(e);E 18 11.4i(b,V.O(V.O({2m:2,31:0,2a:D(a){a.M.1J({2d:d})}},c),{3y:f}))};11.nd=D(c){c=$(c);G d={1q:c.12.1q,1s:c.12.1s,1A:c.12.1A,1r:c.12.1r};c.4B();E 18 11.3P(c,5,V.O({4I:17,4q:17,2a:D(b){18 11.3P(c,1,{4I:17,7n:17,2a:D(a){a.M.21().4x().1J(d)}})}},1b[1]||{}))};11.ad=1H.1D();V.O(V.O(11.ad.1c,11.2E.1c),{1Q:D(c){C.M=$(c);if(!C.M){2u(11.6z);}G d=V.O({12:{}},1b[1]||{});if(1m d.12=="2J"){if(d.12.2G(":")==-1){G e="",6l="."+d.12;$A(1d.nb).6q().1j(D(b){if(b.8C){8C=b.8C}1e{if(b.hD){8C=b.hD}}$A(8C).6q().1j(D(a){if(6l==a.n7){e=a.12.hm;2u $1C;}});if(e){2u $1C;}});C.12=e.dd();d.2a=D(b){b.M.4w(b.J.12);b.ab.1j(D(a){if(a.12!="2d"){b.M.12[a.12]=""}})}}1e{C.12=d.12.dd()}}1e{C.12=$H(d.12)}C.1T(d)},6d:D(){D 5g(a){if(!a||["n3(0, 0, 0, 0)","hB"].25(a)){a="#hN"}a=a.5g();E $R(0,2).1O(D(i){E 4F(a.3G(i*2+1,i*2+3),16)})}C.ab=C.12.1O(D(a){G b=a[0],1l=a[1],4H=1h;if(1l.5g("#hA")!="#hA"){1l=1l.5g();4H="55"}1e{if(b=="2d"){1l=3x(1l);if(1k.1Z.4j&&(!C.M.at.dy)){C.M.1J({aW:1})}}1e{if(N.hz.48(1l)){G c=1l.1E(/^([\\+\\-]?[0-9\\.]+)(.*)$/);1l=3x(c[1]);4H=(c.Y==3)?c[2]:1h}}}G d=C.M.1t(b);E{12:b.7f(),4l:4H=="55"?5g(d):3x(d||0),6s:4H=="55"?5g(1l):1l,4H:4H}}.1o(C)).6u(D(a){E((a.4l==a.6s)||(a.4H!="55"&&(hx(a.4l)||hx(a.6s))))})},1G:D(a){G b={},2P,i=C.ab.Y;1R(i--){b[(2P=C.ab[i]).12]=2P.4H=="55"?"#"+(1S.3e(2P.4l[0]+(2P.6s[0]-2P.4l[0])*a)).6P()+(1S.3e(2P.4l[1]+(2P.6s[1]-2P.4l[1])*a)).6P()+(1S.3e(2P.4l[2]+(2P.6s[2]-2P.4l[2])*a)).6P():2P.4l+1S.3e(((2P.6s-2P.4l)*a)*2W)/2W+2P.4H}C.M.1J(b,19)}});11.hw=1H.1D();V.O(11.hw.1c,{1Q:D(a){C.4o=[];C.J=1b[1]||{};C.hv(a)},hv:D(c){c.1j(D(a){G b=$H(a).29().3D();C.4o.1f($H({dc:$H(a).bJ().3D(),6y:11.ad,J:{12:b}}))}.1o(C));E C},dw:D(){E 18 11.5G(C.4o.1O(D(a){G b=[$(a.dc)||$$(a.dc)].4f();E b.1O(D(e){E 18 a.6y(e,V.O({3f:19},a.J))})}).4f(),C.J)}});N.hu=$w("51 mV mU mS "+"mR mP mO mM "+"mL mK mJ mI "+"mH mG mF 3z mE 55 "+"5M mD 1r 1s mC mB "+"mA mz my mx mw mu "+"mt ms mr 2d mq mp "+"mo mn ml mk mj "+"5F mi 1q 1A mh 8x");N.hz=/^(([\\+\\-]?[0-9\\.]+)(em|ex|1K|in|cm|mm|hW|mg|\\%))|0$/;2F.1c.dd=D(){G b=1d.23("2Q");b.2q="<2Q 12=\\""+C+"\\"></2Q>";G c=b.2k[0].12,91=$H();N.hu.1j(D(a){if(c[a]){91[a]=c[a]}});if(1k.1Z.4j&&C.2G("2d")>-1){91.2d=C.1E(/2d:\\s*((?:0|1)?(?:\\.\\d*)?)/)[1]}E 91};N.hf=D(a,b){18 11.ad(a,V.O({12:b},1b[2]||{}));E a};["4N","bZ","dY","94","92","hf"].1j(D(f){N.1v[f]=N[f]});N.1v.mf=D(a,b,c){s=b.eP().7f();hd=s.6o(0).2h()+s.7j(1);18 11[hd](a,c);E $(a)};N.d3();if(1m 11=="1P"){2u("md.js b1 b0 7l.bN.aZ\' 1Y.js aY");}G 3F={6N:[],3C:D(a){C.6N=C.6N.6u(D(d){E d.M==$(a)})},49:D(a){a=$(a);G b=V.O({ma:19,4y:1h,3j:17},1b[1]||{});if(b.6i){b.8u=[];G d=b.6i;if((1m d=="3R")&&(d.5y==1W)){d.1j(D(c){b.8u.1f($(c))})}1e{b.8u.1f($(d))}}if(b.7z){b.7z=[b.7z].4f()}N.3u(a);b.M=a;C.6N.1f(b)},hb:D(a){9Y=a[0];1g(i=1;i<a.Y;++i){if(N.7F(a[i].M,9Y.M)){9Y=a[i]}}E 9Y},ha:D(a,b){G d;if(b.3j){d=a.cY}1e{d=a.1z}E b.8u.6w(D(c){E d==c})},cX:D(a,b,c){E((c.M!=b)&&((!c.8u)||C.ha(b,c))&&((!c.7z)||(N.6R(b).6w(D(v){E c.7z.25(v)})))&&1x.bs(c.M,a[0],a[1]))},8s:D(a){if(a.4y){N.6c(a.M,a.4y)}C.4c=1h},5k:D(a){if(a.4y){N.4w(a.M,a.4y)}C.4c=a},2w:D(b,c){if(!C.6N.Y){E}G d=[];if(C.4c){C.8s(C.4c)}C.6N.1j(D(a){if(3F.cX(b,c,a)){d.1f(a)}});if(d.Y>0){5C=3F.hb(d);1x.bs(5C.M,b[0],b[1]);if(5C.5i){5C.5i(c,5C.M,1x.3H(5C.3H,5C.M))}3F.5k(5C)}},h6:D(a,b){if(!C.4c){E}1x.4R();if(C.cX([1a.5X(a),1a.5W(a)],b,C.4c)){if(C.4c.h5){C.4c.h5(b,C.4c.M,a);E 19}}},7s:D(){if(C.4c){C.8s(C.4c)}}};G 1U={6A:[],2U:[],9T:D(a){if(C.6A.Y==0){C.6B=C.6H.2T(C);C.6K=C.9W.2T(C);C.cV=C.95.2T(C);1a.1X(1d,"96",C.6B);1a.1X(1d,"97",C.6K);1a.1X(1d,"7R",C.cV)}C.6A.1f(a)},cO:D(a){C.6A=C.6A.6u(D(d){E d==a});if(C.6A.Y==0){1a.2C(1d,"96",C.6B);1a.2C(1d,"97",C.6K);1a.2C(1d,"7R",C.cV)}},5k:D(a){if(a.J.3J){C.7B=3A(D(){1U.7B=1h;1p.7g();1U.4K=a}.1o(C),a.J.3J)}1e{1p.7g();C.4K=a}},8s:D(){C.4K=1h},9W:D(a){if(!C.4K){E}G b=[1a.5X(a),1a.5W(a)];if(C.6E&&(C.6E.2i()==b.2i())){E}C.6E=b;C.4K.9W(a,b)},6H:D(a){if(C.7B){9n(C.7B);C.7B=1h}if(!C.4K){E}C.6E=1h;C.4K.6H(a);C.4K=1h},95:D(a){if(C.4K){C.4K.95(a)}},e3:D(a){C.2U.1f(a);C.cT()},gW:D(a){C.2U=C.2U.6u(D(o){E o.M==a});C.cT()},8q:D(a,b,c){if(C[a+"e4"]>0){C.2U.1j(D(o){if(o[a]){o[a](a,b,c)}})}if(b.J[a]){b.J[a](b,c)}},cT:D(){["ba","bd","bb"].1j(D(a){1U[a+"e4"]=1U.2U.2A(D(o){E o[a]}).Y})}};G 5m=1H.1D();5m.8p={};5m.1c={1Q:D(e){G f={2z:17,5R:D(a,b,c){G d=1S.lX(1S.9c(b^2)+1S.9c(c^2))*0.lW;18 11.3d(a,{x:-c,y:-b,2m:d,3w:{7x:"eb",1B:"3r"}})},5S:D(a){G b=1m a.99=="aO"?a.99:1;18 11.4i(a,{2m:0.2,31:0.7,3p:b,3w:{7x:"eb",1B:"3r"},aE:D(){5m.8p[a]=17}})},6p:2W,be:17,6D:17,1I:17,44:20,2X:15,4O:17,3J:0};if(!1b[1]||1m 1b[1].5S=="1P"){V.O(f,{6F:D(a){a.99=N.8c(a);5m.8p[a]=19;18 11.4i(a,{2m:0.2,31:a.99,3p:0.7})}})}G g=V.O(f,1b[1]||{});C.M=$(e);if(g.2z&&(1m g.2z=="2J")){C.2z=C.M.3b("."+g.2z,0)}if(!C.2z){C.2z=$(g.2z)}if(!C.2z){C.2z=C.M}if(g.1I&&!g.1I.7v&&!g.1I.bg){g.1I=$(g.1I);C.cQ=N.hT(C.M,g.1I)}N.3u(C.M);C.7a=C.9a();C.J=g;C.3V=17;C.5d=C.gH.2T(C);1a.1X(C.2z,"6I",C.5d);1U.9T(C)},9S:D(){1a.2C(C.2z,"6I",C.5d);1U.cO(C)},9a:D(){E([4F(N.1t(C.M,"1s")||"0"),4F(N.1t(C.M,"1q")||"0")])},gH:D(a){if(1m 5m.8p[C.M]!="1P"&&5m.8p[C.M]){E}if(1a.bC(a)){G b=1a.M(a);if((6G=b.1L.2h())&&(6G=="b2"||6G=="d0"||6G=="bm"||6G=="ea"||6G=="90")){E}G c=[1a.5X(a),1a.5W(a)];G d=1x.3E(C.M);C.2y=[0,1].1O(D(i){E(c[i]-d[i])});1U.5k(C);1a.2H(a)}},9R:D(a){C.3V=19;if(C.J.6p){C.gF=4F(N.1t(C.M,"z-2p")||0);C.M.12.8x=C.J.6p}if(C.J.5B){C.9Q=C.M.lQ(19);1x.bo(C.M);C.M.1z.4P(C.9Q,C.M)}if(C.J.1I){if(C.J.1I==1p){G b=C.9k(C.J.1I);C.cK=b.1s;C.bu=b.1q}1e{C.cK=C.J.1I.42;C.bu=C.J.1I.3N}}1U.8q("ba",C,a);if(C.J.6F){C.J.6F(C.M)}},9W:D(a,b){if(!C.3V){C.9R(a)}if(!C.J.6D){1x.4R();3F.2w(b,C.M)}1U.8q("bb",C,a);C.7U(b);if(C.J.8b){C.J.8b(C)}if(C.J.1I){C.bx();G p;if(C.J.1I==1p){5Q(C.9k(C.J.1I)){p=[1s,1q,1s+1A,1q+1r]}}1e{p=1x.9f(C.J.1I);p[0]+=C.J.1I.42+1x.7N;p[1]+=C.J.1I.3N+1x.7M;p.1f(p[0]+C.J.1I.3v);p.1f(p[1]+C.J.1I.3h)}G c=[0,0];if(b[0]<(p[0]+C.J.44)){c[0]=b[0]-(p[0]+C.J.44)}if(b[1]<(p[1]+C.J.44)){c[1]=b[1]-(p[1]+C.J.44)}if(b[0]>(p[2]-C.J.44)){c[0]=b[0]-(p[2]-C.J.44)}if(b[1]>(p[3]-C.J.44)){c[1]=b[1]-(p[3]-C.J.44)}C.gC(c)}if(1k.1Z.47){1p.b5(0,0)}1a.2H(a)},7P:D(a,b){C.3V=17;if(C.J.6D){1x.4R();G c=[1a.5X(a),1a.5W(a)];3F.2w(c,C.M)}if(C.J.5B){1x.eo(C.M);N.3C(C.9Q);C.9Q=1h}G e=17;if(b){e=3F.h6(a,C.M);if(!e){e=17}}if(e&&C.J.gB){C.J.gB(C.M)}1U.8q("bd",C,a);G f=C.J.be;if(f&&1m f=="D"){f=f(C.M)}G d=C.9a();if(f&&C.J.5R){if(e==0||f!="7X"){C.J.5R(C.M,d[1]-C.7a[1],d[0]-C.7a[0])}}1e{C.7a=d}if(C.J.6p){C.M.12.8x=C.gF}if(C.J.5S){C.J.5S(C.M)}1U.8s(C);3F.7s()},95:D(a){if(a.7O!=1a.bE){E}C.7P(a,17);1a.2H(a)},6H:D(a){if(!C.3V){E}C.bx();C.7P(a,19);1a.2H(a)},7U:D(a){G b=1x.3E(C.M);if(C.J.5B){G r=1x.bt(C.M);b[0]+=r[0]-1x.7N;b[1]+=r[1]-1x.7M}G d=C.9a();b[0]-=d[0];b[1]-=d[1];if(C.J.1I&&(C.J.1I!=1p&&C.cQ)){b[0]-=C.J.1I.42-C.cK;b[1]-=C.J.1I.3N-C.bu}G p=[0,1].1O(D(i){E(a[i]-b[i]-C.2y[i])}.1o(C));if(C.J.4O){if(1m C.J.4O=="D"){p=C.J.4O(p[0],p[1],C)}1e{if(C.J.4O 4E 1W){p=p.1O(D(v,i){E 1S.3e(v/C.J.4O[i])*C.J.4O[i]}.1o(C))}1e{p=p.1O(D(v){E 1S.3e(v/C.J.4O)*C.J.4O}.1o(C))}}}G c=C.M.12;if((!C.J.6k)||(C.J.6k=="9g")){c.1s=p[0]+"1K"}if((!C.J.6k)||(C.J.6k=="6J")){c.1q=p[1]+"1K"}if(c.5I=="5x"){c.5I=""}},bx:D(){if(C.9N){dt(C.9N);C.9N=1h;1U.4C=1h}},gC:D(a){if(!(a[0]||a[1])){E}C.2X=[a[0]*C.J.2X,a[1]*C.J.2X];C.cI=18 7D();C.9N=8N(C.1I.1o(C),10)},1I:D(){G a=18 7D();G b=a-C.cI;C.cI=a;if(C.J.1I==1p){5Q(C.9k(C.J.1I)){if(C.2X[0]||C.2X[1]){G d=b/2W;C.J.1I.7v(1s+d*C.2X[0],1q+d*C.2X[1])}}}1e{C.J.1I.42+=C.2X[0]*b/2W;C.J.1I.3N+=C.2X[1]*b/2W}1x.4R();3F.2w(1U.6E,C.M);1U.8q("bb",C);if(C.cQ){1U.4C=1U.4C||$A(1U.6E);1U.4C[0]+=C.2X[0]*b/2W;1U.4C[1]+=C.2X[1]*b/2W;if(1U.4C[0]<0){1U.4C[0]=0}if(1U.4C[1]<0){1U.4C[1]=0}C.7U(1U.4C)}if(C.J.8b){C.J.8b(C)}},9k:D(w){G T,L,W,H;5Q(w.1d){if(w.1d.3m&&3m.3N){T=3m.3N;L=3m.42}1e{if(w.1d.26){T=26.3N;L=26.42}}if(w.gx){W=w.gx;H=w.dl}1e{if(w.1d.3m&&3m.7r){W=3m.7r;H=3m.53}1e{W=26.3v;H=26.3h}}}E{1q:T,1s:L,1A:W,1r:H}}};G bB=1H.1D();bB.1c={1Q:D(a,b){C.M=$(a);C.76=b;C.3l=1y.4J(C.M)},ba:D(){C.3l=1y.4J(C.M)},bd:D(){1y.5n();if(C.3l!=1y.4J(C.M)){C.76(C.M)}}};G 1y={gw:/^[^3T\\-](?:[A-lM-lK-9\\-\\3T]*)[3T](.*)$/,8J:{},gv:D(a){1R(a.1L.2h()!="9j"){if(a.id&&1y.8J[a.id]){E a}a=a.1z}},J:D(a){a=1y.gv($(a));if(!a){E}E 1y.8J[a.id]},9S:D(a){G s=1y.J(a);if(s){1U.gW(s.M);s.83.1j(D(d){3F.3C(d)});s.cG.89("9S");a2 1y.8J[s.M.id]}},1D:D(b){b=$(b);G c=V.O({M:b,6O:"li",gu:17,3j:17,8l:"cF",3H:"6J",6k:"6J",6i:b,2z:17,3Z:17,3J:0,4y:1h,5B:17,6D:17,1I:17,44:20,2X:15,5r:C.gw,8v:17,2g:17,52:1k.4b,gp:1k.4b},1b[1]||{});C.9S(b);G d={be:19,6D:c.6D,1I:c.1I,2X:c.2X,44:c.44,3J:c.3J,5B:c.5B,6k:c.6k,2z:c.2z};if(c.6F){d.6F=c.6F}if(c.5R){d.5R=c.5R}1e{if(c.5B){d.5R=D(a){a.12.1q=0;a.12.1s=0}}}if(c.5S){d.5S=c.5S}if(c.6p){d.6p=c.6p}G f={3H:c.3H,6i:c.6i,3j:c.3j,4y:c.4y,5i:1y.5i};G g={5i:1y.go,3H:c.3H,6i:c.6i,4y:c.4y};N.6T(b);c.cG=[];c.83=[];if(c.gu||c.3j){3F.49(b,g);c.83.1f(b)}(c.8v||C.4p(b,c)||[]).1j(D(e,i){G a=c.2g?$(c.2g[i]):(c.2z?$(e).6L(c.2z)[0]:e);c.cG.1f(18 5m(e,V.O(d,{2z:a})));3F.49(e,f);if(c.3j){e.cY=b}c.83.1f(e)});if(c.3j){(1y.eT(b,c)||[]).1j(D(e){3F.49(e,g);e.cY=b;c.83.1f(e)})}C.8J[b.id]=c;1U.e3(18 bB(b,c.gp))},4p:D(a,b){E N.9p(a,b.3Z,b.3j?19:17,b.6O)},eT:D(a,b){E N.9p(a,b.3Z,b.3j?19:17,b.8l)},5i:D(a,b,c){if(N.7F(b,a)){E}if(c>0.33&&c<0.66&&1y.J(b).3j){E}1e{if(c>0.5){1y.5Z(b,"lJ");if(b.b7!=a){G d=a.1z;a.12.5I="5x";b.1z.4P(a,b);if(b.1z!=d){1y.J(d).52(a)}1y.J(b.1z).52(a)}}1e{1y.5Z(b,"eX");G e=b.5K||1h;if(e!=a){G f=a.1z;a.12.5I="5x";b.1z.4P(a,e);if(b.1z!=f){1y.J(f).52(a)}1y.J(b.1z).52(a)}}}},go:D(a,b,c){G d=a.1z;G e=1y.J(b);if(!N.7F(b,a)){G f;G g=1y.4p(b,{6O:e.6O,3Z:e.3Z});G h=1h;if(g){G i=N.8k(b,e.3H)*(1-c);1g(f=0;f<g.Y;f+=1){if(i-N.8k(g[f],e.3H)>=0){i-=N.8k(g[f],e.3H)}1e{if(i-(N.8k(g[f],e.3H)/2)>=0){h=f+1<g.Y?g[f+1]:1h;1C}1e{h=g[f];1C}}}}b.4P(a,h);1y.J(d).52(a);e.52(a)}},5n:D(){if(1y.4Z){1y.4Z.21()}},5Z:D(a,b){G c=1y.J(a.1z);if(c&&!c.5B){E}if(!1y.4Z){1y.4Z=($("gk")||N.O(1d.23("e8"))).21().4w("gk").1J({1B:"3i"});1d.3Y("26").lF(0).24(1y.4Z)}G d=1x.3E(a);1y.4Z.1J({1s:d[0]+"1K",1q:d[1]+"1K"});if(b=="eX"){if(c.3H=="9g"){1y.4Z.1J({1s:(d[0]+a.7r)+"1K"})}1e{1y.4Z.1J({1q:(d[1]+a.53)+"1K"})}}1y.4Z.2w()},cB:D(a,b,c){G d=1y.4p(a,b)||[];1g(G i=0;i<d.Y;++i){G e=d[i].id.1E(b.5r);if(!e){3S}G f={id:4X(e?e[1]:1h),M:a,bK:c,6j:[],1B:c.6j.Y,5z:$(d[i]).3b(b.8l)};if(f.5z){C.cB(f.5z,b,f)}c.6j.1f(f)}E c},3j:D(a){a=$(a);G b=C.J(a);G c=V.O({6O:b.6O,8l:b.8l,3Z:b.3Z,3a:a.id,5r:b.5r},1b[1]||{});G d={id:1h,bK:1h,6j:[],5z:a,1B:0};E 1y.cB(a,c,d)},gh:D(a){G b="";do{if(a.id){b="["+a.1B+"]"+b}}1R((a=a.bK)!=1h);E b},fs:D(b){b=$(b);G c=V.O(C.J(b),1b[1]||{});E $(C.4p(b,c)||[]).1O(D(a){E a.id.1E(c.5r)?a.id.1E(c.5r)[1]:""})},lC:D(b,c){b=$(b);G d=V.O(C.J(b),1b[2]||{});G e={};C.4p(b,d).1j(D(n){if(n.id.1E(d.5r)){e[n.id.1E(d.5r)[1]]=[n,n.1z]}n.1z.7E(n)});c.1j(D(a){G n=e[a];if(n){n[1].24(n[0]);a2 e[a]}})},4J:D(b){b=$(b);G c=V.O(1y.J(b),1b[1]||{});G d=4X((1b[1]&&1b[1].3a)?1b[1].3a:b.id);if(c.3j){E 1y.3j(b,1b[1]).6j.1O(D(a){E[d+1y.gh(a)+"[id]="+4X(a.id)].2f(a.6j.1O(1b.a5))}).4f().2j("&")}1e{E 1y.fs(b,1b[1]).1O(D(a){E d+"[]="+4X(a)}).2j("&")}}};N.7F=D(a,b){if(!a.1z||a==b){E 17}if(a.1z==b){E 19}E N.7F(a.1z,b)};N.9p=D(b,c,d,f){if(!b.b6()){E 1h}f=f.2h();if(c){c=[c].4f()}G g=[];$A(b.2k).1j(D(e){if(e.1L&&e.1L.2h()==f&&(!c||(N.6R(e).6w(D(v){E c.25(v)})))){g.1f(e)}if(d){G a=N.9p(e,c,d,f);if(a){g.1f(a)}}});E(g.Y>0?g.4f():[])};N.8k=D(a,b){E a["2y"+((b=="6J"||b=="1r")?"lB":"lA")]};if(1m 11=="1P"){2u("lz.js b1 b0 7l.bN.aZ\' 1Y.js aY");}G 4U={};4U.2E=D(){};4U.2E.1c={cy:D(c,d,e){c=$(c);C.M=c;C.1G=$(d);C.6S=17;C.81=17;C.2Y=17;C.2p=0;C.5a=0;if(C.6h){C.6h(e)}1e{C.J=e||{}}C.J.73=C.J.73||C.M.3a;C.J.6e=C.J.6e||[];C.J.4r=C.J.4r||0.4;C.J.cv=C.J.cv||1;C.J.cu=C.J.cu||D(a,b){if(!b.12.1B||b.12.1B=="3i"){b.12.1B="3i";1x.3X(a,b,{bp:17,57:a.3h})}11.8V(b,{2m:0.15})};C.J.bY=C.J.bY||D(a,b){18 11.aU(b,{2m:0.15})};if(1m(C.J.6e)=="2J"){C.J.6e=18 1W(C.J.6e)}C.76=1h;C.M.6U("gf","lu");N.21(C.1G);1a.1X(C.M,"f6",C.gd.2T(C));1a.1X(C.M,"7R",C.gc.2T(C));1a.1X(1p,"ls",D(){c.6U("gf","61")})},2w:D(){if(N.1t(C.1G,"3q")=="3W"){C.J.cu(C.M,C.1G)}if(!C.5t&&(1k.1Z.4j)&&(N.1t(C.1G,"1B")=="3i")){18 2M.cw(C.1G,"<g9 id=\\""+C.1G.id+"fz\\" "+"12=\\"3q:3W;1B:3i;8I:lq:lp.gP.lo(2d=0);\\" "+"93=\\"fl:17;\\" ln=\\"0\\" lm=\\"no\\"></g9>");C.5t=$(C.1G.id+"fz")}if(C.5t){3A(C.g7.1o(C),50)}},g7:D(){1x.3X(C.1G,C.5t,{bq:(!C.1G.12.1r)});C.5t.12.8x=1;C.1G.12.8x=2;N.2w(C.5t)},21:D(){C.cr();if(N.1t(C.1G,"3q")!="3W"){C.J.bY(C.M,C.1G)}if(C.5t){N.21(C.5t)}},g6:D(){if(C.J.9E){N.2w(C.J.9E)}},cr:D(){if(C.J.9E){N.21(C.J.9E)}},gc:D(a){if(C.2Y){4V(a.7O){1F 1a.bG:1F 1a.bF:C.9A();1a.2H(a);1F 1a.bE:C.21();C.2Y=17;1a.2H(a);E;1F 1a.eV:1F 1a.eS:E;1F 1a.eU:C.g4();C.4z();if(1k.1Z.47){1a.2H(a)}E;1F 1a.eQ:C.fL();C.4z();if(1k.1Z.47){1a.2H(a)}E}}1e{if(a.7O==1a.bG||a.7O==1a.bF||(1k.1Z.47>0&&a.7O==0)){E}}C.81=19;C.6S=19;if(C.76){9n(C.76)}C.76=3A(C.g3.1o(C),C.J.4r*2W)},5k:D(){C.81=17;C.6S=19;C.9B()},5i:D(a){G b=1a.5o(a,"b9");if(C.2p!=b.9D){C.2p=b.9D;C.4z()}1a.2H(a)},g2:D(a){G b=1a.5o(a,"b9");C.2p=b.9D;C.9A();C.21()},gd:D(a){3A(C.21.1o(C),lj);C.6S=17;C.2Y=17},4z:D(){if(C.5a>0){1g(G i=0;i<C.5a;i++){C.2p==i?N.4w(C.6a(i),"62"):N.6c(C.6a(i),"62")}if(C.6S){C.2w();C.2Y=19}}1e{C.2Y=17;C.21()}},g4:D(){if(C.2p>0){C.2p--}1e{C.2p=C.5a-1}C.6a(C.2p).g0(19)},fL:D(){if(C.2p<C.5a-1){C.2p++}1e{C.2p=0}C.6a(C.2p).g0(17)},6a:D(a){E C.1G.4s.2k[a]},fZ:D(){E C.6a(C.2p)},9A:D(){C.2Y=17;C.9C(C.fZ())},9C:D(a){if(C.J.9C){C.J.9C(a);E}G b="";if(C.J.2A){G c=1d.6L(C.J.2A,a)||[];if(c.Y>0){b=N.94(c[0],C.J.2A)}}1e{b=N.92(a,"lh")}G d=C.co();if(d!=-1){G e=C.M.1l.4L(0,d+1);G f=C.M.1l.4L(d+1).1E(/^\\s+/);if(f){e+=f[0]}C.M.1l=e+b}1e{C.M.1l=b}C.M.7g();if(C.J.fY){C.J.fY(C.M,a)}},cn:D(a){if(!C.81&&C.6S){C.1G.2q=a;N.6T(C.1G);N.6T(C.1G.3b());if(C.1G.4s&&C.1G.3b().2k){C.5a=C.1G.3b().2k.Y;1g(G i=0;i<C.5a;i++){G b=C.6a(i);b.9D=i;C.fW(b)}}1e{C.5a=0}C.cr();C.2p=0;if(C.5a==1&&C.J.lg){C.9A();C.21()}1e{C.4z()}}},fW:D(a){1a.1X(a,"8a",C.5i.2T(C));1a.1X(a,"6Z",C.g2.2T(C))},g3:D(){C.81=17;if(C.9F().Y>=C.J.cv){C.9B()}1e{C.2Y=17;C.21()}},9F:D(){G a=C.co();if(a!=-1){G b=C.M.1l.4L(a+1).1M(/^\\s+/,"").1M(/\\s+$/,"")}1e{G b=C.M.1l}E/\\n/.48(b)?"":b},co:D(){G a=-1;1g(G i=0;i<C.J.6e.Y;i++){G b=C.M.1l.eh(C.J.6e[i]);if(b>a){a=b}}E a}};1u.4U=1H.1D();V.O(V.O(1u.4U.1c,4U.2E.1c),{1Q:D(a,b,c,d){C.cy(a,b,d);C.J.6f=19;C.J.2e=C.2e.1o(C);C.J.cl=C.J.3g||1h;C.2Z=c},9B:D(){C.g6();G a=4X(C.J.73)+"="+4X(C.9F());C.J.3g=C.J.3o?C.J.3o(C.M,a):a;if(C.J.cl){C.J.3g+="&"+C.J.cl}18 1u.4Y(C.2Z,C.J)},2e:D(a){C.cn(a.60)}});4U.fU=1H.1D();4U.fU.1c=V.O(18 4U.2E(),{1Q:D(a,b,c,d){C.cy(a,b,d);C.J.6x=c},9B:D(){C.cn(C.J.6l(C))},6h:D(h){C.J=V.O({ck:10,fT:19,fS:2,cj:19,fR:17,6l:D(a){G b=[];G c=[];G d=a.9F();G e=0;1g(G i=0;i<a.J.6x.Y&&b.Y<a.J.ck;i++){G f=a.J.6x[i];G g=a.J.cj?f.2s().2G(d.2s()):f.2G(d);1R(g!=-1){if(g==0&&f.Y!=d.Y){b.1f("<li><9X>"+f.4L(0,d.Y)+"</9X>"+f.4L(d.Y)+"</li>");1C}1e{if(d.Y>=a.J.fS&&a.J.fT&&g!=-1){if(a.J.fR||/\\s/.48(f.4L(g-1,1))){c.1f("<li>"+f.4L(0,g)+"<9X>"+f.4L(g,d.Y)+"</9X>"+f.4L(g+d.Y)+"</li>");1C}}}g=a.J.cj?f.2s().2G(d.2s(),g+1):f.2G(d,g+1)}}if(c.Y){b=b.2f(c.3G(0,a.J.ck-b.Y))}E"<cF>"+b.2j("")+"</cF>"}},h||{})}});8E.ci=D(a){3A(D(){8E.5k(a)},1)};1u.8n=1H.1D();1u.8n.fP="#ld";1u.8n.1c={1Q:D(c,d,e){C.2Z=d;C.M=$(c);C.J=V.O({73:"1l",ch:19,cx:17,9I:"fO",cf:17,ce:19,cd:"7b",cC:"",bM:"",cD:"",fN:"l8...",fM:"l7 3p l6",9I:"fO",9K:1,2e:D(a,b){18 11.au(b,{9V:C.J.8G})},6t:D(a){l4("dZ lU 5Q l3 l2: "+a.60.9O())},3o:D(a){E 1w.4J(a)},fJ:19,gJ:"g8...",c7:"9U-78",c6:"9U-l1",gN:"9U-1V",8G:1u.8n.fP,fH:"#l0",2O:1h,c5:17,9z:{},4T:17},e||{});if(!C.J.8r&&C.M.id){C.J.8r=C.M.id+"-9U";if($(C.J.8r)){C.J.8r=1h}}if(C.J.2O){C.J.2O=$(C.J.2O)}C.6M=N.1t(C.M,"as-55");if(!C.6M){C.6M="hB"}C.M.d8=C.J.fM;C.8t=C.fF.2T(C);C.88=C.fE.2T(C);C.8z=C.a8.2T(C);1a.1X(C.M,"6Z",C.8t);1a.1X(C.M,"8a",C.88);1a.1X(C.M,"a3",C.8z);if(C.J.2O){1a.1X(C.J.2O,"6Z",C.8t);1a.1X(C.J.2O,"8a",C.88);1a.1X(C.J.2O,"a3",C.8z)}},fF:D(a){if(C.78){E}if(C.d2){E}C.d2=19;C.he();if(C.J.2O){N.21(C.J.2O)}N.21(C.M);C.fB();C.M.1z.4P(C.1V,C.M);if(!C.J.7Y){8E.ci(C.4k)}if(a){1a.2H(a)}E 17},fB:D(){C.1V=1d.23("1V");C.1V.id=C.J.8r;N.4w(C.1V,C.J.gN);C.1V.kU=C.8w.1o(C);C.c3();if(C.J.5L){G a=1d.23("br");C.1V.24(a)}if(C.J.cC){C.1V.24(1d.4M(C.J.cC))}if(C.J.ch){G b=1d.23("6r");b.1N="dg";b.1l=C.J.9I;b.2B="kT";C.1V.24(b)}if(C.J.cx){G c=1d.23("a");c.aQ="#";c.24(1d.4M(C.J.9I));c.c2=C.8w.1o(C);c.2B="kS";C.1V.24(c)}if(C.J.bM&&(C.J.cx||C.J.ch)&&(C.J.ce||C.J.cf)){C.1V.24(1d.4M(C.J.bM))}if(C.J.cf){G d=1d.23("6r");d.1N="dg";d.1l=C.J.cd;d.c2=C.c1.1o(C);d.2B="kR";C.1V.24(d)}if(C.J.ce){G e=1d.23("a");e.aQ="#";e.24(1d.4M(C.J.cd));e.c2=C.c1.1o(C);e.2B="kQ mv";C.1V.24(e)}if(C.J.cD){C.1V.24(1d.4M(C.J.cD))}},fx:D(a){if(!C.J.fJ){E 17}E a.1E(/<br/i)||a.1E(/<p>/i)},hj:D(a){E a.1M(/<br>/gi,"\\n").1M(/<br\\/>/gi,"\\n").1M(/<\\/p>/gi,"\\n").1M(/<p>/gi,"")},c3:D(){G a;if(C.J.7Y){a=C.J.gJ}1e{a=C.fw()}G b=C;if(C.J.9K==1&&!C.fx(a)){C.J.5L=17;G c=1d.23("6r");c.hi=C;c.1N="4g";c.3a=C.J.73;c.1l=a;c.12.51=C.J.8G;c.2B="fu";G d=C.J.8K||C.J.d7||0;if(d!=0){c.8K=d}if(C.J.c5){c.ft=C.8w.1o(C)}C.4k=c}1e{C.J.5L=19;G e=1d.23("5L");e.hi=C;e.3a=C.J.73;e.1l=C.hj(a);e.9K=C.J.9K;e.d7=C.J.d7||40;e.2B="fu";if(C.J.c5){e.ft=C.8w.1o(C)}C.4k=e}if(C.J.7Y){C.aN()}C.1V.24(C.4k)},fw:D(){E C.M.2q},aN:D(){N.4w(C.1V,C.J.c6);C.4k.2v=19;18 1u.4Y(C.J.7Y,V.O({6f:19,2e:C.fr.1o(C)},C.J.9z))},fr:D(a){N.6c(C.1V,C.J.c6);C.4k.2v=17;C.4k.1l=a.60.9O();8E.ci(C.4k)},c1:D(){C.2e();C.a6();E 17},6t:D(a){C.J.6t(a);if(C.5V){C.M.2q=C.5V;C.5V=1h}E 17},8w:D(){G a=C.1V;G b=C.4k.1l;C.fq();if(C.J.4T){18 1u.4Y(C.2Z,V.O({3g:C.J.3o(a,b),2e:C.2e.1o(C),6t:C.6t.1o(C),6f:19,4T:19},C.J.9z))}1e{18 1u.9o({56:C.M,7X:1h},C.2Z,V.O({3g:C.J.3o(a,b),2e:C.2e.1o(C),6t:C.6t.1o(C)},C.J.9z))}if(1b.Y>1){1a.2H(1b[0])}E 17},fq:D(){C.78=19;C.da();C.a8();C.fo()},fo:D(){C.5V=C.M.2q;C.M.2q=C.J.fN;N.4w(C.M,C.J.c7);C.M.12.51=C.6M;N.2w(C.M)},da:D(){if(C.1V){if(C.1V.1z){N.3C(C.1V)}C.1V=1h}},fE:D(){if(C.78){E}C.M.12.51=C.J.8G;if(C.6y){C.6y.7b()}N.4w(C.M,C.J.fn)},a8:D(){if(C.J.51){C.M.12.51=C.kL}N.6c(C.M,C.J.fn);if(C.78){E}C.6y=18 11.au(C.M,{9V:C.J.8G,aq:C.J.fH,ap:C.6M})},a6:D(){N.6c(C.M,C.J.c7);C.da();C.a8();C.M.12.51=C.6M;N.2w(C.M);if(C.J.2O){N.2w(C.J.2O)}C.d2=17;C.78=17;C.5V=1h;C.fk()},2e:D(a){C.a6();C.J.2e.1o(C)(a,C.M)},he:D(){},fk:D(){},ho:D(){if(C.5V){C.M.2q=C.5V}C.a6();1a.2C(C.M,"6Z",C.8t);1a.2C(C.M,"8a",C.88);1a.2C(C.M,"a3",C.8z);if(C.J.2O){1a.2C(C.J.2O,"6Z",C.8t);1a.2C(C.J.2O,"8a",C.88);1a.2C(C.J.2O,"a3",C.8z)}}};1u.bX=1H.1D();V.O(1u.bX.1c,1u.8n.1c);V.O(1u.bX.1c,{c3:D(){if(!C.d9){G c=1d.23("2A");G d=C.J.kJ||[];G f;d.1j(D(e,i){f=1d.23("kI");f.1l=(e 4E 1W)?e[0]:e;if((1m C.J.1l=="1P")&&((e 4E 1W)?C.M.2q==e[1]:e==f.1l)){f.62=19}if(C.J.1l==f.1l){f.62=19}f.24(1d.4M((e 4E 1W)?e[1]:e));c.24(f)}.1o(C));C.d9=c}C.4k=C.d9;if(C.J.7Y){C.aN()}C.1V.24(C.4k);C.J.3o=D(a,b){E"1l="+4X(b)}}});1w.N.hp=1H.1D();1w.N.hp.1c={1Q:D(a,b,c){C.3J=b||0.5;C.M=$(a);C.3o=c;C.4d=1h;C.3l=$F(C.M);1a.1X(C.M,"kH",C.fi.2T(C))},fi:D(a){if(C.3l==$F(C.M)){E}if(C.4d){9n(C.4d)}C.4d=3A(C.54.1o(C),C.3J*2W);C.3l=$F(C.M)},54:D(){C.4d=1h;C.3o(C.M,$F(C.M))}};if(!9w){G 9w={}}9w.fh=1H.1D();9w.fh.1c={1Q:D(a,b,c){G d=C;if(a 4E 1W){C.2g=a.7w(D(e){E $(e)})}1e{C.2g=[$(a)]}C.2c=$(b);C.J=c||{};C.db=C.J.db||"9g";C.ff=C.J.ff||1;C.hC=4F(C.J.hC||"1");C.28=C.J.28||$R(0,1);C.1l=0;C.29=C.2g.1O(D(){E 0});C.5N=C.J.5N?C.J.5N.1O(D(s){E $(s)}):17;C.J.9v=$(C.J.9v||1h);C.J.ax=$(C.J.ax||1h);C.bV=C.J.bV||17;C.ac=C.J.ac||C.28.3r;C.bU=C.J.bU||C.28.1T;C.bT=4F(C.J.bT||"0");C.8A=4F(C.J.8A||"0");C.bS=C.fb()-C.hE();C.9u=C.5l()?(C.2g[0].3h!=0?C.2g[0].3h:C.2g[0].12.1r.1M(/1K$/,"")):(C.2g[0].3v!=0?C.2g[0].3v:C.2g[0].12.1A.1M(/1K$/,""));C.2Y=17;C.3V=17;C.2v=17;if(C.J.2v){C.fa()}C.45=C.J.29?C.J.29.aF(1k.K):17;if(C.45){C.bU=C.45.8d();C.ac=C.45.5J()}C.5d=C.9R.2T(C);C.6B=C.6H.2T(C);C.6K=C.1G.2T(C);C.2g.1j(D(h,i){i=d.2g.Y-1-i;d.8B(3x((d.J.bR 4E 1W?d.J.bR[i]:d.J.bR)||d.28.1T),i);N.3u(h);1a.1X(h,"6I",d.5d)});1a.1X(C.2c,"6I",C.5d);1a.1X(1d,"96",C.6B);1a.1X(1d,"97",C.6K);C.ae=19},ho:D(){G a=C;1a.2C(C.2c,"6I",C.5d);1a.2C(1d,"96",C.6B);1a.2C(1d,"97",C.6K);C.2g.1j(D(h){1a.2C(h,"6I",a.5d)})},fa:D(){C.2v=19},kA:D(){C.2v=17},f9:D(b){if(C.45){if(b>=C.45.5J()){E(C.45.5J())}if(b<=C.45.8d()){E(C.45.8d())}G c=1S.9c(C.45[0]-b);G d=C.45[0];C.45.1j(D(v){G a=1S.9c(v-b);if(a<=c){d=v;c=a}});E d}if(b>C.28.3r){E C.28.3r}if(b<C.28.1T){E C.28.1T}E b},8B:D(a,b){if(!C.2Y){C.7d=b||0;C.7h=C.2g[C.7d];C.dh()}b=b||C.7d||0;if(C.ae&&C.bV){if((b>0)&&(a<C.29[b-1])){a=C.29[b-1]}if((b<(C.2g.Y-1))&&(a>C.29[b+1])){a=C.29[b+1]}}a=C.f9(a);C.29[b]=a;C.1l=C.29[0];C.2g[b].12[C.5l()?"1q":"1s"]=C.7e(a);C.f7();if(!C.3V||!C.4e){C.bQ()}},kx:D(a,b){C.8B(C.29[b||C.7d||0]+a,b||C.7d||0)},7e:D(a){E 1S.3e(((C.bS-C.9u)/(C.28.3r-C.28.1T))*(a-C.28.1T))+"1K"},bP:D(a){E((a/(C.bS-C.9u)*(C.28.3r-C.28.1T))+C.28.1T)},ao:D(a){G v=C.29.aF(1k.K);a=a||0;E $R(v[a],v[a+1])},hE:D(){E(C.5l()?C.8A:C.bT)},fb:D(){E(C.5l()?(C.2c.3h!=0?C.2c.3h:C.2c.12.1r.1M(/1K$/,""))-C.8A:(C.2c.3v!=0?C.2c.3v:C.2c.12.1A.1M(/1K$/,""))-C.8A)},5l:D(){E(C.db=="6J")},f7:D(){G a=C;if(C.5N){$R(0,C.5N.Y-1).1j(D(r){a.a4(a.5N[r],a.ao(r))})}if(C.J.9v){C.a4(C.J.9v,$R(0,C.29.Y>1?C.ao(0).8d():C.1l))}if(C.J.ax){C.a4(C.J.ax,$R(C.29.Y>1?C.ao(C.5N.Y-1).5J():C.1l,C.ac))}},a4:D(a,b){if(C.5l()){a.12.1q=C.7e(b.1T);a.12.1r=C.7e(b.3r-b.1T+C.28.1T)}1e{a.12.1s=C.7e(b.1T);a.12.1A=C.7e(b.3r-b.1T+C.28.1T)}},dh:D(){C.2g.1j(D(h){N.6c(h,"62")});N.4w(C.7h,"62")},9R:D(a){if(1a.bC(a)){if(!C.2v){C.2Y=19;G b=1a.M(a);G c=[1a.5X(a),1a.5W(a)];G d=b;if(d==C.2c){G e=1x.3E(C.2c);C.4e=a;C.8B(C.bP((C.5l()?c[1]-e[1]:c[0]-e[0])-(C.9u/2)));G f=1x.3E(C.7h);C.bO=(c[0]-f[0]);C.di=(c[1]-f[1])}1e{1R((C.2g.2G(b)==-1)&&b.1z){b=b.1z}if(C.2g.2G(b)!=-1){C.7h=b;C.7d=C.2g.2G(C.7h);C.dh();G g=1x.3E(C.7h);C.bO=(c[0]-g[0]);C.di=(c[1]-g[1])}}}1a.2H(a)}},1G:D(a){if(C.2Y){if(!C.3V){C.3V=19}C.7U(a);if(1k.1Z.47){1p.b5(0,0)}1a.2H(a)}},7U:D(a){G b=[1a.5X(a),1a.5W(a)];G c=1x.3E(C.2c);b[0]-=C.bO+c[0];b[1]-=C.di+c[1];C.4e=a;C.8B(C.bP(C.5l()?b[1]:b[0]));if(C.ae&&C.J.f4){C.J.f4(C.29.Y>1?C.29:C.1l,C)}},6H:D(a){if(C.2Y&&C.3V){C.7P(a,19);1a.2H(a)}C.2Y=17;C.3V=17},7P:D(a,b){C.2Y=17;C.3V=17;C.bQ()},bQ:D(){if(C.ae&&C.J.52){C.J.52(C.29.Y>1?C.29:C.1l,C)}C.4e=1h}};6m={4o:{},9t:19,7I:18 2V("<kw 12=\\"1r:0\\" id=\\"am#{2c}3T#{id}\\" 93=\\"#{2Z}\\" 72=\\"17\\" i0=\\"19\\" 5x=\\"19\\"/>"),az:D(){6m.9t=19},aa:D(){6m.9t=17},dw:D(c){if(!6m.9t){E}G d=V.O({2c:"84",2Z:c,1M:17},1b[1]||{});if(d.1M&&C.4o[d.2c]){$R(0,C.4o[d.2c].id).1j(D(a){G b=$("am"+d.2c+"3T"+a);b.hQ&&b.hQ();b.3C()});C.4o[d.2c]=1h}if(!C.4o[d.2c]){C.4o[d.2c]={id:0}}1e{C.4o[d.2c].id++}d.id=C.4o[d.2c].id;if(1k.1Z.4j){G e=1d.23("ku");e.6U("id","am"+d.2c+"3T"+d.id);e.6U("93",d.2Z);e.6U("72","1");e.6U("i0","19");$$("26")[0].24(e)}1e{18 2M.cz($$("26")[0],6m.7I.3M(d))}}};if(1k.1Z.7Q&&5h.70.2G("nG")>0){if(5h.f0&&$A(5h.f0).6w(D(p){E p.3a.2G("ks")!=-1})){6m.7I=18 2V("<3R id=\\"am#{2c}3T#{id}\\" 1A=\\"0\\" 1r=\\"0\\" 1N=\\"kq/nL\\" fX=\\"#{2Z}\\"/>")}1e{6m.dw=D(){}}}',62,1474,'||||||||||||||||||||||||||||||||||||||this|function|return||var|||options|||element|Element|extend|||||||Object|||length|||Effect|style||node|||false|new|true|Event|arguments|prototype|document|else|push|for|null|Selector|each|Prototype|value|typeof|results|bind|window|top|height|left|getStyle|Ajax|Methods|Form|Position|Sortable|parentNode|width|position|break|create|match|case|update|Class|scroll|setStyle|px|tagName|replace|type|map|undefined|initialize|while|Math|start|Draggables|form|Array|observe|effects|Browser||hide|child|createElement|appendChild|include|body||range|values|afterFinishInternal|nth|track|opacity|onComplete|concat|handles|toUpperCase|inspect|join|childNodes|handlers|duration||transport|index|innerHTML|pseudos|toLowerCase|last|throw|disabled|show|xpath|offset|handle|select|className|stopObserving|try|Base|String|indexOf|stop|table|string|Hash|catch|Insertion|of|externalControl|transform|div|valueL|method|bindAsEventListener|observers|Template|1000|scrollSpeed|active|url||from|Abstract||||||||name|down|toJSON|Move|round|sync|parameters|offsetHeight|absolute|tree|Enumerable|lastValue|documentElement|RegExp|callback|to|display|end|getValue|moveY|makePositioned|offsetWidth|queue|parseFloat|transition|bottom|setTimeout|_each|remove|first|cumulativeOffset|Droppables|slice|overlap|100|delay|toString|gsub|evaluate|scrollTop|nodeType|Scale|toArray|object|continue|_|Transitions|dragging|none|clone|getElementsByTagName|only||apply|scrollLeft|restoreAfterFinish|scrollSensitivity|allowedValues||WebKit|test|add|matcher|emptyFunction|last_active|timer|event|flatten|text|dims|Opacity|IE|editField|originalValue|opera|key|tracks|findElements|scaleX|frequency|firstChild|_counted|args|stripScripts|addClassName|undoClipping|hoverclass|render|inject|makeClipping|_lastScrollPointer|undoPositioned|instanceof|parseInt|offsetParent|unit|scaleContent|serialize|activeDraggable|substr|createTextNode|getInlineOpacity|snap|insertBefore|Builder|prepare|hasAttribute|evalScripts|Autocompleter|switch|not|encodeURIComponent|Request|_marker||backgroundColor|onChange|clientHeight|onTimerEvent|color|success|offsetTop|scaleMode|ByTag|entryCount|attr|descendant|eventMouseDown|strip|sibling|parseColor|navigator|onHover|split|activate|isVertical|Draggable|unmark|findElement|offsetLeft|startOn|format|toPaddedString|iefix|EventObserver|nodeValue|finishOn|hidden|constructor|container|expression|ghosting|drop|source|tbody|right|Parallel|finish|visibility|max|nextSibling|textarea|fontSize|spans|attribute|formula|with|reverteffect|endeffect|sinoidal|toQueryString|oldInnerHTML|pointerY|pointerX|decay|mark|responseText|on|selected|checked|getDimensions|_cache||BrowserFeatures|registerCallback|pluck|getEntry|beforeSetup|removeClassName|setup|tokens|asynchronous|scaleFrom|setOptions|containment|children|constraint|selector|Sound|initialMoveY|charAt|zindex|reverse|input|targetValue|onFailure|reject|setOpacity|detect|array|effect|_elementDoesNotExistError|drags|eventMouseUp|Heading|quiet|_lastPointer|starteffect|tag_name|endDrag|mousedown|vertical|eventMouseMove|getElementsByClassName|originalBackground|drops|tag|toColorPart|initializeRange|classNames|hasFocus|cleanWhitespace|setAttribute|Number|ps|get|state|click|userAgent|adjacent|loop|paramName|relative||observer|Responders|saving|TBODY|delta|cancel|getElements|activeHandleIdx|translateToPx|camelize|focus|activeHandle|insertContent|substring|TR|script|_overflow|scaleY|originalTop|originalLeft|_flag|clientWidth|reset|pos|interval|scrollTo|collect|scope|empty|accept|previousElementSibling|_timeout|nextSiblings|Date|removeChild|isParent|cache|ycomp|template|class|contains|HTMLElement|deltaY|deltaX|keyCode|finishDrag|Gecko|keypress|nextElementSibling|Serializers|draw|ElementExtensions|content|failure|loadTextURL|pseudo|__proto__|changed|len|droppables|global|eval|dispatchException|escapeHTML|mouseoverListener|invoke|mouseover|change|getOpacity|min|codeForEvent|following|laterSibling|attrPresence|attachEvent|criteria|offsetSize|treeTag|post|InPlaceEditor|responders|_dragging|notify|formId|deactivate|onclickListener|_containers|elements|onSubmit|zIndex|nodeClassName|mouseoutListener|alignY|setValue|cssRules|xcomp|Field|TD|highlightcolor|THEAD|filter|sortables|size|scaleFromCenter|property|setInterval|ScriptFragment|Internal|instances|Queues|auto|currentlyExecuting|descendantOf|Appear|ClassNames|nodeIndex|names|_attributeTranslations|TEXTAREA|styleRules|collectTextNodesIgnoreClass|src|collectTextNodes|keyPress|mouseup|mousemove|recursivelyCollect|_opacity|currentDelta|_isStringOrNumber|abs|visible|Simulated|page|horizontal|onCreate|hasClassName|BODY|_getWindowScroll|times|evalJSON|clearTimeout|Updater|findChildren|Observer|TimedObserver|json|_enabled|handleLength|startSpan|Control|shift|cssFloat|ajaxOptions|selectEntry|getUpdatedChoices|updateElement|autocompleteIndex|indicator|getToken|request|patterns|okText|operators|rows|HTML|count|scrollInterval|stripTags|dispatch|_clone|startDrag|destroy|register|inplaceeditor|startcolor|updateDrag|strong|deepest|ObjectRange|toQueryParams|copy|delete|mouseout|setSpan|callee|leaveEditMode|call|leaveHover|_getAttr|disable|transforms|maximum|Morph|initialized|opacityTransition|scaleTransition|moveTransition|center|direction|tr|depth|sound_|status|getRange|restorecolor|endcolor|alpha|background|currentStyle|Highlight|originalWidth|originalHeight|endSpan|overflow|enable|box|_madePositioned|static|frame|afterFinish|sortBy|afterSetup|currentFrame|00001|falses|styleFloat|idle|ScopedQueue|loadExternalText|number|float|href|findAll|cos|limit|Fade|PAIRS|zoom|slices|library|us|including|requires|INPUT|readAttribute|findChildElements|scrollBy|hasChildNodes|previousSibling|previousSiblings|LI|onStart|onDrag|predicate|onEnd|revert|selectNodeContents|outerHTML|ATTR_MAP|_text|toggle|SpecificElementExtensions|_children|OPTION|findOrStore|absolutize|setHeight|setTop||within|realOffset|originalScrollTop|TH|_getElementsByXPath|stopScrolling|unfilterJSON|succ|updater|SortableObserver|isLeftClick|Opera|KEY_ESC|KEY_RETURN|KEY_TAB|getHeader|onElementEvent|keys|parent|optionValue|textBetweenControls|aculo|offsetX|translateToValue|updateFinished|sliderValue|trackLength|alignX|minimum|restricted|matchingInputs|InPlaceCollectionEditor|onHide|forceRerendering|PI|onclickCancel|onclick|createEditField|fragment|submitOnBlur|loadingClassName|savingClassName|onStateChange|respondToReadyState|and|XPath|preceding|cancelText|cancelLink|cancelButton|unique|okButton|scrollFreeActivate|ignoreCase|choices|defaultParams||updateChoices|findLastToken|_complete|Complete|stopIndicator|or|set|onShow|minChars|After|okLink|baseInitialize|Bottom|encoding|_tree|textBeforeControls|textAfterControls|application|ul|draggables|adjacency|lastScrolled|TFOOT|originalScrollLeft|TableSection|COLGROUP|COL|unregister|CAPTION|_isScrollChild|ownerDocument|activeRequestCount|_cacheObserverCallbacks|getTransport|eventKeypress|scrollStart|isAffected|treeNode|OPTGROUP|SELECT|Test|editing|addMethods|prepareReplacement|indexed|specified|cols|title|cached_selectTag|removeForm|axis|ids|parseStyle|button|without|submit|updateStyles|offsetY|0px|interpret|innerHeight|_reverse|_base||oldStyle|capitalize|default|_getStyle|clearInterval|originalStyle|Version|play|mode|hasLayout|beforeFinish|running|totalFrames|totalTime|fromToDelta|fps|DefaultOptions|getTime|full|floor|pulse|flicker|linear|appear|PeriodicalExecuter|BlindDown|SlideUp|SlideDown|speed|eachSlice|tagifyText|these|getAttribute|attributes|Try|setContentZoom|Error|pattern|Pattern|immediateDescendants|addObserver|Count|firstDescendant|descendants|ancestors|DIV|createContextualFragment|BUTTON|_draggable|createRange|amp|blank|_attributes|PARAM|lastIndexOf|LEGEND|endsWith|AREA|NODEMAP|||relativize|_originalHeight|_originalWidth|startsWith|_originalTop|_originalLeft|setWidth|setLeft|_extended||JSON|withinIncludingScrolloffsets|positionedOffset|includeScrollOffsets|detachEvent|removeEventListener|keydown|unloadCache|addEventListener|_observeAndCache|preventDefault|lastText|updateComplete|which|PeriodicalUpdater|insertion|updateContent|dasherize|KEY_DOWN|onException|KEY_RIGHT|findTreeElements|KEY_UP|KEY_LEFT|evalResponse|after|registerFormCallbacks|selectMany|plugins|200|inputSelector|radio|onSlide|checkbox|blur|drawSpans|requestHeaders|getNearestValue|setDisabled|maximumOffset|findFirstElement|2005|Content|increment|charCodeAt|Slider|delayedListener|xml|onLeaveEditMode|javascript|BlindUp|hoverClassName|showSaving|matchElements|onLoading|onLoadedExternalText|sequence|onblur|editor_field|getIndices|getText|hasHTMLLineBreaks|byClassName|_iefix|readyState|createForm|overrideMimeType|decodeURIComponent|enterHover|enterEditMode|odd|highlightendcolor|setRequestHeaders|handleLineBreaks|onreadystatechange|markNext|clickToEditText|savingText|ok|defaultHighlightColor|unescapeHTML|fullSearch|partialChars|partialSearch|Local|local|addObservers|data|afterUpdateElement|getCurrentEntry|scrollIntoView|Function|onClick|onObserverEvent|markPrevious|root|startIndicator|fixIEOverlapping|Loading|iframe|compileXPathMatcher|Events|onKeyPress|onBlur|compileMatcher|autocomplete|collapse|_constructIndex||Top|dropmarker|extractScripts|Before|img|onEmptyHover|onUpdate|contentFromAnonymousTable|contentType|insertAdjacentHTML||dropOnEmpty|_findRootElement|SERIALIZE_RULE|innerWidth|IFRAME|FRAMESET|TableCell|onDropped|startScrolling|KHTML|TableCol|originalZ|enabled|initDrag|IMG|loadingText|DEL|Mod|INS|formClassName|H6|Microsoft|H5|H4|XMLHTTP|H3|H2|scan|removeObserver|H1|ActiveXObject|XMLHttpRequest|DIR|DL|sub|OL|exclusive|onDrop|fire|UL|even|FIELDSET|isContained|findDeepestChild|findDOMClass|effect_class|onEnterEditMode|morph|FORM|multiple|obj|convertHTMLLineBreaks|getAttributeNode|JSONFilter|cssText|addPair|dispose|DelayedObserver|fromCharCode|merge|readonly|serializeElements|CSS_PROPERTIES|addTracks|Transform|isNaN|arrayLength|CSS_LENGTH|zzzzzz|transparent|step|rules|minimumOffset|specialChar|td|beforeStartInternal|afterUpdateInternal|05|clear|ScrollTo|_delta|ffffff|selectOne|backgroundImage|Stop|setDimensions|scrollHeight|childOf|factor|fontSizeType|pt|find|elementPositioning|scaleTo|autostart|pop|MoveBy|zip|sort|finished|beforeStart|afterUpdate|beforeUpdate|block|parallel|partition|Queue||front||getComputedStyle|defaultView|inGroupsOf|wobble|random|grep|||Effect2|any|blind|toggleClassName||all|slide|160|span|builder|getWidth|operate|getHeight|required|but|exist|does|DOM|instead|The|message|ElementDoesNotExistError|use|deprecated|getElementsBySelector|getSeconds|next|rgb|VAR|previous|getMinutes|TT|TITLE|TABLE|SUP|SUB|STYLE|up|STRONG|STRIKE|getHours|SPAN|SMALL|siblings|SCRIPT|SAMP|PRE|OBJECT|NOSCRIPT|NOFRAMES|META|MENU|MAP|LINK|LABEL|KBD|ISINDEX|getDate|HR|HEAD|FRAME|FONT|EM|DT|parseQuery|getMonth||DFN|DD|CODE|CITE|CENTER|BR|BLOCKQUOTE|replaceChild|getFullYear|BIG|BDO|BASEFONT|BASE|APPLET|ADDRESS|ACRONYM|ABBR|dump|build|quot|htmlFor|isFinite|fieldset|formed|Badly|SyntaxError|pageYOffset|pageXOffset|snapshotItem|unload|snapshotLength|ORDERED_NODE_SNAPSHOT_TYPE|XPathResult|Eaeflnr|cancelBubble|returnValue|stopPropagation|getElementById|clientY|pageY|clientX|pageX|srcElement|target|u00|KEY_PAGEDOWN|KEY_PAGEUP|x1f|KEY_END|KEY_HOME|x00|KEY_DELETE|getResponseHeader|ecma|KEY_BACKSPACE|java|Failure|underscore|Success|audio|selectedIndex|QuickTime|300|bgsound|one|embed|setValueBy|setRequestHeader|present|setEnabled|action|close|focusFirstElement|Connection|charset|getInputs|keyup|option|collection|html|oldBackground|Accept|selectorType|With|Requested|editor_cancel|editor_cancel_button|editor_ok_link|editor_ok_button|onsubmit|abled|dis|send|mod|postBody|FFFFFF|loading|server|the|alert|translate|edit|Click|Saving|open|starts|Safari|Konqueror|FFFF99||_method|autoSelect|informal||250|Interactive|Loaded|scrolling|frameborder|Alpha|DXImageTransform|progid|Uninitialized|beforeunload||off|setStartAfter|afterEnd|beforeEnd|UTF|controls|Width|Height|setSequence|afterBegin|urlencoded|item|setStartBefore|beforeBegin|www|before|z0|Toggle|Za|IFrame|FrameSet|TableRow|cloneNode|TableCaption|Image|Anchor|communicating|Quote|02|sqrt|truncate|Msxml2|boolean|Directory|DList|OList|UList|unknown|FieldSet|Paragraph|TextArea|OptGroup|greedy|bar|secure|dragdrop|foo|visualEffect|pc|wordSpacing|textIndent|paddingTop|paddingRight|paddingLeft||paddingBottom|outlineWidth|outlineOffset|outlineColor|minWidth|minHeight|maxWidth|maxHeight|editor_cancel_link|markerOffset|marginTop|marginRight|marginLeft|marginBottom|lineHeight|letterSpacing|fontWeight|clip|borderTopWidth|borderTopStyle|borderTopColor|borderSpacing|borderRightWidth|borderRightStyle|borderRightColor|borderLeftWidth|longDesc|borderLeftStyle|borderLeftColor|longdesc|borderBottomWidth|borderBottomStyle|readOnly|borderBottomColor|backgroundPosition|maxLength|maxlength|encType|enctype|tabIndex|tabindex|accessKey|rgba|accesskey|uffff|AppleWebKit|selectorText|dateTime|datetime|uniq|styleSheets|vAlign|Fold|pulses|valign|reduce|Pulsate|Shrink|rowSpan|01|rowspan|colSpan|colspan||RangeError|999999|Grow|Squish|compact|Shake|DropOut|SwitchOff|beforeSetupInternal|Puff|x01|NodeList|image|keepBackgroundImage|ffff99|entries|finally|Win|member|scrollWidth|childElements|font|mpeg'.split('|'),0,{}))
	/*  Prototype JavaScript framework, version 1.6.0.3
 *  (c) 2005-2008 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
 *
 *--------------------------------------------------------------------------*/

var Prototype = {
  Version: '1.6.0.3',

  Browser: {
    IE:     !!(window.attachEvent &&
      navigator.userAgent.indexOf('Opera') === -1),
    Opera:  navigator.userAgent.indexOf('Opera') > -1,
    WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
    Gecko:  navigator.userAgent.indexOf('Gecko') > -1 &&
      navigator.userAgent.indexOf('KHTML') === -1,
    MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
  },

  BrowserFeatures: {
    XPath: !!document.evaluate,
    SelectorsAPI: !!document.querySelector,
    ElementExtensions: !!window.HTMLElement,
    SpecificElementExtensions:
      document.createElement('div')['__proto__'] &&
      document.createElement('div')['__proto__'] !==
        document.createElement('form')['__proto__']
  },

  ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
  JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,

  emptyFunction: function() { },
  K: function(x) { return x }
};

if (Prototype.Browser.MobileSafari)
  Prototype.BrowserFeatures.SpecificElementExtensions = false;


/* Based on Alex Arnell's inheritance implementation. */
var Class = {
  create: function() {
    var parent = null, properties = $A(arguments);
    if (Object.isFunction(properties[0]))
      parent = properties.shift();

    function klass() {
      this.initialize.apply(this, arguments);
    }

    Object.extend(klass, Class.Methods);
    klass.superclass = parent;
    klass.subclasses = [];

    if (parent) {
      var subclass = function() { };
      subclass.prototype = parent.prototype;
      klass.prototype = new subclass;
      parent.subclasses.push(klass);
    }

    for (var i = 0; i < properties.length; i++)
      klass.addMethods(properties[i]);

    if (!klass.prototype.initialize)
      klass.prototype.initialize = Prototype.emptyFunction;

    klass.prototype.constructor = klass;

    return klass;
  }
};

Class.Methods = {
  addMethods: function(source) {
    var ancestor   = this.superclass && this.superclass.prototype;
    var properties = Object.keys(source);

    if (!Object.keys({ toString: true }).length)
      properties.push("toString", "valueOf");

    for (var i = 0, length = properties.length; i < length; i++) {
      var property = properties[i], value = source[property];
      if (ancestor && Object.isFunction(value) &&
          value.argumentNames().first() == "$super") {
        var method = value;
        value = (function(m) {
          return function() { return ancestor[m].apply(this, arguments) };
        })(property).wrap(method);

        value.valueOf = method.valueOf.bind(method);
        value.toString = method.toString.bind(method);
      }
      this.prototype[property] = value;
    }

    return this;
  }
};

var Abstract = { };

Object.extend = function(destination, source) {
  for (var property in source)
    destination[property] = source[property];
  return destination;
};

Object.extend(Object, {
  inspect: function(object) {
    try {
      if (Object.isUndefined(object)) return 'undefined';
      if (object === null) return 'null';
      return object.inspect ? object.inspect() : String(object);
    } catch (e) {
      if (e instanceof RangeError) return '...';
      throw e;
    }
  },

  toJSON: function(object) {
    var type = typeof object;
    switch (type) {
      case 'undefined':
      case 'function':
      case 'unknown': return;
      case 'boolean': return object.toString();
    }

    if (object === null) return 'null';
    if (object.toJSON) return object.toJSON();
    if (Object.isElement(object)) return;

    var results = [];
    for (var property in object) {
      var value = Object.toJSON(object[property]);
      if (!Object.isUndefined(value))
        results.push(property.toJSON() + ': ' + value);
    }

    return '{' + results.join(', ') + '}';
  },

  toQueryString: function(object) {
    return $H(object).toQueryString();
  },

  toHTML: function(object) {
    return object && object.toHTML ? object.toHTML() : String.interpret(object);
  },

  keys: function(object) {
    var keys = [];
    for (var property in object)
      keys.push(property);
    return keys;
  },

  values: function(object) {
    var values = [];
    for (var property in object)
      values.push(object[property]);
    return values;
  },

  clone: function(object) {
    return Object.extend({ }, object);
  },

  isElement: function(object) {
    return !!(object && object.nodeType == 1);
  },

  isArray: function(object) {
    return object != null && typeof object == "object" &&
      'splice' in object && 'join' in object;
  },

  isHash: function(object) {
    return object instanceof Hash;
  },

  isFunction: function(object) {
    return typeof object == "function";
  },

  isString: function(object) {
    return typeof object == "string";
  },

  isNumber: function(object) {
    return typeof object == "number";
  },

  isUndefined: function(object) {
    return typeof object == "undefined";
  }
});

Object.extend(Function.prototype, {
  argumentNames: function() {
    var names = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1]
      .replace(/\s+/g, '').split(',');
    return names.length == 1 && !names[0] ? [] : names;
  },

  bind: function() {
    if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
    var __method = this, args = $A(arguments), object = args.shift();
    return function() {
      return __method.apply(object, args.concat($A(arguments)));
    }
  },

  bindAsEventListener: function() {
    var __method = this, args = $A(arguments), object = args.shift();
    return function(event) {
      return __method.apply(object, [event || window.event].concat(args));
    }
  },

  curry: function() {
    if (!arguments.length) return this;
    var __method = this, args = $A(arguments);
    return function() {
      return __method.apply(this, args.concat($A(arguments)));
    }
  },

  delay: function() {
    var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
    return window.setTimeout(function() {
      return __method.apply(__method, args);
    }, timeout);
  },

  defer: function() {
    var args = [0.01].concat($A(arguments));
    return this.delay.apply(this, args);
  },

  wrap: function(wrapper) {
    var __method = this;
    return function() {
      return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
    }
  },

  methodize: function() {
    if (this._methodized) return this._methodized;
    var __method = this;
    return this._methodized = function() {
      return __method.apply(null, [this].concat($A(arguments)));
    };
  }
});

Date.prototype.toJSON = function() {
  return '"' + this.getUTCFullYear() + '-' +
    (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
    this.getUTCDate().toPaddedString(2) + 'T' +
    this.getUTCHours().toPaddedString(2) + ':' +
    this.getUTCMinutes().toPaddedString(2) + ':' +
    this.getUTCSeconds().toPaddedString(2) + 'Z"';
};

var Try = {
  these: function() {
    var returnValue;

    for (var i = 0, length = arguments.length; i < length; i++) {
      var lambda = arguments[i];
      try {
        returnValue = lambda();
        break;
      } catch (e) { }
    }

    return returnValue;
  }
};

RegExp.prototype.match = RegExp.prototype.test;

RegExp.escape = function(str) {
  return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
};

/*--------------------------------------------------------------------------*/

var PeriodicalExecuter = Class.create({
  initialize: function(callback, frequency) {
    this.callback = callback;
    this.frequency = frequency;
    this.currentlyExecuting = false;

    this.registerCallback();
  },

  registerCallback: function() {
    this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
  },

  execute: function() {
    this.callback(this);
  },

  stop: function() {
    if (!this.timer) return;
    clearInterval(this.timer);
    this.timer = null;
  },

  onTimerEvent: function() {
    if (!this.currentlyExecuting) {
      try {
        this.currentlyExecuting = true;
        this.execute();
      } finally {
        this.currentlyExecuting = false;
      }
    }
  }
});
Object.extend(String, {
  interpret: function(value) {
    return value == null ? '' : String(value);
  },
  specialChar: {
    '\b': '\\b',
    '\t': '\\t',
    '\n': '\\n',
    '\f': '\\f',
    '\r': '\\r',
    '\\': '\\\\'
  }
});

Object.extend(String.prototype, {
  gsub: function(pattern, replacement) {
    var result = '', source = this, match;
    replacement = arguments.callee.prepareReplacement(replacement);

    while (source.length > 0) {
      if (match = source.match(pattern)) {
        result += source.slice(0, match.index);
        result += String.interpret(replacement(match));
        source  = source.slice(match.index + match[0].length);
      } else {
        result += source, source = '';
      }
    }
    return result;
  },

  sub: function(pattern, replacement, count) {
    replacement = this.gsub.prepareReplacement(replacement);
    count = Object.isUndefined(count) ? 1 : count;

    return this.gsub(pattern, function(match) {
      if (--count < 0) return match[0];
      return replacement(match);
    });
  },

  scan: function(pattern, iterator) {
    this.gsub(pattern, iterator);
    return String(this);
  },

  truncate: function(length, truncation) {
    length = length || 30;
    truncation = Object.isUndefined(truncation) ? '...' : truncation;
    return this.length > length ?
      this.slice(0, length - truncation.length) + truncation : String(this);
  },

  strip: function() {
    return this.replace(/^\s+/, '').replace(/\s+$/, '');
  },

  stripTags: function() {
    return this.replace(/<\/?[^>]+>/gi, '');
  },

  stripScripts: function() {
    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
  },

  extractScripts: function() {
    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
    return (this.match(matchAll) || []).map(function(scriptTag) {
      return (scriptTag.match(matchOne) || ['', ''])[1];
    });
  },

  evalScripts: function() {
    return this.extractScripts().map(function(script) { return eval(script) });
  },

  escapeHTML: function() {
    var self = arguments.callee;
    self.text.data = this;
    return self.div.innerHTML;
  },

  unescapeHTML: function() {
    var div = new Element('div');
    div.innerHTML = this.stripTags();
    return div.childNodes[0] ? (div.childNodes.length > 1 ?
      $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
      div.childNodes[0].nodeValue) : '';
  },

  toQueryParams: function(separator) {
    var match = this.strip().match(/([^?#]*)(#.*)?$/);
    if (!match) return { };

    return match[1].split(separator || '&').inject({ }, function(hash, pair) {
      if ((pair = pair.split('='))[0]) {
        var key = decodeURIComponent(pair.shift());
        var value = pair.length > 1 ? pair.join('=') : pair[0];
        if (value != undefined) value = decodeURIComponent(value);

        if (key in hash) {
          if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
          hash[key].push(value);
        }
        else hash[key] = value;
      }
      return hash;
    });
  },

  toArray: function() {
    return this.split('');
  },

  succ: function() {
    return this.slice(0, this.length - 1) +
      String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
  },

  times: function(count) {
    return count < 1 ? '' : new Array(count + 1).join(this);
  },

  camelize: function() {
    var parts = this.split('-'), len = parts.length;
    if (len == 1) return parts[0];

    var camelized = this.charAt(0) == '-'
      ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
      : parts[0];

    for (var i = 1; i < len; i++)
      camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);

    return camelized;
  },

  capitalize: function() {
    return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
  },

  underscore: function() {
    return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
  },

  dasherize: function() {
    return this.gsub(/_/,'-');
  },

  inspect: function(useDoubleQuotes) {
    var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
      var character = String.specialChar[match[0]];
      return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
    });
    if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
    return "'" + escapedString.replace(/'/g, '\\\'') + "'";
  },

  toJSON: function() {
    return this.inspect(true);
  },

  unfilterJSON: function(filter) {
    return this.sub(filter || Prototype.JSONFilter, '#{1}');
  },

  isJSON: function() {
    var str = this;
    if (str.blank()) return false;
    str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
    return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
  },

  evalJSON: function(sanitize) {
    var json = this.unfilterJSON();
    try {
      if (!sanitize || json.isJSON()) return eval('(' + json + ')');
    } catch (e) { }
    throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
  },

  include: function(pattern) {
    return this.indexOf(pattern) > -1;
  },

  startsWith: function(pattern) {
    return this.indexOf(pattern) === 0;
  },

  endsWith: function(pattern) {
    var d = this.length - pattern.length;
    return d >= 0 && this.lastIndexOf(pattern) === d;
  },

  empty: function() {
    return this == '';
  },

  blank: function() {
    return /^\s*$/.test(this);
  },

  interpolate: function(object, pattern) {
    return new Template(this, pattern).evaluate(object);
  }
});

if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
  escapeHTML: function() {
    return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
  },
  unescapeHTML: function() {
    return this.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
  }
});

String.prototype.gsub.prepareReplacement = function(replacement) {
  if (Object.isFunction(replacement)) return replacement;
  var template = new Template(replacement);
  return function(match) { return template.evaluate(match) };
};

String.prototype.parseQuery = String.prototype.toQueryParams;

Object.extend(String.prototype.escapeHTML, {
  div:  document.createElement('div'),
  text: document.createTextNode('')
});

String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);

var Template = Class.create({
  initialize: function(template, pattern) {
    this.template = template.toString();
    this.pattern = pattern || Template.Pattern;
  },

  evaluate: function(object) {
    if (Object.isFunction(object.toTemplateReplacements))
      object = object.toTemplateReplacements();

    return this.template.gsub(this.pattern, function(match) {
      if (object == null) return '';

      var before = match[1] || '';
      if (before == '\\') return match[2];

      var ctx = object, expr = match[3];
      var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
      match = pattern.exec(expr);
      if (match == null) return before;

      while (match != null) {
        var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
        ctx = ctx[comp];
        if (null == ctx || '' == match[3]) break;
        expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
        match = pattern.exec(expr);
      }

      return before + String.interpret(ctx);
    });
  }
});
Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;

var $break = { };

var Enumerable = {
  each: function(iterator, context) {
    var index = 0;
    try {
      this._each(function(value) {
        iterator.call(context, value, index++);
      });
    } catch (e) {
      if (e != $break) throw e;
    }
    return this;
  },

  eachSlice: function(number, iterator, context) {
    var index = -number, slices = [], array = this.toArray();
    if (number < 1) return array;
    while ((index += number) < array.length)
      slices.push(array.slice(index, index+number));
    return slices.collect(iterator, context);
  },

  all: function(iterator, context) {
    iterator = iterator || Prototype.K;
    var result = true;
    this.each(function(value, index) {
      result = result && !!iterator.call(context, value, index);
      if (!result) throw $break;
    });
    return result;
  },

  any: function(iterator, context) {
    iterator = iterator || Prototype.K;
    var result = false;
    this.each(function(value, index) {
      if (result = !!iterator.call(context, value, index))
        throw $break;
    });
    return result;
  },

  collect: function(iterator, context) {
    iterator = iterator || Prototype.K;
    var results = [];
    this.each(function(value, index) {
      results.push(iterator.call(context, value, index));
    });
    return results;
  },

  detect: function(iterator, context) {
    var result;
    this.each(function(value, index) {
      if (iterator.call(context, value, index)) {
        result = value;
        throw $break;
      }
    });
    return result;
  },

  findAll: function(iterator, context) {
    var results = [];
    this.each(function(value, index) {
      if (iterator.call(context, value, index))
        results.push(value);
    });
    return results;
  },

  grep: function(filter, iterator, context) {
    iterator = iterator || Prototype.K;
    var results = [];

    if (Object.isString(filter))
      filter = new RegExp(filter);

    this.each(function(value, index) {
      if (filter.match(value))
        results.push(iterator.call(context, value, index));
    });
    return results;
  },

  include: function(object) {
    if (Object.isFunction(this.indexOf))
      if (this.indexOf(object) != -1) return true;

    var found = false;
    this.each(function(value) {
      if (value == object) {
        found = true;
        throw $break;
      }
    });
    return found;
  },

  inGroupsOf: function(number, fillWith) {
    fillWith = Object.isUndefined(fillWith) ? null : fillWith;
    return this.eachSlice(number, function(slice) {
      while(slice.length < number) slice.push(fillWith);
      return slice;
    });
  },

  inject: function(memo, iterator, context) {
    this.each(function(value, index) {
      memo = iterator.call(context, memo, value, index);
    });
    return memo;
  },

  invoke: function(method) {
    var args = $A(arguments).slice(1);
    return this.map(function(value) {
      return value[method].apply(value, args);
    });
  },

  max: function(iterator, context) {
    iterator = iterator || Prototype.K;
    var result;
    this.each(function(value, index) {
      value = iterator.call(context, value, index);
      if (result == null || value >= result)
        result = value;
    });
    return result;
  },

  min: function(iterator, context) {
    iterator = iterator || Prototype.K;
    var result;
    this.each(function(value, index) {
      value = iterator.call(context, value, index);
      if (result == null || value < result)
        result = value;
    });
    return result;
  },

  partition: function(iterator, context) {
    iterator = iterator || Prototype.K;
    var trues = [], falses = [];
    this.each(function(value, index) {
      (iterator.call(context, value, index) ?
        trues : falses).push(value);
    });
    return [trues, falses];
  },

  pluck: function(property) {
    var results = [];
    this.each(function(value) {
      results.push(value[property]);
    });
    return results;
  },

  reject: function(iterator, context) {
    var results = [];
    this.each(function(value, index) {
      if (!iterator.call(context, value, index))
        results.push(value);
    });
    return results;
  },

  sortBy: function(iterator, context) {
    return this.map(function(value, index) {
      return {
        value: value,
        criteria: iterator.call(context, value, index)
      };
    }).sort(function(left, right) {
      var a = left.criteria, b = right.criteria;
      return a < b ? -1 : a > b ? 1 : 0;
    }).pluck('value');
  },

  toArray: function() {
    return this.map();
  },

  zip: function() {
    var iterator = Prototype.K, args = $A(arguments);
    if (Object.isFunction(args.last()))
      iterator = args.pop();

    var collections = [this].concat(args).map($A);
    return this.map(function(value, index) {
      return iterator(collections.pluck(index));
    });
  },

  size: function() {
    return this.toArray().length;
  },

  inspect: function() {
    return '#<Enumerable:' + this.toArray().inspect() + '>';
  }
};

Object.extend(Enumerable, {
  map:     Enumerable.collect,
  find:    Enumerable.detect,
  select:  Enumerable.findAll,
  filter:  Enumerable.findAll,
  member:  Enumerable.include,
  entries: Enumerable.toArray,
  every:   Enumerable.all,
  some:    Enumerable.any
});
function $A(iterable) {
  if (!iterable) return [];
  if (iterable.toArray) return iterable.toArray();
  var length = iterable.length || 0, results = new Array(length);
  while (length--) results[length] = iterable[length];
  return results;
}

if (Prototype.Browser.WebKit) {
  $A = function(iterable) {
    if (!iterable) return [];
    // In Safari, only use the `toArray` method if it's not a NodeList.
    // A NodeList is a function, has an function `item` property, and a numeric
    // `length` property. Adapted from Google Doctype.
    if (!(typeof iterable === 'function' && typeof iterable.length ===
        'number' && typeof iterable.item === 'function') && iterable.toArray)
      return iterable.toArray();
    var length = iterable.length || 0, results = new Array(length);
    while (length--) results[length] = iterable[length];
    return results;
  };
}

Array.from = $A;

Object.extend(Array.prototype, Enumerable);

if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;

Object.extend(Array.prototype, {
  _each: function(iterator) {
    for (var i = 0, length = this.length; i < length; i++)
      iterator(this[i]);
  },

  clear: function() {
    this.length = 0;
    return this;
  },

  first: function() {
    return this[0];
  },

  last: function() {
    return this[this.length - 1];
  },

  compact: function() {
    return this.select(function(value) {
      return value != null;
    });
  },

  flatten: function() {
    return this.inject([], function(array, value) {
      return array.concat(Object.isArray(value) ?
        value.flatten() : [value]);
    });
  },

  without: function() {
    var values = $A(arguments);
    return this.select(function(value) {
      return !values.include(value);
    });
  },

  reverse: function(inline) {
    return (inline !== false ? this : this.toArray())._reverse();
  },

  reduce: function() {
    return this.length > 1 ? this : this[0];
  },

  uniq: function(sorted) {
    return this.inject([], function(array, value, index) {
      if (0 == index || (sorted ? array.last() != value : !array.include(value)))
        array.push(value);
      return array;
    });
  },

  intersect: function(array) {
    return this.uniq().findAll(function(item) {
      return array.detect(function(value) { return item === value });
    });
  },

  clone: function() {
    return [].concat(this);
  },

  size: function() {
    return this.length;
  },

  inspect: function() {
    return '[' + this.map(Object.inspect).join(', ') + ']';
  },

  toJSON: function() {
    var results = [];
    this.each(function(object) {
      var value = Object.toJSON(object);
      if (!Object.isUndefined(value)) results.push(value);
    });
    return '[' + results.join(', ') + ']';
  }
});

// use native browser JS 1.6 implementation if available
if (Object.isFunction(Array.prototype.forEach))
  Array.prototype._each = Array.prototype.forEach;

if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
  i || (i = 0);
  var length = this.length;
  if (i < 0) i = length + i;
  for (; i < length; i++)
    if (this[i] === item) return i;
  return -1;
};

if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
  i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
  var n = this.slice(0, i).reverse().indexOf(item);
  return (n < 0) ? n : i - n - 1;
};

Array.prototype.toArray = Array.prototype.clone;

function $w(string) {
  if (!Object.isString(string)) return [];
  string = string.strip();
  return string ? string.split(/\s+/) : [];
}

if (Prototype.Browser.Opera){
  Array.prototype.concat = function() {
    var array = [];
    for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
    for (var i = 0, length = arguments.length; i < length; i++) {
      if (Object.isArray(arguments[i])) {
        for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
          array.push(arguments[i][j]);
      } else {
        array.push(arguments[i]);
      }
    }
    return array;
  };
}
Object.extend(Number.prototype, {
  toColorPart: function() {
    return this.toPaddedString(2, 16);
  },

  succ: function() {
    return this + 1;
  },

  times: function(iterator, context) {
    $R(0, this, true).each(iterator, context);
    return this;
  },

  toPaddedString: function(length, radix) {
    var string = this.toString(radix || 10);
    return '0'.times(length - string.length) + string;
  },

  toJSON: function() {
    return isFinite(this) ? this.toString() : 'null';
  }
});

$w('abs round ceil floor').each(function(method){
  Number.prototype[method] = Math[method].methodize();
});
function $H(object) {
  return new Hash(object);
};

var Hash = Class.create(Enumerable, (function() {

  function toQueryPair(key, value) {
    if (Object.isUndefined(value)) return key;
    return key + '=' + encodeURIComponent(String.interpret(value));
  }

  return {
    initialize: function(object) {
      this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
    },

    _each: function(iterator) {
      for (var key in this._object) {
        var value = this._object[key], pair = [key, value];
        pair.key = key;
        pair.value = value;
        iterator(pair);
      }
    },

    set: function(key, value) {
      return this._object[key] = value;
    },

    get: function(key) {
      // simulating poorly supported hasOwnProperty
      if (this._object[key] !== Object.prototype[key])
        return this._object[key];
    },

    unset: function(key) {
      var value = this._object[key];
      delete this._object[key];
      return value;
    },

    toObject: function() {
      return Object.clone(this._object);
    },

    keys: function() {
      return this.pluck('key');
    },

    values: function() {
      return this.pluck('value');
    },

    index: function(value) {
      var match = this.detect(function(pair) {
        return pair.value === value;
      });
      return match && match.key;
    },

    merge: function(object) {
      return this.clone().update(object);
    },

    update: function(object) {
      return new Hash(object).inject(this, function(result, pair) {
        result.set(pair.key, pair.value);
        return result;
      });
    },

    toQueryString: function() {
      return this.inject([], function(results, pair) {
        var key = encodeURIComponent(pair.key), values = pair.value;

        if (values && typeof values == 'object') {
          if (Object.isArray(values))
            return results.concat(values.map(toQueryPair.curry(key)));
        } else results.push(toQueryPair(key, values));
        return results;
      }).join('&');
    },

    inspect: function() {
      return '#<Hash:{' + this.map(function(pair) {
        return pair.map(Object.inspect).join(': ');
      }).join(', ') + '}>';
    },

    toJSON: function() {
      return Object.toJSON(this.toObject());
    },

    clone: function() {
      return new Hash(this);
    }
  }
})());

Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
Hash.from = $H;
var ObjectRange = Class.create(Enumerable, {
  initialize: function(start, end, exclusive) {
    this.start = start;
    this.end = end;
    this.exclusive = exclusive;
  },

  _each: function(iterator) {
    var value = this.start;
    while (this.include(value)) {
      iterator(value);
      value = value.succ();
    }
  },

  include: function(value) {
    if (value < this.start)
      return false;
    if (this.exclusive)
      return value < this.end;
    return value <= this.end;
  }
});

var $R = function(start, end, exclusive) {
  return new ObjectRange(start, end, exclusive);
};

var Ajax = {
  getTransport: function() {
    return Try.these(
      function() {return new XMLHttpRequest()},
      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
    ) || false;
  },

  activeRequestCount: 0
};

Ajax.Responders = {
  responders: [],

  _each: function(iterator) {
    this.responders._each(iterator);
  },

  register: function(responder) {
    if (!this.include(responder))
      this.responders.push(responder);
  },

  unregister: function(responder) {
    this.responders = this.responders.without(responder);
  },

  dispatch: function(callback, request, transport, json) {
    this.each(function(responder) {
      if (Object.isFunction(responder[callback])) {
        try {
          responder[callback].apply(responder, [request, transport, json]);
        } catch (e) { }
      }
    });
  }
};

Object.extend(Ajax.Responders, Enumerable);

Ajax.Responders.register({
  onCreate:   function() { Ajax.activeRequestCount++ },
  onComplete: function() { Ajax.activeRequestCount-- }
});

Ajax.Base = Class.create({
  initialize: function(options) {
    this.options = {
      method:       'post',
      asynchronous: true,
      contentType:  'application/x-www-form-urlencoded',
      encoding:     'UTF-8',
      parameters:   '',
      evalJSON:     true,
      evalJS:       true
    };
    Object.extend(this.options, options || { });

    this.options.method = this.options.method.toLowerCase();

    if (Object.isString(this.options.parameters))
      this.options.parameters = this.options.parameters.toQueryParams();
    else if (Object.isHash(this.options.parameters))
      this.options.parameters = this.options.parameters.toObject();
  }
});

Ajax.Request = Class.create(Ajax.Base, {
  _complete: false,

  initialize: function($super, url, options) {
    $super(options);
    this.transport = Ajax.getTransport();
    this.request(url);
  },

  request: function(url) {
    this.url = url;
    this.method = this.options.method;
    var params = Object.clone(this.options.parameters);

    if (!['get', 'post'].include(this.method)) {
      // simulate other verbs over post
      params['_method'] = this.method;
      this.method = 'post';
    }

    this.parameters = params;

    if (params = Object.toQueryString(params)) {
      // when GET, append parameters to URL
      if (this.method == 'get')
        this.url += (this.url.include('?') ? '&' : '?') + params;
      else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
        params += '&_=';
    }

    try {
      var response = new Ajax.Response(this);
      if (this.options.onCreate) this.options.onCreate(response);
      Ajax.Responders.dispatch('onCreate', this, response);

      this.transport.open(this.method.toUpperCase(), this.url,
        this.options.asynchronous);

      if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);

      this.transport.onreadystatechange = this.onStateChange.bind(this);
      this.setRequestHeaders();

      this.body = this.method == 'post' ? (this.options.postBody || params) : null;
      this.transport.send(this.body);

      /* Force Firefox to handle ready state 4 for synchronous requests */
      if (!this.options.asynchronous && this.transport.overrideMimeType)
        this.onStateChange();

    }
    catch (e) {
      this.dispatchException(e);
    }
  },

  onStateChange: function() {
    var readyState = this.transport.readyState;
    if (readyState > 1 && !((readyState == 4) && this._complete))
      this.respondToReadyState(this.transport.readyState);
  },

  setRequestHeaders: function() {
    var headers = {
      'X-Requested-With': 'XMLHttpRequest',
      'X-Prototype-Version': Prototype.Version,
      'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
    };

    if (this.method == 'post') {
      headers['Content-type'] = this.options.contentType +
        (this.options.encoding ? '; charset=' + this.options.encoding : '');

      /* Force "Connection: close" for older Mozilla browsers to work
       * around a bug where XMLHttpRequest sends an incorrect
       * Content-length header. See Mozilla Bugzilla #246651.
       */
      if (this.transport.overrideMimeType &&
          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
            headers['Connection'] = 'close';
    }

    // user-defined headers
    if (typeof this.options.requestHeaders == 'object') {
      var extras = this.options.requestHeaders;

      if (Object.isFunction(extras.push))
        for (var i = 0, length = extras.length; i < length; i += 2)
          headers[extras[i]] = extras[i+1];
      else
        $H(extras).each(function(pair) { headers[pair.key] = pair.value });
    }

    for (var name in headers)
      this.transport.setRequestHeader(name, headers[name]);
  },

  success: function() {
    var status = this.getStatus();
    return !status || (status >= 200 && status < 300);
  },

  getStatus: function() {
    try {
      return this.transport.status || 0;
    } catch (e) { return 0 }
  },

  respondToReadyState: function(readyState) {
    var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);

    if (state == 'Complete') {
      try {
        this._complete = true;
        (this.options['on' + response.status]
         || this.options['on' + (this.success() ? 'Success' : 'Failure')]
         || Prototype.emptyFunction)(response, response.headerJSON);
      } catch (e) {
        this.dispatchException(e);
      }

      var contentType = response.getHeader('Content-type');
      if (this.options.evalJS == 'force'
          || (this.options.evalJS && this.isSameOrigin() && contentType
          && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
        this.evalResponse();
    }

    try {
      (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
      Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
    } catch (e) {
      this.dispatchException(e);
    }

    if (state == 'Complete') {
      // avoid memory leak in MSIE: clean up
      this.transport.onreadystatechange = Prototype.emptyFunction;
    }
  },

  isSameOrigin: function() {
    var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
    return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
      protocol: location.protocol,
      domain: document.domain,
      port: location.port ? ':' + location.port : ''
    }));
  },

  getHeader: function(name) {
    try {
      return this.transport.getResponseHeader(name) || null;
    } catch (e) { return null }
  },

  evalResponse: function() {
    try {
      return eval((this.transport.responseText || '').unfilterJSON());
    } catch (e) {
      this.dispatchException(e);
    }
  },

  dispatchException: function(exception) {
    (this.options.onException || Prototype.emptyFunction)(this, exception);
    Ajax.Responders.dispatch('onException', this, exception);
  }
});

Ajax.Request.Events =
  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];

Ajax.Response = Class.create({
  initialize: function(request){
    this.request = request;
    var transport  = this.transport  = request.transport,
        readyState = this.readyState = transport.readyState;

    if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
      this.status       = this.getStatus();
      this.statusText   = this.getStatusText();
      this.responseText = String.interpret(transport.responseText);
      this.headerJSON   = this._getHeaderJSON();
    }

    if(readyState == 4) {
      var xml = transport.responseXML;
      this.responseXML  = Object.isUndefined(xml) ? null : xml;
      this.responseJSON = this._getResponseJSON();
    }
  },

  status:      0,
  statusText: '',

  getStatus: Ajax.Request.prototype.getStatus,

  getStatusText: function() {
    try {
      return this.transport.statusText || '';
    } catch (e) { return '' }
  },

  getHeader: Ajax.Request.prototype.getHeader,

  getAllHeaders: function() {
    try {
      return this.getAllResponseHeaders();
    } catch (e) { return null }
  },

  getResponseHeader: function(name) {
    return this.transport.getResponseHeader(name);
  },

  getAllResponseHeaders: function() {
    return this.transport.getAllResponseHeaders();
  },

  _getHeaderJSON: function() {
    var json = this.getHeader('X-JSON');
    if (!json) return null;
    json = decodeURIComponent(escape(json));
    try {
      return json.evalJSON(this.request.options.sanitizeJSON ||
        !this.request.isSameOrigin());
    } catch (e) {
      this.request.dispatchException(e);
    }
  },

  _getResponseJSON: function() {
    var options = this.request.options;
    if (!options.evalJSON || (options.evalJSON != 'force' &&
      !(this.getHeader('Content-type') || '').include('application/json')) ||
        this.responseText.blank())
          return null;
    try {
      return this.responseText.evalJSON(options.sanitizeJSON ||
        !this.request.isSameOrigin());
    } catch (e) {
      this.request.dispatchException(e);
    }
  }
});

Ajax.Updater = Class.create(Ajax.Request, {
  initialize: function($super, container, url, options) {
    this.container = {
      success: (container.success || container),
      failure: (container.failure || (container.success ? null : container))
    };

    options = Object.clone(options);
    var onComplete = options.onComplete;
    options.onComplete = (function(response, json) {
      this.updateContent(response.responseText);
      if (Object.isFunction(onComplete)) onComplete(response, json);
    }).bind(this);

    $super(url, options);
  },

  updateContent: function(responseText) {
    var receiver = this.container[this.success() ? 'success' : 'failure'],
        options = this.options;

    if (!options.evalScripts) responseText = responseText.stripScripts();

    if (receiver = $(receiver)) {
      if (options.insertion) {
        if (Object.isString(options.insertion)) {
          var insertion = { }; insertion[options.insertion] = responseText;
          receiver.insert(insertion);
        }
        else options.insertion(receiver, responseText);
      }
      else receiver.update(responseText);
    }
  }
});

Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
  initialize: function($super, container, url, options) {
    $super(options);
    this.onComplete = this.options.onComplete;

    this.frequency = (this.options.frequency || 2);
    this.decay = (this.options.decay || 1);

    this.updater = { };
    this.container = container;
    this.url = url;

    this.start();
  },

  start: function() {
    this.options.onComplete = this.updateComplete.bind(this);
    this.onTimerEvent();
  },

  stop: function() {
    this.updater.options.onComplete = undefined;
    clearTimeout(this.timer);
    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
  },

  updateComplete: function(response) {
    if (this.options.decay) {
      this.decay = (response.responseText == this.lastText ?
        this.decay * this.options.decay : 1);

      this.lastText = response.responseText;
    }
    this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
  },

  onTimerEvent: function() {
    this.updater = new Ajax.Updater(this.container, this.url, this.options);
  }
});
function $(element) {
  if (arguments.length > 1) {
    for (var i = 0, elements = [], length = arguments.length; i < length; i++)
      elements.push($(arguments[i]));
    return elements;
  }
  if (Object.isString(element))
    element = document.getElementById(element);
  return Element.extend(element);
}

if (Prototype.BrowserFeatures.XPath) {
  document._getElementsByXPath = function(expression, parentElement) {
    var results = [];
    var query = document.evaluate(expression, $(parentElement) || document,
      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
    for (var i = 0, length = query.snapshotLength; i < length; i++)
      results.push(Element.extend(query.snapshotItem(i)));
    return results;
  };
}

/*--------------------------------------------------------------------------*/

if (!window.Node) var Node = { };

if (!Node.ELEMENT_NODE) {
  // DOM level 2 ECMAScript Language Binding
  Object.extend(Node, {
    ELEMENT_NODE: 1,
    ATTRIBUTE_NODE: 2,
    TEXT_NODE: 3,
    CDATA_SECTION_NODE: 4,
    ENTITY_REFERENCE_NODE: 5,
    ENTITY_NODE: 6,
    PROCESSING_INSTRUCTION_NODE: 7,
    COMMENT_NODE: 8,
    DOCUMENT_NODE: 9,
    DOCUMENT_TYPE_NODE: 10,
    DOCUMENT_FRAGMENT_NODE: 11,
    NOTATION_NODE: 12
  });
}

(function() {
  var element = this.Element;
  this.Element = function(tagName, attributes) {
    attributes = attributes || { };
    tagName = tagName.toLowerCase();
    var cache = Element.cache;
    if (Prototype.Browser.IE && attributes.name) {
      tagName = '<' + tagName + ' name="' + attributes.name + '">';
      delete attributes.name;
      return Element.writeAttribute(document.createElement(tagName), attributes);
    }
    if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
    return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
  };
  Object.extend(this.Element, element || { });
  if (element) this.Element.prototype = element.prototype;
}).call(window);

Element.cache = { };

Element.Methods = {
  visible: function(element) {
    return $(element).style.display != 'none';
  },

  toggle: function(element) {
    element = $(element);
    Element[Element.visible(element) ? 'hide' : 'show'](element);
    return element;
  },

  hide: function(element) {
    element = $(element);
    element.style.display = 'none';
    return element;
  },

  show: function(element) {
    element = $(element);
    element.style.display = '';
    return element;
  },

  remove: function(element) {
    element = $(element);
    element.parentNode.removeChild(element);
    return element;
  },

  update: function(element, content) {
    element = $(element);
    if (content && content.toElement) content = content.toElement();
    if (Object.isElement(content)) return element.update().insert(content);
    content = Object.toHTML(content);
    element.innerHTML = content.stripScripts();
    content.evalScripts.bind(content).defer();
    return element;
  },

  replace: function(element, content) {
    element = $(element);
    if (content && content.toElement) content = content.toElement();
    else if (!Object.isElement(content)) {
      content = Object.toHTML(content);
      var range = element.ownerDocument.createRange();
      range.selectNode(element);
      content.evalScripts.bind(content).defer();
      content = range.createContextualFragment(content.stripScripts());
    }
    element.parentNode.replaceChild(content, element);
    return element;
  },

  insert: function(element, insertions) {
    element = $(element);

    if (Object.isString(insertions) || Object.isNumber(insertions) ||
        Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
          insertions = {bottom:insertions};

    var content, insert, tagName, childNodes;

    for (var position in insertions) {
      content  = insertions[position];
      position = position.toLowerCase();
      insert = Element._insertionTranslations[position];

      if (content && content.toElement) content = content.toElement();
      if (Object.isElement(content)) {
        insert(element, content);
        continue;
      }

      content = Object.toHTML(content);

      tagName = ((position == 'before' || position == 'after')
        ? element.parentNode : element).tagName.toUpperCase();

      childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());

      if (position == 'top' || position == 'after') childNodes.reverse();
      childNodes.each(insert.curry(element));

      content.evalScripts.bind(content).defer();
    }

    return element;
  },

  wrap: function(element, wrapper, attributes) {
    element = $(element);
    if (Object.isElement(wrapper))
      $(wrapper).writeAttribute(attributes || { });
    else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
    else wrapper = new Element('div', wrapper);
    if (element.parentNode)
      element.parentNode.replaceChild(wrapper, element);
    wrapper.appendChild(element);
    return wrapper;
  },

  inspect: function(element) {
    element = $(element);
    var result = '<' + element.tagName.toLowerCase();
    $H({'id': 'id', 'className': 'class'}).each(function(pair) {
      var property = pair.first(), attribute = pair.last();
      var value = (element[property] || '').toString();
      if (value) result += ' ' + attribute + '=' + value.inspect(true);
    });
    return result + '>';
  },

  recursivelyCollect: function(element, property) {
    element = $(element);
    var elements = [];
    while (element = element[property])
      if (element.nodeType == 1)
        elements.push(Element.extend(element));
    return elements;
  },

  ancestors: function(element) {
    return $(element).recursivelyCollect('parentNode');
  },

  descendants: function(element) {
    return $(element).select("*");
  },

  firstDescendant: function(element) {
    element = $(element).firstChild;
    while (element && element.nodeType != 1) element = element.nextSibling;
    return $(element);
  },

  immediateDescendants: function(element) {
    if (!(element = $(element).firstChild)) return [];
    while (element && element.nodeType != 1) element = element.nextSibling;
    if (element) return [element].concat($(element).nextSiblings());
    return [];
  },

  previousSiblings: function(element) {
    return $(element).recursivelyCollect('previousSibling');
  },

  nextSiblings: function(element) {
    return $(element).recursivelyCollect('nextSibling');
  },

  siblings: function(element) {
    element = $(element);
    return element.previousSiblings().reverse().concat(element.nextSiblings());
  },

  match: function(element, selector) {
    if (Object.isString(selector))
      selector = new Selector(selector);
    return selector.match($(element));
  },

  up: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return $(element.parentNode);
    var ancestors = element.ancestors();
    return Object.isNumber(expression) ? ancestors[expression] :
      Selector.findElement(ancestors, expression, index);
  },

  down: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return element.firstDescendant();
    return Object.isNumber(expression) ? element.descendants()[expression] :
      Element.select(element, expression)[index || 0];
  },

  previous: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
    var previousSiblings = element.previousSiblings();
    return Object.isNumber(expression) ? previousSiblings[expression] :
      Selector.findElement(previousSiblings, expression, index);
  },

  next: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
    var nextSiblings = element.nextSiblings();
    return Object.isNumber(expression) ? nextSiblings[expression] :
      Selector.findElement(nextSiblings, expression, index);
  },

  select: function() {
    var args = $A(arguments), element = $(args.shift());
    return Selector.findChildElements(element, args);
  },

  adjacent: function() {
    var args = $A(arguments), element = $(args.shift());
    return Selector.findChildElements(element.parentNode, args).without(element);
  },

  identify: function(element) {
    element = $(element);
    var id = element.readAttribute('id'), self = arguments.callee;
    if (id) return id;
    do { id = 'anonymous_element_' + self.counter++ } while ($(id));
    element.writeAttribute('id', id);
    return id;
  },

  readAttribute: function(element, name) {
    element = $(element);
    if (Prototype.Browser.IE) {
      var t = Element._attributeTranslations.read;
      if (t.values[name]) return t.values[name](element, name);
      if (t.names[name]) name = t.names[name];
      if (name.include(':')) {
        return (!element.attributes || !element.attributes[name]) ? null :
         element.attributes[name].value;
      }
    }
    return element.getAttribute(name);
  },

  writeAttribute: function(element, name, value) {
    element = $(element);
    var attributes = { }, t = Element._attributeTranslations.write;

    if (typeof name == 'object') attributes = name;
    else attributes[name] = Object.isUndefined(value) ? true : value;

    for (var attr in attributes) {
      name = t.names[attr] || attr;
      value = attributes[attr];
      if (t.values[attr]) name = t.values[attr](element, value);
      if (value === false || value === null)
        element.removeAttribute(name);
      else if (value === true)
        element.setAttribute(name, name);
      else element.setAttribute(name, value);
    }
    return element;
  },

  getHeight: function(element) {
    return $(element).getDimensions().height;
  },

  getWidth: function(element) {
    return $(element).getDimensions().width;
  },

  classNames: function(element) {
    return new Element.ClassNames(element);
  },

  hasClassName: function(element, className) {
    if (!(element = $(element))) return;
    var elementClassName = element.className;
    return (elementClassName.length > 0 && (elementClassName == className ||
      new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
  },

  addClassName: function(element, className) {
    if (!(element = $(element))) return;
    if (!element.hasClassName(className))
      element.className += (element.className ? ' ' : '') + className;
    return element;
  },

  removeClassName: function(element, className) {
    if (!(element = $(element))) return;
    element.className = element.className.replace(
      new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
    return element;
  },

  toggleClassName: function(element, className) {
    if (!(element = $(element))) return;
    return element[element.hasClassName(className) ?
      'removeClassName' : 'addClassName'](className);
  },

  // removes whitespace-only text node children
  cleanWhitespace: function(element) {
    element = $(element);
    var node = element.firstChild;
    while (node) {
      var nextNode = node.nextSibling;
      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
        element.removeChild(node);
      node = nextNode;
    }
    return element;
  },

  empty: function(element) {
    return $(element).innerHTML.blank();
  },

  descendantOf: function(element, ancestor) {
    element = $(element), ancestor = $(ancestor);

    if (element.compareDocumentPosition)
      return (element.compareDocumentPosition(ancestor) & 8) === 8;

    if (ancestor.contains)
      return ancestor.contains(element) && ancestor !== element;

    while (element = element.parentNode)
      if (element == ancestor) return true;

    return false;
  },

  scrollTo: function(element) {
    element = $(element);
    var pos = element.cumulativeOffset();
    window.scrollTo(pos[0], pos[1]);
    return element;
  },

  getStyle: function(element, style) {
    element = $(element);
    style = style == 'float' ? 'cssFloat' : style.camelize();
    var value = element.style[style];
    if (!value || value == 'auto') {
      var css = document.defaultView.getComputedStyle(element, null);
      value = css ? css[style] : null;
    }
    if (style == 'opacity') return value ? parseFloat(value) : 1.0;
    return value == 'auto' ? null : value;
  },

  getOpacity: function(element) {
    return $(element).getStyle('opacity');
  },

  setStyle: function(element, styles) {
    element = $(element);
    var elementStyle = element.style, match;
    if (Object.isString(styles)) {
      element.style.cssText += ';' + styles;
      return styles.include('opacity') ?
        element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
    }
    for (var property in styles)
      if (property == 'opacity') element.setOpacity(styles[property]);
      else
        elementStyle[(property == 'float' || property == 'cssFloat') ?
          (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
            property] = styles[property];

    return element;
  },

  setOpacity: function(element, value) {
    element = $(element);
    element.style.opacity = (value == 1 || value === '') ? '' :
      (value < 0.00001) ? 0 : value;
    return element;
  },

  getDimensions: function(element) {
    element = $(element);
    var display = element.getStyle('display');
    if (display != 'none' && display != null) // Safari bug
      return {width: element.offsetWidth, height: element.offsetHeight};

    // All *Width and *Height properties give 0 on elements with display none,
    // so enable the element temporarily
    var els = element.style;
    var originalVisibility = els.visibility;
    var originalPosition = els.position;
    var originalDisplay = els.display;
    els.visibility = 'hidden';
    els.position = 'absolute';
    els.display = 'block';
    var originalWidth = element.clientWidth;
    var originalHeight = element.clientHeight;
    els.display = originalDisplay;
    els.position = originalPosition;
    els.visibility = originalVisibility;
    return {width: originalWidth, height: originalHeight};
  },

  makePositioned: function(element) {
    element = $(element);
    var pos = Element.getStyle(element, 'position');
    if (pos == 'static' || !pos) {
      element._madePositioned = true;
      element.style.position = 'relative';
      // Opera returns the offset relative to the positioning context, when an
      // element is position relative but top and left have not been defined
      if (Prototype.Browser.Opera) {
        element.style.top = 0;
        element.style.left = 0;
      }
    }
    return element;
  },

  undoPositioned: function(element) {
    element = $(element);
    if (element._madePositioned) {
      element._madePositioned = undefined;
      element.style.position =
        element.style.top =
        element.style.left =
        element.style.bottom =
        element.style.right = '';
    }
    return element;
  },

  makeClipping: function(element) {
    element = $(element);
    if (element._overflow) return element;
    element._overflow = Element.getStyle(element, 'overflow') || 'auto';
    if (element._overflow !== 'hidden')
      element.style.overflow = 'hidden';
    return element;
  },

  undoClipping: function(element) {
    element = $(element);
    if (!element._overflow) return element;
    element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
    element._overflow = null;
    return element;
  },

  cumulativeOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
    } while (element);
    return Element._returnOffset(valueL, valueT);
  },

  positionedOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      element = element.offsetParent;
      if (element) {
        if (element.tagName.toUpperCase() == 'BODY') break;
        var p = Element.getStyle(element, 'position');
        if (p !== 'static') break;
      }
    } while (element);
    return Element._returnOffset(valueL, valueT);
  },

  absolutize: function(element) {
    element = $(element);
    if (element.getStyle('position') == 'absolute') return element;
    // Position.prepare(); // To be done manually by Scripty when it needs it.

    var offsets = element.positionedOffset();
    var top     = offsets[1];
    var left    = offsets[0];
    var width   = element.clientWidth;
    var height  = element.clientHeight;

    element._originalLeft   = left - parseFloat(element.style.left  || 0);
    element._originalTop    = top  - parseFloat(element.style.top || 0);
    element._originalWidth  = element.style.width;
    element._originalHeight = element.style.height;

    element.style.position = 'absolute';
    element.style.top    = top + 'px';
    element.style.left   = left + 'px';
    element.style.width  = width + 'px';
    element.style.height = height + 'px';
    return element;
  },

  relativize: function(element) {
    element = $(element);
    if (element.getStyle('position') == 'relative') return element;
    // Position.prepare(); // To be done manually by Scripty when it needs it.

    element.style.position = 'relative';
    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);

    element.style.top    = top + 'px';
    element.style.left   = left + 'px';
    element.style.height = element._originalHeight;
    element.style.width  = element._originalWidth;
    return element;
  },

  cumulativeScrollOffset: function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.scrollTop  || 0;
      valueL += element.scrollLeft || 0;
      element = element.parentNode;
    } while (element);
    return Element._returnOffset(valueL, valueT);
  },

  getOffsetParent: function(element) {
    if (element.offsetParent) return $(element.offsetParent);
    if (element == document.body) return $(element);

    while ((element = element.parentNode) && element != document.body)
      if (Element.getStyle(element, 'position') != 'static')
        return $(element);

    return $(document.body);
  },

  viewportOffset: function(forElement) {
    var valueT = 0, valueL = 0;

    var element = forElement;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;

      // Safari fix
      if (element.offsetParent == document.body &&
        Element.getStyle(element, 'position') == 'absolute') break;

    } while (element = element.offsetParent);

    element = forElement;
    do {
      if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) {
        valueT -= element.scrollTop  || 0;
        valueL -= element.scrollLeft || 0;
      }
    } while (element = element.parentNode);

    return Element._returnOffset(valueL, valueT);
  },

  clonePosition: function(element, source) {
    var options = Object.extend({
      setLeft:    true,
      setTop:     true,
      setWidth:   true,
      setHeight:  true,
      offsetTop:  0,
      offsetLeft: 0
    }, arguments[2] || { });

    // find page position of source
    source = $(source);
    var p = source.viewportOffset();

    // find coordinate system to use
    element = $(element);
    var delta = [0, 0];
    var parent = null;
    // delta [0,0] will do fine with position: fixed elements,
    // position:absolute needs offsetParent deltas
    if (Element.getStyle(element, 'position') == 'absolute') {
      parent = element.getOffsetParent();
      delta = parent.viewportOffset();
    }

    // correct by body offsets (fixes Safari)
    if (parent == document.body) {
      delta[0] -= document.body.offsetLeft;
      delta[1] -= document.body.offsetTop;
    }

    // set position
    if (options.setLeft)   element.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
    if (options.setTop)    element.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
    if (options.setWidth)  element.style.width = source.offsetWidth + 'px';
    if (options.setHeight) element.style.height = source.offsetHeight + 'px';
    return element;
  }
};

Element.Methods.identify.counter = 1;

Object.extend(Element.Methods, {
  getElementsBySelector: Element.Methods.select,
  childElements: Element.Methods.immediateDescendants
});

Element._attributeTranslations = {
  write: {
    names: {
      className: 'class',
      htmlFor:   'for'
    },
    values: { }
  }
};

if (Prototype.Browser.Opera) {
  Element.Methods.getStyle = Element.Methods.getStyle.wrap(
    function(proceed, element, style) {
      switch (style) {
        case 'left': case 'top': case 'right': case 'bottom':
          if (proceed(element, 'position') === 'static') return null;
        case 'height': case 'width':
          // returns '0px' for hidden elements; we want it to return null
          if (!Element.visible(element)) return null;

          // returns the border-box dimensions rather than the content-box
          // dimensions, so we subtract padding and borders from the value
          var dim = parseInt(proceed(element, style), 10);

          if (dim !== element['offset' + style.capitalize()])
            return dim + 'px';

          var properties;
          if (style === 'height') {
            properties = ['border-top-width', 'padding-top',
             'padding-bottom', 'border-bottom-width'];
          }
          else {
            properties = ['border-left-width', 'padding-left',
             'padding-right', 'border-right-width'];
          }
          return properties.inject(dim, function(memo, property) {
            var val = proceed(element, property);
            return val === null ? memo : memo - parseInt(val, 10);
          }) + 'px';
        default: return proceed(element, style);
      }
    }
  );

  Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
    function(proceed, element, attribute) {
      if (attribute === 'title') return element.title;
      return proceed(element, attribute);
    }
  );
}

else if (Prototype.Browser.IE) {
  // IE doesn't report offsets correctly for static elements, so we change them
  // to "relative" to get the values, then change them back.
  Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
    function(proceed, element) {
      element = $(element);
      // IE throws an error if element is not in document
      try { element.offsetParent }
      catch(e) { return $(document.body) }
      var position = element.getStyle('position');
      if (position !== 'static') return proceed(element);
      element.setStyle({ position: 'relative' });
      var value = proceed(element);
      element.setStyle({ position: position });
      return value;
    }
  );

  $w('positionedOffset viewportOffset').each(function(method) {
    Element.Methods[method] = Element.Methods[method].wrap(
      function(proceed, element) {
        element = $(element);
        try { element.offsetParent }
        catch(e) { return Element._returnOffset(0,0) }
        var position = element.getStyle('position');
        if (position !== 'static') return proceed(element);
        // Trigger hasLayout on the offset parent so that IE6 reports
        // accurate offsetTop and offsetLeft values for position: fixed.
        var offsetParent = element.getOffsetParent();
        if (offsetParent && offsetParent.getStyle('position') === 'fixed')
          offsetParent.setStyle({ zoom: 1 });
        element.setStyle({ position: 'relative' });
        var value = proceed(element);
        element.setStyle({ position: position });
        return value;
      }
    );
  });

  Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap(
    function(proceed, element) {
      try { element.offsetParent }
      catch(e) { return Element._returnOffset(0,0) }
      return proceed(element);
    }
  );

  Element.Methods.getStyle = function(element, style) {
    element = $(element);
    style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
    var value = element.style[style];
    if (!value && element.currentStyle) value = element.currentStyle[style];

    if (style == 'opacity') {
      if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
        if (value[1]) return parseFloat(value[1]) / 100;
      return 1.0;
    }

    if (value == 'auto') {
      if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
        return element['offset' + style.capitalize()] + 'px';
      return null;
    }
    return value;
  };

  Element.Methods.setOpacity = function(element, value) {
    function stripAlpha(filter){
      return filter.replace(/alpha\([^\)]*\)/gi,'');
    }
    element = $(element);
    var currentStyle = element.currentStyle;
    if ((currentStyle && !currentStyle.hasLayout) ||
      (!currentStyle && element.style.zoom == 'normal'))
        element.style.zoom = 1;

    var filter = element.getStyle('filter'), style = element.style;
    if (value == 1 || value === '') {
      (filter = stripAlpha(filter)) ?
        style.filter = filter : style.removeAttribute('filter');
      return element;
    } else if (value < 0.00001) value = 0;
    style.filter = stripAlpha(filter) +
      'alpha(opacity=' + (value * 100) + ')';
    return element;
  };

  Element._attributeTranslations = {
    read: {
      names: {
        'class': 'className',
        'for':   'htmlFor'
      },
      values: {
        _getAttr: function(element, attribute) {
          return element.getAttribute(attribute, 2);
        },
        _getAttrNode: function(element, attribute) {
          var node = element.getAttributeNode(attribute);
          return node ? node.value : "";
        },
        _getEv: function(element, attribute) {
          attribute = element.getAttribute(attribute);
          return attribute ? attribute.toString().slice(23, -2) : null;
        },
        _flag: function(element, attribute) {
          return $(element).hasAttribute(attribute) ? attribute : null;
        },
        style: function(element) {
          return element.style.cssText.toLowerCase();
        },
        title: function(element) {
          return element.title;
        }
      }
    }
  };

  Element._attributeTranslations.write = {
    names: Object.extend({
      cellpadding: 'cellPadding',
      cellspacing: 'cellSpacing'
    }, Element._attributeTranslations.read.names),
    values: {
      checked: function(element, value) {
        element.checked = !!value;
      },

      style: function(element, value) {
        element.style.cssText = value ? value : '';
      }
    }
  };

  Element._attributeTranslations.has = {};

  $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
      'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
    Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
    Element._attributeTranslations.has[attr.toLowerCase()] = attr;
  });

  (function(v) {
    Object.extend(v, {
      href:        v._getAttr,
      src:         v._getAttr,
      type:        v._getAttr,
      action:      v._getAttrNode,
      disabled:    v._flag,
      checked:     v._flag,
      readonly:    v._flag,
      multiple:    v._flag,
      onload:      v._getEv,
      onunload:    v._getEv,
      onclick:     v._getEv,
      ondblclick:  v._getEv,
      onmousedown: v._getEv,
      onmouseup:   v._getEv,
      onmouseover: v._getEv,
      onmousemove: v._getEv,
      onmouseout:  v._getEv,
      onfocus:     v._getEv,
      onblur:      v._getEv,
      onkeypress:  v._getEv,
      onkeydown:   v._getEv,
      onkeyup:     v._getEv,
      onsubmit:    v._getEv,
      onreset:     v._getEv,
      onselect:    v._getEv,
      onchange:    v._getEv
    });
  })(Element._attributeTranslations.read.values);
}

else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
  Element.Methods.setOpacity = function(element, value) {
    element = $(element);
    element.style.opacity = (value == 1) ? 0.999999 :
      (value === '') ? '' : (value < 0.00001) ? 0 : value;
    return element;
  };
}

else if (Prototype.Browser.WebKit) {
  Element.Methods.setOpacity = function(element, value) {
    element = $(element);
    element.style.opacity = (value == 1 || value === '') ? '' :
      (value < 0.00001) ? 0 : value;

    if (value == 1)
      if(element.tagName.toUpperCase() == 'IMG' && element.width) {
        element.width++; element.width--;
      } else try {
        var n = document.createTextNode(' ');
        element.appendChild(n);
        element.removeChild(n);
      } catch (e) { }

    return element;
  };

  // Safari returns margins on body which is incorrect if the child is absolutely
  // positioned.  For performance reasons, redefine Element#cumulativeOffset for
  // KHTML/WebKit only.
  Element.Methods.cumulativeOffset = function(element) {
    var valueT = 0, valueL = 0;
    do {
      valueT += element.offsetTop  || 0;
      valueL += element.offsetLeft || 0;
      if (element.offsetParent == document.body)
        if (Element.getStyle(element, 'position') == 'absolute') break;

      element = element.offsetParent;
    } while (element);

    return Element._returnOffset(valueL, valueT);
  };
}

if (Prototype.Browser.IE || Prototype.Browser.Opera) {
  // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
  Element.Methods.update = function(element, content) {
    element = $(element);

    if (content && content.toElement) content = content.toElement();
    if (Object.isElement(content)) return element.update().insert(content);

    content = Object.toHTML(content);
    var tagName = element.tagName.toUpperCase();

    if (tagName in Element._insertionTranslations.tags) {
      $A(element.childNodes).each(function(node) { element.removeChild(node) });
      Element._getContentFromAnonymousElement(tagName, content.stripScripts())
        .each(function(node) { element.appendChild(node) });
    }
    else element.innerHTML = content.stripScripts();

    content.evalScripts.bind(content).defer();
    return element;
  };
}

if ('outerHTML' in document.createElement('div')) {
  Element.Methods.replace = function(element, content) {
    element = $(element);

    if (content && content.toElement) content = content.toElement();
    if (Object.isElement(content)) {
      element.parentNode.replaceChild(content, element);
      return element;
    }

    content = Object.toHTML(content);
    var parent = element.parentNode, tagName = parent.tagName.toUpperCase();

    if (Element._insertionTranslations.tags[tagName]) {
      var nextSibling = element.next();
      var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
      parent.removeChild(element);
      if (nextSibling)
        fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
      else
        fragments.each(function(node) { parent.appendChild(node) });
    }
    else element.outerHTML = content.stripScripts();

    content.evalScripts.bind(content).defer();
    return element;
  };
}

Element._returnOffset = function(l, t) {
  var result = [l, t];
  result.left = l;
  result.top = t;
  return result;
};

Element._getContentFromAnonymousElement = function(tagName, html) {
  var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
  if (t) {
    div.innerHTML = t[0] + html + t[1];
    t[2].times(function() { div = div.firstChild });
  } else div.innerHTML = html;
  return $A(div.childNodes);
};

Element._insertionTranslations = {
  before: function(element, node) {
    element.parentNode.insertBefore(node, element);
  },
  top: function(element, node) {
    element.insertBefore(node, element.firstChild);
  },
  bottom: function(element, node) {
    element.appendChild(node);
  },
  after: function(element, node) {
    element.parentNode.insertBefore(node, element.nextSibling);
  },
  tags: {
    TABLE:  ['<table>',                '</table>',                   1],
    TBODY:  ['<table><tbody>',         '</tbody></table>',           2],
    TR:     ['<table><tbody><tr>',     '</tr></tbody></table>',      3],
    TD:     ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
    SELECT: ['<select>',               '</select>',                  1]
  }
};

(function() {
  Object.extend(this.tags, {
    THEAD: this.tags.TBODY,
    TFOOT: this.tags.TBODY,
    TH:    this.tags.TD
  });
}).call(Element._insertionTranslations);

Element.Methods.Simulated = {
  hasAttribute: function(element, attribute) {
    attribute = Element._attributeTranslations.has[attribute] || attribute;
    var node = $(element).getAttributeNode(attribute);
    return !!(node && node.specified);
  }
};

Element.Methods.ByTag = { };

Object.extend(Element, Element.Methods);

if (!Prototype.BrowserFeatures.ElementExtensions &&
    document.createElement('div')['__proto__']) {
  window.HTMLElement = { };
  window.HTMLElement.prototype = document.createElement('div')['__proto__'];
  Prototype.BrowserFeatures.ElementExtensions = true;
}

Element.extend = (function() {
  if (Prototype.BrowserFeatures.SpecificElementExtensions)
    return Prototype.K;

  var Methods = { }, ByTag = Element.Methods.ByTag;

  var extend = Object.extend(function(element) {
    if (!element || element._extendedByPrototype ||
        element.nodeType != 1 || element == window) return element;

    var methods = Object.clone(Methods),
      tagName = element.tagName.toUpperCase(), property, value;

    // extend methods for specific tags
    if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);

    for (property in methods) {
      value = methods[property];
      if (Object.isFunction(value) && !(property in element))
        element[property] = value.methodize();
    }

    element._extendedByPrototype = Prototype.emptyFunction;
    return element;

  }, {
    refresh: function() {
      // extend methods for all tags (Safari doesn't need this)
      if (!Prototype.BrowserFeatures.ElementExtensions) {
        Object.extend(Methods, Element.Methods);
        Object.extend(Methods, Element.Methods.Simulated);
      }
    }
  });

  extend.refresh();
  return extend;
})();

Element.hasAttribute = function(element, attribute) {
  if (element.hasAttribute) return element.hasAttribute(attribute);
  return Element.Methods.Simulated.hasAttribute(element, attribute);
};

Element.addMethods = function(methods) {
  var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;

  if (!methods) {
    Object.extend(Form, Form.Methods);
    Object.extend(Form.Element, Form.Element.Methods);
    Object.extend(Element.Methods.ByTag, {
      "FORM":     Object.clone(Form.Methods),
      "INPUT":    Object.clone(Form.Element.Methods),
      "SELECT":   Object.clone(Form.Element.Methods),
      "TEXTAREA": Object.clone(Form.Element.Methods)
    });
  }

  if (arguments.length == 2) {
    var tagName = methods;
    methods = arguments[1];
  }

  if (!tagName) Object.extend(Element.Methods, methods || { });
  else {
    if (Object.isArray(tagName)) tagName.each(extend);
    else extend(tagName);
  }

  function extend(tagName) {
    tagName = tagName.toUpperCase();
    if (!Element.Methods.ByTag[tagName])
      Element.Methods.ByTag[tagName] = { };
    Object.extend(Element.Methods.ByTag[tagName], methods);
  }

  function copy(methods, destination, onlyIfAbsent) {
    onlyIfAbsent = onlyIfAbsent || false;
    for (var property in methods) {
      var value = methods[property];
      if (!Object.isFunction(value)) continue;
      if (!onlyIfAbsent || !(property in destination))
        destination[property] = value.methodize();
    }
  }

  function findDOMClass(tagName) {
    var klass;
    var trans = {
      "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
      "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
      "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
      "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
      "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
      "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
      "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
      "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
      "FrameSet", "IFRAME": "IFrame"
    };
    if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
    if (window[klass]) return window[klass];
    klass = 'HTML' + tagName + 'Element';
    if (window[klass]) return window[klass];
    klass = 'HTML' + tagName.capitalize() + 'Element';
    if (window[klass]) return window[klass];

    window[klass] = { };
    window[klass].prototype = document.createElement(tagName)['__proto__'];
    return window[klass];
  }

  if (F.ElementExtensions) {
    copy(Element.Methods, HTMLElement.prototype);
    copy(Element.Methods.Simulated, HTMLElement.prototype, true);
  }

  if (F.SpecificElementExtensions) {
    for (var tag in Element.Methods.ByTag) {
      var klass = findDOMClass(tag);
      if (Object.isUndefined(klass)) continue;
      copy(T[tag], klass.prototype);
    }
  }

  Object.extend(Element, Element.Methods);
  delete Element.ByTag;

  if (Element.extend.refresh) Element.extend.refresh();
  Element.cache = { };
};

document.viewport = {
  getDimensions: function() {
    var dimensions = { }, B = Prototype.Browser;
    $w('width height').each(function(d) {
      var D = d.capitalize();
      if (B.WebKit && !document.evaluate) {
        // Safari <3.0 needs self.innerWidth/Height
        dimensions[d] = self['inner' + D];
      } else if (B.Opera && parseFloat(window.opera.version()) < 9.5) {
        // Opera <9.5 needs document.body.clientWidth/Height
        dimensions[d] = document.body['client' + D]
      } else {
        dimensions[d] = document.documentElement['client' + D];
      }
    });
    return dimensions;
  },

  getWidth: function() {
    return this.getDimensions().width;
  },

  getHeight: function() {
    return this.getDimensions().height;
  },

  getScrollOffsets: function() {
    return Element._returnOffset(
      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
      window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
  }
};
/* Portions of the Selector class are derived from Jack Slocum's DomQuery,
 * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
 * license.  Please see http://www.yui-ext.com/ for more information. */

var Selector = Class.create({
  initialize: function(expression) {
    this.expression = expression.strip();

    if (this.shouldUseSelectorsAPI()) {
      this.mode = 'selectorsAPI';
    } else if (this.shouldUseXPath()) {
      this.mode = 'xpath';
      this.compileXPathMatcher();
    } else {
      this.mode = "normal";
      this.compileMatcher();
    }

  },

  shouldUseXPath: function() {
    if (!Prototype.BrowserFeatures.XPath) return false;

    var e = this.expression;

    // Safari 3 chokes on :*-of-type and :empty
    if (Prototype.Browser.WebKit &&
     (e.include("-of-type") || e.include(":empty")))
      return false;

    // XPath can't do namespaced attributes, nor can it read
    // the "checked" property from DOM nodes
    if ((/(\[[\w-]*?:|:checked)/).test(e))
      return false;

    return true;
  },

  shouldUseSelectorsAPI: function() {
    if (!Prototype.BrowserFeatures.SelectorsAPI) return false;

    if (!Selector._div) Selector._div = new Element('div');

    // Make sure the browser treats the selector as valid. Test on an
    // isolated element to minimize cost of this check.
    try {
      Selector._div.querySelector(this.expression);
    } catch(e) {
      return false;
    }

    return true;
  },

  compileMatcher: function() {
    var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
        c = Selector.criteria, le, p, m;

    if (Selector._cache[e]) {
      this.matcher = Selector._cache[e];
      return;
    }

    this.matcher = ["this.matcher = function(root) {",
                    "var r = root, h = Selector.handlers, c = false, n;"];

    while (e && le != e && (/\S/).test(e)) {
      le = e;
      for (var i in ps) {
        p = ps[i];
        if (m = e.match(p)) {
          this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
            new Template(c[i]).evaluate(m));
          e = e.replace(m[0], '');
          break;
        }
      }
    }

    this.matcher.push("return h.unique(n);\n}");
    eval(this.matcher.join('\n'));
    Selector._cache[this.expression] = this.matcher;
  },

  compileXPathMatcher: function() {
    var e = this.expression, ps = Selector.patterns,
        x = Selector.xpath, le, m;

    if (Selector._cache[e]) {
      this.xpath = Selector._cache[e]; return;
    }

    this.matcher = ['.//*'];
    while (e && le != e && (/\S/).test(e)) {
      le = e;
      for (var i in ps) {
        if (m = e.match(ps[i])) {
          this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
            new Template(x[i]).evaluate(m));
          e = e.replace(m[0], '');
          break;
        }
      }
    }

    this.xpath = this.matcher.join('');
    Selector._cache[this.expression] = this.xpath;
  },

  findElements: function(root) {
    root = root || document;
    var e = this.expression, results;

    switch (this.mode) {
      case 'selectorsAPI':
        // querySelectorAll queries document-wide, then filters to descendants
        // of the context element. That's not what we want.
        // Add an explicit context to the selector if necessary.
        if (root !== document) {
          var oldId = root.id, id = $(root).identify();
          e = "#" + id + " " + e;
        }

        results = $A(root.querySelectorAll(e)).map(Element.extend);
        root.id = oldId;

        return results;
      case 'xpath':
        return document._getElementsByXPath(this.xpath, root);
      default:
       return this.matcher(root);
    }
  },

  match: function(element) {
    this.tokens = [];

    var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
    var le, p, m;

    while (e && le !== e && (/\S/).test(e)) {
      le = e;
      for (var i in ps) {
        p = ps[i];
        if (m = e.match(p)) {
          // use the Selector.assertions methods unless the selector
          // is too complex.
          if (as[i]) {
            this.tokens.push([i, Object.clone(m)]);
            e = e.replace(m[0], '');
          } else {
            // reluctantly do a document-wide search
            // and look for a match in the array
            return this.findElements(document).include(element);
          }
        }
      }
    }

    var match = true, name, matches;
    for (var i = 0, token; token = this.tokens[i]; i++) {
      name = token[0], matches = token[1];
      if (!Selector.assertions[name](element, matches)) {
        match = false; break;
      }
    }

    return match;
  },

  toString: function() {
    return this.expression;
  },

  inspect: function() {
    return "#<Selector:" + this.expression.inspect() + ">";
  }
});

Object.extend(Selector, {
  _cache: { },

  xpath: {
    descendant:   "//*",
    child:        "/*",
    adjacent:     "/following-sibling::*[1]",
    laterSibling: '/following-sibling::*',
    tagName:      function(m) {
      if (m[1] == '*') return '';
      return "[local-name()='" + m[1].toLowerCase() +
             "' or local-name()='" + m[1].toUpperCase() + "']";
    },
    className:    "[contains(concat(' ', @class, ' '), ' #{1} ')]",
    id:           "[@id='#{1}']",
    attrPresence: function(m) {
      m[1] = m[1].toLowerCase();
      return new Template("[@#{1}]").evaluate(m);
    },
    attr: function(m) {
      m[1] = m[1].toLowerCase();
      m[3] = m[5] || m[6];
      return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
    },
    pseudo: function(m) {
      var h = Selector.xpath.pseudos[m[1]];
      if (!h) return '';
      if (Object.isFunction(h)) return h(m);
      return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
    },
    operators: {
      '=':  "[@#{1}='#{3}']",
      '!=': "[@#{1}!='#{3}']",
      '^=': "[starts-with(@#{1}, '#{3}')]",
      '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
      '*=': "[contains(@#{1}, '#{3}')]",
      '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
      '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
    },
    pseudos: {
      'first-child': '[not(preceding-sibling::*)]',
      'last-child':  '[not(following-sibling::*)]',
      'only-child':  '[not(preceding-sibling::* or following-sibling::*)]',
      'empty':       "[count(*) = 0 and (count(text()) = 0)]",
      'checked':     "[@checked]",
      'disabled':    "[(@disabled) and (@type!='hidden')]",
      'enabled':     "[not(@disabled) and (@type!='hidden')]",
      'not': function(m) {
        var e = m[6], p = Selector.patterns,
            x = Selector.xpath, le, v;

        var exclusion = [];
        while (e && le != e && (/\S/).test(e)) {
          le = e;
          for (var i in p) {
            if (m = e.match(p[i])) {
              v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
              exclusion.push("(" + v.substring(1, v.length - 1) + ")");
              e = e.replace(m[0], '');
              break;
            }
          }
        }
        return "[not(" + exclusion.join(" and ") + ")]";
      },
      'nth-child':      function(m) {
        return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
      },
      'nth-last-child': function(m) {
        return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
      },
      'nth-of-type':    function(m) {
        return Selector.xpath.pseudos.nth("position() ", m);
      },
      'nth-last-of-type': function(m) {
        return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
      },
      'first-of-type':  function(m) {
        m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
      },
      'last-of-type':   function(m) {
        m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
      },
      'only-of-type':   function(m) {
        var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
      },
      nth: function(fragment, m) {
        var mm, formula = m[6], predicate;
        if (formula == 'even') formula = '2n+0';
        if (formula == 'odd')  formula = '2n+1';
        if (mm = formula.match(/^(\d+)$/)) // digit only
          return '[' + fragment + "= " + mm[1] + ']';
        if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
          if (mm[1] == "-") mm[1] = -1;
          var a = mm[1] ? Number(mm[1]) : 1;
          var b = mm[2] ? Number(mm[2]) : 0;
          predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
          "((#{fragment} - #{b}) div #{a} >= 0)]";
          return new Template(predicate).evaluate({
            fragment: fragment, a: a, b: b });
        }
      }
    }
  },

  criteria: {
    tagName:      'n = h.tagName(n, r, "#{1}", c);      c = false;',
    className:    'n = h.className(n, r, "#{1}", c);    c = false;',
    id:           'n = h.id(n, r, "#{1}", c);           c = false;',
    attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
    attr: function(m) {
      m[3] = (m[5] || m[6]);
      return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
    },
    pseudo: function(m) {
      if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
      return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
    },
    descendant:   'c = "descendant";',
    child:        'c = "child";',
    adjacent:     'c = "adjacent";',
    laterSibling: 'c = "laterSibling";'
  },

  patterns: {
    // combinators must be listed first
    // (and descendant needs to be last combinator)
    laterSibling: /^\s*~\s*/,
    child:        /^\s*>\s*/,
    adjacent:     /^\s*\+\s*/,
    descendant:   /^\s/,

    // selectors follow
    tagName:      /^\s*(\*|[\w\-]+)(\b|$)?/,
    id:           /^#([\w\-\*]+)(\b|$)/,
    className:    /^\.([\w\-\*]+)(\b|$)/,
    pseudo:
/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
    attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/,
    attr:         /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
  },

  // for Selector.match and Element#match
  assertions: {
    tagName: function(element, matches) {
      return matches[1].toUpperCase() == element.tagName.toUpperCase();
    },

    className: function(element, matches) {
      return Element.hasClassName(element, matches[1]);
    },

    id: function(element, matches) {
      return element.id === matches[1];
    },

    attrPresence: function(element, matches) {
      return Element.hasAttribute(element, matches[1]);
    },

    attr: function(element, matches) {
      var nodeValue = Element.readAttribute(element, matches[1]);
      return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
    }
  },

  handlers: {
    // UTILITY FUNCTIONS
    // joins two collections
    concat: function(a, b) {
      for (var i = 0, node; node = b[i]; i++)
        a.push(node);
      return a;
    },

    // marks an array of nodes for counting
    mark: function(nodes) {
      var _true = Prototype.emptyFunction;
      for (var i = 0, node; node = nodes[i]; i++)
        node._countedByPrototype = _true;
      return nodes;
    },

    unmark: function(nodes) {
      for (var i = 0, node; node = nodes[i]; i++)
        node._countedByPrototype = undefined;
      return nodes;
    },

    // mark each child node with its position (for nth calls)
    // "ofType" flag indicates whether we're indexing for nth-of-type
    // rather than nth-child
    index: function(parentNode, reverse, ofType) {
      parentNode._countedByPrototype = Prototype.emptyFunction;
      if (reverse) {
        for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
          var node = nodes[i];
          if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
        }
      } else {
        for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
          if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
      }
    },

    // filters out duplicates and extends all nodes
    unique: function(nodes) {
      if (nodes.length == 0) return nodes;
      var results = [], n;
      for (var i = 0, l = nodes.length; i < l; i++)
        if (!(n = nodes[i])._countedByPrototype) {
          n._countedByPrototype = Prototype.emptyFunction;
          results.push(Element.extend(n));
        }
      return Selector.handlers.unmark(results);
    },

    // COMBINATOR FUNCTIONS
    descendant: function(nodes) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        h.concat(results, node.getElementsByTagName('*'));
      return results;
    },

    child: function(nodes) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        for (var j = 0, child; child = node.childNodes[j]; j++)
          if (child.nodeType == 1 && child.tagName != '!') results.push(child);
      }
      return results;
    },

    adjacent: function(nodes) {
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        var next = this.nextElementSibling(node);
        if (next) results.push(next);
      }
      return results;
    },

    laterSibling: function(nodes) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        h.concat(results, Element.nextSiblings(node));
      return results;
    },

    nextElementSibling: function(node) {
      while (node = node.nextSibling)
        if (node.nodeType == 1) return node;
      return null;
    },

    previousElementSibling: function(node) {
      while (node = node.previousSibling)
        if (node.nodeType == 1) return node;
      return null;
    },

    // TOKEN FUNCTIONS
    tagName: function(nodes, root, tagName, combinator) {
      var uTagName = tagName.toUpperCase();
      var results = [], h = Selector.handlers;
      if (nodes) {
        if (combinator) {
          // fastlane for ordinary descendant combinators
          if (combinator == "descendant") {
            for (var i = 0, node; node = nodes[i]; i++)
              h.concat(results, node.getElementsByTagName(tagName));
            return results;
          } else nodes = this[combinator](nodes);
          if (tagName == "*") return nodes;
        }
        for (var i = 0, node; node = nodes[i]; i++)
          if (node.tagName.toUpperCase() === uTagName) results.push(node);
        return results;
      } else return root.getElementsByTagName(tagName);
    },

    id: function(nodes, root, id, combinator) {
      var targetNode = $(id), h = Selector.handlers;
      if (!targetNode) return [];
      if (!nodes && root == document) return [targetNode];
      if (nodes) {
        if (combinator) {
          if (combinator == 'child') {
            for (var i = 0, node; node = nodes[i]; i++)
              if (targetNode.parentNode == node) return [targetNode];
          } else if (combinator == 'descendant') {
            for (var i = 0, node; node = nodes[i]; i++)
              if (Element.descendantOf(targetNode, node)) return [targetNode];
          } else if (combinator == 'adjacent') {
            for (var i = 0, node; node = nodes[i]; i++)
              if (Selector.handlers.previousElementSibling(targetNode) == node)
                return [targetNode];
          } else nodes = h[combinator](nodes);
        }
        for (var i = 0, node; node = nodes[i]; i++)
          if (node == targetNode) return [targetNode];
        return [];
      }
      return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
    },

    className: function(nodes, root, className, combinator) {
      if (nodes && combinator) nodes = this[combinator](nodes);
      return Selector.handlers.byClassName(nodes, root, className);
    },

    byClassName: function(nodes, root, className) {
      if (!nodes) nodes = Selector.handlers.descendant([root]);
      var needle = ' ' + className + ' ';
      for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
        nodeClassName = node.className;
        if (nodeClassName.length == 0) continue;
        if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
          results.push(node);
      }
      return results;
    },

    attrPresence: function(nodes, root, attr, combinator) {
      if (!nodes) nodes = root.getElementsByTagName("*");
      if (nodes && combinator) nodes = this[combinator](nodes);
      var results = [];
      for (var i = 0, node; node = nodes[i]; i++)
        if (Element.hasAttribute(node, attr)) results.push(node);
      return results;
    },

    attr: function(nodes, root, attr, value, operator, combinator) {
      if (!nodes) nodes = root.getElementsByTagName("*");
      if (nodes && combinator) nodes = this[combinator](nodes);
      var handler = Selector.operators[operator], results = [];
      for (var i = 0, node; node = nodes[i]; i++) {
        var nodeValue = Element.readAttribute(node, attr);
        if (nodeValue === null) continue;
        if (handler(nodeValue, value)) results.push(node);
      }
      return results;
    },

    pseudo: function(nodes, name, value, root, combinator) {
      if (nodes && combinator) nodes = this[combinator](nodes);
      if (!nodes) nodes = root.getElementsByTagName("*");
      return Selector.pseudos[name](nodes, value, root);
    }
  },

  pseudos: {
    'first-child': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        if (Selector.handlers.previousElementSibling(node)) continue;
          results.push(node);
      }
      return results;
    },
    'last-child': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        if (Selector.handlers.nextElementSibling(node)) continue;
          results.push(node);
      }
      return results;
    },
    'only-child': function(nodes, value, root) {
      var h = Selector.handlers;
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
          results.push(node);
      return results;
    },
    'nth-child':        function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, formula, root);
    },
    'nth-last-child':   function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, formula, root, true);
    },
    'nth-of-type':      function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, formula, root, false, true);
    },
    'nth-last-of-type': function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, formula, root, true, true);
    },
    'first-of-type':    function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, "1", root, false, true);
    },
    'last-of-type':     function(nodes, formula, root) {
      return Selector.pseudos.nth(nodes, "1", root, true, true);
    },
    'only-of-type':     function(nodes, formula, root) {
      var p = Selector.pseudos;
      return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
    },

    // handles the an+b logic
    getIndices: function(a, b, total) {
      if (a == 0) return b > 0 ? [b] : [];
      return $R(1, total).inject([], function(memo, i) {
        if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
        return memo;
      });
    },

    // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
    nth: function(nodes, formula, root, reverse, ofType) {
      if (nodes.length == 0) return [];
      if (formula == 'even') formula = '2n+0';
      if (formula == 'odd')  formula = '2n+1';
      var h = Selector.handlers, results = [], indexed = [], m;
      h.mark(nodes);
      for (var i = 0, node; node = nodes[i]; i++) {
        if (!node.parentNode._countedByPrototype) {
          h.index(node.parentNode, reverse, ofType);
          indexed.push(node.parentNode);
        }
      }
      if (formula.match(/^\d+$/)) { // just a number
        formula = Number(formula);
        for (var i = 0, node; node = nodes[i]; i++)
          if (node.nodeIndex == formula) results.push(node);
      } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
        if (m[1] == "-") m[1] = -1;
        var a = m[1] ? Number(m[1]) : 1;
        var b = m[2] ? Number(m[2]) : 0;
        var indices = Selector.pseudos.getIndices(a, b, nodes.length);
        for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
          for (var j = 0; j < l; j++)
            if (node.nodeIndex == indices[j]) results.push(node);
        }
      }
      h.unmark(nodes);
      h.unmark(indexed);
      return results;
    },

    'empty': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++) {
        // IE treats comments as element nodes
        if (node.tagName == '!' || node.firstChild) continue;
        results.push(node);
      }
      return results;
    },

    'not': function(nodes, selector, root) {
      var h = Selector.handlers, selectorType, m;
      var exclusions = new Selector(selector).findElements(root);
      h.mark(exclusions);
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (!node._countedByPrototype) results.push(node);
      h.unmark(exclusions);
      return results;
    },

    'enabled': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (!node.disabled && (!node.type || node.type !== 'hidden'))
          results.push(node);
      return results;
    },

    'disabled': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (node.disabled) results.push(node);
      return results;
    },

    'checked': function(nodes, value, root) {
      for (var i = 0, results = [], node; node = nodes[i]; i++)
        if (node.checked) results.push(node);
      return results;
    }
  },

  operators: {
    '=':  function(nv, v) { return nv == v; },
    '!=': function(nv, v) { return nv != v; },
    '^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); },
    '$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); },
    '*=': function(nv, v) { return nv == v || nv && nv.include(v); },
    '$=': function(nv, v) { return nv.endsWith(v); },
    '*=': function(nv, v) { return nv.include(v); },
    '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
    '|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() +
     '-').include('-' + (v || "").toUpperCase() + '-'); }
  },

  split: function(expression) {
    var expressions = [];
    expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
      expressions.push(m[1].strip());
    });
    return expressions;
  },

  matchElements: function(elements, expression) {
    var matches = $$(expression), h = Selector.handlers;
    h.mark(matches);
    for (var i = 0, results = [], element; element = elements[i]; i++)
      if (element._countedByPrototype) results.push(element);
    h.unmark(matches);
    return results;
  },

  findElement: function(elements, expression, index) {
    if (Object.isNumber(expression)) {
      index = expression; expression = false;
    }
    return Selector.matchElements(elements, expression || '*')[index || 0];
  },

  findChildElements: function(element, expressions) {
    expressions = Selector.split(expressions.join(','));
    var results = [], h = Selector.handlers;
    for (var i = 0, l = expressions.length, selector; i < l; i++) {
      selector = new Selector(expressions[i].strip());
      h.concat(results, selector.findElements(element));
    }
    return (l > 1) ? h.unique(results) : results;
  }
});

if (Prototype.Browser.IE) {
  Object.extend(Selector.handlers, {
    // IE returns comment nodes on getElementsByTagName("*").
    // Filter them out.
    concat: function(a, b) {
      for (var i = 0, node; node = b[i]; i++)
        if (node.tagName !== "!") a.push(node);
      return a;
    },

    // IE improperly serializes _countedByPrototype in (inner|outer)HTML.
    unmark: function(nodes) {
      for (var i = 0, node; node = nodes[i]; i++)
        node.removeAttribute('_countedByPrototype');
      return nodes;
    }
  });
}

function $$() {
  return Selector.findChildElements(document, $A(arguments));
}
var Form = {
  reset: function(form) {
    $(form).reset();
    return form;
  },

  serializeElements: function(elements, options) {
    if (typeof options != 'object') options = { hash: !!options };
    else if (Object.isUndefined(options.hash)) options.hash = true;
    var key, value, submitted = false, submit = options.submit;

    var data = elements.inject({ }, function(result, element) {
      if (!element.disabled && element.name) {
        key = element.name; value = $(element).getValue();
        if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
            submit !== false && (!submit || key == submit) && (submitted = true)))) {
          if (key in result) {
            // a key is already present; construct an array of values
            if (!Object.isArray(result[key])) result[key] = [result[key]];
            result[key].push(value);
          }
          else result[key] = value;
        }
      }
      return result;
    });

    return options.hash ? data : Object.toQueryString(data);
  }
};

Form.Methods = {
  serialize: function(form, options) {
    return Form.serializeElements(Form.getElements(form), options);
  },

  getElements: function(form) {
    return $A($(form).getElementsByTagName('*')).inject([],
      function(elements, child) {
        if (Form.Element.Serializers[child.tagName.toLowerCase()])
          elements.push(Element.extend(child));
        return elements;
      }
    );
  },

  getInputs: function(form, typeName, name) {
    form = $(form);
    var inputs = form.getElementsByTagName('input');

    if (!typeName && !name) return $A(inputs).map(Element.extend);

    for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
      var input = inputs[i];
      if ((typeName && input.type != typeName) || (name && input.name != name))
        continue;
      matchingInputs.push(Element.extend(input));
    }

    return matchingInputs;
  },

  disable: function(form) {
    form = $(form);
    Form.getElements(form).invoke('disable');
    return form;
  },

  enable: function(form) {
    form = $(form);
    Form.getElements(form).invoke('enable');
    return form;
  },

  findFirstElement: function(form) {
    var elements = $(form).getElements().findAll(function(element) {
      return 'hidden' != element.type && !element.disabled;
    });
    var firstByIndex = elements.findAll(function(element) {
      return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
    }).sortBy(function(element) { return element.tabIndex }).first();

    return firstByIndex ? firstByIndex : elements.find(function(element) {
      return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
    });
  },

  focusFirstElement: function(form) {
    form = $(form);
    form.findFirstElement().activate();
    return form;
  },

  request: function(form, options) {
    form = $(form), options = Object.clone(options || { });

    var params = options.parameters, action = form.readAttribute('action') || '';
    if (action.blank()) action = window.location.href;
    options.parameters = form.serialize(true);

    if (params) {
      if (Object.isString(params)) params = params.toQueryParams();
      Object.extend(options.parameters, params);
    }

    if (form.hasAttribute('method') && !options.method)
      options.method = form.method;

    return new Ajax.Request(action, options);
  }
};

/*--------------------------------------------------------------------------*/

Form.Element = {
  focus: function(element) {
    $(element).focus();
    return element;
  },

  select: function(element) {
    $(element).select();
    return element;
  }
};

Form.Element.Methods = {
  serialize: function(element) {
    element = $(element);
    if (!element.disabled && element.name) {
      var value = element.getValue();
      if (value != undefined) {
        var pair = { };
        pair[element.name] = value;
        return Object.toQueryString(pair);
      }
    }
    return '';
  },

  getValue: function(element) {
    element = $(element);
    var method = element.tagName.toLowerCase();
    return Form.Element.Serializers[method](element);
  },

  setValue: function(element, value) {
    element = $(element);
    var method = element.tagName.toLowerCase();
    Form.Element.Serializers[method](element, value);
    return element;
  },

  clear: function(element) {
    $(element).value = '';
    return element;
  },

  present: function(element) {
    return $(element).value != '';
  },

  activate: function(element) {
    element = $(element);
    try {
      element.focus();
      if (element.select && (element.tagName.toLowerCase() != 'input' ||
          !['button', 'reset', 'submit'].include(element.type)))
        element.select();
    } catch (e) { }
    return element;
  },

  disable: function(element) {
    element = $(element);
    element.disabled = true;
    return element;
  },

  enable: function(element) {
    element = $(element);
    element.disabled = false;
    return element;
  }
};

/*--------------------------------------------------------------------------*/

var Field = Form.Element;
var $F = Form.Element.Methods.getValue;

/*--------------------------------------------------------------------------*/

Form.Element.Serializers = {
  input: function(element, value) {
    switch (element.type.toLowerCase()) {
      case 'checkbox':
      case 'radio':
        return Form.Element.Serializers.inputSelector(element, value);
      default:
        return Form.Element.Serializers.textarea(element, value);
    }
  },

  inputSelector: function(element, value) {
    if (Object.isUndefined(value)) return element.checked ? element.value : null;
    else element.checked = !!value;
  },

  textarea: function(element, value) {
    if (Object.isUndefined(value)) return element.value;
    else element.value = value;
  },

  select: function(element, value) {
    if (Object.isUndefined(value))
      return this[element.type == 'select-one' ?
        'selectOne' : 'selectMany'](element);
    else {
      var opt, currentValue, single = !Object.isArray(value);
      for (var i = 0, length = element.length; i < length; i++) {
        opt = element.options[i];
        currentValue = this.optionValue(opt);
        if (single) {
          if (currentValue == value) {
            opt.selected = true;
            return;
          }
        }
        else opt.selected = value.include(currentValue);
      }
    }
  },

  selectOne: function(element) {
    var index = element.selectedIndex;
    return index >= 0 ? this.optionValue(element.options[index]) : null;
  },

  selectMany: function(element) {
    var values, length = element.length;
    if (!length) return null;

    for (var i = 0, values = []; i < length; i++) {
      var opt = element.options[i];
      if (opt.selected) values.push(this.optionValue(opt));
    }
    return values;
  },

  optionValue: function(opt) {
    // extend element because hasAttribute may not be native
    return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
  }
};

/*--------------------------------------------------------------------------*/

Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
  initialize: function($super, element, frequency, callback) {
    $super(callback, frequency);
    this.element   = $(element);
    this.lastValue = this.getValue();
  },

  execute: function() {
    var value = this.getValue();
    if (Object.isString(this.lastValue) && Object.isString(value) ?
        this.lastValue != value : String(this.lastValue) != String(value)) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  }
});

Form.Element.Observer = Class.create(Abstract.TimedObserver, {
  getValue: function() {
    return Form.Element.getValue(this.element);
  }
});

Form.Observer = Class.create(Abstract.TimedObserver, {
  getValue: function() {
    return Form.serialize(this.element);
  }
});

/*--------------------------------------------------------------------------*/

Abstract.EventObserver = Class.create({
  initialize: function(element, callback) {
    this.element  = $(element);
    this.callback = callback;

    this.lastValue = this.getValue();
    if (this.element.tagName.toLowerCase() == 'form')
      this.registerFormCallbacks();
    else
      this.registerCallback(this.element);
  },

  onElementEvent: function() {
    var value = this.getValue();
    if (this.lastValue != value) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  },

  registerFormCallbacks: function() {
    Form.getElements(this.element).each(this.registerCallback, this);
  },

  registerCallback: function(element) {
    if (element.type) {
      switch (element.type.toLowerCase()) {
        case 'checkbox':
        case 'radio':
          Event.observe(element, 'click', this.onElementEvent.bind(this));
          break;
        default:
          Event.observe(element, 'change', this.onElementEvent.bind(this));
          break;
      }
    }
  }
});

Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
  getValue: function() {
    return Form.Element.getValue(this.element);
  }
});

Form.EventObserver = Class.create(Abstract.EventObserver, {
  getValue: function() {
    return Form.serialize(this.element);
  }
});
if (!window.Event) var Event = { };

Object.extend(Event, {
  KEY_BACKSPACE: 8,
  KEY_TAB:       9,
  KEY_RETURN:   13,
  KEY_ESC:      27,
  KEY_LEFT:     37,
  KEY_UP:       38,
  KEY_RIGHT:    39,
  KEY_DOWN:     40,
  KEY_DELETE:   46,
  KEY_HOME:     36,
  KEY_END:      35,
  KEY_PAGEUP:   33,
  KEY_PAGEDOWN: 34,
  KEY_INSERT:   45,

  cache: { },

  relatedTarget: function(event) {
    var element;
    switch(event.type) {
      case 'mouseover': element = event.fromElement; break;
      case 'mouseout':  element = event.toElement;   break;
      default: return null;
    }
    return Element.extend(element);
  }
});

Event.Methods = (function() {
  var isButton;

  if (Prototype.Browser.IE) {
    var buttonMap = { 0: 1, 1: 4, 2: 2 };
    isButton = function(event, code) {
      return event.button == buttonMap[code];
    };

  } else if (Prototype.Browser.WebKit) {
    isButton = function(event, code) {
      switch (code) {
        case 0: return event.which == 1 && !event.metaKey;
        case 1: return event.which == 1 && event.metaKey;
        default: return false;
      }
    };

  } else {
    isButton = function(event, code) {
      return event.which ? (event.which === code + 1) : (event.button === code);
    };
  }

  return {
    isLeftClick:   function(event) { return isButton(event, 0) },
    isMiddleClick: function(event) { return isButton(event, 1) },
    isRightClick:  function(event) { return isButton(event, 2) },

    element: function(event) {
      event = Event.extend(event);

      var node          = event.target,
          type          = event.type,
          currentTarget = event.currentTarget;

      if (currentTarget && currentTarget.tagName) {
        // Firefox screws up the "click" event when moving between radio buttons
        // via arrow keys. It also screws up the "load" and "error" events on images,
        // reporting the document as the target instead of the original image.
        if (type === 'load' || type === 'error' ||
          (type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
            && currentTarget.type === 'radio'))
              node = currentTarget;
      }
      if (node.nodeType == Node.TEXT_NODE) node = node.parentNode;
      return Element.extend(node);
    },

    findElement: function(event, expression) {
      var element = Event.element(event);
      if (!expression) return element;
      var elements = [element].concat(element.ancestors());
      return Selector.findElement(elements, expression, 0);
    },

    pointer: function(event) {
      var docElement = document.documentElement,
      body = document.body || { scrollLeft: 0, scrollTop: 0 };
      return {
        x: event.pageX || (event.clientX +
          (docElement.scrollLeft || body.scrollLeft) -
          (docElement.clientLeft || 0)),
        y: event.pageY || (event.clientY +
          (docElement.scrollTop || body.scrollTop) -
          (docElement.clientTop || 0))
      };
    },

    pointerX: function(event) { return Event.pointer(event).x },
    pointerY: function(event) { return Event.pointer(event).y },

    stop: function(event) {
      Event.extend(event);
      event.preventDefault();
      event.stopPropagation();
      event.stopped = true;
    }
  };
})();

Event.extend = (function() {
  var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
    m[name] = Event.Methods[name].methodize();
    return m;
  });

  if (Prototype.Browser.IE) {
    Object.extend(methods, {
      stopPropagation: function() { this.cancelBubble = true },
      preventDefault:  function() { this.returnValue = false },
      inspect: function() { return "[object Event]" }
    });

    return function(event) {
      if (!event) return false;
      if (event._extendedByPrototype) return event;

      event._extendedByPrototype = Prototype.emptyFunction;
      var pointer = Event.pointer(event);
      Object.extend(event, {
        target: event.srcElement,
        relatedTarget: Event.relatedTarget(event),
        pageX:  pointer.x,
        pageY:  pointer.y
      });
      return Object.extend(event, methods);
    };

  } else {
    Event.prototype = Event.prototype || document.createEvent("HTMLEvents")['__proto__'];
    Object.extend(Event.prototype, methods);
    return Prototype.K;
  }
})();

Object.extend(Event, (function() {
  var cache = Event.cache;

  function getEventID(element) {
    if (element._prototypeEventID) return element._prototypeEventID[0];
    arguments.callee.id = arguments.callee.id || 1;
    return element._prototypeEventID = [++arguments.callee.id];
  }

  function getDOMEventName(eventName) {
    if (eventName && eventName.include(':')) return "dataavailable";
    return eventName;
  }

  function getCacheForID(id) {
    return cache[id] = cache[id] || { };
  }

  function getWrappersForEventName(id, eventName) {
    var c = getCacheForID(id);
    return c[eventName] = c[eventName] || [];
  }

  function createWrapper(element, eventName, handler) {
    var id = getEventID(element);
    var c = getWrappersForEventName(id, eventName);
    if (c.pluck("handler").include(handler)) return false;

    var wrapper = function(event) {
      if (!Event || !Event.extend ||
        (event.eventName && event.eventName != eventName))
          return false;

      Event.extend(event);
      handler.call(element, event);
    };

    wrapper.handler = handler;
    c.push(wrapper);
    return wrapper;
  }

  function findWrapper(id, eventName, handler) {
    var c = getWrappersForEventName(id, eventName);
    return c.find(function(wrapper) { return wrapper.handler == handler });
  }

  function destroyWrapper(id, eventName, handler) {
    var c = getCacheForID(id);
    if (!c[eventName]) return false;
    c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
  }

  function destroyCache() {
    for (var id in cache)
      for (var eventName in cache[id])
        cache[id][eventName] = null;
  }


  // Internet Explorer needs to remove event handlers on page unload
  // in order to avoid memory leaks.
  if (window.attachEvent) {
    window.attachEvent("onunload", destroyCache);
  }

  // Safari has a dummy event handler on page unload so that it won't
  // use its bfcache. Safari <= 3.1 has an issue with restoring the "document"
  // object when page is returned to via the back button using its bfcache.
  if (Prototype.Browser.WebKit) {
    window.addEventListener('unload', Prototype.emptyFunction, false);
  }

  return {
    observe: function(element, eventName, handler) {
      element = $(element);
      var name = getDOMEventName(eventName);

      var wrapper = createWrapper(element, eventName, handler);
      if (!wrapper) return element;

      if (element.addEventListener) {
        element.addEventListener(name, wrapper, false);
      } else {
        element.attachEvent("on" + name, wrapper);
      }

      return element;
    },

    stopObserving: function(element, eventName, handler) {
      element = $(element);
      var id = getEventID(element), name = getDOMEventName(eventName);

      if (!handler && eventName) {
        getWrappersForEventName(id, eventName).each(function(wrapper) {
          element.stopObserving(eventName, wrapper.handler);
        });
        return element;

      } else if (!eventName) {
        Object.keys(getCacheForID(id)).each(function(eventName) {
          element.stopObserving(eventName);
        });
        return element;
      }

      var wrapper = findWrapper(id, eventName, handler);
      if (!wrapper) return element;

      if (element.removeEventListener) {
        element.removeEventListener(name, wrapper, false);
      } else {
        element.detachEvent("on" + name, wrapper);
      }

      destroyWrapper(id, eventName, handler);

      return element;
    },

    fire: function(element, eventName, memo) {
      element = $(element);
      if (element == document && document.createEvent && !element.dispatchEvent)
        element = document.documentElement;

      var event;
      if (document.createEvent) {
        event = document.createEvent("HTMLEvents");
        event.initEvent("dataavailable", true, true);
      } else {
        event = document.createEventObject();
        event.eventType = "ondataavailable";
      }

      event.eventName = eventName;
      event.memo = memo || { };

      if (document.createEvent) {
        element.dispatchEvent(event);
      } else {
        element.fireEvent(event.eventType, event);
      }

      return Event.extend(event);
    }
  };
})());

Object.extend(Event, Event.Methods);

Element.addMethods({
  fire:          Event.fire,
  observe:       Event.observe,
  stopObserving: Event.stopObserving
});

Object.extend(document, {
  fire:          Element.Methods.fire.methodize(),
  observe:       Element.Methods.observe.methodize(),
  stopObserving: Element.Methods.stopObserving.methodize(),
  loaded:        false
});

(function() {
  /* Support for the DOMContentLoaded event is based on work by Dan Webb,
     Matthias Miller, Dean Edwards and John Resig. */

  var timer;

  function fireContentLoadedEvent() {
    if (document.loaded) return;
    if (timer) window.clearInterval(timer);
    document.fire("dom:loaded");
    document.loaded = true;
  }

  if (document.addEventListener) {
    if (Prototype.Browser.WebKit) {
      timer = window.setInterval(function() {
        if (/loaded|complete/.test(document.readyState))
          fireContentLoadedEvent();
      }, 0);

      Event.observe(window, "load", fireContentLoadedEvent);

    } else {
      document.addEventListener("DOMContentLoaded",
        fireContentLoadedEvent, false);
    }

  } else {
    document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
    $("__onDOMContentLoaded").onreadystatechange = function() {
      if (this.readyState == "complete") {
        this.onreadystatechange = null;
        fireContentLoadedEvent();
      }
    };
  }
})();
/*------------------------------- DEPRECATED -------------------------------*/

Hash.toQueryString = Object.toQueryString;

var Toggle = { display: Element.toggle };

Element.Methods.childOf = Element.Methods.descendantOf;

var Insertion = {
  Before: function(element, content) {
    return Element.insert(element, {before:content});
  },

  Top: function(element, content) {
    return Element.insert(element, {top:content});
  },

  Bottom: function(element, content) {
    return Element.insert(element, {bottom:content});
  },

  After: function(element, content) {
    return Element.insert(element, {after:content});
  }
};

var $continue = new Error('"throw $continue" is deprecated, use "return" instead');

// This should be moved to script.aculo.us; notice the deprecated methods
// further below, that map to the newer Element methods.
var Position = {
  // set to true if needed, warning: firefox performance problems
  // NOT neeeded for page scrolling, only if draggable contained in
  // scrollable elements
  includeScrollOffsets: false,

  // must be called before calling withinIncludingScrolloffset, every time the
  // page is scrolled
  prepare: function() {
    this.deltaX =  window.pageXOffset
                || document.documentElement.scrollLeft
                || document.body.scrollLeft
                || 0;
    this.deltaY =  window.pageYOffset
                || document.documentElement.scrollTop
                || document.body.scrollTop
                || 0;
  },

  // caches x/y coordinate pair to use with overlap
  within: function(element, x, y) {
    if (this.includeScrollOffsets)
      return this.withinIncludingScrolloffsets(element, x, y);
    this.xcomp = x;
    this.ycomp = y;
    this.offset = Element.cumulativeOffset(element);

    return (y >= this.offset[1] &&
            y <  this.offset[1] + element.offsetHeight &&
            x >= this.offset[0] &&
            x <  this.offset[0] + element.offsetWidth);
  },

  withinIncludingScrolloffsets: function(element, x, y) {
    var offsetcache = Element.cumulativeScrollOffset(element);

    this.xcomp = x + offsetcache[0] - this.deltaX;
    this.ycomp = y + offsetcache[1] - this.deltaY;
    this.offset = Element.cumulativeOffset(element);

    return (this.ycomp >= this.offset[1] &&
            this.ycomp <  this.offset[1] + element.offsetHeight &&
            this.xcomp >= this.offset[0] &&
            this.xcomp <  this.offset[0] + element.offsetWidth);
  },

  // within must be called directly before
  overlap: function(mode, element) {
    if (!mode) return 0;
    if (mode == 'vertical')
      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
        element.offsetHeight;
    if (mode == 'horizontal')
      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
        element.offsetWidth;
  },

  // Deprecation layer -- use newer Element methods now (1.5.2).

  cumulativeOffset: Element.Methods.cumulativeOffset,

  positionedOffset: Element.Methods.positionedOffset,

  absolutize: function(element) {
    Position.prepare();
    return Element.absolutize(element);
  },

  relativize: function(element) {
    Position.prepare();
    return Element.relativize(element);
  },

  realOffset: Element.Methods.cumulativeScrollOffset,

  offsetParent: Element.Methods.getOffsetParent,

  page: Element.Methods.viewportOffset,

  clone: function(source, target, options) {
    options = options || { };
    return Element.clonePosition(target, source, options);
  }
};

/*--------------------------------------------------------------------------*/

if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
  function iter(name) {
    return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
  }

  instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
  function(element, className) {
    className = className.toString().strip();
    var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
    return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
  } : function(element, className) {
    className = className.toString().strip();
    var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
    if (!classNames && !className) return elements;

    var nodes = $(element).getElementsByTagName('*');
    className = ' ' + className + ' ';

    for (var i = 0, child, cn; child = nodes[i]; i++) {
      if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
          (classNames && classNames.all(function(name) {
            return !name.toString().blank() && cn.include(' ' + name + ' ');
          }))))
        elements.push(Element.extend(child));
    }
    return elements;
  };

  return function(className, parentElement) {
    return $(parentElement || document.body).getElementsByClassName(className);
  };
}(Element.Methods);

/*--------------------------------------------------------------------------*/

Element.ClassNames = Class.create();
Element.ClassNames.prototype = {
  initialize: function(element) {
    this.element = $(element);
  },

  _each: function(iterator) {
    this.element.className.split(/\s+/).select(function(name) {
      return name.length > 0;
    })._each(iterator);
  },

  set: function(className) {
    this.element.className = className;
  },

  add: function(classNameToAdd) {
    if (this.include(classNameToAdd)) return;
    this.set($A(this).concat(classNameToAdd).join(' '));
  },

  remove: function(classNameToRemove) {
    if (!this.include(classNameToRemove)) return;
    this.set($A(this).without(classNameToRemove).join(' '));
  },

  toString: function() {
    return $A(this).join(' ');
  }
};

Object.extend(Element.ClassNames.prototype, Enumerable);

/*--------------------------------------------------------------------------*/

Element.addMethods();
	// script.aculo.us scriptaculous.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008

// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// For details, see the script.aculo.us web site: http://script.aculo.us/

var Scriptaculous = {
  Version: '1.8.2',
  require: function(libraryName) {
    // inserting via DOM fails in Safari 2.0, so brute force approach
    document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
  },
  REQUIRED_PROTOTYPE: '1.6.0.3',
  load: function() {
    function convertVersionString(versionString) {
      var v = versionString.replace(/_.*|\./g, '');
      v = parseInt(v + '0'.times(4-v.length));
      return versionString.indexOf('_') > -1 ? v-1 : v;
    }

    if((typeof Prototype=='undefined') ||
       (typeof Element == 'undefined') ||
       (typeof Element.Methods=='undefined') ||
       (convertVersionString(Prototype.Version) <
        convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
       throw("script.aculo.us requires the Prototype JavaScript framework >= " +
        Scriptaculous.REQUIRED_PROTOTYPE);

    var js = /scriptaculous\.js(\?.*)?$/;
    $$('head script[src]').findAll(function(s) {
      return s.src.match(js);
    }).each(function(s) {
      var path = s.src.replace(js, ''),
      includes = s.src.match(/\?.*load=([a-z,]*)/);
      (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each(
       function(include) { Scriptaculous.require(path+include+'.js') });
    });
  }
};

Scriptaculous.load();
	/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",encodeURIComponent(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
	/******************************************************************************
Name:    Highslide JS
Version: 4.1.2 (March 27 2009)
Config:  default +events +unobtrusive +imagemap +slideshow +positioning +transitions +viewport +thumbstrip +inline +ajax +iframe +flash +packed
Author:  Torstein Hønsi
Support: http://highslide.com/support

Licence:
Highslide JS is licensed under a Creative Commons Attribution-NonCommercial 2.5
License (http://creativecommons.org/licenses/by-nc/2.5/).

You are free:
	* to copy, distribute, display, and perform the work
	* to make derivative works

Under the following conditions:
	* Attribution. You must attribute the work in the manner  specified by  the
	  author or licensor.
	* Noncommercial. You may not use this work for commercial purposes.

* For  any  reuse  or  distribution, you  must make clear to others the license
  terms of this work.
* Any  of  these  conditions  can  be  waived  if  you  get permission from the 
  copyright holder.

Your fair use and other rights are in no way affected by the above.
******************************************************************************/
eval(function(p,a,c,k,e,d){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--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[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}('A m={11:{9I:\'aw\',ay:\'dA...\',az:\'95 2e dz\',bB:\'95 2e dy 2e dw\',8G:\'dx 2e dB I (f)\',cx:\'dC by <i>a8 a9</i>\',cf:\'dG 2e dF a8 a9 dD\',92:\'a4\',90:\'a5\',9a:\'ac\',9j:\'ab\',9k:\'ab (dv)\',a0:\'du\',ag:\'a7\',ae:\'a7 1p (a2)\',9Z:\'a6\',ao:\'a6 1p (a2)\',93:\'a4 (94 W)\',8X:\'a5 (94 3g)\',91:\'ac\',9T:\'1:1\',3I:\'dl %1 dj %2\',9v:\'95 2e 2d 2L, do al dp 2e 3D. dt 94 dr P 1G al 31.\'},54:\'M/dH/\',8p:\'dI.5g\',5P:\'e2.5g\',6M:5o,be:5o,5j:15,9o:15,5u:15,6v:15,4f:e1,ax:0.75,9t:L,8t:5,3L:2,e0:3,5Z:1f,c0:\'4z 3g\',c1:1,bi:L,cy:\'dW://M.dZ/\',aJ:L,9A:[\'a\',\'4U\'],3j:[],ct:5o,4o:0,8y:50,6O:1f,7X:L,4u:L,3M:\'69\',8F:L,3Z:\'22\',7F:\'22\',9U:H,9Q:H,8P:L,4B:an,5y:an,5W:L,1U:\'e4-e8\',7k:\'M-Q\',96:{2U:\'<O 1Z="M-2U"><68>\'+\'<1K 1Z="M-31">\'+\'<a 21="#" 2k="{m.11.93}">\'+\'<1A>{m.11.92}</1A></a>\'+\'</1K>\'+\'<1K 1Z="M-3N">\'+\'<a 21="#" 2k="{m.11.ae}">\'+\'<1A>{m.11.ag}</1A></a>\'+\'</1K>\'+\'<1K 1Z="M-3i">\'+\'<a 21="#" 2k="{m.11.ao}">\'+\'<1A>{m.11.9Z}</1A></a>\'+\'</1K>\'+\'<1K 1Z="M-1G">\'+\'<a 21="#" 2k="{m.11.8X}">\'+\'<1A>{m.11.90}</1A></a>\'+\'</1K>\'+\'<1K 1Z="M-3D">\'+\'<a 21="#" 2k="{m.11.91}">\'+\'<1A>{m.11.9a}</1A></a>\'+\'</1K>\'+\'<1K 1Z="M-1c-2H">\'+\'<a 21="#" 2k="{m.11.8G}">\'+\'<1A>{m.11.9T}</1A></a>\'+\'</1K>\'+\'<1K 1Z="M-2d">\'+\'<a 21="#" 2k="{m.11.9k}" >\'+\'<1A>{m.11.9j}</1A></a>\'+\'</1K>\'+\'</68></O>\',aZ:\'<O 1Z="M-dU"><68>\'+\'<1K 1Z="M-31">\'+\'<a 21="#" 2k="{m.11.93}" 2n="D m.31(k)">\'+\'<1A>{m.11.92}</1A></a>\'+\'</1K>\'+\'<1K 1Z="M-1G">\'+\'<a 21="#" 2k="{m.11.8X}" 2n="D m.1G(k)">\'+\'<1A>{m.11.90}</1A></a>\'+\'</1K>\'+\'<1K 1Z="M-3D">\'+\'<a 21="#" 2k="{m.11.91}" 2n="D 1f">\'+\'<1A>{m.11.9a}</1A></a>\'+\'</1K>\'+\'<1K 1Z="M-2d">\'+\'<a 21="#" 2k="{m.11.9k}" 2n="D m.2d(k)">\'+\'<1A>{m.11.9j}</1A></a>\'+\'</1K>\'+\'</68></O>\'+\'<O 1Z="M-1i"></O>\'+\'<O 1Z="M-dK"><O>\'+\'<1A 1Z="M-3R" 2k="{m.11.a0}"><1A></1A></1A>\'+\'</O></O>\'},5O:[],8d:L,18:[],8c:[\'5W\',\'3G\',\'3Z\',\'7F\',\'9U\',\'9Q\',\'1U\',\'3L\',\'di\',\'dT\',\'dS\',\'9S\',\'dR\',\'dQ\',\'e9\',\'9R\',\'8P\',\'4a\',\'5t\',\'3j\',\'4o\',\'K\',\'N\',\'8k\',\'6O\',\'7X\',\'4u\',\'dg\',\'cN\',\'cM\',\'2K\',\'8F\',\'4c\',\'56\',\'3M\',\'85\',\'7k\',\'4B\',\'5y\',\'au\',\'cL\',\'2N\',\'2P\',\'cj\',\'b8\',\'1m\'],1S:[],6r:0,7L:{x:[\'bm\',\'W\',\'4w\',\'3g\',\'bn\'],y:[\'5s\',\'V\',\'8L\',\'4z\',\'7o\']},6Y:{},9R:{},9S:{},85:{af:{},2p:{},a1:{}},48:[],6d:[],4r:{},4g:[],7r:[],4V:[],72:{},9p:{},4m:9i((5i.7A.5H().2q(/.+(?:b7|cO|cP|1x)[\\/: ]([\\d.]+)/)||[0,\'0\'])[1]),1x:(1d.63&&!1T.3S),55:/cs/.1b(5i.7A),5V:/cS.+b7:1\\.[0-8].+cJ/.1b(5i.7A),$:C(1B){q(1B)D 1d.8Z(1B)},2w:C(2a,3p){2a[2a.Y]=3p},16:C(aU,42,44,64,aV){A el=1d.16(aU);q(42)m.3T(el,42);q(aV)m.R(el,{7Z:0,86:\'1s\',8s:0});q(44)m.R(el,44);q(64)64.1X(el);D el},3T:C(el,42){P(A x 3h 42)el[x]=42[x];D el},R:C(el,44){P(A x 3h 44){q(m.1x&&x==\'1v\'){q(44[x]>0.99)el.E.cD(\'5Q\');J el.E.5Q=\'aN(1v=\'+(44[x]*2Q)+\')\'}J el.E[x]=44[x]}},24:C(el,1z,3s){A 4i,4b,4D;q(1I 3s!=\'6P\'||3s===H){A 2J=bA;3s={4d:2J[2],2P:2J[3],7l:2J[4]}}q(1I 3s.4d!=\'3I\')3s.4d=5o;3s.2P=1l[3s.2P]||1l.aL;3s.6T=m.3T({},1z);P(A 35 3h 1z){A e=1L m.28(el,3s,35);4i=9i(m.8n(el,35))||0;4b=9i(1z[35]);4D=35!=\'1v\'?\'F\':\'\';e.3z(4i,4b,4D)}},8n:C(el,1z){q(1d.7J){D 1d.7J.bx(el,H).bz(1z)}J{q(1z==\'1v\')1z=\'5Q\';A 3p=el.6a[1z.29(/\\-(\\w)/g,C(a,b){D b.b1()})];q(1z==\'5Q\')3p=3p.29(/aN\\(1v=([0-9]+)\\)/,C(a,b){D b/2Q});D 3p===\'\'?1:3p}},73:C(){A d=1d,w=1T,46=d.8I&&d.8I!=\'c4\'?d.5h:d.1i;A b=d.1i;A b6=(w.78&&w.ap)?w.78+w.ap:1l.2T(b.aQ,b.1C),b3=(w.77&&1T.aP)?w.77+w.aP:1l.2T(b.aX,b.1M),7m=m.1x?46.aQ:(d.5h.9h||5k.78),7w=m.1x?1l.2T(46.aX,46.9c):(d.5h.9c||5k.77);A K=m.1x?46.9h:(d.5h.9h||5k.78),N=m.1x?46.9c:5k.77;D{7m:1l.2T(7m,b6),7w:1l.2T(7w,b3),K:K,N:N,6z:m.1x?46.6z:da,6l:m.1x?46.6l:d8}},7a:C(el){q(/4U/i.1b(el.3J)){A 6I=1d.2B(\'1O\');P(A i=0;i<6I.Y;i++){A u=6I[i].d7;q(u&&u.29(/^.*?#/,\'\')==el.26.35){el=6I[i];4S}}}A p={x:el.4A,y:el.80};57(el.aY){el=el.aY;p.x+=el.4A;p.y+=el.80;q(el!=1d.1i&&el!=1d.5h){p.x-=el.6z;p.y-=el.6l}}D p},2H:C(a,2p,3z,Z){q(!a)a=m.16(\'a\',H,{1n:\'1s\'},m.2c);q(1I a.5z==\'C\')D 2p;q(Z==\'3w\'){P(A i=0;i<m.4g.Y;i++){q(m.4g[i]&&m.4g[i].a==a){m.4g[i].b9();m.4g[i]=H;D 1f}}m.aD=L}1E{1L m.67(a,2p,3z,Z);D 1f}1D(e){D L}},9z:C(a,2p,3z){D m.2H(a,2p,3z,\'3w\')},8l:C(){D m.16(\'O\',{19:\'M-3w-T\',2h:m.97(m.96.aZ)})},4G:C(el,3J,19){A 1j=el.2B(3J);P(A i=0;i<1j.Y;i++){q((1L 4I(19)).1b(1j[i].19)){D 1j[i]}}D H},97:C(s){s=s.29(/\\s/g,\' \');A 2l=/{m\\.11\\.([^}]+)\\}/g,6b=s.2q(2l),11;q(6b)P(A i=0;i<6b.Y;i++){11=6b[i].29(2l,"$1");q(1I m.11[11]!=\'1W\')s=s.29(6b[i],m.11[11])}D s},7B:C(){A 1j=1d.2B(\'a\');P(A i=0;i<1j.Y;i++){A Z=m.aM(1j[i]);q(Z&&!1j[i].b0){(C(){A t=Z;q(m.1y(m,\'df\',{6q:1j[i],Z:t})){1j[i].2n=(Z==\'2L\')?C(){D m.2H(k)}:C(){D m.9z(k,{2K:t})}}})();1j[i].b0=L}}q(!m.aR)3P(m.7B,50);J q(i)m.79()},aM:C(el){q(el.7s==\'M\')D\'2L\';J q(el.7s==\'M-30\')D\'30\';J q(el.7s==\'M-1g\')D\'1g\';J q(el.7s==\'M-3t\')D\'3t\'},8m:C(a){P(A i=0;i<m.4V.Y;i++){q(m.4V[i][0]==a){A c=m.4V[i][1];m.4V[i][1]=c.58(1);D c}}D H},aK:C(e){A 2a=m.6m();P(A i=0;i<2a.4R.Y;i++){A a=2a.4R[i];q(m.41(a,\'2K\')==\'30\'&&m.41(a,\'8F\'))m.2w(m.7r,a)}m.8B(0)},8B:C(i){q(!m.7r[i])D;A a=m.7r[i];A 5E=m.6c(m.41(a,\'8k\'));q(!5E)5E=m.8l();A 30=1L m.6K(a,5E,1);30.9d=C(){};30.3B=C(){m.2w(m.4V,[a,5E]);m.8B(i+1)};30.9g()},aH:C(){A 8A=0,7x=-1,18=m.18,B,1F;P(A i=0;i<18.Y;i++){B=18[i];q(B){1F=B.Q.E.1F;q(1F&&1F>8A){8A=1F;7x=i}}}q(7x==-1)m.3e=-1;J 18[7x].3V()},41:C(a,5C){a.5z=a.2n;A p=a.5z?a.5z():H;a.5z=H;D(p&&1I p[5C]!=\'1W\')?p[5C]:(1I m[5C]!=\'1W\'?m[5C]:H)},6L:C(a){A 1m=m.41(a,\'1m\');q(1m)D 1m;D a.21},6c:C(1B){A 1N=m.$(1B),4t=m.9p[1B],a={};q(!1N&&!4t)D H;q(!4t){4t=1N.58(L);4t.1B=\'\';m.9p[1B]=4t;D 1N}J{D 4t.58(L)}},51:C(d){m.9E.1X(d);m.9E.2h=\'\'},1H:C(B){q(!m.2D){m.2D=m.16(\'O\',{19:\'M-cZ\',5x:\'\',2n:C(){q(m.1y(m,\'d0\'))m.2d()}},{1k:\'2m\',1o:\'2b\',W:0,1v:0},m.2c,L);m.2z(1T,\'3R\',m.5f)}m.2D.E.1n=\'\';m.5f();m.2D.5x+=\'|\'+B.S;q(m.5V&&m.at)m.R(m.2D,{76:\'6t(\'+m.54+\'d4.aj)\',1v:1});J m.24(m.2D,{1v:B.4o},m.8y)},8V:C(S){q(!m.2D)D;q(1I S!=\'1W\')m.2D.5x=m.2D.5x.29(\'|\'+S,\'\');q((1I S!=\'1W\'&&m.2D.5x!=\'\')||(m.2t&&m.41(m.2t,\'4o\')))D;q(m.5V&&m.at)m.R(m.2D,{76:\'1s\',K:0,N:0});J m.24(m.2D,{1v:0},m.8y,H,C(){m.R(m.2D,{1n:\'1s\',K:0,N:0})})},5f:C(B){q(!m.2D)D;A h=(m.1x&&B&&B.Q)?2r(B.Q.E.V)+2r(B.Q.E.N)+(B.1a?B.1a.1q:0):0;m.R(m.2D,{K:m.3n.7m+\'F\',N:1l.2T(m.3n.7w,h)+\'F\'})},8x:C(5a,B){A 1e=B=B||m.3d();q(m.2t)D 1f;J m.1e=1e;1E{m.2t=5a;5a.2n()}1D(e){m.1e=m.2t=H}1E{q(!5a||B.3j[1]!=\'47\')B.2d()}1D(e){}D 1f},6o:C(el,2o){A B=m.3d(el);q(B){5a=B.89(2o);D m.8x(5a,B)}J D 1f},31:C(el){D m.6o(el,-1)},1G:C(el){D m.6o(el,1)},6F:C(e){q(!e)e=1T.2G;q(!e.2Z)e.2Z=e.9L;q(1I e.2Z.aC!=\'1W\')D L;q(!m.1y(m,\'d2\',e))D L;A B=m.3d();A 2o=H;aS(e.d1){2g 70:q(B)B.6V();D L;2g 32:2o=2;4S;2g 34:2g 39:2g 40:2o=1;4S;2g 8:2g 33:2g 37:2g 38:2o=-1;4S;2g 27:2g 13:2o=0}q(2o!==H){q(2o!=2)m.53(1d,1T.3S?\'9x\':\'9C\',m.6F);q(!m.aJ)D L;q(e.5m)e.5m();J e.bo=1f;q(B){q(2o==0){B.2d()}J q(2o==2){q(B.1p)B.1p.bT()}J{q(B.1p)B.1p.3i();m.6o(B.S,2o)}D 1f}}D L},fe:C(14){m.2w(m.1S,m.3T(14,{23:\'23\'+m.6r++}))},fd:C(1t){A 3a=1t.2N;q(1I 3a==\'6P\'){P(A i=0;i<3a.Y;i++){A o={};P(A x 3h 1t)o[x]=1t[x];o.2N=3a[i];m.2w(m.6d,o)}}J{m.2w(m.6d,1t)}},7I:C(6q,6n){A el,2l=/^M-Q-([0-9]+)$/;el=6q;57(el.26){q(el.6D!==1W)D el.6D;q(el.1B&&2l.1b(el.1B))D el.1B.29(2l,"$1");el=el.26}q(!6n){el=6q;57(el.26){q(el.3J&&m.6x(el)){P(A S=0;S<m.18.Y;S++){A B=m.18[S];q(B&&B.a==el)D S}}el=el.26}}D H},3d:C(el,6n){q(1I el==\'1W\')D m.18[m.3e]||H;q(1I el==\'3I\')D m.18[el]||H;q(1I el==\'9O\')el=m.$(el);D m.18[m.7I(el,6n)]||H},6x:C(a){D(a.2n&&a.2n.cp().29(/\\s/g,\' \').2q(/m.(eW|e)f0/))},cd:C(){P(A i=0;i<m.18.Y;i++)q(m.18[i]&&m.18[i].5B)m.aH()},1y:C(5v,8J,2J){D 5v&&5v[8J]?(5v[8J](5v,2J)!==1f):L},9q:C(e){q(!e)e=1T.2G;q(e.f2>1)D L;q(!e.2Z)e.2Z=e.9L;A el=e.2Z;57(el.26&&!(/M-(2L|3D|3w|3R)/.1b(el.19))){el=el.26}A B=m.3d(el);q(B&&(B.6e||!B.5B))D L;q(B&&e.Z==\'7E\'){q(e.2Z.aC)D L;A 2q=el.19.2q(/M-(2L|3D|3R)/);q(2q){m.2F={B:B,Z:2q[1],W:B.x.G,K:B.x.I,V:B.y.G,N:B.y.I,aO:e.6B,aE:e.7g};m.2z(1d,\'6J\',m.6R);q(e.5m)e.5m();q(/M-(2L|3w)-9D/.1b(B.T.19)){B.3V();m.8N=L}D 1f}J q(/M-3w/.1b(el.19)&&m.3e!=B.S){B.3V();B.4Q(\'1r\')}}J q(e.Z==\'aq\'){m.53(1d,\'6J\',m.6R);q(m.2F){q(m.52&&m.2F.Z==\'2L\')m.2F.B.T.E.4l=m.52;A 3r=m.2F.3r;q(!3r&&!m.8N&&!/(3D|3R)/.1b(m.2F.Z)){q(m.1y(B,\'fu\'))B.2d()}J q(3r||(!3r&&m.aD)){m.2F.B.4Q(\'1r\')}q(m.2F.B.3E)m.2F.B.3E.E.1n=\'1s\';q(3r)m.1y(m.2F.B,\'ft\',m.2F);q(3r)m.5f(B);m.8N=1f;m.2F=H}J q(/M-2L-9D/.1b(el.19)){el.E.4l=m.52}}D 1f},6R:C(e){q(!m.2F)D L;q(!e)e=1T.2G;A a=m.2F,B=a.B;q(B.1g){q(!B.3E)B.3E=m.16(\'O\',H,{1k:\'2m\',K:B.x.I+\'F\',N:B.y.I+\'F\',W:B.x.cb+\'F\',V:B.y.cb+\'F\',1F:4,76:(m.1x?\'fv\':\'1s\'),1v:.fr},B.Q,L);q(B.3E.E.1n==\'1s\')B.3E.E.1n=\'\'}a.dX=e.6B-a.aO;a.dY=e.7g-a.aE;A 9K=1l.fi(1l.aG(a.dX,2)+1l.aG(a.dY,2));q(!a.3r)a.3r=(a.Z!=\'2L\'&&9K>0)||(9K>(m.fn||5));q(a.3r&&e.6B>5&&e.7g>5){q(!m.1y(B,\'fm\',a))D 1f;q(a.Z==\'3R\')B.3R(a);J{B.8C(a.W+a.dX,a.V+a.dY);q(a.Z==\'2L\')B.T.E.4l=\'3D\'}}D 1f},aF:C(e){1E{q(!e)e=1T.2G;A 4Y=/f1/i.1b(e.Z);q(!e.2Z)e.2Z=e.9L;q(m.1x)e.9P=4Y?e.er:e.eV;A B=m.3d(e.2Z);q(!B.5B)D;q(!B||!e.9P||m.3d(e.9P,L)==B||m.2F)D;m.1y(B,4Y?\'et\':\'ew\',e);P(A i=0;i<B.1S.Y;i++)(C(){A o=m.$(\'23\'+B.1S[i]);q(o&&o.7v){q(4Y)m.R(o,{1o:\'2b\'});m.24(o,{1v:4Y?o.1v:0},o.2C,H,4Y?H:C(){m.R(o,{1o:\'1r\'})})}})()}1D(e){}},2z:C(el,2G,49){1E{el.2z(2G,49,1f)}1D(e){1E{el.aA(\'6f\'+2G,49);el.en(\'6f\'+2G,49)}1D(e){el[\'6f\'+2G]=49}}},53:C(el,2G,49){1E{el.53(2G,49,1f)}1D(e){1E{el.aA(\'6f\'+2G,49)}1D(e){el[\'6f\'+2G]=H}}},6y:C(i){q(m.8d&&m.5O[i]&&m.5O[i]!=\'1W\'){A 1O=1d.16(\'1O\');1O.4K=C(){1O=H;m.6y(i+1)};1O.1m=m.5O[i]}},aI:C(3I){q(3I&&1I 3I!=\'6P\')m.8t=3I;A 2a=m.6m();P(A i=0;i<2a.4X.Y&&i<m.8t;i++){m.2w(m.5O,m.6L(2a.4X[i]))}q(m.1U)1L m.5n(m.1U,C(){m.6y(0)});J m.6y(0);q(m.5P)A 5g=m.16(\'1O\',{1m:m.54+m.5P})},74:C(){q(!m.2c){m.3n=m.73();m.4P=m.1x&&m.4m<7;m.c9=m.4P&&87.ek==\'ej:\';P(A x 3h m.6E){q(1I m[x]!=\'1W\')m.11[x]=m[x];J q(1I m.11[x]==\'1W\'&&1I m.6E[x]!=\'1W\')m.11[x]=m.6E[x]}m.2c=m.16(\'O\',{19:\'M-2c\'},{1k:\'2m\',W:0,V:0,K:\'2Q%\',1F:m.4f,9H:\'aw\'},1d.1i,L);m.2y=m.16(\'a\',{19:\'M-2y\',2k:m.11.az,2h:m.11.ay,21:\'bZ:;\'},{1k:\'2m\',V:\'-4e\',1v:m.ax,1F:1},m.2c);m.9E=m.16(\'O\',H,{1n:\'1s\'},m.2c);m.36=m.16(\'O\',{19:\'M-36\'},H,m.2c,1);m.3y=m.16(\'O\',H,{aa:\'ar\',eM:\'eL\'},H,L);1l.eP=C(t,b,c,d){D c*t/d+b};1l.aL=C(t,b,c,d){D c*(t/=d)*t+b};1l.8W=C(t,b,c,d){D-c*(t/=d)*(t-2)+b};m.bq=m.4P;m.br=((1T.3S&&m.4m<9)||5i.ch==\'cm\'||(m.1x&&m.4m<5.5));m.1y(k,\'eT\')}},bs:C(){m.av=L;q(m.8g)m.8g()},79:C(){A el,1j,63=[],4X=[],4R=[],3q={},2l;P(A i=0;i<m.9A.Y;i++){1j=1d.2B(m.9A[i]);P(A j=0;j<1j.Y;j++){el=1j[j];2l=m.6x(el);q(2l){m.2w(63,el);q(2l[0]==\'m.2H\')m.2w(4X,el);J q(2l[0]==\'m.9z\')m.2w(4R,el);A g=m.41(el,\'2N\')||\'1s\';q(!3q[g])3q[g]=[];m.2w(3q[g],el)}}}m.4y={63:63,3q:3q,4X:4X,4R:4R};D m.4y},6m:C(){D m.4y||m.79()},2d:C(el){A B=m.3d(el);q(B)B.2d();D 1f}};m.28=C(3c,1t,1z){k.1t=1t;k.3c=3c;k.1z=1z;q(!1t.b5)1t.b5={}};m.28.4O={9y:C(){(m.28.3F[k.1z]||m.28.3F.am)(k);q(k.1t.3F)k.1t.3F.9X(k.3c,k.4C,k)},3z:C(b4,2e,4D){k.9F=(1L 7W()).83();k.4i=b4;k.4b=2e;k.4D=4D;k.4C=k.4i;k.G=k.9s=0;A 5k=k;C t(7u){D 5k.3F(7u)}t.3c=k.3c;q(t()&&m.48.2w(t)==1){m.ai=ez(C(){A 48=m.48;P(A i=0;i<48.Y;i++)q(!48[i]())48.eD(i--,1);q(!48.Y){eH(m.ai)}},13)}},3F:C(7u){A t=(1L 7W()).83();q(7u||t>=k.1t.4d+k.9F){k.4C=k.4b;k.G=k.9s=1;k.9y();k.1t.6T[k.1z]=L;A 9N=L;P(A i 3h k.1t.6T)q(k.1t.6T[i]!==L)9N=1f;q(9N){q(k.1t.7l)k.1t.7l.9X(k.3c)}D 1f}J{A n=t-k.9F;k.9s=n/k.1t.4d;k.G=k.1t.2P(n,0,1,k.1t.4d);k.4C=k.4i+((k.4b-k.4i)*k.G);k.9y()}D L}};m.3T(m.28,{3F:{1v:C(28){m.R(28.3c,{1v:28.4C})},am:C(28){q(28.3c.E&&28.3c.E[28.1z]!=H)28.3c.E[28.1z]=28.4C+28.4D;J 28.3c[28.1z]=28.4C}}});m.5n=C(1U,3B){k.3B=3B;k.1U=1U;A v=m.4m,3X;k.7G=m.1x&&v>=5.5&&v<7;q(!1U){q(3B)3B();D}m.74();k.2i=m.16(\'2i\',{ey:0},{1o:\'1r\',1k:\'2m\',ex:\'eh\',K:0},m.2c,L);A 4q=m.16(\'4q\',H,H,k.2i,1);k.2I=[];P(A i=0;i<=8;i++){q(i%3==0)3X=m.16(\'3X\',H,{N:\'22\'},4q,L);k.2I[i]=m.16(\'2I\',H,H,3X,L);A E=i!=4?{eb:0,ed:0}:{1k:\'4v\'};m.R(k.2I[i],E)}k.2I[4].19=1U+\' M-1a\';k.ak()};m.5n.4O={ak:C(){A 1m=m.54+(m.es||"ep/")+k.1U+".aj";A 9Y=m.55?m.2c:H;k.3H=m.16(\'1O\',H,{1k:\'2m\',V:\'-4e\'},9Y,L);A 3x=k;k.3H.4K=C(){3x.9W()};k.3H.1m=1m},9W:C(){A o=k.1q=k.3H.K/4,G=[[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]],1H={N:(2*o)+\'F\',K:(2*o)+\'F\'};P(A i=0;i<=8;i++){q(G[i]){q(k.7G){A w=(i==1||i==7)?\'2Q%\':k.3H.K+\'F\';A O=m.16(\'O\',H,{K:\'2Q%\',N:\'2Q%\',1k:\'4v\',2s:\'1r\'},k.2I[i],L);m.16(\'O\',H,{5Q:"fp:fq.cc.fk(ff=f3, 1m=\'"+k.3H.1m+"\')",1k:\'2m\',K:w,N:k.3H.N+\'F\',W:(G[i][0]*o)+\'F\',V:(G[i][1]*o)+\'F\'},O,L)}J{m.R(k.2I[i],{76:\'6t(\'+k.3H.1m+\') \'+(G[i][0]*o)+\'F \'+(G[i][1]*o)+\'F\'})}q(1T.3S&&(i==3||i==5))m.16(\'O\',H,1H,k.2I[i],L);m.R(k.2I[i],1H)}}k.3H=H;q(m.4r[k.1U])m.4r[k.1U].65();m.4r[k.1U]=k;q(k.3B)k.3B()},4x:C(G,1q,9V,2C,2P){A B=k.B,3u=B.Q.E,1q=1q||0,G=G||{x:B.x.G+1q,y:B.y.G+1q,w:B.x.U(\'1V\')-2*1q,h:B.y.U(\'1V\')-2*1q};q(9V)k.2i.E.1o=(G.h>=4*k.1q)?\'2b\':\'1r\';m.R(k.2i,{W:(G.x-k.1q)+\'F\',V:(G.y-k.1q)+\'F\',K:(G.w+2*k.1q)+\'F\'});G.w-=2*k.1q;G.h-=2*k.1q;m.R(k.2I[4],{K:G.w>=0?G.w+\'F\':0,N:G.h>=0?G.h+\'F\':0});q(k.7G)k.2I[3].E.N=k.2I[5].E.N=k.2I[4].E.N},65:C(aT){q(aT)k.2i.E.1o=\'1r\';J m.51(k.2i)}};m.6s=C(B,1H){k.B=B;k.1H=1H;k.3f=1H==\'x\'?\'bL\':\'bM\';k.3k=k.3f.5H();k.62=1H==\'x\'?\'bU\':\'bW\';k.6w=k.62.5H();k.7D=1H==\'x\'?\'bQ\':\'bJ\';k.b2=k.7D.5H();k.1h=k.3v=0};m.6s.4O={U:C(S){aS(S){2g\'8r\':D k.1R+k.3l+(k.t-m.2y[\'1q\'+k.3f])/2;2g\'8o\':D k.G+k.cb+k.1h+(k.I-m.2y[\'1q\'+k.3f])/2;2g\'1V\':D k.I+2*k.cb+k.1h+k.3v;2g\'5L\':D k.4n-k.3m-k.4j;2g\'5G\':D k.G-(k.B.1a?k.B.1a.1q:0);2g\'7H\':D k.U(\'1V\')+(k.B.1a?2*k.B.1a.1q:0);2g\'2j\':D k.1Y?1l.4W((k.I-k.1Y)/2):0}},7S:C(){k.cb=(k.B.T[\'1q\'+k.3f]-k.t)/2;k.4j=m[\'8s\'+k.7D]+2*k.cb},8a:C(){k.t=k.B.el[k.3k]?2r(k.B.el[k.3k]):k.B.el[\'1q\'+k.3f];k.1R=k.B.1R[k.1H];k.3l=(k.B.el[\'1q\'+k.3f]-k.t)/2;q(k.1R==0){k.1R=(m.3n[k.3k]/2)+m.3n[\'2f\'+k.62]}},7Q:C(){A B=k.B;k.2O=\'22\';q(B.7F==\'4w\')k.2O=\'4w\';J q(1L 4I(k.6w).1b(B.3Z))k.2O=H;J q(1L 4I(k.b2).1b(B.3Z))k.2O=\'2T\';k.G=k.1R-k.cb+k.3l;k.I=1l.3C(k.1c,B[\'2T\'+k.3f]||k.1c);k.2W=B.5W?1l.3C(B[\'3C\'+k.3f],k.1c):k.1c;q(B.2Y&&B.3G){k.I=B[k.3k];k.1Y=k.1c}q(k.1H==\'x\'&&m.5Z)k.2W=B.4B;k.2Z=B[\'2Z\'+k.1H.b1()];k.3m=m[\'8s\'+k.62];k.2f=m.3n[\'2f\'+k.62];k.4n=m.3n[k.3k]},7i:C(i){A B=k.B;q(B.2Y&&(B.3G||m.5Z)){k.1Y=i;k.I=1l.2T(k.I,k.1Y);B.T.E[k.6w]=k.U(\'2j\')+\'F\'}J k.I=i;B.T.E[k.3k]=i+\'F\';B.Q.E[k.3k]=k.U(\'1V\')+\'F\';q(B.1a)B.1a.4x();q(B.3E)B.3E.E[k.3k]=i+\'F\';q(B.2E){A d=B.2u;q(k.8f===1W)k.8f=B.1w[\'1q\'+k.3f]-d[\'1q\'+k.3f];d.E[k.3k]=(k.I-k.8f)+\'F\';q(k.1H==\'x\')B.3Y.E.K=\'22\';q(B.1i)B.1i.E[k.3k]=\'22\'}q(k.1H==\'x\'&&B.1u)B.5d(L);q(k.1H==\'x\'&&B.1p&&B.2Y){q(i==k.1c)B.1p.4Z(\'1c-2H\');J B.1p.4E(\'1c-2H\')}},9M:C(i){k.G=i;k.B.Q.E[k.6w]=i+\'F\';q(k.B.1a)k.B.1a.4x()}};m.67=C(a,2p,3z,3o){q(1d.9J&&m.1x&&!m.av){m.8g=C(){1L m.67(a,2p,3z,3o)};D}k.a=a;k.3z=3z;k.3o=3o||\'2L\';k.2E=(3o==\'3w\');k.2Y=!k.2E;m.8d=1f;k.1S=[];k.1e=m.1e;m.1e=H;m.74();A S=k.S=m.18.Y;P(A i=0;i<m.8c.Y;i++){A 35=m.8c[i];k[35]=2p&&1I 2p[35]!=\'1W\'?2p[35]:m[35]}q(!k.1m)k.1m=a.21;A el=(2p&&2p.8U)?m.$(2p.8U):a;el=k.aB=el.2B(\'1O\')[0]||el;k.7p=el.1B||a.1B;q(!m.1y(k,\'eY\'))D L;P(A i=0;i<m.18.Y;i++){q(m.18[i]&&m.18[i].a==a&&!(k.1e&&k.3j[1]==\'47\')){m.18[i].3V();D 1f}}P(A i=0;i<m.18.Y;i++){q(m.18[i]&&m.18[i].aB!=el&&!m.18[i].7z){m.18[i].6A()}}m.18[k.S]=k;q(!m.9t&&!m.2t){q(m.18[S-1])m.18[S-1].2d();q(1I m.3e!=\'1W\'&&m.18[m.3e])m.18[m.3e].2d()}k.el=el;k.1R=m.7a(el);m.3n=m.73();A x=k.x=1L m.6s(k,\'x\');x.8a();A y=k.y=1L m.6s(k,\'y\');y.8a();q(/4U/i.1b(el.3J))k.cn(el);k.Q=m.16(\'O\',{1B:\'M-Q-\'+k.S,19:k.7k},{1o:\'1r\',1k:\'2m\',1F:m.4f++},H,L);k.Q.ev=k.Q.eJ=m.aF;q(k.3o==\'2L\'&&k.3L==2)k.3L=0;q(!k.1U||(k.1e&&k.2Y&&k.3j[1]==\'47\')){k[k.3o+\'8b\']()}J q(m.4r[k.1U]){k.8q();k[k.3o+\'8b\']()}J{k.5M();A B=k;1L m.5n(k.1U,C(){B.8q();B[B.3o+\'8b\']()})}D L};m.67.4O={8D:C(e){1T.87.21=k.1m},8q:C(){A 1a=k.1a=m.4r[k.1U];1a.B=k;1a.2i.E.1F=k.Q.E.1F;m.4r[k.1U]=H},5M:C(){q(k.7z||k.2y)D;k.2y=m.2y;A B=k;k.2y.2n=C(){B.6A()};q(!m.1y(k,\'eS\'))D;A B=k,l=k.x.U(\'8r\')+\'F\',t=k.y.U(\'8r\')+\'F\';q(!2S&&k.1e&&k.3j[1]==\'47\')A 2S=k.1e;q(2S){l=2S.x.U(\'8o\')+\'F\';t=2S.y.U(\'8o\')+\'F\';k.2y.E.1F=m.4f++}3P(C(){q(B.2y)m.R(B.2y,{W:l,V:t,1F:m.4f++})},2Q)},ei:C(){A B=k;A 1O=1d.16(\'1O\');k.T=1O;1O.4K=C(){q(m.18[B.S])B.5I()};q(m.ef)1O.ee=C(){D 1f};1O.19=\'M-2L\';m.R(1O,{1o:\'1r\',1n:\'3A\',1k:\'2m\',au:\'4e\',1F:3});1O.2k=m.11.9v;q(m.55)m.2c.1X(1O);q(m.1x&&m.fl)1O.1m=H;1O.1m=k.1m;k.5M()},fj:C(){q(!m.1y(k,\'fo\'))D;k.T=m.8m(k.a);q(!k.T)k.T=m.6c(k.8k);q(!k.T)k.T=m.8l();k.8K([\'7h\']);q(k.7h){A 1i=m.4G(k.T,\'O\',\'M-1i\');q(1i)1i.1X(k.7h);k.7h.E.1n=\'3A\'}m.1y(k,\'eO\');k.1w=k.T;q(/(3t|1g)/.1b(k.2K))k.7Y(k.1w);m.2c.1X(k.Q);m.R(k.Q,{1k:\'dP\',7Z:\'0 \'+m.9o+\'F 0 \'+m.5j+\'F\'});k.T=m.16(\'O\',{19:\'M-3w\'},{1k:\'4v\',1F:3,2s:\'1r\'},k.Q);k.3Y=m.16(\'O\',H,H,k.T,1);k.3Y.1X(k.1w);m.R(k.1w,{1k:\'4v\',1n:\'3A\',9H:m.11.9I||\'\'});q(k.K)k.1w.E.K=k.K+\'F\';q(k.N)k.1w.E.N=k.N+\'F\';q(k.1w.1C<k.4B)k.1w.E.K=k.4B+\'F\';q(k.2K==\'30\'&&!m.8m(k.a)){k.5M();A 30=1L m.6K(k.a,k.1w);A B=k;30.3B=C(){q(m.18[B.S])B.5I()};30.9d=C(){87.21=B.1m};30.9g()}J q(k.2K==\'1g\'&&k.3M==\'69\'){k.6j()}J k.5I()},5I:C(){1E{q(!k.T)D;k.T.4K=H;q(k.7z)D;J k.7z=L;A x=k.x,y=k.y;q(k.2y){m.R(k.2y,{V:\'-4e\'});k.2y=H;m.1y(k,\'cz\')}q(k.2Y){x.1c=k.T.K;y.1c=k.T.N;m.R(k.T,{K:x.t+\'F\',N:y.t+\'F\'});k.Q.1X(k.T);m.2c.1X(k.Q)}J q(k.81)k.81();x.7S();y.7S();m.R(k.Q,{W:(x.1R+x.3l-x.cb)+\'F\',V:(y.1R+x.3l-y.cb)+\'F\'});k.9w();k.bl();A 2V=x.1c/y.1c;x.7Q();k.2O(x);y.7Q();k.2O(y);q(k.2E)k.cr();q(k.1u)k.5d(0,1);q(k.5W){q(k.2Y)k.ci(2V);J k.7V();A 1Q=k.1p;q(1Q&&k.1e&&1Q.2U&&1Q.aW){A G=1Q.cl.1k||\'\',p;P(A 1H 3h m.7L)P(A i=0;i<5;i++){p=k[1H];q(G.2q(m.7L[1H][i])){p.G=k.1e[1H].G+(k.1e[1H].1h-p.1h)+(k.1e[1H].I-p.I)*[0,0,.5,1,1][i];q(1Q.aW==\'d5\'){q(p.G+p.I+p.1h+p.3v>p.2f+p.4n-p.4j)p.G=p.2f+p.4n-p.I-p.3m-p.4j-p.1h-p.3v;q(p.G<p.2f+p.3m)p.G=p.2f+p.3m}}}}q(k.2Y&&k.x.1c>(k.x.1Y||k.x.I)){k.c2();q(k.1S.Y==1)k.5d()}}k.9G()}1D(e){k.8D(e)}},7Y:C(64,22){A c=m.4G(64,\'6W\',\'M-1i\');q(/(1g|3t)/.1b(k.2K)){q(k.4c)c.E.K=k.4c+\'F\';q(k.56)c.E.N=k.56+\'F\'}},6j:C(){q(k.ad)D;A B=k;k.1i=m.4G(k.1w,\'6W\',\'M-1i\');q(k.2K==\'1g\'){k.5M();A 5D=m.3y.58(1);k.1i.1X(5D);k.d9=k.1w.1C;q(!k.4c)k.4c=5D.1C;A 4T=k.1w.1M-k.1i.1M,h=k.56||m.3n.N-4T-m.5u-m.6v,4K=k.3M==\'69\'?\' 4K="q (m.18[\'+k.S+\']) m.18[\'+k.S+\'].5I()" \':\'\';k.1i.2h+=\'<1g 35="m\'+(1L 7W()).83()+\'" cC="0" S="\'+k.S+\'" \'+\' cR="L" E="K:\'+k.4c+\'F; N:\'+h+\'F" \'+4K+\' 1m="\'+k.1m+\'"></1g>\';k.5D=k.1i.2B(\'O\')[0];k.1g=k.1i.2B(\'1g\')[0];q(k.3M==\'60\')k.82()}q(k.2K==\'3t\'){k.1i.1B=k.1i.1B||\'m-dJ-1B-\'+k.S;A a=k.85;q(1I a.2p.ah==\'1W\')a.2p.ah=\'e6\';q(9r)9r.e3(k.1m,k.1i.1B,k.4c,k.56,a.dq||\'7\',a.ds,a.af,a.2p,a.a1)}k.ad=L},81:C(){q(k.1g&&!k.56){k.1g.E.N=k.1i.E.N=k.7N()+\'F\'}k.1w.1X(m.3y);q(!k.x.1c)k.x.1c=k.1w.1C;k.y.1c=k.1w.1M;k.1w.8v(m.3y);q(m.1x&&k.a3>2r(k.1w.6a.N)){k.a3=2r(k.1w.6a.N)}m.R(k.Q,{1k:\'2m\',7Z:\'0\'});m.R(k.T,{K:k.x.t+\'F\',N:k.y.t+\'F\'})},7N:C(){A h;1E{A 2A=k.1g.9b||k.1g.5T.1d;A 3y=2A.16(\'O\');3y.E.aa=\'ar\';2A.1i.1X(3y);h=3y.80;q(m.1x)h+=2r(2A.1i.6a.5u)+2r(2A.1i.6a.6v)-1}1D(e){h=fh}D h},82:C(){A 4M=k.1w.1C-k.5D.1C;q(4M<0)4M=0;A 4T=k.1w.1M-k.1g.1M;m.R(k.1g,{K:(k.x.I-4M)+\'F\',N:(k.y.I-4T)+\'F\'});m.R(k.1i,{K:k.1g.E.K,N:k.1g.E.N});k.59=k.1g;k.2u=k.59},cr:C(){k.7Y(k.1w);q(k.2K==\'3t\'&&k.3M==\'69\')k.6j();q(k.x.I<k.x.1c&&!k.6O)k.x.I=k.x.1c;q(k.y.I<k.y.1c&&!k.7X)k.y.I=k.y.1c;k.2u=k.1w;m.R(k.3Y,{1k:\'4v\',K:k.x.I+\'F\'});m.R(k.1w,{86:\'1s\',K:\'22\',N:\'22\'});A 1N=m.4G(k.1w,\'6W\',\'M-1i\');q(1N&&!/(1g|3t)/.1b(k.2K)){A 5e=1N;1N=m.16(5e.dn,H,{2s:\'1r\'},H,L);5e.26.dm(1N,5e);1N.1X(m.3y);1N.1X(5e);A 4M=k.1w.1C-1N.1C;A 4T=k.1w.1M-1N.1M;1N.8v(m.3y);A 6S=m.55||5i.ch==\'cm\'?1:0;m.R(1N,{K:(k.x.I-4M-6S)+\'F\',N:(k.y.I-4T)+\'F\',2s:\'22\',1k:\'4v\'});q(6S&&5e.1M>1N.1M){1N.E.K=(2r(1N.E.K)+6S)+\'F\'}k.59=1N;k.2u=k.59}q(k.1g&&k.3M==\'69\')k.82();q(!k.59&&k.y.I<k.3Y.1M)k.2u=k.T;q(k.2u==k.T&&!k.6O&&!/(1g|3t)/.1b(k.2K)){k.x.I+=17}q(k.2u&&k.2u.1M>k.2u.26.1M){3P("1E { m.18["+k.S+"].2u.E.2s = \'22\'; } 1D(e) {}",m.6M)}},cn:C(4U){A c=4U.dk.9e(\',\');P(A i=0;i<c.Y;i++)c[i]=2r(c[i]);q(4U.dV.5H()==\'dL\'){k.x.1R+=c[0]-c[2];k.y.1R+=c[1]-c[2];k.x.t=k.y.t=2*c[2]}J{A 5J,61,5S=5J=c[0],5Y=61=c[1];P(A i=0;i<c.Y;i++){q(i%2==0){5S=1l.3C(5S,c[i]);5J=1l.2T(5J,c[i])}J{5Y=1l.3C(5Y,c[i]);61=1l.2T(61,c[i])}}k.x.1R+=5S;k.x.t=5J-5S;k.y.1R+=5Y;k.y.t=61-5Y}},2O:C(p,5c){A 4h,2S=p.2Z,1H=p==k.x?\'x\':\'y\';q(2S&&2S.2q(/ /)){4h=2S.9e(\' \');2S=4h[0]}q(2S&&m.$(2S)){p.G=m.7a(m.$(2S))[1H];q(4h&&4h[1]&&4h[1].2q(/^[-]?[0-9]+F$/))p.G+=2r(4h[1]);q(p.I<p.2W)p.I=p.2W}J q(p.2O==\'22\'||p.2O==\'4w\'){A 84=1f;A 5b=p.B.5W;q(p.2O==\'4w\')p.G=1l.4W(p.2f+(p.4n+p.3m-p.4j-p.U(\'1V\'))/2);J p.G=1l.4W(p.G-((p.U(\'1V\')-p.t)/2));q(p.G<p.2f+p.3m){p.G=p.2f+p.3m;84=L}q(!5c&&p.I<p.2W){p.I=p.2W;5b=1f}q(p.G+p.U(\'1V\')>p.2f+p.4n-p.4j){q(!5c&&84&&5b){p.I=p.U(\'5L\')}J q(p.U(\'1V\')<p.U(\'5L\')){p.G=p.2f+p.4n-p.4j-p.U(\'1V\')}J{p.G=p.2f+p.3m;q(!5c&&5b)p.I=p.U(\'5L\')}}q(!5c&&p.I<p.2W){p.I=p.2W;5b=1f}}J q(p.2O==\'2T\'){p.G=1l.cH(p.G-p.I+p.t)}q(p.G<p.3m){A cw=p.G;p.G=p.3m;q(5b&&!5c)p.I=p.I-(p.G-cw)}},ci:C(2V){A x=k.x,y=k.y,6X=1f,3b=1l.3C(x.1c,x.I),43=1l.3C(y.1c,y.I),3G=(k.3G||m.5Z);q(3b/43>2V){ 3b=43*2V;q(3b<x.2W){3b=x.2W;43=3b/2V}6X=L}J q(3b/43<2V){ 43=3b/2V;6X=L}q(m.5Z&&x.1c<x.2W){x.1Y=x.1c;y.I=y.1Y=y.1c}J q(k.3G){x.1Y=3b;y.1Y=43}J{x.I=3b;y.I=43}k.7V(3G?H:2V);q(3G&&y.I<y.1Y){y.1Y=y.I;x.1Y=y.I*2V}q(6X||3G){x.G=x.1R-x.cb+x.3l;x.2W=x.I;k.2O(x,L);y.G=y.1R-y.cb+y.3l;y.2W=y.I;k.2O(y,L);q(k.1u)k.5d()}},7V:C(2V){A x=k.x,y=k.y;q(k.1u){57(y.I>k.5y&&x.I>k.4B&&y.U(\'1V\')>y.U(\'5L\')){y.I-=10;q(2V)x.I=y.I*2V;k.5d(0,1)}}},cU:C(){q(k.2u){A h=/1g/i.1b(k.2u.3J)?k.7N()+1+\'F\':\'22\';q(k.1i)k.1i.E.N=h;k.2u.E.N=h;k.y.7i(k.1w.1M);m.5f(k)}},9G:C(){A x=k.x,y=k.y;k.4Q(\'1r\');m.1y(k,\'cX\');q(k.1p&&k.1p.2M)k.1p.2M.5l();k.9B(1,{Q:{K:x.U(\'1V\'),N:y.U(\'1V\'),W:x.G,V:y.G},T:{W:x.1h+x.U(\'2j\'),V:y.1h+y.U(\'2j\'),K:x.1Y||x.I,N:y.1Y||y.I}},m.6M)},9B:C(1J,2e,2C){A 5N=k.3j,7M=1J?(k.1e?k.1e.a:H):m.2t,t=(5N[1]&&7M&&m.41(7M,\'3j\')[1]==5N[1])?5N[1]:5N[0];q(k[t]&&t!=\'2H\'){k[t](1J,2e);D}q(k.1a&&!k.3L){q(1J)k.1a.4x();J k.1a.65((k.2E&&k.4u))}q(!1J)k.8u();A B=k,x=B.x,y=B.y,2P=k.2P;q(!1J)2P=k.cj||2P;A 60=1J?C(){q(B.1a)B.1a.2i.E.1o="2b";3P(C(){B.6i()},50)}:C(){B.5p()};q(1J)m.R(k.Q,{K:x.t+\'F\',N:y.t+\'F\'});q(1J&&k.2E){m.R(k.Q,{W:(x.1R-x.cb+x.3l)+\'F\',V:(y.1R-y.cb+y.3l)+\'F\'})}q(k.b8){m.R(k.Q,{1v:1J?0:1});m.3T(2e.Q,{1v:1J})}m.24(k.Q,2e.Q,{4d:2C,2P:2P,3F:C(3p,2J){q(B.1a&&B.3L&&2J.1z==\'V\'){A 6h=1J?2J.G:1-2J.G;A G={w:x.t+(x.U(\'1V\')-x.t)*6h,h:y.t+(y.U(\'1V\')-y.t)*6h,x:x.1R+(x.G-x.1R)*6h,y:y.1R+(y.G-y.1R)*6h};B.1a.4x(G,0,1)}q(B.2E){q(2J.1z==\'W\')B.3Y.E.W=(x.G-3p)+\'F\';q(2J.1z==\'V\')B.3Y.E.V=(y.G-3p)+\'F\'}}});m.24(k.T,2e.T,2C,2P,60);q(1J){k.Q.E.1o=\'2b\';k.T.E.1o=\'2b\';q(k.2E)k.1w.E.1o=\'2b\';k.a.19+=\' M-4J-3Z\'}},6g:C(1J,2e){k.3L=1f;A B=k,t=1J?m.6M:0;q(1J){m.24(k.Q,2e.Q,0);m.R(k.Q,{1v:0,1o:\'2b\'});m.24(k.T,2e.T,0);k.T.E.1o=\'2b\';m.24(k.Q,{1v:1},t,H,C(){B.6i()})}q(k.1a){k.1a.2i.E.1F=k.Q.E.1F;A 6H=1J||-1,1q=k.1a.1q,7T=1J?3:1q,7U=1J?1q:3;P(A i=7T;6H*i<=6H*7U;i+=6H,t+=25){(C(){A o=1J?7U-i:7T-i;3P(C(){B.1a.4x(0,o,1)},t)})()}}q(1J){}J{3P(C(){q(B.1a)B.1a.65(B.4u);B.8u();m.24(B.Q,{1v:0},H,H,C(){B.5p()})},t)}},47:C(1J,2e){q(!1J)D;A B=k,2C=m.ct,1e=B.1e,x=B.x,y=B.y,2v=1e.x,2x=1e.y,1u=B.1u,Q=k.Q,T=k.T;m.53(1d,\'6J\',m.6R);k.1a=1e.1a;q(k.1a)k.1a.B=B;1e.1a=H;1e.Q.E.2s=\'1r\';m.R(Q,{W:2v.G+\'F\',V:2x.G+\'F\',K:2v.U(\'1V\')+\'F\',N:2x.U(\'1V\')+\'F\'});m.R(T,{1n:\'1s\',K:(x.1Y||x.I)+\'F\',N:(y.1Y||y.I)+\'F\',W:(x.1h+x.U(\'2j\'))+\'F\',V:(y.1h+y.U(\'2j\'))+\'F\'});A 4s=m.16(\'O\',{19:\'M-2L\'},{1k:\'2m\',1F:4,2s:\'1r\',1n:\'1s\',W:(2v.1h+2v.U(\'2j\'))+\'F\',V:(2x.1h+2x.U(\'2j\'))+\'F\',K:(2v.1Y||2v.I)+\'F\',N:(2x.1Y||2x.I)+\'F\'});q(k.2E)m.R(k.3Y,{W:0,V:0});q(1u)m.R(1u,{2s:\'2b\',W:(2v.1h+2v.cb)+\'F\',V:(2x.1h+2x.cb)+\'F\',K:2v.I+\'F\',N:2x.I+\'F\'});A 7R={7K:1e,8j:k};P(A n 3h 7R){k[n]=7R[n].T.58(1);m.R(k[n],{1k:\'2m\',86:0,1o:\'2b\'});4s.1X(k[n])}m.R(k.7K,{W:0,V:0});m.R(k.8j,{1n:\'3A\',1v:0,W:(x.G-2v.G+x.1h-2v.1h+x.U(\'2j\')-2v.U(\'2j\'))+\'F\',V:(y.G-2x.G+y.1h-2x.1h+y.U(\'2j\')-2x.U(\'2j\'))+\'F\'});Q.1X(4s);q(1u){1u.19=\'\';Q.1X(1u)}4s.E.1n=\'\';1e.T.E.1n=\'1s\';q(m.55){A 2q=5i.7A.2q(/cs\\/([0-9]{3})/);q(2q&&2r(2q[1])<d3)Q.E.1o=\'2b\'}C 4b(){Q.E.1o=T.E.1o=\'2b\';T.E.1n=\'3A\';4s.E.1n=\'1s\';B.a.19+=\' M-4J-3Z\';B.6i();1e.5p()}m.24(1e.Q,{W:x.G,V:y.G,K:x.U(\'1V\'),N:y.U(\'1V\')},2C);m.24(4s,{K:x.1Y||x.I,N:y.1Y||y.I,W:x.1h+x.U(\'2j\'),V:y.1h+y.U(\'2j\')},2C);m.24(k.7K,{W:(2v.G-x.G+2v.1h-x.1h+2v.U(\'2j\')-x.U(\'2j\')),V:(2x.G-y.G+2x.1h-y.1h+2x.U(\'2j\')-y.U(\'2j\'))},2C);m.24(k.8j,{1v:1,W:0,V:0},2C);q(1u)m.24(1u,{W:x.1h+x.cb,V:y.1h+y.cb,K:x.I,N:y.I},2C);q(k.1a)A cv=C(3p,2J){q(2J.1z==\'V\'){A 3u=B.Q.E;A G={w:2r(3u.K),h:2r(3u.N),x:2r(3u.W),y:2r(3u.V)};B.1a.4x(G)}};m.24(Q,2e.Q,{4d:2C,7l:4b,3F:cv});4s.E.1o=\'2b\'},bb:C(o,el){q(!k.1e)D 1f;P(A i=0;i<k.1e.1S.Y;i++){A 6Q=m.$(\'23\'+k.1e.1S[i]);q(6Q&&6Q.23==o.23){k.8R();6Q.eG=k.S;m.2w(k.1S,k.1e.1S[i]);D L}}D 1f},6i:C(){k.5B=L;k.3V();q(k.2E&&k.3M==\'60\')k.6j();q(k.1g){1E{A B=k,2A=k.1g.9b||k.1g.5T.1d;m.2z(2A,\'7E\',C(){q(m.3e!=B.S)B.3V()})}1D(e){}q(m.1x&&1I k.6e!=\'eA\')k.1g.E.K=(k.4c-1)+\'F\'}q(k.4o)m.1H(k);q(m.2t&&m.2t==k.a)m.2t=H;k.cu();A p=m.3n,8i=m.6Y.x+p.6z,8h=m.6Y.y+p.6l;k.8w=k.x.G<8i&&8i<k.x.G+k.x.U(\'1V\')&&k.y.G<8h&&8h<k.y.G+k.y.U(\'1V\');q(k.1u)k.c5();m.1y(k,\'eB\')},cu:C(){A S=k.S;A 1U=k.1U;1L m.5n(1U,C(){1E{m.18[S].co()}1D(e){}})},co:C(){A 1G=k.89(1);q(1G&&1G.2n.cp().2q(/m\\.2H/))A 1O=m.16(\'1O\',{1m:m.6L(1G)})},89:C(2o){A 88=k.6G(),as=m.4y.3q[k.2N||\'1s\'];q(!as[88+2o]&&k.1p&&k.1p.bP){q(2o==1)D as[0];J q(2o==-1)D as[as.Y-1]}D as[88+2o]||H},6G:C(){A 2a=m.6m().3q[k.2N||\'1s\'];q(2a)P(A i=0;i<2a.Y;i++){q(2a[i]==k.a)D i}D H},bk:C(){q(k[k.5t]){A 2a=m.4y.3q[k.2N||\'1s\'];q(2a){A s=m.11.3I.29(\'%1\',k.6G()+1).29(\'%2\',2a.Y);k[k.5t].2h=\'<O 1Z="M-3I">\'+s+\'</O>\'+k[k.5t].2h}}},9w:C(){q(!k.1e){P(A i=0;i<m.6d.Y;i++){A 1Q=m.6d[i],3a=1Q.2N;q(1I 3a==\'1W\'||3a===H||3a===k.2N)k.1p=1L m.98(k,1Q)}}J{k.1p=k.1e.1p}A 1Q=k.1p;q(!1Q)D;A B=1Q.B=k;1Q.bK();1Q.4Z(\'1c-2H\');q(1Q.2U){A o=1Q.cl||{};o.4F=1Q.2U;o.23=\'2U\';k.4H(o)}q(1Q.2M)1Q.2M.6p(k);q(!k.1e&&k.4a)1Q.3N(L);q(1Q.4a){1Q.4a=3P(C(){m.1G(B.S)},(1Q.fb||fa))}},6A:C(){m.18[k.S]=H;q(m.2t==k.a)m.2t=H;m.8V(k.S);q(k.2y)m.2y.E.W=\'-4e\';m.1y(k,\'cz\')},bj:C(){q(k.5K)D;k.5K=m.16(\'a\',{21:m.cy,19:\'M-5K\',2h:m.11.cx,2k:m.11.cf});k.4H({4F:k.5K,1k:\'V W\',23:\'5K\'})},8K:C(8e,bu){P(A i=0;i<8e.Y;i++){A Z=8e[i],s=H;q(Z==\'8O\'&&!m.1y(k,\'f9\'))D;J q(Z==\'4L\'&&!m.1y(k,\'f8\'))D;q(!k[Z+\'7b\']&&k.7p)k[Z+\'7b\']=Z+\'-P-\'+k.7p;q(k[Z+\'7b\'])k[Z]=m.6c(k[Z+\'7b\']);q(!k[Z]&&!k[Z+\'7C\']&&k[Z+\'bv\'])1E{s=f7(k[Z+\'bv\'])}1D(e){}q(!k[Z]&&k[Z+\'7C\']){s=k[Z+\'7C\']}q(!k[Z]&&!s){A 1G=k.a.bw;57(1G&&!m.6x(1G)){q((1L 4I(\'M-\'+Z)).1b(1G.19||H)){k[Z]=1G.58(1);4S}1G=1G.bw}}q(!k[Z]&&!s&&k.5t==Z)s=\'\\n\';q(!k[Z]&&s)k[Z]=m.16(\'O\',{19:\'M-\'+Z,2h:s});q(bu&&k[Z]){A o={1k:(Z==\'4L\')?\'5s\':\'7o\'};P(A x 3h k[Z+\'bt\'])o[x]=k[Z+\'bt\'][x];o.4F=k[Z];k.4H(o)}}},4Q:C(1o){q(m.bq)k.6U(\'fc\',1o);q(m.br)k.6U(\'eZ\',1o);q(m.5V)k.6U(\'*\',1o)},6U:C(3J,1o){A 1j=1d.2B(3J);A 1z=3J==\'*\'?\'2s\':\'1o\';P(A i=0;i<1j.Y;i++){q(1z==\'1o\'||(1d.7J.bx(1j[i],"").bz(\'2s\')==\'22\'||1j[i].bE(\'1r-by\')!=H)){A 2X=1j[i].bE(\'1r-by\');q(1o==\'2b\'&&2X){2X=2X.29(\'[\'+k.S+\']\',\'\');1j[i].5w(\'1r-by\',2X);q(!2X)1j[i].E[1z]=1j[i].9u}J q(1o==\'1r\'){A 3O=m.7a(1j[i]);3O.w=1j[i].1C;3O.h=1j[i].1M;q(!k.4o){A bF=(3O.x+3O.w<k.x.U(\'5G\')||3O.x>k.x.U(\'5G\')+k.x.U(\'7H\'));A bD=(3O.y+3O.h<k.y.U(\'5G\')||3O.y>k.y.U(\'5G\')+k.y.U(\'7H\'))}A 7q=m.7I(1j[i]);q(!bF&&!bD&&7q!=k.S){q(!2X){1j[i].5w(\'1r-by\',\'[\'+k.S+\']\');1j[i].9u=1j[i].E[1z];1j[i].E[1z]=\'1r\'}J q(2X.bC(\'[\'+k.S+\']\')==-1){1j[i].5w(\'1r-by\',2X+\'[\'+k.S+\']\')}}J q((2X==\'[\'+k.S+\']\'||m.3e==7q)&&7q!=k.S){1j[i].5w(\'1r-by\',\'\');1j[i].E[1z]=1j[i].9u||\'\'}J q(2X&&2X.bC(\'[\'+k.S+\']\')>-1){1j[i].5w(\'1r-by\',2X.29(\'[\'+k.S+\']\',\'\'))}}}}},3V:C(){k.Q.E.1F=m.4f++;P(A i=0;i<m.18.Y;i++){q(m.18[i]&&i==m.3e){A 4k=m.18[i];4k.T.19+=\' M-\'+4k.3o+\'-9D\';q(4k.2Y){4k.T.E.4l=m.1x?\'bp\':\'7e\';4k.T.2k=m.11.bB}m.1y(4k,\'eE\')}}q(k.1a)k.1a.2i.E.1F=k.Q.E.1F;k.T.19=\'M-\'+k.3o;q(k.2Y){k.T.2k=m.11.9v;q(m.5P){m.52=1T.3S?\'7e\':\'6t(\'+m.54+m.5P+\'), 7e\';q(m.1x&&m.4m<6)m.52=\'bp\';k.T.E.4l=m.52}}m.3e=k.S;m.2z(1d,1T.3S?\'9x\':\'9C\',m.6F);m.1y(k,\'eF\')},8C:C(x,y){k.x.9M(x);k.y.9M(y)},3R:C(e){A w,h,r=e.K/e.N;w=1l.2T(e.K+e.dX,1l.3C(k.4B,k.x.1c));q(k.2Y&&1l.eq(w-k.x.1c)<12)w=k.x.1c;h=k.2E?e.N+e.dY:w/r;q(h<1l.3C(k.5y,k.y.1c)){h=1l.3C(k.5y,k.y.1c);q(k.2Y)w=h*r}k.8E(w,h)},8E:C(w,h){k.y.7i(h);k.x.7i(w)},2d:C(){q(k.6e||!k.5B)D;q(k.3j[1]==\'47\'&&m.2t){m.3d(m.2t).6A();m.2t=H}q(!m.1y(k,\'eK\'))D;k.6e=L;q(k.1p&&!m.2t)k.1p.3i();m.53(1d,1T.3S?\'9x\':\'9C\',m.6F);1E{q(k.2E)k.bf();k.T.E.4l=\'eR\';k.9B(0,{Q:{K:k.x.t,N:k.y.t,W:k.x.1R-k.x.cb+k.x.3l,V:k.y.1R-k.y.cb+k.y.3l},T:{W:0,V:0,K:k.x.t,N:k.y.t}},m.be)}1D(e){k.5p()}},bf:C(){q(m.5V){q(!m.66)m.66=m.16(\'O\',H,{1k:\'2m\'},m.2c);m.R(m.66,{K:k.x.I+\'F\',N:k.y.I+\'F\',W:k.x.G+\'F\',V:k.y.G+\'F\',1n:\'3A\'})}q(k.2K==\'3t\')1E{m.$(k.1i.1B).eN()}1D(e){}q(k.3M==\'60\'&&!k.4u)k.bd();q(k.2u&&k.2u!=k.59)k.2u.E.2s=\'1r\'},bd:C(){q(m.1x&&k.1g)1E{k.1g.5T.1d.1i.2h=\'\'}1D(e){}q(k.2K==\'3t\')9r.eg(k.1i.1B);k.1i.2h=\'\'},c7:C(){q(k.1a)k.1a.2i.E.1n=\'1s\';k.3E=H;k.Q.E.1n=\'1s\';m.2w(m.4g,k)},b9:C(){1E{m.18[k.S]=k;q(!m.9t&&m.3e!=k.S){1E{m.18[m.3e].2d()}1D(e){}}A z=m.4f++,3u={1n:\'\',1F:z};m.R(k.Q,3u);k.6e=1f;A o=k.1a||0;q(o){q(!k.3L)3u.1o=\'1r\';m.R(o.2i,3u)}q(k.1p){k.9w()}k.9G()}1D(e){}},4H:C(o){A el=o.4F,4N=(o.bg==\'36\'&&!/7d$/.1b(o.1k));q(1I el==\'9O\')el=m.6c(el);q(o.3w)el=m.16(\'O\',{2h:o.3w});q(!el||1I el==\'9O\')D;q(!m.1y(k,\'eu\',{14:el}))D;el.E.1n=\'3A\';o.23=o.23||o.4F;q(k.3j[1]==\'47\'&&k.bb(o,el))D;k.8R();A K=o.K&&/^[0-9]+(F|%)$/.1b(o.K)?o.K:\'22\';q(/^(W|3g)7d$/.1b(o.1k)&&!/^[0-9]+F$/.1b(o.K))K=\'eU\';A 14=m.16(\'O\',{1B:\'23\'+m.6r++,23:o.23},{1k:\'2m\',1o:\'1r\',K:K,9H:m.11.9I||\'\',1v:0},4N?m.36:k.1u,L);q(4N)14.6D=k.S;14.1X(el);m.3T(14,{1v:1,cg:0,bh:0,2C:(o.6g===0||o.6g===1f||(o.6g==2&&m.1x))?0:5o});m.3T(14,o);q(k.bG){k.5X(14);q(!14.7v||k.8w)m.24(14,{1v:14.1v},14.2C)}m.2w(k.1S,m.6r-1)},5X:C(14){A p=14.1k||\'8L 4w\',4N=(14.bg==\'36\'),6u=14.cg,6C=14.bh;q(4N){m.36.E.1n=\'3A\';14.6D=k.S;q(14.1C>14.26.1C)14.E.K=\'2Q%\'}J q(14.26!=k.1u)k.1u.1X(14);q(/W$/.1b(p))14.E.W=6u+\'F\';q(/4w$/.1b(p))m.R(14,{W:\'50%\',5j:(6u-1l.4W(14.1C/2))+\'F\'});q(/3g$/.1b(p))14.E.3g=-6u+\'F\';q(/^bm$/.1b(p)){m.R(14,{3g:\'2Q%\',9o:k.x.cb+\'F\',V:-k.y.cb+\'F\',4z:-k.y.cb+\'F\',2s:\'22\'});k.x.1h=14.1C}J q(/^bn$/.1b(p)){m.R(14,{W:\'2Q%\',5j:k.x.cb+\'F\',V:-k.y.cb+\'F\',4z:-k.y.cb+\'F\',2s:\'22\'});k.x.3v=14.1C}A 8M=14.26.1M;14.E.N=\'22\';q(4N&&14.1M>8M)14.E.N=m.4P?8M+\'F\':\'2Q%\';q(/^V/.1b(p))14.E.V=6C+\'F\';q(/^8L/.1b(p))m.R(14,{V:\'50%\',5u:(6C-1l.4W(14.1M/2))+\'F\'});q(/^4z/.1b(p))14.E.4z=-6C+\'F\';q(/^5s$/.1b(p)){m.R(14,{W:(-k.x.1h-k.x.cb)+\'F\',3g:(-k.x.3v-k.x.cb)+\'F\',4z:\'2Q%\',6v:k.y.cb+\'F\',K:\'22\'});k.y.1h=14.1M}J q(/^7o$/.1b(p)){m.R(14,{1k:\'4v\',W:(-k.x.1h-k.x.cb)+\'F\',3g:(-k.x.3v-k.x.cb)+\'F\',V:\'2Q%\',5u:k.y.cb+\'F\',K:\'22\'});k.y.3v=14.1M;14.E.1k=\'2m\'}},bl:C(){k.8K([\'4L\',\'8O\'],L);k.bk();q(k.8O)m.1y(k,\'eX\');q(k.4L)m.1y(k,\'f5\');q(k.4L&&k.8P)k.4L.19+=\' M-3D\';q(m.bi)k.bj();P(A i=0;i<m.1S.Y;i++){A o=m.1S[i],7y=o.8U,3a=o.2N;q((!7y&&!3a)||(7y&&7y==k.7p)||(3a&&3a===k.2N)){q(k.2Y||(k.2E&&o.ea))k.4H(o)}}A 7j=[];P(A i=0;i<k.1S.Y;i++){A o=m.$(\'23\'+k.1S[i]);q(/7d$/.1b(o.1k))k.5X(o);J m.2w(7j,o)}P(A i=0;i<7j.Y;i++)k.5X(7j[i]);k.bG=L},8R:C(){q(!k.1u)k.1u=m.16(\'O\',{19:k.7k},{1k:\'2m\',K:(k.x.I||k.x.1c)+\'F\',N:(k.y.I||k.y.1c)+\'F\',1o:\'1r\',2s:\'1r\',1F:m.1x?4:H},m.2c,L)},5d:C(8z,bH){A 1u=k.1u,x=k.x,y=k.y;m.R(1u,{K:x.I+\'F\',N:y.I+\'F\'});q(8z||bH){P(A i=0;i<k.1S.Y;i++){A o=m.$(\'23\'+k.1S[i]);A 8H=(m.4P||1d.8I==\'c4\');q(o&&/^(5s|7o)$/.1b(o.1k)){q(8H){o.E.K=(1u.1C+2*x.cb+x.1h+x.3v)+\'F\'}y[o.1k==\'5s\'?\'1h\':\'3v\']=o.1M}q(o&&8H&&/^(W|3g)7d$/.1b(o.1k)){o.E.N=(1u.1M+2*y.cb)+\'F\'}}}q(8z){m.R(k.T,{V:y.1h+\'F\'});m.R(1u,{V:(y.1h+y.cb)+\'F\'})}},c5:C(){A b=k.1u;b.19=\'\';m.R(b,{V:(k.y.1h+k.y.cb)+\'F\',W:(k.x.1h+k.x.cb)+\'F\',2s:\'2b\'});q(m.55)b.E.1o=\'2b\';k.Q.1X(b);P(A i=0;i<k.1S.Y;i++){A o=m.$(\'23\'+k.1S[i]);o.E.1F=o.23==\'2U\'?5:4;q(!o.7v||k.8w){o.E.1o=\'2b\';m.24(o,{1v:o.1v},o.2C)}}},8u:C(){q(!k.1S.Y)D;P(A i=0;i<k.1S.Y;i++){A o=m.$(\'23\'+k.1S[i]);q(o.26==m.36)m.51(o)}q(k.1p){A c=k.1p.2U;q(c&&m.3d(c)==k)c.26.8v(c)}q(k.2E&&k.4u){k.1u.E.V=\'-4e\';m.2c.1X(k.1u)}J m.51(k.1u)},c2:C(){q(k.1p&&k.1p.2U){k.1p.4E(\'1c-2H\');D}k.7t=m.16(\'a\',{21:\'bZ:m.18[\'+k.S+\'].6V();\',2k:m.11.8G,19:\'M-1c-2H\'});q(!m.1y(k,\'cW\'))D;k.4H({4F:k.7t,1k:m.c0,7v:L,1v:m.c1})},6V:C(){1E{q(!m.1y(k,\'d6\'))D;q(k.7t)m.51(k.7t);k.3V();A 3b=k.x.I;k.8E(k.x.1c,k.y.1c);A 7c=k.x.G-(k.x.I-3b)/2;q(7c<m.5j)7c=m.5j;k.8C(7c,k.y.G);k.4Q(\'1r\');m.5f(k)}1D(e){k.8D(e)}},5p:C(){k.a.19=k.a.19.29(\'M-4J-3Z\',\'\');k.4Q(\'2b\');q(k.2E&&k.4u&&k.3j[1]!=\'47\'){k.c7()}J{q(k.1a&&k.3L)k.1a.65();m.51(k.Q)}q(m.66)m.66.E.1n=\'1s\';q(!m.36.71.Y)m.36.E.1n=\'1s\';q(k.4o)m.8V(k.S);m.1y(k,\'db\');m.18[k.S]=H;m.cd()}};m.6K=C(a,T,6Z){k.a=a;k.T=T;k.6Z=6Z};m.6K.4O={9g:C(){q(!k.1m)k.1m=m.6L(k.a);q(k.1m.2q(\'#\')){A 2a=k.1m.9e(\'#\');k.1m=2a[0];k.1B=2a[1]}q(m.72[k.1m]){k.bY=m.72[k.1m];q(k.1B)k.9n();J k.5U();D}1E{k.3K=1L c8()}1D(e){1E{k.3K=1L ce("dh.ca")}1D(e){1E{k.3K=1L ce("cc.ca")}1D(e){k.9d()}}}A 3x=k;k.3K.cG=C(){q(3x.3K.9J==4){q(3x.1B)3x.9n();J 3x.5U()}};k.3K.bO("cI",k.1m,L);k.3K.cA(\'X-cE-cF\',\'c8\');k.3K.cB(H)},9n:C(){m.74();A 42=1T.3S||m.c9?{1m:\'cT:cQ\'}:H;k.1g=m.16(\'1g\',42,{1k:\'2m\',V:\'-4e\'},m.2c);k.5U()},5U:C(){A s=k.bY||k.3K.cK;q(k.6Z)m.72[k.1m]=s;q(!m.1x||m.4m>=5.5){s=s.29(/\\s/g,\' \').29(1L 4I(\'<dO[^>]*>\',\'bN\'),\'\').29(1L 4I(\'<bX[^>]*>.*?</bX>\',\'bN\'),\'\');q(k.1g){A 2A=k.1g.9b;q(!2A&&k.1g.5T)2A=k.1g.5T.1d;q(!2A){A 3x=k;3P(C(){3x.5U()},25);D}2A.bO();2A.dM(s);2A.2d();1E{s=2A.8Z(k.1B).2h}1D(e){1E{s=k.1g.1d.8Z(k.1B).2h}1D(e){}}}J{s=s.29(1L 4I(\'^.*?<1i[^>]*>(.*?)</1i>.*?$\',\'i\'),\'$1\')}}m.4G(k.T,\'6W\',\'M-1i\').2h=s;k.3B();P(A x 3h k)k[x]=H}};m.98=C(B,1t){q(m.e5!==1f)m.79();k.B=B;P(A x 3h 1t)k[x]=1t[x];q(k.e7)k.bI();q(k.2M)k.2M=m.bS(k)};m.98.4O={bI:C(){k.2U=m.16(\'O\',{2h:m.97(m.96.2U)},H,m.2c);A 5A=[\'3N\',\'3i\',\'31\',\'1G\',\'3D\',\'1c-2H\',\'2d\'];k.1P={};A 3x=k;P(A i=0;i<5A.Y;i++){k.1P[5A[i]]=m.4G(k.2U,\'1K\',\'M-\'+5A[i]);k.4E(5A[i])}k.1P.3i.E.1n=\'1s\'},bK:C(){q(k.bP||!k.2U)D;A 5g=k.B.6G(),2l=/6k$/;q(5g==0)k.4Z(\'31\');J q(2l.1b(k.1P.31.2B(\'a\')[0].19))k.4E(\'31\');q(5g+1==m.4y.3q[k.B.2N||\'1s\'].Y){k.4Z(\'1G\');k.4Z(\'3N\')}J q(2l.1b(k.1P.1G.2B(\'a\')[0].19)){k.4E(\'1G\');k.4E(\'3N\')}},4E:C(1P){q(!k.1P)D;A bV=k,a=k.1P[1P].2B(\'a\')[0],2l=/6k$/;a.2n=C(){bV[1P]();D 1f};q(2l.1b(a.19))a.19=a.19.29(2l,\'\')},4Z:C(1P){q(!k.1P)D;A a=k.1P[1P].2B(\'a\')[0];a.2n=C(){D 1f};q(!/6k$/.1b(a.19))a.19+=\' 6k\'},bT:C(){q(k.4a)k.3i();J k.3N()},3N:C(bR){q(k.1P){k.1P.3N.E.1n=\'1s\';k.1P.3i.E.1n=\'\'}k.4a=L;q(!bR)m.1G(k.B.S)},3i:C(){q(k.1P){k.1P.3i.E.1n=\'1s\';k.1P.3N.E.1n=\'\'}dE(k.4a);k.4a=H},31:C(){k.3i();m.31(k.1P.31)},1G:C(){k.3i();m.1G(k.1P.1G)},3D:C(){},\'1c-2H\':C(){m.3d().6V()},2d:C(){m.2d(k.1P.2d)}};m.bS=C(1p){C 6p(B){m.3T(1t||{},{4F:4p,23:\'2M\'});q(m.4P)1t.6g=0;B.4H(1t);m.R(4p.26,{2s:\'1r\'})};C 2f(3U){5l(1W,1l.4W(3U*4p[3Q?\'1C\':\'1M\']*0.7))};C 5l(i,8Y){q(i===1W)P(A j=0;j<5r.Y;j++){q(5r[j]==1p.B.a){i=j;4S}}A as=4p.2B(\'a\'),4J=as[i],45=4J.26,W=3Q?\'bU\':\'bW\',3g=3Q?\'bQ\':\'bJ\',K=3Q?\'bL\':\'bM\',4A=\'1q\'+W,1C=\'1q\'+K,6N=O.26.26[1C]-2i[1C],5R=2r(2i.E[3Q?\'W\':\'V\'])||0,2R=5R,dN=20;q(8Y!==1W){2R=5R-8Y;q(2R>0)2R=0;q(2R<6N)2R=6N}J{P(A j=0;j<as.Y;j++)as[j].19=\'\';4J.19=\'M-4J-3Z\';A 9m=i>0?as[i-1].26[4A]:45[4A],9l=45[4A]+45[1C]+(as[i+1]?as[i+1].26[1C]:0);q(9l>O[1C]-5R)2R=O[1C]-9l;J q(9m<-5R)2R=-9m}A 9f=45[4A]+(45[1C]-7f[1C])/2+2R;m.24(2i,3Q?{W:2R}:{V:2R},H,\'8W\');m.24(7f,3Q?{W:9f}:{V:9f},H,\'8W\');8S.E.1n=2R<0?\'3A\':\'1s\';8T.E.1n=(2R>6N)?\'3A\':\'1s\'};A 5r=m.4y.3q[1p.B.2N||\'1s\'],1t=1p.2M,5F=1t.5F||\'c6\',8Q=(5F==\'dc\'),3W=8Q?[\'O\',\'68\',\'1K\',\'1A\']:[\'2i\',\'4q\',\'3X\',\'2I\'],3Q=(5F==\'c6\'),4p=m.16(\'O\',{19:\'M-2M M-2M-\'+5F,2h:\'<O 1Z="M-2M-de">\'+\'<\'+3W[0]+\'><\'+3W[1]+\'></\'+3W[1]+\'></\'+3W[0]+\'></O>\'+\'<O 1Z="M-2f-1J"><O></O></O>\'+\'<O 1Z="M-2f-dd"><O></O></O>\'+\'<O 1Z="M-7f"><O></O></O>\'},{1n:\'1s\'},m.2c),5q=4p.71,O=5q[0],8S=5q[1],8T=5q[2],7f=5q[3],2i=O.cY,4q=4p.2B(3W[1])[0],3X;P(A i=0;i<5r.Y;i++){q(i==0||!3Q)3X=m.16(3W[2],H,H,4q);(C(){A a=5r[i],45=m.16(3W[3],H,H,3X),cV=i;m.16(\'a\',{21:a.21,2n:C(){D m.8x(a)},2h:m.c3?m.c3(a):a.2h},H,45)})()}q(!8Q){8S.2n=C(){2f(-1)};8T.2n=C(){2f(1)};m.2z(4q,1d.f4!==1W?\'fs\':\'em\',C(e){A 3U=0;e=e||1T.2G;q(e.ba){3U=e.ba/ec;q(m.3S)3U=-3U}J q(e.bc){3U=-e.bc/3}q(3U)2f(-3U*0.2);q(e.5m)e.5m();e.bo=1f})}D{6p:6p,5l:5l}};q(1d.9J&&m.1x){(C(){1E{1d.5h.eI(\'W\')}1D(e){3P(bA.eC,50);D}m.bs()})()}m.6E=m.11;A f6=m.67;m.2z(1T,\'7n\',C(){q(m.8p){A 7P=\'.M 1O\',7O=\'4l: 6t(\'+m.54+m.8p+\'), 7e !eQ;\';A E=m.16(\'E\',{Z:\'eo/8n\'},H,1d.2B(\'fw\')[0]);q(!m.1x){E.1X(1d.fg(7P+" {"+7O+"}"))}J{A 1e=1d.cq[1d.cq.Y-1];q(1I(1e.ck)=="6P")1e.ck(7P,7O)}}});m.2z(1T,\'3R\',C(){m.3n=m.73();q(m.36)P(A i=0;i<m.36.71.Y;i++){A 1N=m.36.71[i],B=m.3d(1N);B.5X(1N);q(1N.23==\'2M\')B.1p.2M.5l()}});m.2z(1d,\'6J\',C(e){m.6Y={x:e.6B,y:e.7g}});m.2z(1d,\'7E\',m.9q);m.2z(1d,\'aq\',m.9q);m.2z(1T,\'7n\',m.aI);m.2z(1T,\'7n\',m.aK);m.2z(1T,\'7n\',C(){m.aR=L});m.7B();',62,963,'||||||||||||||||||||this||hs||||if||||||||||var|exp|function|return|style|px|pos|null|size|else|width|true|highslide|height|div|for|wrapper|setStyles|key|content|get|top|left||length|type||lang|||overlay||createElement||expanders|className|outline|test|full|document|last|false|iframe|p1|body|els|position|Math|src|display|visibility|slideshow|offset|hidden|none|options|overlayBox|opacity|innerContent|ie|fireEvent|prop|span|id|offsetWidth|catch|try|zIndex|next|dim|typeof|up|li|new|offsetHeight|node|img|btn|ss|tpos|overlays|window|outlineType|wsize|undefined|appendChild|imgSize|class||href|auto|hsId|animate||parentNode||fx|replace|arr|visible|container|close|to|scroll|case|innerHTML|table|imgPad|title|re|absolute|onclick|op|params|match|parseInt|overflow|upcoming|scrollerDiv|lastX|push|lastY|loading|addEventListener|doc|getElementsByTagName|dur|dimmer|isHtml|dragArgs|event|expand|td|args|objectType|image|thumbstrip|slideshowGroup|justify|easing|100|tblPos|tgt|max|controls|ratio|minSize|hiddenBy|isImage|target|ajax|previous||||name|viewport||||sg|xSize|elem|getExpander|focusKey|ucwh|right|in|pause|transitions|wh|tb|marginMin|page|contentType|val|groups|hasDragged|opt|swf|stl|p2|html|pThis|clearing|custom|block|onLoad|min|move|releaseMask|step|useBox|graphic|number|tagName|xmlHttp|outlineWhileAnimating|objectLoadTime|play|elPos|setTimeout|isX|resize|opera|extend|delta|focus|tree|tr|mediumContent|anchor||getParam|attribs|ySize|styles|cell|iebody|crossfade|timers|func|autoplay|end|objectWidth|duration|9999px|zIndexCounter|sleeping|tgtArr|start|marginMax|blurExp|cursor|uaVersion|clientSize|dimmingOpacity|dom|tbody|pendingOutlines|fadeBox|clone|preserveContent|relative|center|setPosition|anchors|bottom|offsetLeft|minWidth|now|unit|enable|overlayId|getElementByClass|createOverlay|RegExp|active|onload|heading|wDiff|relToVP|prototype|ieLt7|doShowHide|htmls|break|hDiff|area|cacheBindings|round|images|over|disable||discardElement|styleRestoreCursor|removeEventListener|graphicsDir|safari|objectHeight|while|cloneNode|scrollingContent|adj|allowReduce|moveOnly|sizeOverlayBox|cNode|setDimmerSize|cur|documentElement|navigator|marginLeft|self|selectThumb|preventDefault|Outline|250|afterClose|domCh|group|above|numberPosition|marginTop|obj|setAttribute|owner|minHeight|getParams|buttons|isExpanded|param|ruler|cache|mode|opos|toLowerCase|contentLoaded|maxX|credits|fitsize|showLoading|trans|preloadTheseImages|restoreCursor|filter|curTblPos|minX|contentWindow|loadHTML|geckoMac|allowSizeReduction|positionOverlay|minY|padToMinWidth|after|maxY|uclt|all|parent|destroy|mask|Expander|ul|before|currentStyle|matches|getNode|slideshows|isClosing|on|fade|fac|afterExpand|writeExtendedContent|disabled|scrollTop|getAnchors|expOnly|previousOrNext|add|element|idCounter|Dimension|url|offX|marginBottom|lt|isHsAnchor|preloadFullImage|scrollLeft|cancelLoading|clientX|offY|hsKey|langDefaults|keyHandler|getAnchorIndex|dir|imgs|mousemove|Ajax|getSrc|expandDuration|minTblPos|allowWidthReduction|object|oDiv|dragHandler|kdeBugCorr|curAnim|showHideElements|doFullExpand|DIV|changed|mouse|pre||childNodes|cachedGets|getPageSize|init||background|innerHeight|innerWidth|updateAnchors|getPosition|Id|xpos|panel|pointer|marker|clientY|maincontent|setSize|os|wrapperClassName|complete|pageWidth|load|below|thumbsUserSetId|wrapperKey|preloadTheseAjax|rel|fullExpandLabel|gotoEnd|hideOnMouseOut|pageHeight|topmostKey|tId|onLoadStarted|userAgent|setClickEvents|Text|ucrb|mousedown|align|hasAlphaImageLoader|osize|getWrapperKey|defaultView|oldImg|oPos|other|getIframePageHeight|dec|sel|calcExpanded|names|calcBorders|startOff|endOff|fitOverlayBox|Date|allowHeightReduction|setObjContainerSize|padding|offsetTop|htmlGetSize|correctIframeSize|getTime|hasMovedMin|swfOptions|border|location|current|getAdjacentAnchor|calcThumb|Create|overrides|continuePreloading|types|sizeDiff|onDomReady|mY|mX|newImg|contentId|getSelfRendered|getCacheBinding|css|loadingPosXfade|expandCursor|connectOutline|loadingPos|margin|numberOfImagesToPreload|destroyOverlays|removeChild|mouseIsOver|transit|dimmingDuration|doWrapper|topZ|preloadAjaxElement|moveTo|error|resizeTo|cacheAjax|fullExpandTitle|ie6|compatMode|evt|getInline|middle|parOff|hasFocused|caption|dragByHeading|floatMode|genOverlayBox|scrollUp|scrollDown|thumbnailId|undim|easeOutQuad|nextTitle|scrollBy|getElementById|nextText|moveTitle|previousText|previousTitle|arrow|Click|skin|replaceLang|Slideshow||moveText|contentDocument|clientHeight|onError|split|markerPos|run|clientWidth|parseFloat|closeText|closeTitle|activeRight|activeLeft|getElementContent|marginRight|clones|mouseClickHandler|swfobject|state|allowMultipleInstances|origProp|restoreTitle|initSlideshow|keypress|update|htmlExpand|openerTagNames|changeSize|keydown|blur|garbageBin|startTime|show|direction|cssDirection|readyState|distance|srcElement|setPos|done|string|relatedTarget|targetY|headingOverlay|captionOverlay|fullExpandText|targetX|vis|onGraphicLoad|call|appendTo|pauseText|resizeTitle|attributes|spacebar|newHeight|Previous|Next|Pause|Play|Highslide|JS|clear|Close|Move|hasExtendedContent|playTitle|flashvars|playText|wmode|timerId|png|preloadGraphic|and|_default|200|pauseTitle|scrollMaxX|mouseup|both||dimmingGeckoFix|maxWidth|isDomReady|ltr|loadingOpacity|loadingText|loadingTitle|detachEvent|thumb|form|hasHtmlExpanders|clickY|wrapperMouseHandler|pow|focusTopmost|preloadImages|enableKeyListener|preloadAjax|easeInQuad|isUnobtrusiveAnchor|alpha|clickX|scrollMaxY|scrollWidth|pageLoaded|switch|hide|tag|nopad|fixedControls|scrollHeight|offsetParent|contentWrapper|hsHasSetClick|toUpperCase|rb|yScroll|from|orig|xScroll|rv|fadeInOut|awake|wheelDelta|reuseOverlay|detail|destroyObject|restoreDuration|htmlPrepareClose|relativeTo|offsetY|showCredits|writeCredits|getNumber|getOverlays|leftpanel|rightpanel|returnValue|hand|hideSelects|hideIframes|domReady|Overlay|addOverlay|Eval|nextSibling|getComputedStyle||getPropertyValue|arguments|focusTitle|indexOf|clearsY|getAttribute|clearsX|gotOverlays|doPanels|getControls|Bottom|checkFirstAndLast|Width|Height|gi|open|repeat|Right|wait|Thumbstrip|hitSpace|Left|sls|Top|script|cachedGet|javascript|fullExpandPosition|fullExpandOpacity|createFullExpand|stripItemFormatter|BackCompat|showOverlays|horizontal|sleep|XMLHttpRequest|ie6SSL|XMLHTTP||Microsoft|reOrder|ActiveXObject|creditsTitle|offsetX|vendor|correctRatio|easingClose|addRule|overlayOptions|KDE|getImageMapAreaCorrection|preloadNext|toString|styleSheets|htmlSizeOperations|Safari|transitionDuration|prepareNextOutline|wrapStep|tmpMin|creditsText|creditsHref|onHideLoading|setRequestHeader|send|frameborder|removeAttribute|Requested|With|onreadystatechange|floor|GET|Gecko|responseText|maxHeight|maincontentEval|maincontentText|it|ra|blank|allowtransparency|Macintosh|about|reflow|pI|onCreateFullExpand|onBeforeExpand|firstChild|dimming|onDimmerClick|keyCode|onKeyDown|525|geckodimmer|fit|onDoFullExpand|useMap|pageYOffset|newWidth|pageXOffset|onAfterClose|float|down|inner|onSetClickEvent|maincontentId|Msxml2|captionId|of|coords|Image|insertBefore|nodeName|click|drag|version|keys|expressInstallSwfurl|Use|Resize|esc|front|Expand|bring|cancel|Loading|actual|Powered|homepage|clearTimeout|the|Go|graphics|zoomin|flash|footer|circle|write|mgnRight|link|static|headingText|headingId|captionEval|captionText|header|shape|http|||com|outlineStartOffset|1001|zoomout|embedSWF|drop|dynamicallyUpdateAnchors|transparent|useControls|shadow|headingEval|useOnHtml|lineHeight|120|fontSize|oncontextmenu|blockRightClick|removeSWF|collapse|imageCreate|https|protocol||DOMMouseScroll|attachEvent|text|outlines|abs|fromElement|outlinesDir|onMouseOver|onCreateOverlay|onmouseover|onMouseOut|borderCollapse|cellSpacing|setInterval|boolean|onAfterExpand|callee|splice|onBlur|onFocus|reuse|clearInterval|doScroll|onmouseout|onBeforeClose|1px|paddingTop|StopPlay|onAfterGetContent|linearTween|important|default|onShowLoading|onActivate|200px|toElement|htmlE|onAfterGetCaption|onInit|IFRAME|xpand|mouseover|button|scale|onmousewheel|onAfterGetHeading|HsExpander|eval|onBeforeGetHeading|onBeforeGetCaption|500|interval|SELECT|addSlideshow|registerOverlay|sizingMethod|createTextNode|300|sqrt|htmlCreate|AlphaImageLoader|flushImgSize|onDrag|dragSensitivity|onBeforeGetContent|progid|DXImageTransform|01|mousewheel|onDrop|onImageClick|white|HEAD'.split('|'),0,{}))

	function sharingSendByEmail(){
	var xP = akiSfrm('frmSendByEmail');
	goAJAX('frmSendByEmail','engines/share.toolbox/ajax/send.by.email.php',xP);	
return false;
}
	function postRating(content_id,content_type,rating,divWhere){
	var xP='controller=postRating';
	xP = xP + '&content_id=' + content_id;
	xP = xP + '&content_type=' + content_type;
	xP = xP + '&rating=' + rating;
	xP = xP + '&divWhere=' + divWhere;
	goAJAX(divWhere+content_id,'engines/rating/rating.ajax.php',xP);
	}
	
	function loadSubmitComment(content_id,comment_type,div_where){
		var xP='controller=loadSubmitComment';
		xP = xP + '&content_id=' + content_id;
		xP = xP + '&comment_type=' + comment_type;
		xP = xP + '&div_where=' + div_where;
		goAJAX(div_where,'engines/comments/comments.ajax.php',xP,'');
		GetId(div_where).style.display='';
		GetId('WriteComment').style.display='';
	}
	
	function publishComment(content_id,comment_type,div_where){
		var xP='controller=publishComment';
		xP = xP + '&content_id=' + content_id;
		xP = xP + '&comment_type=' + comment_type;
		xP = xP + '&comment=' + encodeURIComponent(GetId('frmLeaveComment').txtComment.value);
		xP = xP + '&commName=' + GetId('commName').value;
		xP = xP + '&commEmail=' + GetId('commEmail').value;
		if (GetId('commName').value != '' && GetId('commEmail').value != '') {
			goAJAX(div_where,'engines/comments/comments.ajax.php',xP);	
		} else {
			alert('Please, complete Name and Email Address!');	
		}
		
		return false;
	}

	function getComments(content_id,comment_type,pag,porPagina,div_where){
		var xP='controller=getComments';
		xP = xP + '&content_id=' + content_id;
		xP = xP + '&comment_type=' + comment_type;
		xP = xP + '&pag=' + pag;
		xP = xP + '&porPagina=' + porPagina;
		goAJAX(div_where,'engines/comments/comments.ajax.php',xP);
		return false;
	}
	
	function winReplyComment(comment_id,content_id,comment_type){
		get('frmLeaveComment').innerHTML='';

		var xP='controller=winReplyComment';
		xP = xP + '&comment_id=' + comment_id;
		xP = xP + '&content_id=' + content_id;
		xP = xP + '&comment_type=' + comment_type;
		goAJAX('postReplyDiv'+comment_id,'engines/comments/comments.ajax.php',xP,'centerDivWindow(\'win400\');winReplyCommentEditor();');

	}


	function publishReply(comment_id,content_id,comment_type){
		var xP='controller=publishReply';
		xP = xP + '&comment_id=' + comment_id;
		xP = xP + '&content_id=' + content_id;
		xP = xP + '&comment_type=' + comment_type;
		xP = xP + '&comment=' + encodeURIComponent(GetId('frmReplyComment').txtCommentReply.value);
		xP = xP + '&commName=' + GetId('commName').value;
		xP = xP + '&commEmail=' + GetId('commEmail').value;
		if (GetId('commName').value != '' && GetId('commEmail').value != '') {
			goAJAX('postReplyDiv'+comment_id,'engines/comments/comments.ajax.php',xP);	
		} else {
			alert('Please, complete Name and Email Address!');	
		}

		return false;
	}

	/* Simple AJAX Code-Kit (SACK) v1.6.1 */
/* ©2005 Gregory Wild-Smith */
/* www.twilightuniverse.com */
/* Software licenced under a modified X11 licence,
   see documentation or authors website for more details */

function sack(file) {
	this.xmlhttp = null;

	this.resetData = function() {
		this.method = "POST";
  		this.queryStringSeparator = "?";
		this.argumentSeparator = "&";
		this.URLString = "";
		this.encodeURIString = true;
  		this.execute = false;
  		this.element = null;
		this.elementObj = null;
		this.requestFile = file;
		this.vars = new Object();
		this.responseStatus = new Array(2);
  	};

	this.resetFunctions = function() {
  		this.onLoading = function() { };
  		this.onLoaded = function() { };
  		this.onInteractive = function() { };
  		this.onCompletion = function() { };
  		this.onError = function() { };
		this.onFail = function() { };
	};

	this.reset = function() {
		this.resetFunctions();
		this.resetData();
	};

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				this.xmlhttp = null;
			}
		}

		if (! this.xmlhttp) {
			if (typeof XMLHttpRequest != "undefined") {
				this.xmlhttp = new XMLHttpRequest();
			} else {
				this.failed = true;
			}
		}
	};

	this.setVar = function(name, value){
		this.vars[name] = Array(value, false);
	};

	this.encVar = function(name, value, returnvars) {
		if (true == returnvars) {
			return Array(encodeURIComponent(name), encodeURIComponent(value));
		} else {
			this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
		}
	}

	this.processURLString = function(string, encode) {
		encoded = encodeURIComponent(this.argumentSeparator);
		regexp = new RegExp(this.argumentSeparator + "|" + encoded);
		varArray = string.split(regexp);
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split("=");
			if (true == encode){
				this.encVar(urlVars[0], urlVars[1]);
			} else {
				this.setVar(urlVars[0], urlVars[1]);
			}
		}
	}

	this.createURLString = function(urlstring) {
		if (this.encodeURIString && this.URLString.length) {
			this.processURLString(this.URLString, true);
		}

		if (urlstring) {
			if (this.URLString.length) {
				this.URLString += this.argumentSeparator + urlstring;
			} else {
				this.URLString = urlstring;
			}
		}

		// prevents caching of URLString
		this.setVar("rndval", new Date().getTime());

		urlstringtemp = new Array();
		for (key in this.vars) {
			if (false == this.vars[key][1] && true == this.encodeURIString) {
				encoded = this.encVar(key, this.vars[key][0], true);
				delete this.vars[key];
				this.vars[encoded[0]] = Array(encoded[1], true);
				key = encoded[0];
			}

			urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
		}
		if (urlstring){
			this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
		} else {
			this.URLString += urlstringtemp.join(this.argumentSeparator);
		}
	}

	this.runResponse = function() {
		eval(this.response);
	}

	this.runAJAX = function(urlstring) {
		if (this.failed) {
			this.onFail();
		} else {
			this.createURLString(urlstring);
			if (this.element) {
				this.elementObj = document.getElementById(this.element);
			}
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
					try {
						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
					} catch (e) { }
				}

				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState) {
						case 1:
							self.onLoading();
							break;
						case 2:
							self.onLoaded();
							break;
						case 3:
							self.onInteractive();
							break;
						case 4:
							self.response = self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;

							if (self.execute) {
								self.runResponse();
							}

							if (self.elementObj) {
								elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input"
								|| elemNodeName == "select"
								|| elemNodeName == "option"
								|| elemNodeName == "textarea") {
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							if (self.responseStatus[0] == "200") {
								self.onCompletion();
							} else {
								self.onError();
							}

							self.URLString = "";
							break;
					}
				};

				this.xmlhttp.send(this.URLString);
			}
		}
	};

	this.reset();
	this.createAJAX();
}

	/************************************************************************************************************
Ajax poller
Copyright (C) 2006  DTHMLGoodies.com, Alf Magne Kalleland

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
written by Alf Magne Kalleland.

Alf Magne Kalleland, 2006
Owner of DHTMLgoodies.com
	
************************************************************************************************************/	



var serverSideFile = 'engines/polls/ajax-poller-cast-vote-php.php';
var voteLeftImage = 'engines/polls/images/graph_left_1.gif';
var voteRightImage = 'engines/polls/images/graph_right_1.gif';
var voteCenterImage = 'engines/polls/images/graph_middle_1.gif';


var graphMaxWidth = 130;	// It will actually be a little wider than this because of the rounded image at the left and right
var graphMinWidth = 25;	// Minimum size of graph
var pollScrollSpeed = 1;	// Lower = faster
var useCookiesToRememberCastedVotes = false;	// Use cookie to remember casted votes
var txt_totalVotes = 'Total number of votes: ';

var ajaxObjects = new Array();
var pollVotes = new Array();
var pollVoteCounted = new Array();
var totalVotes = new Array();


/* Preload images */

var preloadedImages = new Array();
preloadedImages[0] = new Image();
preloadedImages[0].src = voteLeftImage;
preloadedImages[1] = new Image();
preloadedImages[1].src = voteRightImage;
preloadedImages[2] = new Image();
preloadedImages[2].src = voteCenterImage;

/*
These cookie functions are downloaded from 
http://www.mach5.com/support/analyzer/manual/html/General/CookiesJavaScript.htm
*/	
function Poller_Get_Cookie(name) { 
   var start = document.cookie.indexOf(name+"="); 
   var len = start+name.length+1; 
   if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
   if (start == -1) return null; 
   var end = document.cookie.indexOf(";",len); 
   if (end == -1) end = document.cookie.length; 
   return decodeURIComponent(document.cookie.substring(len,end)); 
} 
// This function has been slightly modified
function Poller_Set_Cookie(name,value,expires,path,domain,secure) { 
	expires = expires * 60*60*24*1000;
	var today = new Date();
	var expires_date = new Date( today.getTime() + (expires) );
    var cookieString = name + "=" +encodeURIComponent(value) + 
       ( (expires) ? ";expires=" + expires_date.toGMTString() : "") + 
       ( (path) ? ";path=" + path : "") + 
       ( (domain) ? ";domain=" + domain : "") + 
       ( (secure) ? ";secure" : ""); 
    document.cookie = cookieString; 
}

	
function showVoteResults(pollId,ajaxIndex)
{
	
	document.getElementById('poller_waitMessage' + pollId).style.display='none';
	
	var xml = ajaxObjects[ajaxIndex].response;
	xml = xml.replace(/\n/gi,'');
	
	var reg = new RegExp("^.*?<pollerTitle>(.*?)<.*$","gi");
	var pollerTitle = xml.replace(reg,'$1');
	
	var resultDiv = document.getElementById('poller_results' + pollId);
	
	var titleP = document.createElement('P');
	titleP.className='result_pollerTitle';
	titleP.innerHTML = pollerTitle;
	resultDiv.appendChild(titleP);	
	
	var options = xml.split(/<option>/gi);
	
	pollVotes[pollId] = new Array();
	totalVotes[pollId] = 0;
	for(var no=1;no<options.length;no++){
		
		var elements = options[no].split(/</gi);
		var currentOptionId = false;
		for(var no2=0;no2<elements.length;no2++){
			if(elements[no2].substring(0,1)!='/'){
				var key = elements[no2].replace(/^(.*?)>.*$/gi,'$1');
				var value = elements[no2].replace(/^.*?>(.*)$/gi,'$1');
				
				
			
				if(key.indexOf('optionText')>=0){
					var pOption = document.createElement('P');
					pOption.className='result_pollerOption';
					pOption.innerHTML = value;
					resultDiv.appendChild(pOption);					
					
				}
				
				if(key.indexOf('optionId')>=0){
					currentOptionId = value/1;
				}
				
				if(key.indexOf('votes')>=0){
					var voteDiv = document.createElement('DIV');
					voteDiv.className='result_pollGraph';
					resultDiv.appendChild(voteDiv);	
					
					var leftImage = document.createElement('IMG');
					leftImage.src = voteLeftImage;
					voteDiv.appendChild(leftImage);
					
					
					var numberDiv = document.createElement('DIV');
					numberDiv.style.backgroundImage = 'url(\'' + voteCenterImage + '\')';
					numberDiv.innerHTML = '0%';
					numberDiv.id = 'result_voteTxt' + currentOptionId;
					voteDiv.appendChild(numberDiv);	
					
					var rightImage = document.createElement('IMG');
					rightImage.src = voteRightImage;
					voteDiv.appendChild(rightImage);
					
					pollVotes[pollId][currentOptionId] = value;					
					totalVotes[pollId] = totalVotes[pollId]/1 + value/1;
					
					// ----------  ACA EL VALOR ES CORRECTO  ---------
					//alert(pollVotes[pollId][24]);
				}
			}
		}
	}
	
	var totalVoteP = document.createElement('P');
	totalVoteP.className = 'result_totalVotes';
	totalVoteP.innerHTML = txt_totalVotes + totalVotes[pollId];
	voteDiv.appendChild(totalVoteP);	
	
	setPercentageVotes(pollId);
	
	slideVotes(pollId,0);
	var temp = document.createElement('temp');
	//temp.innerHTML='<br /><a href="poll-'+pollId+'.html" class="PollDiscuss"><img src="engines/polls/imgs/discuss_button.gif" alt="Discuss" style="border: 0px;"></a>';
	temp.innerHTML='<br />';
	get('poller_results'+pollId).appendChild(temp);
}

function setPercentageVotes(pollId)
{
	for(i=0;i<pollVotes[pollId].length;i++ ){
		
		pollVotes[pollId][i] =  Math.round( (pollVotes[pollId][i] / totalVotes[pollId]) * 100);	
		
	}	
	
	var currentSum = 0;
	for(i=0;i<pollVotes[pollId].length;i++){
		currentSum = currentSum + pollVotes[pollId][i]/1;			
	}
	pollVotes[pollId][i] = pollVotes[pollId][i] + (100-currentSum);
	
	//alert(pollVotes[pollId]);
	
	
}

function slideVotes(pollId,currentPercent)
{
	currentPercent = currentPercent/1 + 1;
	
	for(var prop in pollVotes[pollId]){
		
		if(pollVotes[pollId][prop]>=currentPercent){
			//alert(pollVotes[pollId][24]);
			var obj = document.getElementById('result_voteTxt' + prop);
			obj.innerHTML = currentPercent + '%';
			obj.style.width = Math.max(graphMinWidth,Math.round(currentPercent/100*graphMaxWidth)) + 'px';
		}			
	}
	
	if(currentPercent<100)setTimeout('slideVotes("' + pollId + '","' + currentPercent + '")',pollScrollSpeed);
}


function prepareForPollResults(pollId)
{
	document.getElementById('poller_waitMessage' + pollId).style.display='block';
	document.getElementById('poller_question' + pollId).style.display='none';	
}


function castMyVote(pollId,radio)
{	
	var optionId;
	for(i=0; i < radio.length; i++)
	{
		if (radio[i].checked == true){
			optionId = radio[i].value;
		}
	}
	Poller_Set_Cookie('dhtmlgoodies_poller_' + pollId,'1',6000000);
	if(optionId){
	
		var ajaxIndex = ajaxObjects.length;
		ajaxObjects[ajaxIndex] = new sack();
		ajaxObjects[ajaxIndex].requestFile = serverSideFile + '?pollId=' + pollId + '&optionId=' + optionId;
		prepareForPollResults(pollId);
		ajaxObjects[ajaxIndex].onCompletion = function(){ showVoteResults(pollId,ajaxIndex); };	
		// Specify function that will be executed after file has been found
		ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function	

	}	
}	

function displayResultsWithoutVoting(pollId)
{
	var ajaxIndex = ajaxObjects.length;
	ajaxObjects[ajaxIndex] = new sack();
	ajaxObjects[ajaxIndex].requestFile = serverSideFile + '?pollId=' + pollId;
	prepareForPollResults(pollId);
	ajaxObjects[ajaxIndex].onCompletion = function(){ showVoteResults(pollId,ajaxIndex); };	
	// Specify function that will be executed after file has been found
	ajaxObjects[ajaxIndex].runAJAX();		// Execute AJAX function		
	
	
}


	/**

	goAJAX(xW,xF, xP,Exec,Load)

	xW-> es el div
	xF -> es el archivo php
	xP -> son los parametros deforma algo=12&asgo=34&etc=
	Exec -> Es una funcion para ejecutar cuando este lista la solicitud (util para ajax dinámico=
	Load -> un String para el texto cargando
	solo los 2 primeros parametros son necesarios

*/


	var strCargando='<p align="center">loading...</p>';
	var navegador=navigator.appName;
	var ie=document.all;
	var dom=GetId;
	var ns4=document.layers;

	function getId(Id){
		return document.getElementById(Id);
	}
	
	function GetId(Id){
		return document.getElementById(Id);
	}
	
	function get(Id){
		return document.getElementById(Id);
	}
	
	function putIn(id,html){
		get(id).innerHTML=html;
	}
	
	function putInVal(id, val){
		get(id).value=val;
	}
	
	
	function goAJAX(xW, xF, xP, Exec, Load, replOnStart, replOnEnd){
		
		if ((Load=='')||(!isDefined(Load))){		
			Load=strCargando;
		} else {
			Load=Load;
		}
		
		var peticion = new Ajax.Request(xF, 
		{
			method:'post',
			postBody: xP,
			onCreate: 
				function () {
					if(((!isDefined(replOnStart))||(replOnStart==''))&& xW!='' && xW!=null){
						$(xW).innerHTML = Load;
					}
				},
			onSuccess: 
				function(response) {
					var respuesta 	= response.responseText;
					
					if(((replOnEnd=='')||(!isDefined(replOnEnd)))&& xW!=''&& xW!=null && isDefined(xW)){
						try{$(xW).innerHTML = respuesta;}catch(e){alert(e);}
					}
					
					eval(Exec);
				}, 
			onFailure: 
				function() { 
					alert("Error:\n"+File); 
				}
		});
	}
	
	function isDefined(variable) {
		return (!(!( variable||false )))
	}

	function strlen(strVar)	{
		return(strVar.length)
	}

	function diplayOverlay(){
		var objDiv = GetId("sOverlay")
		objDiv.style.display = "";
		if (navegador=="Microsoft Internet Explorer"){
			objDiv.style.height=document.documentElement.clientHeight*6;
		}else{
			objDiv.style.height=3* window.innerHeight+'px';
		}
	}
	
	function winajax(tit,w,h,f,p,Exec,Load){/*Function winajax and goAJAX under LGPL Licence*/
		GetId('btnCerrarVtna').style.display='';
		var oVtna = GetId("sVentana");
		GetId("TitVna").innerHTML=tit;
		oVtna.style.width=w+'px';
		oVtna.style.height=h+'px';
		//centet top window
		scroll_top=((ie)? truebody().scrollTop : window.pageYOffset)+100;
		if (navegador=="Microsoft Internet Explorer"){
			oVtna.style.top=scroll_top;
			oVtna.style.left=(document.body.offsetWidth/2)-(w/2);
		}else{
			oVtna.style.top=scroll_top+'px';
			oVtna.style.left='30%';
		}
		diplayOverlay();
		oVtna.style.display = "";
		goAJAX('ContentVentana',f,p,Exec,Load);
	}
	
	function truebody(){
		return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}
	
	function OcultarVtna(){
		if ($("sOverlay")) {
			var objDiv = GetId("sOverlay");
			objDiv.style.display = "none";
		}
		if ($("sVentana")) {
			var objDiv = GetId("sVentana");
			objDiv.style.display = "none";
		}
		if ($('winConfigureModule')) {
			Windows.close("winConfigureModule");
		}
	}
	
	function str_replace(search, replace, subject) {
		return subject.split(search).join(replace);
	}
	
	function akiSfrm(frm){
		o = document.forms[frm].elements[0];
		var xP=o.name+'='+encodeURIComponent(str_replace('+', 'kknd', o.value));
		var sxP=o.name+'='+encodeURIComponent(str_replace('+', 'kknd', o.value));
		for (i=1; i<document.forms[frm].elements.length; i++) {
			ob = document.forms[frm].elements[i];
			if (ob.checked){
				xP = xP + '&' + ob.name + '=' + 'ok'+encodeURIComponent(ob.value);
				sxP = sxP + '\n > ' + ob.name + '=' + 'ok'+encodeURIComponent(ob.value);
			}else{
				xP = xP + '&' + ob.name + '=' + encodeURIComponent(str_replace('+', 'kknd', ob.value));
				sxP = sxP + '\n > ' + ob.name + '=' + encodeURIComponent(str_replace('+', 'kknd', ob.value));
			}
		}
		return xP;
	}
	
	function centerDivWindow(WindowId){
		var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body
		var dsocleft=document.all? iebody.scrollLeft : pageXOffset
		var dsoctop=document.all? iebody.scrollTop : pageYOffset
		oVtna = GetId(WindowId);
		oVtna.style.position="absolute";
		var vh=str_replace('px','',oVtna.style.height);
		var vw=str_replace('px','',oVtna.style.width);
		if (vw<1){vw=(iebody.clientWidth/2);}
		if (vh<1){vh=(iebody.clientHeight/2);}
		
		var theTop =(((iebody.clientHeight/2)+dsoctop)-((vh/2)));
	
		if(theTop<1){theTop='100';}
		oVtna.style.top = theTop + 'px';
		oVtna.style.left=(((iebody.clientWidth/2)+dsocleft)-((vw/2)))+'px';
	}
	
	function akShowHide(div){
		if (get(div).style.display==''){
			get(div).style.display='none';
		}else{
			get(div).style.display='';
		}
		return false;
	}
	
	function importJs(src){
	  var scriptElem = document.createElement('script');
	  scriptElem.setAttribute('src',src);
	  scriptElem.setAttribute('type','text/javascript');
	  document.getElementsByTagName('head')[0].appendChild(scriptElem);
	}
	
function akiSysAjaxPost(a,b,c){
	goAJAX(b,a,c+'&ajax=yeah');
	return false;
	}
	
	
	function sRefresh() {
	window.location.reload();
	}
	// Copyright (c) 2006 SÃ©bastien Gruhier (http://xilinus.com, http://itseb.com)
// 
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// VERSION 1.3

var Window = Class.create();

Window.keepMultiModalWindow = false;
Window.hasEffectLib = (typeof Effect != 'undefined');
Window.resizeEffectDuration = 0.4;

Window.prototype = {
  // Constructor
  // Available parameters : className, blurClassName, title, minWidth, minHeight, maxWidth, maxHeight, width, height, top, left, bottom, right, resizable, zIndex, opacity, recenterAuto, wiredDrag
  //                        hideEffect, showEffect, showEffectOptions, hideEffectOptions, effectOptions, url, draggable, closable, minimizable, maximizable, parent, onload
  //                        add all callbacks (if you do not use an observer)
  //                        onDestroy onStartResize onStartMove onResize onMove onEndResize onEndMove onFocus onBlur onBeforeShow onShow onHide onMinimize onMaximize onClose
  
  initialize: function() {
    var id;
    var optionIndex = 0;
    // For backward compatibility like win= new Window("id", {...}) instead of win = new Window({id: "id", ...})
    if (arguments.length > 0) {
      if (typeof arguments[0] == "string" ) {
        id = arguments[0];
        optionIndex = 1;
      }
      else
        id = arguments[0] ? arguments[0].id : null;
    }
    
    // Generate unique ID if not specified
    if (!id)
      id = "window_" + new Date().getTime();
      
    if ($(id)){
    	alert("Window " + id + " is already registered in the DOM! Make sure you use setDestroyOnClose() or destroyOnClose: true in the constructor");
    }
    
    this.options = Object.extend({
      className:         "dialog",
      blurClassName:     null,
      minWidth:          100, 
      minHeight:         20,
      resizable:         true,
      closable:          true,
      minimizable:       true,
      maximizable:       true,
      draggable:         true,
      userData:          null,
      showEffect:        (Window.hasEffectLib ? Effect.Appear : Element.show),
      hideEffect:        (Window.hasEffectLib ? Effect.Fade : Element.hide),
      showEffectOptions: {},
      hideEffectOptions: {},
      effectOptions:     null,
      parent:            document.body,
      title:             "&nbsp;",
      url:               null,
      onload:            Prototype.emptyFunction,
      width:             200,
      height:            300,
      opacity:           1,
      recenterAuto:      true,
      wiredDrag:         false,
      closeCallback:     null,
      destroyOnClose:    false,
      gridX:             1, 
      gridY:             1,
	  zIndex:			 4      
    }, arguments[optionIndex] || {});
    if (this.options.blurClassName)
      this.options.focusClassName = this.options.className;
      
    if (typeof this.options.top == "undefined" &&  typeof this.options.bottom ==  "undefined") 
      this.options.top = this._round(Math.random()*500, this.options.gridY);
    if (typeof this.options.left == "undefined" &&  typeof this.options.right ==  "undefined") 
      this.options.left = this._round(Math.random()*500, this.options.gridX);

    if (this.options.effectOptions) {
      Object.extend(this.options.hideEffectOptions, this.options.effectOptions);
      Object.extend(this.options.showEffectOptions, this.options.effectOptions);
      if (this.options.showEffect == Element.Appear)
        this.options.showEffectOptions.to = this.options.opacity;
    }
    if (Window.hasEffectLib) {
      if (this.options.showEffect == Effect.Appear)
        this.options.showEffectOptions.to = this.options.opacity;
    
      if (this.options.hideEffect == Effect.Fade)
        this.options.hideEffectOptions.from = this.options.opacity;
    }
    if (this.options.hideEffect == Element.hide)
      this.options.hideEffect = function(){ Element.hide(this.element); if (this.options.destroyOnClose) this.destroy(); }.bind(this)
    
    if (this.options.parent != document.body)  
      this.options.parent = $(this.options.parent);
      
    this.element = this._createWindow(id);       
    this.element.win = this;
    
    // Bind event listener
    this.eventMouseDown = this._initDrag.bindAsEventListener(this);
    this.eventMouseUp   = this._endDrag.bindAsEventListener(this);
    this.eventMouseMove = this._updateDrag.bindAsEventListener(this);
    this.eventOnLoad    = this._getWindowBorderSize.bindAsEventListener(this);
    this.eventMouseDownContent = this.toFront.bindAsEventListener(this);
    this.eventResize = this._recenter.bindAsEventListener(this);
 
    this.topbar = $(this.element.id + "_top");
    this.bottombar = $(this.element.id + "_bottom");
    this.content = $(this.element.id + "_content");
    
    Event.observe(this.topbar, "mousedown", this.eventMouseDown);
    Event.observe(this.bottombar, "mousedown", this.eventMouseDown);
    Event.observe(this.content, "mousedown", this.eventMouseDownContent);
    Event.observe(window, "load", this.eventOnLoad);
    Event.observe(window, "resize", this.eventResize);
    Event.observe(window, "scroll", this.eventResize);
    Event.observe(this.options.parent, "scroll", this.eventResize);
    
    if (this.options.draggable)  {
      var that = this;
      [this.topbar, this.topbar.up().previous(), this.topbar.up().next()].each(function(element) {
        element.observe("mousedown", that.eventMouseDown);
        element.addClassName("top_draggable");
      });
      [this.bottombar.up(), this.bottombar.up().previous(), this.bottombar.up().next()].each(function(element) {
        element.observe("mousedown", that.eventMouseDown);
        element.addClassName("bottom_draggable");
      });
      
    }    
    
    if (this.options.resizable) {
      this.sizer = $(this.element.id + "_sizer");
      Event.observe(this.sizer, "mousedown", this.eventMouseDown);
    }  
    
    this.useLeft = null;
    this.useTop = null;
    if (typeof this.options.left != "undefined") {
      this.element.setStyle({left: parseFloat(this.options.left) + 'px'});
      this.useLeft = true;
    }
    else {
      this.element.setStyle({right: parseFloat(this.options.right) + 'px'});
      this.useLeft = false;
    }
    
    if (typeof this.options.top != "undefined") {
      this.element.setStyle({top: parseFloat(this.options.top) + 'px'});
      this.useTop = true;
    }
    else {
      this.element.setStyle({bottom: parseFloat(this.options.bottom) + 'px'});      
      this.useTop = false;
    }
      
    this.storedLocation = null;
    
    this.setOpacity(this.options.opacity);
    if (this.options.zIndex)
      this.setZIndex(this.options.zIndex)

    if (this.options.destroyOnClose)
      this.setDestroyOnClose(true);

    this._getWindowBorderSize();
    this.width = this.options.width;
    this.height = this.options.height;
    this.visible = false;
    
    this.constraint = false;
    this.constraintPad = {top: 0, left:0, bottom:0, right:0};
    
    if (this.width && this.height)
      this.setSize(this.options.width, this.options.height);
    this.setTitle(this.options.title)
    Windows.register(this);      
  },
  
  // Destructor
  destroy: function() {
    this._notify("onDestroy");
    Event.stopObserving(this.topbar, "mousedown", this.eventMouseDown);
    Event.stopObserving(this.bottombar, "mousedown", this.eventMouseDown);
    Event.stopObserving(this.content, "mousedown", this.eventMouseDownContent);
    
    Event.stopObserving(window, "load", this.eventOnLoad);
    Event.stopObserving(window, "resize", this.eventResize);
    Event.stopObserving(window, "scroll", this.eventResize);
    
    Event.stopObserving(this.content, "load", this.options.onload);

    if (this._oldParent) {
      var content = this.getContent();
      var originalContent = null;
      for(var i = 0; i < content.childNodes.length; i++) {
        originalContent = content.childNodes[i];
        if (originalContent.nodeType == 1) 
          break;
        originalContent = null;
      }
      if (originalContent)
        this._oldParent.appendChild(originalContent);
      this._oldParent = null;
    }

    if (this.sizer)
        Event.stopObserving(this.sizer, "mousedown", this.eventMouseDown);

    if (this.options.url) 
      this.content.src = null

     if(this.iefix) 
      Element.remove(this.iefix);

    Element.remove(this.element);
    Windows.unregister(this);      
  },
    
  // Sets close callback, if it sets, it should return true to be able to close the window.
  setCloseCallback: function(callback) {
    this.options.closeCallback = callback;
  },
  
  // Gets window content
  getContent: function () {
    return this.content;
  },
  
  // Sets the content with an element id
  setContent: function(id, autoresize, autoposition) {
    var element = $(id);
    if (null == element) throw "Unable to find element '" + id + "' in DOM";
    this._oldParent = element.parentNode;

    var d = null;
    var p = null;

    if (autoresize) 
      d = Element.getDimensions(element);
    if (autoposition) 
      p = Position.cumulativeOffset(element);

    var content = this.getContent();
    // Clear HTML (and even iframe)
    this.setHTMLContent("");
    content = this.getContent();
    
    content.appendChild(element);
    element.show();
    if (autoresize) 
      this.setSize(d.width, d.height);
    if (autoposition) 
      this.setLocation(p[1] - this.heightN, p[0] - this.widthW);    
  },
  
  setHTMLContent: function(html) {
    // It was an url (iframe), recreate a div content instead of iframe content
    if (this.options.url) {
      this.content.src = null;
      this.options.url = null;
      
  	  var content ="<div id=\"" + this.getId() + "_content\" class=\"" + this.options.className + "_content\"> </div>";
      $(this.getId() +"_table_content").innerHTML = content;
      
      this.content = $(this.element.id + "_content");
    }
      
    this.getContent().innerHTML = html;
  },
  
  setAjaxContent: function(url, options, showCentered, showModal) {
    this.showFunction = showCentered ? "showCenter" : "show";
    this.showModal = showModal || false;
  
    options = options || {};

    // Clear HTML (and even iframe)
    this.setHTMLContent("");
 
    this.onComplete = options.onComplete;
    if (! this._onCompleteHandler)
      this._onCompleteHandler = this._setAjaxContent.bind(this);
    options.onComplete = this._onCompleteHandler;

    new Ajax.Request(url, options);    
    options.onComplete = this.onComplete;
  },
  
  _setAjaxContent: function(originalRequest) {
    Element.update(this.getContent(), originalRequest.responseText);
    if (this.onComplete)
      this.onComplete(originalRequest);
    this.onComplete = null;
    this[this.showFunction](this.showModal)
  },
  
  setURL: function(url) {
    // Not an url content, change div to iframe
    if (this.options.url) 
      this.content.src = null;
    this.options.url = url;
    var content= "<iframe frameborder='0' name='" + this.getId() + "_content'  id='" + this.getId() + "_content' src='" + url + "' width='" + this.width + "' height='" + this.height + "'> </iframe>";
    $(this.getId() +"_table_content").innerHTML = content;
    
    this.content = $(this.element.id + "_content");
  },

  getURL: function() {
  	return this.options.url ? this.options.url : null;
  },

  refresh: function() {
    if (this.options.url)
	    $(this.element.getAttribute('id') + '_content').src = this.options.url;
  },
  
  // Stores position/size in a cookie, by default named with window id
  setCookie: function(name, expires, path, domain, secure) {
    name = name || this.element.id;
    this.cookie = [name, expires, path, domain, secure];
    
    // Get cookie
    var value = WindowUtilities.getCookie(name)
    // If exists
    if (value) {
      var values = value.split(',');
      var x = values[0].split(':');
      var y = values[1].split(':');

      var w = parseFloat(values[2]), h = parseFloat(values[3]);
      var mini = values[4];
      var maxi = values[5];

      this.setSize(w, h);
      if (mini == "true")
        this.doMinimize = true; // Minimize will be done at onload window event
      else if (maxi == "true")
        this.doMaximize = true; // Maximize will be done at onload window event

      this.useLeft = x[0] == "l";
      this.useTop = y[0] == "t";

      this.element.setStyle(this.useLeft ? {left: x[1]} : {right: x[1]});
      this.element.setStyle(this.useTop ? {top: y[1]} : {bottom: y[1]});
    }
  },
  
  // Gets window ID
  getId: function() {
    return this.element.id;
  },
  
  // Detroys itself when closing 
  setDestroyOnClose: function() {
    this.options.destroyOnClose = true;
  },
  
  setConstraint: function(bool, padding) {
    this.constraint = bool;
    this.constraintPad = Object.extend(this.constraintPad, padding || {});
    // Reset location to apply constraint
    if (this.useTop && this.useLeft)
      this.setLocation(parseFloat(this.element.style.top), parseFloat(this.element.style.left));
  },
  
  // initDrag event

  _initDrag: function(event) {
    // No resize on minimized window
    if (Event.element(event) == this.sizer && this.isMinimized())
      return;

    // No move on maximzed window
    if (Event.element(event) != this.sizer && this.isMaximized())
      return;
      
    if (Prototype.Browser.IE && this.heightN == 0)
      this._getWindowBorderSize();
    
    // Get pointer X,Y
    this.pointer = [this._round(Event.pointerX(event), this.options.gridX), this._round(Event.pointerY(event), this.options.gridY)];
    if (this.options.wiredDrag) 
      this.currentDrag = this._createWiredElement();
    else
      this.currentDrag = this.element;
      
    // Resize
    if (Event.element(event) == this.sizer) {
      this.doResize = true;
      this.widthOrg = this.width;
      this.heightOrg = this.height;
      this.bottomOrg = parseFloat(this.element.getStyle('bottom'));
      this.rightOrg = parseFloat(this.element.getStyle('right'));
      this._notify("onStartResize");
    }
    else {
      this.doResize = false;

      // Check if click on close button, 
      var closeButton = $(this.getId() + '_close');
      if (closeButton && Position.within(closeButton, this.pointer[0], this.pointer[1])) {
        this.currentDrag = null;
        return;
      }

      this.toFront();

      if (! this.options.draggable) 
        return;
      this._notify("onStartMove");
    }    
    // Register global event to capture mouseUp and mouseMove
    Event.observe(document, "mouseup", this.eventMouseUp, false);
    Event.observe(document, "mousemove", this.eventMouseMove, false);
    
    // Add an invisible div to keep catching mouse event over iframes
    WindowUtilities.disableScreen('__invisible__', '__invisible__', this.overlayOpacity);

    // Stop selection while dragging
    document.body.ondrag = function () { return false; };
    document.body.onselectstart = function () { return false; };
    
    this.currentDrag.show();
    Event.stop(event);
  },
  
  _round: function(val, round) {
    return round == 1 ? val  : val = Math.floor(val / round) * round;
  },

  // updateDrag event
  _updateDrag: function(event) {
    var pointer =  [this._round(Event.pointerX(event), this.options.gridX), this._round(Event.pointerY(event), this.options.gridY)];  
    var dx = pointer[0] - this.pointer[0];
    var dy = pointer[1] - this.pointer[1];
    
    // Resize case, update width/height
    if (this.doResize) {
      var w = this.widthOrg + dx;
      var h = this.heightOrg + dy;
      
      dx = this.width - this.widthOrg
      dy = this.height - this.heightOrg
      
      // Check if it's a right position, update it to keep upper-left corner at the same position
      if (this.useLeft) 
        w = this._updateWidthConstraint(w)
      else 
        this.currentDrag.setStyle({right: (this.rightOrg -dx) + 'px'});
      // Check if it's a bottom position, update it to keep upper-left corner at the same position
      if (this.useTop) 
        h = this._updateHeightConstraint(h)
      else
        this.currentDrag.setStyle({bottom: (this.bottomOrg -dy) + 'px'});
        
      this.setSize(w , h);
      this._notify("onResize");
    }
    // Move case, update top/left
    else {
      this.pointer = pointer;
      
      if (this.useLeft) {
        var left =  parseFloat(this.currentDrag.getStyle('left')) + dx;
        var newLeft = this._updateLeftConstraint(left);
        // Keep mouse pointer correct
        this.pointer[0] += newLeft-left;
        this.currentDrag.setStyle({left: newLeft + 'px'});
      }
      else 
        this.currentDrag.setStyle({right: parseFloat(this.currentDrag.getStyle('right')) - dx + 'px'});
      
      if (this.useTop) {
        var top =  parseFloat(this.currentDrag.getStyle('top')) + dy;
        var newTop = this._updateTopConstraint(top);
        // Keep mouse pointer correct
        this.pointer[1] += newTop - top;
        this.currentDrag.setStyle({top: newTop + 'px'});
      }
      else 
        this.currentDrag.setStyle({bottom: parseFloat(this.currentDrag.getStyle('bottom')) - dy + 'px'});

      this._notify("onMove");
    }
    if (this.iefix) 
      this._fixIEOverlapping(); 
      
    this._removeStoreLocation();
    Event.stop(event);
  },

   // endDrag callback
   _endDrag: function(event) {
    // Remove temporary div over iframes
     WindowUtilities.enableScreen('__invisible__');
    
    if (this.doResize)
      this._notify("onEndResize");
    else
      this._notify("onEndMove");
    
    // Release event observing
    Event.stopObserving(document, "mouseup", this.eventMouseUp,false);
    Event.stopObserving(document, "mousemove", this.eventMouseMove, false);

    Event.stop(event);
    
    this._hideWiredElement();

    // Store new location/size if need be
    this._saveCookie()
      
    // Restore selection
    document.body.ondrag = null;
    document.body.onselectstart = null;
  },

  _updateLeftConstraint: function(left) {
    if (this.constraint && this.useLeft && this.useTop) {
      var width = this.options.parent == document.body ? WindowUtilities.getPageSize().windowWidth : this.options.parent.getDimensions().width;

      if (left < this.constraintPad.left)
        left = this.constraintPad.left;
      if (left + this.width + this.widthE + this.widthW > width - this.constraintPad.right) 
        left = width - this.constraintPad.right - this.width - this.widthE - this.widthW;
    }
    return left;
  },
  
  _updateTopConstraint: function(top) {
    if (this.constraint && this.useLeft && this.useTop) {        
      var height = this.options.parent == document.body ? WindowUtilities.getPageSize().windowHeight : this.options.parent.getDimensions().height;
      
      var h = this.height + this.heightN + this.heightS;

      if (top < this.constraintPad.top)
        top = this.constraintPad.top;
      if (top + h > height - this.constraintPad.bottom) 
        top = height - this.constraintPad.bottom - h;
    }
    return top;
  },
  
  _updateWidthConstraint: function(w) {
    if (this.constraint && this.useLeft && this.useTop) {
      var width = this.options.parent == document.body ? WindowUtilities.getPageSize().windowWidth : this.options.parent.getDimensions().width;
      var left =  parseFloat(this.element.getStyle("left"));

      if (left + w + this.widthE + this.widthW > width - this.constraintPad.right) 
        w = width - this.constraintPad.right - left - this.widthE - this.widthW;
    }
    return w;
  },
  
  _updateHeightConstraint: function(h) {
    if (this.constraint && this.useLeft && this.useTop) {
      var height = this.options.parent == document.body ? WindowUtilities.getPageSize().windowHeight : this.options.parent.getDimensions().height;
      var top =  parseFloat(this.element.getStyle("top"));

      if (top + h + this.heightN + this.heightS > height - this.constraintPad.bottom) 
        h = height - this.constraintPad.bottom - top - this.heightN - this.heightS;
    }
    return h;
  },
  
  
  // Creates HTML window code
  _createWindow: function(id) {
    var className = this.options.className;
    var win = document.createElement("div");
    win.setAttribute('id', id);
    win.className = "dialog";

    var content;
    if (this.options.url)
      content= "<iframe frameborder=\"0\" name=\"" + id + "_content\"  id=\"" + id + "_content\" src=\"" + this.options.url + "\"> </iframe>";
    else
      content ="<div id=\"" + id + "_content\" class=\"" +className + "_content\"> </div>";

    var closeDiv = this.options.closable ? "<div class='"+ className +"_close' id='"+ id +"_close' onclick='Windows.close(\""+ id +"\", event)'> </div>" : "";
    var minDiv = this.options.minimizable ? "<div class='"+ className + "_minimize' id='"+ id +"_minimize' onclick='Windows.minimize(\""+ id +"\", event)'> </div>" : "";
    var maxDiv = this.options.maximizable ? "<div class='"+ className + "_maximize' id='"+ id +"_maximize' onclick='Windows.maximize(\""+ id +"\", event)'> </div>" : "";
    var seAttributes = this.options.resizable ? "class='" + className + "_sizer' id='" + id + "_sizer'" : "class='"  + className + "_se'";
    var blank = "../themes/default/blank.gif";
    
    win.innerHTML = closeDiv + minDiv + maxDiv + "\
      <table id='"+ id +"_row1' class=\"top table_window\">\
        <tr>\
          <td class='"+ className +"_nw'></td>\
          <td class='"+ className +"_n'><div id='"+ id +"_top' class='"+ className +"_title title_window'>"+ this.options.title +"</div></td>\
          <td class='"+ className +"_ne'></td>\
        </tr>\
      </table>\
      <table id='"+ id +"_row2' class=\"mid table_window\">\
        <tr>\
          <td class='"+ className +"_w'></td>\
            <td id='"+ id +"_table_content' class='"+ className +"_content' valign='top'>" + content + "</td>\
          <td class='"+ className +"_e'></td>\
        </tr>\
      </table>\
        <table id='"+ id +"_row3' class=\"bot table_window\">\
        <tr>\
          <td class='"+ className +"_sw'></td>\
            <td class='"+ className +"_s'><div id='"+ id +"_bottom' class='status_bar'><span style='float:left; width:1px; height:1px'></span></div></td>\
            <td " + seAttributes + "></td>\
        </tr>\
      </table>\
    ";
    Element.hide(win);
    this.options.parent.insertBefore(win, this.options.parent.firstChild);
    Event.observe($(id + "_content"), "load", this.options.onload);
    return win;
  },
  
  
  changeClassName: function(newClassName) {    
    var className = this.options.className;
    var id = this.getId();
    $A(["_close", "_minimize", "_maximize", "_sizer", "_content"]).each(function(value) { this._toggleClassName($(id + value), className + value, newClassName + value) }.bind(this));
    this._toggleClassName($(id + "_top"), className + "_title", newClassName + "_title");
    $$("#" + id + " td").each(function(td) {td.className = td.className.sub(className,newClassName); });
    this.options.className = newClassName;
  },
  
  _toggleClassName: function(element, oldClassName, newClassName) { 
    if (element) {
      element.removeClassName(oldClassName);
      element.addClassName(newClassName);
    }
  },
  
  // Sets window location
  setLocation: function(top, left) {
    top = this._updateTopConstraint(top);
    left = this._updateLeftConstraint(left);

    var e = this.currentDrag || this.element;
    e.setStyle({top: top + 'px'});
    e.setStyle({left: left + 'px'});

    this.useLeft = true;
    this.useTop = true;
  },
    
  getLocation: function() {
    var location = {};
    if (this.useTop)
      location = Object.extend(location, {top: this.element.getStyle("top")});
    else
      location = Object.extend(location, {bottom: this.element.getStyle("bottom")});
    if (this.useLeft)
      location = Object.extend(location, {left: this.element.getStyle("left")});
    else
      location = Object.extend(location, {right: this.element.getStyle("right")});
    
    return location;
  },
  
  // Gets window size
  getSize: function() {
    return {width: this.width, height: this.height};
  },
    
  // Sets window size
  setSize: function(width, height, useEffect) {    
    width = parseFloat(width);
    height = parseFloat(height);
    
    // Check min and max size
    if (!this.minimized && width < this.options.minWidth)
      width = this.options.minWidth;

    if (!this.minimized && height < this.options.minHeight)
      height = this.options.minHeight;
      
    if (this.options. maxHeight && height > this.options. maxHeight)
      height = this.options. maxHeight;

    if (this.options. maxWidth && width > this.options. maxWidth)
      width = this.options. maxWidth;

    
    if (this.useTop && this.useLeft && Window.hasEffectLib && Effect.ResizeWindow && useEffect) {
      new Effect.ResizeWindow(this, null, null, width, height, {duration: Window.resizeEffectDuration});
    } else {
      this.width = width;
      this.height = height;
      var e = this.currentDrag ? this.currentDrag : this.element;

      e.setStyle({width: width + this.widthW + this.widthE + "px"})
      e.setStyle({height: height  + this.heightN + this.heightS + "px"})

      // Update content size
      if (!this.currentDrag || this.currentDrag == this.element) {
        var content = $(this.element.id + '_content');
        content.setStyle({height: height  + 'px'});
        content.setStyle({width: width  + 'px'});
      }
    }
  },
  
  updateHeight: function() {
    this.setSize(this.width, this.content.scrollHeight, true);
  },
  
  updateWidth: function() {
    this.setSize(this.content.scrollWidth, this.height, true);
  },
  
  // Brings window to front
  toFront: function() {
    if (this.element.style.zIndex < Windows.maxZIndex)  
      this.setZIndex(Windows.maxZIndex + 1);
    if (this.iefix) 
      this._fixIEOverlapping(); 
  },
   
  getBounds: function(insideOnly) {
    if (! this.width || !this.height || !this.visible)  
      this.computeBounds();
    var w = this.width;
    var h = this.height;

    if (!insideOnly) {
      w += this.widthW + this.widthE;
      h += this.heightN + this.heightS;
    }
    var bounds = Object.extend(this.getLocation(), {width: w + "px", height: h + "px"});
    return bounds;
  },
      
  computeBounds: function() {
     if (! this.width || !this.height) {
      var size = WindowUtilities._computeSize(this.content.innerHTML, this.content.id, this.width, this.height, 0, this.options.className)
      if (this.height)
        this.width = size + 5
      else
        this.height = size + 5
    }

    this.setSize(this.width, this.height);
    if (this.centered)
      this._center(this.centerTop, this.centerLeft);    
  },
  
  // Displays window modal state or not
  show: function(modal) {
    this.visible = true;
    if (modal) {
      // Hack for Safari !!
      if (typeof this.overlayOpacity == "undefined") {
        var that = this;
        setTimeout(function() {that.show(modal)}, 10);
        return;
      }
      Windows.addModalWindow(this);
      
      this.modal = true;      
      this.setZIndex(Windows.maxZIndex + 1);
      Windows.unsetOverflow(this);
    }
    else    
      if (!this.element.style.zIndex) 
        this.setZIndex(Windows.maxZIndex + 1);        
      
    // To restore overflow if need be
    if (this.oldStyle)
      this.getContent().setStyle({overflow: this.oldStyle});
      
    this.computeBounds();
    
    this._notify("onBeforeShow");   
    if (this.options.showEffect != Element.show && this.options.showEffectOptions)
      this.options.showEffect(this.element, this.options.showEffectOptions);  
    else
      this.options.showEffect(this.element);  
      
    this._checkIEOverlapping();
    WindowUtilities.focusedWindow = this
    this._notify("onShow");   
  },
  
  // Displays window modal state or not at the center of the page
  showCenter: function(modal, top, left) {
    this.centered = true;
    this.centerTop = top;
    this.centerLeft = left;

    this.show(modal);
  },
  
  isVisible: function() {
    return this.visible;
  },
  
  _center: function(top, left) {    
    var windowScroll = WindowUtilities.getWindowScroll(this.options.parent);    
    var pageSize = WindowUtilities.getPageSize(this.options.parent);    
    if (typeof top == "undefined")
      top = (pageSize.windowHeight - (this.height + this.heightN + this.heightS))/2;
    top += windowScroll.top
    
    if (typeof left == "undefined")
      left = (pageSize.windowWidth - (this.width + this.widthW + this.widthE))/2;
    left += windowScroll.left      
    this.setLocation(top, left);
    this.toFront();
  },
  
  _recenter: function(event) {     
    if (this.centered) {
      var pageSize = WindowUtilities.getPageSize(this.options.parent);
      var windowScroll = WindowUtilities.getWindowScroll(this.options.parent);    

      // Check for this stupid IE that sends dumb events
      if (this.pageSize && this.pageSize.windowWidth == pageSize.windowWidth && this.pageSize.windowHeight == pageSize.windowHeight && 
          this.windowScroll.left == windowScroll.left && this.windowScroll.top == windowScroll.top) 
        return;
      this.pageSize = pageSize;
      this.windowScroll = windowScroll;
      // set height of Overlay to take up whole page and show
      if ($('overlay_modal')) 
        $('overlay_modal').setStyle({height: (pageSize.pageHeight + 'px')});
      
      if (this.options.recenterAuto)
        this._center(this.centerTop, this.centerLeft);    
    }
  },
  
  // Hides window
  hide: function() {
    this.visible = false;
    if (this.modal) {
      Windows.removeModalWindow(this);
      Windows.resetOverflow();
    }
    // To avoid bug on scrolling bar
    this.oldStyle = this.getContent().getStyle('overflow') || "auto"
    this.getContent().setStyle({overflow: "hidden"});

    this.options.hideEffect(this.element, this.options.hideEffectOptions);  

     if(this.iefix) 
      this.iefix.hide();

    if (!this.doNotNotifyHide)
      this._notify("onHide");
  },

  close: function() {
    // Asks closeCallback if exists
    if (this.visible) {
      if (this.options.closeCallback && ! this.options.closeCallback(this)) 
        return;

      if (this.options.destroyOnClose) {
        var destroyFunc = this.destroy.bind(this);
        if (this.options.hideEffectOptions.afterFinish) {
          var func = this.options.hideEffectOptions.afterFinish;
          this.options.hideEffectOptions.afterFinish = function() {func();destroyFunc() }
        }
        else 
          this.options.hideEffectOptions.afterFinish = function() {destroyFunc() }
      }
      Windows.updateFocusedWindow();
      
      this.doNotNotifyHide = true;
      this.hide();
      this.doNotNotifyHide = false;
      this._notify("onClose");
    }
  },
  
  minimize: function() {
    if (this.resizing)
      return;
    
    var r2 = $(this.getId() + "_row2");
    
    if (!this.minimized) {
      this.minimized = true;

      var dh = r2.getDimensions().height;
      this.r2Height = dh;
      var h  = this.element.getHeight() - dh;

      if (this.useLeft && this.useTop && Window.hasEffectLib && Effect.ResizeWindow) {
        new Effect.ResizeWindow(this, null, null, null, this.height -dh, {duration: Window.resizeEffectDuration});
      } else  {
        this.height -= dh;
        this.element.setStyle({height: h + "px"});
        r2.hide();
      }

      if (! this.useTop) {
        var bottom = parseFloat(this.element.getStyle('bottom'));
        this.element.setStyle({bottom: (bottom + dh) + 'px'});
      }
    } 
    else {      
      this.minimized = false;
      
      var dh = this.r2Height;
      this.r2Height = null;
      if (this.useLeft && this.useTop && Window.hasEffectLib && Effect.ResizeWindow) {
        new Effect.ResizeWindow(this, null, null, null, this.height + dh, {duration: Window.resizeEffectDuration});
      }
      else {
        var h  = this.element.getHeight() + dh;
        this.height += dh;
        this.element.setStyle({height: h + "px"})
        r2.show();
      }
      if (! this.useTop) {
        var bottom = parseFloat(this.element.getStyle('bottom'));
        this.element.setStyle({bottom: (bottom - dh) + 'px'});
      }
      this.toFront();
    }
    this._notify("onMinimize");
    
    // Store new location/size if need be
    this._saveCookie()
  },
  
  maximize: function() {
    if (this.isMinimized() || this.resizing)
      return;
  
    if (Prototype.Browser.IE && this.heightN == 0)
      this._getWindowBorderSize();
      
    if (this.storedLocation != null) {
      this._restoreLocation();
      if(this.iefix) 
        this.iefix.hide();
    }
    else {
      this._storeLocation();
      Windows.unsetOverflow(this);
      
      var windowScroll = WindowUtilities.getWindowScroll(this.options.parent);
      var pageSize = WindowUtilities.getPageSize(this.options.parent);    
      var left = windowScroll.left;
      var top = windowScroll.top;
      
      if (this.options.parent != document.body) {
        windowScroll =  {top:0, left:0, bottom:0, right:0};
        var dim = this.options.parent.getDimensions();
        pageSize.windowWidth = dim.width;
        pageSize.windowHeight = dim.height;
        top = 0; 
        left = 0;
      }
      
      if (this.constraint) {
        pageSize.windowWidth -= Math.max(0, this.constraintPad.left) + Math.max(0, this.constraintPad.right);
        pageSize.windowHeight -= Math.max(0, this.constraintPad.top) + Math.max(0, this.constraintPad.bottom);
        left +=  Math.max(0, this.constraintPad.left);
        top +=  Math.max(0, this.constraintPad.top);
      }
      
      var width = pageSize.windowWidth - this.widthW - this.widthE;
      var height= pageSize.windowHeight - this.heightN - this.heightS;

      if (this.useLeft && this.useTop && Window.hasEffectLib && Effect.ResizeWindow) {
        new Effect.ResizeWindow(this, top, left, width, height, {duration: Window.resizeEffectDuration});
      }
      else {
        this.setSize(width, height);
        this.element.setStyle(this.useLeft ? {left: left} : {right: left});
        this.element.setStyle(this.useTop ? {top: top} : {bottom: top});
      }
        
      this.toFront();
      if (this.iefix) 
        this._fixIEOverlapping(); 
    }
    this._notify("onMaximize");

    // Store new location/size if need be
    this._saveCookie()
  },
  
  isMinimized: function() {
    return this.minimized;
  },
  
  isMaximized: function() {
    return (this.storedLocation != null);
  },
  
  setOpacity: function(opacity) {
    if (Element.setOpacity)
      Element.setOpacity(this.element, opacity);
  },
  
  setZIndex: function(zindex) {
    this.element.setStyle({zIndex: zindex});
    Windows.updateZindex(zindex, this);
  },

  setTitle: function(newTitle) {
    if (!newTitle || newTitle == "") 
      newTitle = "&nbsp;";
      
    Element.update(this.element.id + '_top', newTitle);
  },
   
  getTitle: function() {
    return $(this.element.id + '_top').innerHTML;
  },
  
  setStatusBar: function(element) {
    var statusBar = $(this.getId() + "_bottom");

    if (typeof(element) == "object") {
      if (this.bottombar.firstChild)
        this.bottombar.replaceChild(element, this.bottombar.firstChild);
      else
        this.bottombar.appendChild(element);
    }
    else
      this.bottombar.innerHTML = element;
  },

  _checkIEOverlapping: function() {
    if(!this.iefix && (navigator.appVersion.indexOf('MSIE')>0) && (navigator.userAgent.indexOf('Opera')<0) && (this.element.getStyle('position')=='absolute')) {
        new Insertion.After(this.element.id, '<iframe id="' + this.element.id + '_iefix" '+ 'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' + 'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
        this.iefix = $(this.element.id+'_iefix');
    }
    if(this.iefix) 
      setTimeout(this._fixIEOverlapping.bind(this), 50);
  },

  _fixIEOverlapping: function() {
      Position.clone(this.element, this.iefix);
      this.iefix.style.zIndex = this.element.style.zIndex - 1;
      this.iefix.show();
  },
  
  _getWindowBorderSize: function(event) {
    // Hack to get real window border size!!
    var div = this._createHiddenDiv(this.options.className + "_n")
    this.heightN = Element.getDimensions(div).height;    
    div.parentNode.removeChild(div)

    var div = this._createHiddenDiv(this.options.className + "_s")
    this.heightS = Element.getDimensions(div).height;    
    div.parentNode.removeChild(div)

    var div = this._createHiddenDiv(this.options.className + "_e")
    this.widthE = Element.getDimensions(div).width;    
    div.parentNode.removeChild(div)

    var div = this._createHiddenDiv(this.options.className + "_w")
    this.widthW = Element.getDimensions(div).width;
    div.parentNode.removeChild(div);
    
    var div = document.createElement("div");
    div.className = "overlay_" + this.options.className ;
    document.body.appendChild(div);
    //alert("no timeout:\nopacity: " + div.getStyle("opacity") + "\nwidth: " + document.defaultView.getComputedStyle(div, null).width);
    var that = this;
    
    // Workaround for Safari!!
    setTimeout(function() {that.overlayOpacity = ($(div).getStyle("opacity")); div.parentNode.removeChild(div);}, 10);
    
    // Workaround for IE!!
    if (Prototype.Browser.IE) {
      this.heightS = $(this.getId() +"_row3").getDimensions().height;
      this.heightN = $(this.getId() +"_row1").getDimensions().height;
    }

    // Safari size fix
    if (Prototype.Browser.WebKit && Prototype.Browser.WebKitVersion < 420)
      this.setSize(this.width, this.height);
    if (this.doMaximize)
      this.maximize();
    if (this.doMinimize)
      this.minimize();
  },
 
  _createHiddenDiv: function(className) {
    var objBody = document.body;
    var win = document.createElement("div");
    win.setAttribute('id', this.element.id+ "_tmp");
    win.className = className;
    win.style.display = 'none';
    win.innerHTML = '';
    objBody.insertBefore(win, objBody.firstChild);
    return win;
  },
  
  _storeLocation: function() {
    if (this.storedLocation == null) {
      this.storedLocation = {useTop: this.useTop, useLeft: this.useLeft, 
                             top: this.element.getStyle('top'), bottom: this.element.getStyle('bottom'),
                             left: this.element.getStyle('left'), right: this.element.getStyle('right'),
                             width: this.width, height: this.height };
    }
  },
  
  _restoreLocation: function() {
    if (this.storedLocation != null) {
      this.useLeft = this.storedLocation.useLeft;
      this.useTop = this.storedLocation.useTop;
      
      if (this.useLeft && this.useTop && Window.hasEffectLib && Effect.ResizeWindow)
        new Effect.ResizeWindow(this, this.storedLocation.top, this.storedLocation.left, this.storedLocation.width, this.storedLocation.height, {duration: Window.resizeEffectDuration});
      else {
        this.element.setStyle(this.useLeft ? {left: this.storedLocation.left} : {right: this.storedLocation.right});
        this.element.setStyle(this.useTop ? {top: this.storedLocation.top} : {bottom: this.storedLocation.bottom});
        this.setSize(this.storedLocation.width, this.storedLocation.height);
      }
      
      Windows.resetOverflow();
      this._removeStoreLocation();
    }
  },
  
  _removeStoreLocation: function() {
    this.storedLocation = null;
  },
  
  _saveCookie: function() {
    if (this.cookie) {
      var value = "";
      if (this.useLeft)
        value += "l:" +  (this.storedLocation ? this.storedLocation.left : this.element.getStyle('left'))
      else
        value += "r:" + (this.storedLocation ? this.storedLocation.right : this.element.getStyle('right'))
      if (this.useTop)
        value += ",t:" + (this.storedLocation ? this.storedLocation.top : this.element.getStyle('top'))
      else
        value += ",b:" + (this.storedLocation ? this.storedLocation.bottom :this.element.getStyle('bottom'))
        
      value += "," + (this.storedLocation ? this.storedLocation.width : this.width);
      value += "," + (this.storedLocation ? this.storedLocation.height : this.height);
      value += "," + this.isMinimized();
      value += "," + this.isMaximized();
      WindowUtilities.setCookie(value, this.cookie)
    }
  },
  
  _createWiredElement: function() {
    if (! this.wiredElement) {
      if (Prototype.Browser.IE)
        this._getWindowBorderSize();
      var div = document.createElement("div");
      div.className = "wired_frame " + this.options.className + "_wired_frame";
      
      div.style.position = 'absolute';
      this.options.parent.insertBefore(div, this.options.parent.firstChild);
      this.wiredElement = $(div);
    }
    if (this.useLeft) 
      this.wiredElement.setStyle({left: this.element.getStyle('left')});
    else 
      this.wiredElement.setStyle({right: this.element.getStyle('right')});
      
    if (this.useTop) 
      this.wiredElement.setStyle({top: this.element.getStyle('top')});
    else 
      this.wiredElement.setStyle({bottom: this.element.getStyle('bottom')});

    var dim = this.element.getDimensions();
    this.wiredElement.setStyle({width: dim.width + "px", height: dim.height +"px"});

    this.wiredElement.setStyle({zIndex: Windows.maxZIndex+30});
    return this.wiredElement;
  },
  
  _hideWiredElement: function() {
    if (! this.wiredElement || ! this.currentDrag)
      return;
    if (this.currentDrag == this.element) 
      this.currentDrag = null;
    else {
      if (this.useLeft) 
        this.element.setStyle({left: this.currentDrag.getStyle('left')});
      else 
        this.element.setStyle({right: this.currentDrag.getStyle('right')});

      if (this.useTop) 
        this.element.setStyle({top: this.currentDrag.getStyle('top')});
      else 
        this.element.setStyle({bottom: this.currentDrag.getStyle('bottom')});

      this.currentDrag.hide();
      this.currentDrag = null;
      if (this.doResize)
        this.setSize(this.width, this.height);
    } 
  },
  
  _notify: function(eventName) {
    if (this.options[eventName])
      this.options[eventName](this);
    else
      Windows.notify(eventName, this);
  }
};

// Windows containers, register all page windows
var Windows = {
  windows: [],
  modalWindows: [],
  observers: [],
  focusedWindow: null,
  maxZIndex: 0,
  overlayShowEffectOptions: {duration: 0.5},
  overlayHideEffectOptions: {duration: 0.5},

  addObserver: function(observer) {
    this.removeObserver(observer);
    this.observers.push(observer);
  },
  
  removeObserver: function(observer) {  
    this.observers = this.observers.reject( function(o) { return o==observer });
  },
  
  // onDestroy onStartResize onStartMove onResize onMove onEndResize onEndMove onFocus onBlur onBeforeShow onShow onHide onMinimize onMaximize onClose
  notify: function(eventName, win) {  
    this.observers.each( function(o) {if(o[eventName]) o[eventName](eventName, win);});
  },

  // Gets window from its id
  getWindow: function(id) {
    return this.windows.detect(function(d) { return d.getId() ==id });
  },

  // Gets the last focused window
  getFocusedWindow: function() {
    return this.focusedWindow;
  },

  updateFocusedWindow: function() {
    this.focusedWindow = this.windows.length >=2 ? this.windows[this.windows.length-2] : null;    
  },
  
  // Registers a new window (called by Windows constructor)
  register: function(win) {
    this.windows.push(win);
  },
    
  // Add a modal window in the stack
  addModalWindow: function(win) {
    // Disable screen if first modal window
    if (this.modalWindows.length == 0) {
      WindowUtilities.disableScreen(win.options.className, 'overlay_modal', win.overlayOpacity, win.getId(), win.options.parent);
    }
    else {
      // Move overlay over all windows
      if (Window.keepMultiModalWindow) {
        $('overlay_modal').style.zIndex = Windows.maxZIndex + 1;
        Windows.maxZIndex += 1;
        WindowUtilities._hideSelect(this.modalWindows.last().getId());
      }
      // Hide current modal window
      else
        this.modalWindows.last().element.hide();
      // Fucking IE select issue
      WindowUtilities._showSelect(win.getId());
    }      
    this.modalWindows.push(win);    
  },
  
  removeModalWindow: function(win) {
    this.modalWindows.pop();
    
    // No more modal windows
    if (this.modalWindows.length == 0)
      WindowUtilities.enableScreen();     
    else {
      if (Window.keepMultiModalWindow) {
        this.modalWindows.last().toFront();
        WindowUtilities._showSelect(this.modalWindows.last().getId());        
      }
      else
        this.modalWindows.last().element.show();
    }
  },
  
  // Registers a new window (called by Windows constructor)
  register: function(win) {
    this.windows.push(win);
  },
  
  // Unregisters a window (called by Windows destructor)
  unregister: function(win) {
    this.windows = this.windows.reject(function(d) { return d==win });
  }, 
  
  // Closes all windows
  closeAll: function() {  
    this.windows.each( function(w) {Windows.close(w.getId())} );
  },
  
  closeAllModalWindows: function() {
    WindowUtilities.enableScreen();     
    this.modalWindows.each( function(win) {if (win) win.close()});    
  },

  // Minimizes a window with its id
  minimize: function(id, event) {
    var win = this.getWindow(id)
    if (win && win.visible)
      win.minimize();
    Event.stop(event);
  },
  
  // Maximizes a window with its id
  maximize: function(id, event) {
    var win = this.getWindow(id)
    if (win && win.visible)
      win.maximize();
    Event.stop(event);
  },

  // Closes a window with its id
  close: function(id, event) {
    var win = this.getWindow(id);
    if (win) 
      win.close();
    if (event)
      Event.stop(event);
  },
  
  blur: function(id) {
    var win = this.getWindow(id);  
    if (!win)
      return;
    if (win.options.blurClassName)
      win.changeClassName(win.options.blurClassName);
    if (this.focusedWindow == win)  
      this.focusedWindow = null;
    win._notify("onBlur");  
  },
  
  focus: function(id) {
    var win = this.getWindow(id);  
    if (!win)
      return;       
    if (this.focusedWindow)
      this.blur(this.focusedWindow.getId())

    if (win.options.focusClassName)
      win.changeClassName(win.options.focusClassName);  
    this.focusedWindow = win;
    win._notify("onFocus");
  },
  
  unsetOverflow: function(except) {    
    this.windows.each(function(d) { d.oldOverflow = d.getContent().getStyle("overflow") || "auto" ; d.getContent().setStyle({overflow: "hidden"}) });
    if (except && except.oldOverflow)
      except.getContent().setStyle({overflow: except.oldOverflow});
  },

  resetOverflow: function() {
    this.windows.each(function(d) { if (d.oldOverflow) d.getContent().setStyle({overflow: d.oldOverflow}) });
  },

  updateZindex: function(zindex, win) { 
    if (zindex > this.maxZIndex) {   
      this.maxZIndex = zindex;    
      if (this.focusedWindow) 
        this.blur(this.focusedWindow.getId())
    }
    this.focusedWindow = win;
    if (this.focusedWindow) 
      this.focus(this.focusedWindow.getId())
  }
};

var DDialog = {
  dialogId: null,
  onCompleteFunc: null,
  callFunc: null, 
  parameters: null, 
    
  confirm: function(content, parameters) {
    // Get Ajax return before
    if (content && typeof content != "string") {
      DDialog._runAjaxRequest(content, parameters, DDialog.confirm);
      return 
    }
    content = content || "";
    
    parameters = parameters || {};
    var okLabel = parameters.okLabel ? parameters.okLabel : "Ok";
    var cancelLabel = parameters.cancelLabel ? parameters.cancelLabel : "Cancel";

    // Backward compatibility
    parameters = Object.extend(parameters, parameters.windowParameters || {});
    parameters.windowParameters = parameters.windowParameters || {};

    parameters.className = parameters.className || "alert";

    var okButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " ok_button'" 
    var cancelButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " cancel_button'" 
    var content = "\
      <div class='" + parameters.className + "_message'>" + content  + "</div>\
        <div class='" + parameters.className + "_buttons'>\
          <input type='button' value='" + okLabel + "' onclick='DDialog.okCallback()' " + okButtonClass + "/>\
          <input type='button' value='" + cancelLabel + "' onclick='DDialog.cancelCallback()' " + cancelButtonClass + "/>\
        </div>\
    ";
    return this._openDDialog(content, parameters)
  },
  
  alert: function(content, parameters) {
    // Get Ajax return before
    if (content && typeof content != "string") {
      DDialog._runAjaxRequest(content, parameters, DDialog.alert);
      return 
    }
    content = content || "";
    
    parameters = parameters || {};
    var okLabel = parameters.okLabel ? parameters.okLabel : "Ok";

    // Backward compatibility    
    parameters = Object.extend(parameters, parameters.windowParameters || {});
    parameters.windowParameters = parameters.windowParameters || {};
    
    parameters.className = parameters.className || "alert";
    
    var okButtonClass = "class ='" + (parameters.buttonClass ? parameters.buttonClass + " " : "") + " ok_button'" 
    var content = "\
      <div class='" + parameters.className + "_message'>" + content  + "</div>\
        <div class='" + parameters.className + "_buttons'>\
          <input type='button' value='" + okLabel + "' onclick='DDialog.okCallback()' " + okButtonClass + "/>\
        </div>";                  
    return this._openDDialog(content, parameters)
  },
  
  info: function(content, parameters) {   
    // Get Ajax return before
    if (content && typeof content != "string") {
      DDialog._runAjaxRequest(content, parameters, DDialog.info);
      return 
    }
    content = content || "";
     
    // Backward compatibility
    parameters = parameters || {};
    parameters = Object.extend(parameters, parameters.windowParameters || {});
    parameters.windowParameters = parameters.windowParameters || {};
    
    parameters.className = parameters.className || "alert";
    
    var content = "<div id='modal_dialog_message' class='" + parameters.className + "_message'>" + content  + "</div>";
    if (parameters.showProgress)
      content += "<div id='modal_dialog_progress' class='" + parameters.className + "_progress'>  </div>";

    parameters.ok = null;
    parameters.cancel = null;
    
    return this._openDDialog(content, parameters)
  },
  
  setInfoMessage: function(message) {
    $('modal_dialog_message').update(message);
  },
  
  closeInfo: function() {
    Windows.close(this.dialogId);
  },
  
  _openDDialog: function(content, parameters) {
    var className = parameters.className;
    
    if (! parameters.height && ! parameters.width) {
      parameters.width = WindowUtilities.getPageSize(parameters.options.parent || document.body).pageWidth / 2;
    }
    if (parameters.id)
      this.dialogId = parameters.id;
    else { 
      var t = new Date();
      this.dialogId = 'modal_dialog_' + t.getTime();
      parameters.id = this.dialogId;
    }

    // compute height or width if need be
    if (! parameters.height || ! parameters.width) {
      var size = WindowUtilities._computeSize(content, this.dialogId, parameters.width, parameters.height, 5, className)
      if (parameters.height)
        parameters.width = size + 5
      else
        parameters.height = size + 5
    }
    parameters.effectOptions = parameters.effectOptions ;
    parameters.resizable   = parameters.resizable || false;
    parameters.minimizable = parameters.minimizable || false;
    parameters.maximizable = parameters.maximizable ||  false;
    parameters.draggable   = parameters.draggable || false;
    parameters.closable    = parameters.closable || false;
    
    var win = new Window(parameters);
    win.getContent().innerHTML = content;
    
    win.showCenter(true, parameters.top, parameters.left);  
    win.setDestroyOnClose();
    
    win.cancelCallback = parameters.onCancel || parameters.cancel; 
    win.okCallback = parameters.onOk || parameters.ok;
    
    return win;    
  },
  
  _getAjaxContent: function(originalRequest)  {
      DDialog.callFunc(originalRequest.responseText, DDialog.parameters)
  },
  
  _runAjaxRequest: function(message, parameters, callFunc) {
    if (message.options == null)
      message.options = {}  
    DDialog.onCompleteFunc = message.options.onComplete;
    DDialog.parameters = parameters;
    DDialog.callFunc = callFunc;
    
    message.options.onComplete = DDialog._getAjaxContent;
    new Ajax.Request(message.url, message.options);
  },
  
  okCallback: function() {
    var win = Windows.focusedWindow;
    if (!win.okCallback || win.okCallback(win)) {
      // Remove onclick on button
      $$("#" + win.getId()+" input").each(function(element) {element.onclick=null;})
      win.close();
    }
  },

  cancelCallback: function() {
    var win = Windows.focusedWindow;
    // Remove onclick on button
    $$("#" + win.getId()+" input").each(function(element) {element.onclick=null})
    win.close();
    if (win.cancelCallback)
      win.cancelCallback(win);
  }
}
/*
  Based on Lightbox JS: Fullsize Image Overlays 
  by Lokesh Dhakar - http://www.huddletogether.com

  For more information on this script, visit:
  http://huddletogether.com/projects/lightbox/

  Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
  (basically, do anything you want, just leave my name and link)
*/

if (Prototype.Browser.WebKit) {
  var array = navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/));
  Prototype.Browser.WebKitVersion = parseFloat(array[1]);
}

var WindowUtilities = {  
  // From dragdrop.js
  getWindowScroll: function(parent) {
    var T, L, W, H;
    parent = parent || document.body;              
    if (parent != document.body) {
      T = parent.scrollTop;
      L = parent.scrollLeft;
      W = parent.scrollWidth;
      H = parent.scrollHeight;
    } 
    else {
      var w = window;
      with (w.document) {
        if (w.document.documentElement && documentElement.scrollTop) {
          T = documentElement.scrollTop;
          L = documentElement.scrollLeft;
        } else if (w.document.body) {
          T = body.scrollTop;
          L = body.scrollLeft;
        }
        if (w.innerWidth) {
          W = w.innerWidth;
          H = w.innerHeight;
        } else if (w.document.documentElement && documentElement.clientWidth) {
          W = documentElement.clientWidth;
          H = documentElement.clientHeight;
        } else {
          W = body.offsetWidth;
          H = body.offsetHeight
        }
      }
    }
    return { top: T, left: L, width: W, height: H };
  }, 
  //
  // getPageSize()
  // Returns array with page width, height and window width, height
  // Core code from - quirksmode.org
  // Edit for Firefox by pHaez
  //
  getPageSize: function(parent){
    parent = parent || document.body;              
    var windowWidth, windowHeight;
    var pageHeight, pageWidth;
    if (parent != document.body) {
      windowWidth = parent.getWidth();
      windowHeight = parent.getHeight();                                
      pageWidth = parent.scrollWidth;
      pageHeight = parent.scrollHeight;                                
    } 
    else {
      var xScroll, yScroll;

      if (window.innerHeight && window.scrollMaxY) {  
        xScroll = document.body.scrollWidth;
        yScroll = window.innerHeight + window.scrollMaxY;
      } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
        xScroll = document.body.scrollWidth;
        yScroll = document.body.scrollHeight;
      } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
        xScroll = document.body.offsetWidth;
        yScroll = document.body.offsetHeight;
      }


      if (self.innerHeight) {  // all except Explorer
        windowWidth = self.innerWidth;
        windowHeight = self.innerHeight;
      } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
      } else if (document.body) { // other Explorers
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
      }  

      // for small pages with total height less then height of the viewport
      if(yScroll < windowHeight){
        pageHeight = windowHeight;
      } else { 
        pageHeight = yScroll;
      }

      // for small pages with total width less then width of the viewport
      if(xScroll < windowWidth){  
        pageWidth = windowWidth;
      } else {
        pageWidth = xScroll;
      }
    }             
    return {pageWidth: pageWidth ,pageHeight: pageHeight , windowWidth: windowWidth, windowHeight: windowHeight};
  },

  disableScreen: function(className, overlayId, overlayOpacity, contentId, parent) {
    WindowUtilities.initLightbox(overlayId, className, function() {this._disableScreen(className, overlayId, overlayOpacity, contentId)}.bind(this), parent || document.body);
  },

  _disableScreen: function(className, overlayId, overlayOpacity, contentId) {
    // prep objects
    var objOverlay = $(overlayId);

    var pageSize = WindowUtilities.getPageSize(objOverlay.parentNode);

    // Hide select boxes as they will 'peek' through the image in IE, store old value
    if (contentId && Prototype.Browser.IE) {
      WindowUtilities._hideSelect();
      WindowUtilities._showSelect(contentId);
    }  
  
    // set height of Overlay to take up whole page and show
    objOverlay.style.height = (pageSize.pageHeight + 'px');
    objOverlay.style.display = 'none'; 
    if (overlayId == "overlay_modal" && Window.hasEffectLib && Windows.overlayShowEffectOptions) {
      objOverlay.overlayOpacity = overlayOpacity;
      new Effect.Appear(objOverlay, Object.extend({from: 0, to: overlayOpacity}, Windows.overlayShowEffectOptions));
    }
    else
      objOverlay.style.display = "block";
  },
  
  enableScreen: function(id) {
    id = id || 'overlay_modal';
    var objOverlay =  $(id);
    if (objOverlay) {
      // hide lightbox and overlay
      if (id == "overlay_modal" && Window.hasEffectLib && Windows.overlayHideEffectOptions)
        new Effect.Fade(objOverlay, Object.extend({from: objOverlay.overlayOpacity, to:0}, Windows.overlayHideEffectOptions));
      else {
        objOverlay.style.display = 'none';
        objOverlay.parentNode.removeChild(objOverlay);
      }
      
      // make select boxes visible using old value
      if (id != "__invisible__") 
        WindowUtilities._showSelect();
    }
  },

  _hideSelect: function(id) {
    if (Prototype.Browser.IE) {
      id = id ==  null ? "" : "#" + id + " ";
      $$(id + 'select').each(function(element) {
        if (! WindowUtilities.isDefined(element.oldVisibility)) {
          element.oldVisibility = element.style.visibility ? element.style.visibility : "visible";
          element.style.visibility = "hidden";
        }
      });
    }
  },
  
  _showSelect: function(id) {
    if (Prototype.Browser.IE) {
      id = id ==  null ? "" : "#" + id + " ";
      $$(id + 'select').each(function(element) {
        if (WindowUtilities.isDefined(element.oldVisibility)) {
          // Why?? Ask IE
          try {
            element.style.visibility = element.oldVisibility;
          } catch(e) {
            element.style.visibility = "visible";
          }
          element.oldVisibility = null;
        }
        else {
          if (element.style.visibility)
            element.style.visibility = "visible";
        }
      });
    }
  },

  isDefined: function(object) {
    return typeof(object) != "undefined" && object != null;
  },
  
  // initLightbox()
  // Function runs on window load, going through link tags looking for rel="lightbox".
  // These links receive onclick events that enable the lightbox display for their targets.
  // The function also inserts html markup at the top of the page which will be used as a
  // container for the overlay pattern and the inline image.
  initLightbox: function(id, className, doneHandler, parent) {
    // Already done, just update zIndex
    if ($(id)) {
      Element.setStyle(id, {zIndex: Windows.maxZIndex + 1});
      Windows.maxZIndex++;
      doneHandler();
    }
    // create overlay div and hardcode some functional styles (aesthetic styles are in CSS file)
    else {
      var objOverlay = document.createElement("div");
      objOverlay.setAttribute('id', id);
      objOverlay.className = "overlay_" + className
      objOverlay.style.display = 'none';
      objOverlay.style.position = 'absolute';
      objOverlay.style.top = '0';
      objOverlay.style.left = '0';
      objOverlay.style.zIndex = Windows.maxZIndex + 1;
      Windows.maxZIndex++;
      objOverlay.style.width = '100%';
      parent.insertBefore(objOverlay, parent.firstChild);
      if (Prototype.Browser.WebKit && id == "overlay_modal") {
        setTimeout(function() {doneHandler()}, 10);
      }
      else
        doneHandler();
    }    
  },
  
  setCookie: function(value, parameters) {
    document.cookie= parameters[0] + "=" + encodeURIComponent(value) +
      ((parameters[1]) ? "; expires=" + parameters[1].toGMTString() : "") +
      ((parameters[2]) ? "; path=" + parameters[2] : "") +
      ((parameters[3]) ? "; domain=" + parameters[3] : "") +
      ((parameters[4]) ? "; secure" : "");
  },

  getCookie: function(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
      begin = dc.indexOf(prefix);
      if (begin != 0) return null;
    } else {
      begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
      end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
  },
    
  _computeSize: function(content, id, width, height, margin, className) {
    var objBody = document.body;
    var tmpObj = document.createElement("div");
    tmpObj.setAttribute('id', id);
    tmpObj.className = className + "_content";

    if (height)
      tmpObj.style.height = height + "px"
    else
      tmpObj.style.width = width + "px"
  
    tmpObj.style.position = 'absolute';
    tmpObj.style.top = '0';
    tmpObj.style.left = '0';
    tmpObj.style.display = 'none';

    tmpObj.innerHTML = content;
    objBody.insertBefore(tmpObj, objBody.firstChild);

    var size;
    if (height)
      size = $(tmpObj).getDimensions().width + margin;
    else
      size = $(tmpObj).getDimensions().height + margin;
    objBody.removeChild(tmpObj);
    return size;
  }  
}


	Effect.ResizeWindow = Class.create();
Object.extend(Object.extend(Effect.ResizeWindow.prototype, Effect.Base.prototype), {
  initialize: function(win, top, left, width, height) {
    this.window = win;
    this.window.resizing = true;
    
    var size = win.getSize();
    this.initWidth    = parseFloat(size.width);
    this.initHeight   = parseFloat(size.height);

    var location = win.getLocation();
    this.initTop    = parseFloat(location.top);
    this.initLeft   = parseFloat(location.left);

    this.width    = width != null  ? parseFloat(width)  : this.initWidth;
    this.height   = height != null ? parseFloat(height) : this.initHeight;
    this.top      = top != null    ? parseFloat(top)    : this.initTop;
    this.left     = left != null   ? parseFloat(left)   : this.initLeft;

    this.dx     = this.left   - this.initLeft;
    this.dy     = this.top    - this.initTop;
    this.dw     = this.width  - this.initWidth;
    this.dh     = this.height - this.initHeight;
    
    this.r2      = $(this.window.getId() + "_row2");
    this.content = $(this.window.getId() + "_content");
        
    this.contentOverflow = this.content.getStyle("overflow") || "auto";
    this.content.setStyle({overflow: "hidden"});
    
    // Wired mode
    if (this.window.options.wiredDrag) {
      this.window.currentDrag = win._createWiredElement();
      this.window.currentDrag.show();
      this.window.element.hide();
    }

    this.start(arguments[5]);
  },
  
  update: function(position) {
    var width  = Math.floor(this.initWidth  + this.dw * position);
    var height = Math.floor(this.initHeight + this.dh * position);
    var top    = Math.floor(this.initTop    + this.dy * position);
    var left   = Math.floor(this.initLeft   + this.dx * position);

    if (window.ie) {
      if (Math.floor(height) == 0)  
        this.r2.hide();
      else if (Math.floor(height) >1)  
        this.r2.show();
    }      
    this.r2.setStyle({height: height});
    this.window.setSize(width, height);
    this.window.setLocation(top, left);
  },
  
  finish: function(position) {
    // Wired mode
    if (this.window.options.wiredDrag) {
      this.window._hideWiredElement();
      this.window.element.show();
    }

    this.window.setSize(this.width, this.height);
    this.window.setLocation(this.top, this.left);
    this.r2.setStyle({height: null});
    
    this.content.setStyle({overflow: this.contentOverflow});
      
    this.window.resizing = false;
  }
});

Effect.ModalSlideDown = function(element) {
  var windowScroll = WindowUtilities.getWindowScroll();    
  var height = element.getStyle("height");  
  element.setStyle({top: - (parseFloat(height) - windowScroll.top) + "px"});
  
  element.show();
  return new Effect.Move(element, Object.extend({ x: 0, y: parseFloat(height) }, arguments[1] || {}));
};


Effect.ModalSlideUp = function(element) {
  var height = element.getStyle("height");
  return new Effect.Move(element, Object.extend({ x: 0, y: -parseFloat(height) }, arguments[1] || {}));
};

PopupEffect = Class.create();
PopupEffect.prototype = {    
  initialize: function(htmlElement) {
    this.html = $(htmlElement);      
    this.options = Object.extend({className: "popup_effect", duration: 0.4}, arguments[1] || {});
    
  },
  show: function(element, options) { 
    var position = Position.cumulativeOffset(this.html);      
    var size = this.html.getDimensions();
    var bounds = element.win.getBounds();
    this.window =  element.win;      
    // Create a div
    if (!this.div) {
      this.div = document.createElement("div");
      this.div.className = this.options.className;
      this.div.style.height = size.height + "px";
      this.div.style.width  = size.width  + "px";
      this.div.style.top    = position[1] + "px";
      this.div.style.left   = position[0] + "px";   
      this.div.style.position = "absolute"
      document.body.appendChild(this.div);
    }                                                   
    if (this.options.fromOpacity)
      this.div.setStyle({opacity: this.options.fromOpacity})
    this.div.show();          
    var style = "top:" + bounds.top + ";left:" +bounds.left + ";width:" + bounds.width +";height:" + bounds.height;
    if (this.options.toOpacity)
      style += ";opacity:" + this.options.toOpacity;
    
    new Effect.Morph(this.div ,{style: style, duration: this.options.duration, afterFinish: this._showWindow.bind(this)});    
  },

  hide: function(element, options) {     
    var position = Position.cumulativeOffset(this.html);      
    var size = this.html.getDimensions();    
    this.window.visible = true; 
    var bounds = this.window.getBounds();
    this.window.visible = false; 

    this.window.element.hide();

    this.div.style.height = bounds.height;
    this.div.style.width  = bounds.width;
    this.div.style.top    = bounds.top;
    this.div.style.left   = bounds.left;
    
    if (this.options.toOpacity)
      this.div.setStyle({opacity: this.options.toOpacity})

    this.div.show();                                 
    var style = "top:" + position[1] + "px;left:" + position[0] + "px;width:" + size.width +"px;height:" + size.height + "px";

    if (this.options.fromOpacity)
      style += ";opacity:" + this.options.fromOpacity;
    new Effect.Morph(this.div ,{style: style, duration: this.options.duration, afterFinish: this._hideDiv.bind(this)});    
  },
  
  _showWindow: function() {
    this.div.hide();
    this.window.element.show(); 
  },
  
  _hideDiv: function() {
    this.div.hide();
  }
}


	var current = 1;
var t=null;
var oNext=null;
var oCurrent=null;
function goToPageGallery(page){
  

	switch(page){
		case 'next':
			if(current==cuantas){
				page=1;
			}else{
				page=current+1;
			}
			
			
		break;
		
		case 'prev':
			if(current==1){
				page=cuantas;
			}else{
				page=current-1
			}
		break
		
		
	}
	
  
  if(!document.images['slideImg'+page].complete){
    	return false;
  }
  if(page!=cuantas){
    if(!document.images['slideImg'+(page+1)].complete){
      return false;
    }
  }
	
	if(page!=current){
		oCurrent=$('ii'+current);

		oRelleno=$('relleno'+current);

		next='ii'+page;

		oNext=$(next);

		effectCurrent();
			
		document.getElementById('imageEngineContainer').style.background='url('+document.images['slideImg'+page].src+')';

		current=page;
	}
	
}



function displayNextGallery(obj){
	oNext.style.display='block';
}

function initSlideGallery(){
   
    clearInterval(t);
    if(intervalo<1000){
      intervalo=1000;
    }
    t=setInterval("nextPageGallery()",intervalo);	
  
}

function nextPageGallery(){
	goToPageGallery('next');
}

function stopSlideGallery(){
	clearInterval(t);
}
	
function buyForm_data(i, form){
	
	var xP=akiSfrm(form)+'&i='+i;
	xP = xP + '&d=buyForm';
	xP = xP + '&controller=configureBlock';
	
	goAJAX(form, 'z/controller.php', xP); 
	
}
	
function generalForms_data(i, form, wich){
	
	var formulario = $(form).serialize().toString();
	
	if(formulario.search('required')>0){
		alert('Please, fill all fields marked as required and try again');
		return false;
	}
	
	var xP=akiSfrm(form)+'&i='+i;
	xP = xP + '&d=generalForms';
	xP = xP + '&controller=configureBlock';
	
	goAJAX(form, 'z/controller.php', xP); 
	
}
		function URLEncode (clearString) {
		var output = '';
	  	var x = 0;
	  	clearString = clearString.toString();
	  	var regex = /(^[a-zA-Z0-9_.]*)/;
	  	while (x < clearString.length) {
			var match = regex.exec(clearString.substr(x));
			if (match != null && match.length > 1 && match[1] != '') {
				output += match[1];
		  		x += match[1].length;
			} else {
		  		if (clearString[x] == ' ')
					output += '+';
		  		else {
					var charCode = clearString.charCodeAt(x);
					var hexVal = charCode.toString(16);
					output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
		  		}
		  		x++;
			}
	  	}
	  	return output;
	}

	function previewArticle(obj,id){
		obj.href='article.mini.'+ id +'.html';
		return hs.htmlExpand(obj, { dimmingOpacity: 0.3, wrapperClassName: 'glossy-dark', outlineType: 'drop-shadow',src: 'article.mini.'+ id +'.html',contentId: 'highslide-html-shared', objectType: 'ajax'} );
		obj.href='#';
	}
	
	function relatedTagAjax(obj,str){
		obj.href='related-by-'+ str +'-mini.html';
		return hs.htmlExpand(	obj, 
								{ 
									dimmingOpacity: 0.3, 
									wrapperClassName: 'glossy-dark', 
									outlineType: 'drop-shadow',
									src: obj.href,
									contentId: 'highslide-html-shared', 
									objectType: 'ajax'
								} 
							);
		obj.href='#';
	}
	/* Articles Top */
	function showTopArticlesViews(rnd){
		get('sMostViewed'+rnd).style.display='';
		get('sMostCommented'+rnd).style.display='none';
		get('toggView'+rnd).className='btnViewActive';
		get('toggComm'+rnd).className='btnCommInactive';
		return false;
	}
	
	function hideTopArticlesViews(rnd){
		get('sMostViewed'+rnd).style.display='none';
		get('sMostCommented'+rnd).style.display='';
		get('toggView'+rnd).className='btnViewInactive';
		get('toggComm'+rnd).className='btnCommActive';
		return false;
	}	

	/* Article Size*/
	function contChangeSize(target, prefix, limit, direction){
		var tclass=get(target).className;var num;
		if(direction=='+'){
			num = parseInt(str_replace(prefix,'',tclass))+1;
		}else{
			num = parseInt(str_replace(prefix,'',tclass))-1;
		}
		if(num>limit){num=limit;}
		if(num==0){num=1;}
		get(target).className=prefix+num;
		return false;
	}

	function contCicleFont(target, prefix, limit){
		var tclass=get(target).className;var num;
		num = parseInt(str_replace(prefix,'',tclass))+1;
		if(num>limit){num=1;}
		get(target).className=prefix+num;
		return false;
	}

	function searchArticles(sec,str){
		var url='search-articles-'+ sec +'-1-'+ URLEncode(str) +'.html';
		document.location.href=url;
	}
	
	/* super Sections*/
	var ssShowArtFinish='1';
	
	function ssShowArt(from, to ,element,box){
		if(ssShowArtFinish=='1'){
			ssShowArtFinish='0';
			new Effect.BlindUp(to, { duration: 0.3 });
			var miArray=$$('#'+box+' .buttons a');
			for (i=0;i<miArray.length;i++){
				(miArray[i]).className='';
			}
			element.className='active';
			setTimeout("get('"+to+"').innerHTML=get('"+from+"').innerHTML;new Effect.BlindDown('"+to+"', { duration: 1.0 });setTimeout(\"ssShowArtFinish='1';\",500);",500);
		}
		return false;
	}

	var blindUpAllCSSFinish='1';
	
	function blindUpAllCSS(theclass,id2BlindDown){
		if(blindUpAllCSSFinish=='1'){
			blindUpAllCSSFinish='0';
			var miArray=$$(theclass);
			for (i=0;i<miArray.length;i++){
				new Effect.BlindUp((miArray[i]).id, { duration: 0.1 });			
			}
			setTimeout("new Effect.BlindDown('" + id2BlindDown + "', { duration: 0.5 });setTimeout(\"blindUpAllCSSFinish='1';\",500);",200);
		}else{
			return false;
		}
	}

	var blindUpAllCSSFinish2='1';

	function blindUpAllCSS2(theclass,id2BlindDown){
		if(blindUpAllCSSFinish2=='1'){
			blindUpAllCSSFinish2='0';
			var miArray=$$(theclass);
			for (i=0;i<miArray.length;i++){
				new Effect.BlindUp((miArray[i]).id, { duration: 0.4 });			
			}
			setTimeout("new Effect.BlindDown('" + id2BlindDown + "', { duration: 1.0 });setTimeout(\"blindUpAllCSSFinish2='1';\",1100);",500);
		}else{
			return false;
		}
	}
	


/* EDIT IN PLACE */
	function showSysWindow(winName,winTitle,winDiv,File,w,h,Exec){
		if(!isDefined(get(winName))){
			var win = new Window({
								 id: winName, 
								 className: "alphacube", 
								 title: winTitle, 
								 width:w, 
								 height:h, 
								 wiredDrag: true,
								 showEffectOptions:{
										duration:'0.2'
								 },
								 hideEffectOptions:{
										duration:'0.2'
								 },
								 recenterAuto:false
							}); 
			win.setDestroyOnClose(); 
			win.showCenter();
			win.setConstraint(true, {left:0, right:0, top: 90, bottom:10});
			win.toFront();
			win.setHTMLContent('<div id="'+winDiv+'"></div>');
			
			goAJAX(winDiv,File,'',Exec);
			get(winName).toFront;
			win.toFront();
		}else{
			get(winName).toFront;
		}	
	}
	
	function showWin(href,title,w,h,Exec){
		if(!isDefined(w)||(w=='')){w=600;}
		if(!isDefined(h)||(h=='')){h=400;}
		var winTitle='win'+str_replace(' ','',title);
		var divTitle='div'+str_replace(' ','',title);
		href=href+'&hwnd='+Math.floor(Math.random( ) * 999 - 2) + 1;
	
		showSysWindow(winTitle,title,divTitle,href,w,h,Exec);
		return false;
	}
	
	function new_npaperEditor (obj) {
		
		window.img_folder='wysiwyg/pics/';
		window.includes_folder='wysiwyg/includes/';
		window.editor_css='wysiwyg/styles/wys.css';
		window.controls_folder='wysiwyg/controls/';
				
		window.centerDialogWin=ge('wysiwyg:container');
		
		editor=new wysiwyg(obj); //create instance of the class, The single argument correspond to DOM id of textarea object.
		
		editor.disabled=false;  //If you wants disable the editor to prevent anything.
		
		editor.onContextMenu=ContextMenu; //register a method to display the contextual menu, You can change this method and/or options displayed in it
		editor.onEvent=EditorEvents; //this method is called when occurs an event, such as: the user selects a bold/italic word, etc...
	
		editor.load(); //procedure to load the editor
		
		load_buttons(editor); //register the buttons editor
		editor.toolbar.print(); //print toolbar in display
		
	}

		function showEditArticleInPlace(i){
			showWin('wcp/Articles.php?ajax=1&ak_m=EfP&ak_sM2=0&ak_pk_id='+i,'Edit Articles','850','500','new_npaperEditor(\'content\');GetId(\'Tecontent\').style.display=\'none\';');
		}	
		
		
function mOvr(src,clrIn) {//on mouse in
	src.style.cursor = 'hand';
	src.bgColor = clrIn;	
	}
function mOut(src,clrIn) {// on mouse out
	src.style.cursor = 'default';
	src.bgColor = clrIn;
	}
function mClk(src) {//on click
	//src.bgColor = "#ffcc99";
	}
		if (document.images){
	  preload_image_object = new Image();
	  // set image url
	  image_url = new Array();
	  image_url[0] = "css/layout/global01.jpg";
	
	   var i = 0;
	   for(i=0; i<1; i++) 
		 preload_image_object.src = image_url[i];
	}
	/*
	var gn=null;
	function submenushow(id){
		if(document.getElementById(id)){
			o=document.getElementById(id);
			var container=document.getElementById('sMainLinks');
			container.innerHTML=o.innerHTML;

			gn=container.firstChild;
	
			container.style.display='';
		}else{
			try{
			document.getElementById('sMainLinks').innerHTML='';
			}catch(e){}
		}
	}
*/


var gn=null;
var hideMenu=0;
function submenushow(id, menuId, level){
	var totalWidth = 0;
	stopHideSubMenu();
	if(document.getElementById(id)){
		var o			= document.getElementById(id);
		var container	= document.getElementById('sMainLinks');
		
		container.innerHTML	=	'<div id="subMenuContainer" style="display:block;">'+o.innerHTML+'</div>';
		gn	=	container.firstChild;
		
		$$('#sMainLinks a').each(
			function(x){
				totalWidth = totalWidth + x.getWidth() + 10;						
			}		
		);
		
		if (window['actualMenu']) {
			actualMenu.setStyle({backgroundImage: 'none', color: '#000000', border:'0px', borderLeft: '1px solid transparent', borderRight: '1px solid transparent'});		
		}
		
		var pos = $("mainMenu").viewportOffset();
		var posLeft = pos.left;
		
		var posMenu = $(menuId).viewportOffset();
		var posMenuLeft = posMenu.left;		

		var finalPosition = posMenuLeft - posLeft - 1;
		
		var top = '';
		if(level == 0){
			topPos = '186'; //topPos + pos.top;
		}else{
			topPos = 0;
		}
		$('subMenuContainer').setStyle({ position:'relative', left:finalPosition+'px', top:topPos+'px', width:'auto'})
		
		document.getElementById('subMenuContainer').style.backgroundPosition = '0 0';
		
		container.style.display='';

	}else{
		try{
		document.getElementById('sMainLinks').innerHTML='';
		}catch(e){}
	}
}

function showSlowly(){

}

function showObj(){

}

function resetSubMenu() {
	var container=document.getElementById('sMainLinks');
	container.innerHTML=actualSubMenu;
	
		if (window['actualMenu']) {
			actualMenu.setStyle({backgroundImage: 'url(css/design/santafe/menu_hover.jpg)', backgroundRepeat: 'repeat-x', color: '#cc0000', borderLeft: '1px solid #cc0000', borderRight: '1px solid #cc0000'});		
		}
}


// START: ADDED BY BETOSS //
function setItemMenuActive(menuId,subMenuId,uri){
	var parametersPOST = "";
	parametersPOST += '&action=setItemMenuActive';
	parametersPOST += '&menuId=' + menuId;
	parametersPOST += '&subMenuId=' + subMenuId;
	//alert(parametersPOST);
	/*var url = 'engines/menu/menu.php';
	var peticion = new Ajax.Request(url, 
	{
	method:'post',
	postBody: parametersPOST,
	onSuccess: 
	function(respuesta) {
	  var datos = respuesta.responseText;
	  window.location.href=uri;
	}, 
	onFailure: function() { alert('Se ha producido un error'+datos); }
	});*/
	window.location.href=uri;
	return true;
}
// END: ADDED BY BETOSS //


function submenuhide()
{
	try{
		document.getElementById('sMainLinks').innerHTML='';
	}catch(e){}
}

function startHideSubMenu(){
	hideMenu=1;
	setTimeout('hideSubMenu()',300);
}
function stopHideSubMenu(){
	hideMenu=0;
}

function hideSubMenu(){
	if(hideMenu==1){
		document.getElementById('sMainLinks').style.display='none';
	}
}
	/**
 * @author Bruno Bornsztein <bruno@missingmethod.com>
 * @copyright 2007 Curbly LLC
 * @package Glider
 * @license MIT
 * @url http://www.missingmethod.com/projects/glider/
 * @version 0.0.3
 * @dependencies prototype.js 1.5.1+, effects.js
 */

/*  Thanks to Andrew Dupont for refactoring help and code cleanup - http://andrewdupont.net/  */

Glider = Class.create();
Object.extend(Object.extend(Glider.prototype, Abstract.prototype), {
	initialize: function(wrapper, options){
	    this.scrolling  = false;
	    this.wrapper    = $(wrapper);
	    this.scroller   = this.wrapper.down('div.scroller');
	    this.sections   = this.wrapper.getElementsBySelector('div.section');
	    this.options    = Object.extend({ duration: 1.0, frequency: 3 }, options || {});

	    this.sections.each( function(section, index) {
	      section._index = index;
	    });    
 
	    this.events = {
	      click: this.click.bind(this)
	    };

	    this.addObservers();
			if(this.options.initialSection) this.moveTo(this.options.initialSection, this.scroller, { duration:this.options.duration });  // initialSection should be the id of the section you want to show up on load
			if(this.options.autoGlide) this.start();
	  },
	
  addObservers: function() {
    var controls = this.wrapper.getElementsBySelector('div.controls a');
    controls.invoke('observe', 'click', this.events.click);
  },	

  click: function(event) {
		this.stop();
    var element = Event.findElement(event, 'a');
    if (this.scrolling) this.scrolling.cancel();
    
    this.moveTo(element.href.split("#")[1], this.scroller, { duration:this.options.duration });     
    Event.stop(event);
  },

	moveTo: function(element, container, options){
			this.current = $(element);

			Position.prepare();
	    var containerOffset = Position.cumulativeOffset(container),
	     elementOffset = Position.cumulativeOffset($(element));

		  this.scrolling 	= new Effect.SmoothScroll(container, 
				{duration:options.duration, x:(elementOffset[0]-containerOffset[0]), y:(elementOffset[1]-containerOffset[1])});
		  return false;
		},
		
  next: function(){
    if (this.current) {
      var currentIndex = this.current._index;
      var nextIndex = (this.sections.length - 1 == currentIndex) ? 0 : currentIndex + 1;      
    } else var nextIndex = 1;

    this.moveTo(this.sections[nextIndex], this.scroller, { 
      duration: this.options.duration
    });
  },
	
  previous: function(){
    if (this.current) {
      var currentIndex = this.current._index;
      var prevIndex = (currentIndex == 0) ? this.sections.length - 1 : 
       currentIndex - 1;
    } else var prevIndex = this.sections.length - 1;
    
    this.moveTo(this.sections[prevIndex], this.scroller, { 
      duration: this.options.duration
    });
  },

	stop: function()
	{
		clearTimeout(this.timer);
	},
	
	start: function()
	{
		this.periodicallyUpdate();
	},
		
	periodicallyUpdate: function()
	{ 
		if (this.timer != null) {
			//alert(this.e);
			glindNext(this.wrapper.id);
			clearTimeout(this.timer);
			this.next();
		}
		this.timer = setTimeout(this.periodicallyUpdate.bind(this), this.options.frequency*this.options.slideDuration);
	}

});

Effect.SmoothScroll = Class.create();
Object.extend(Object.extend(Effect.SmoothScroll.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    var options = Object.extend({
      x:    0,
      y:    0,
      mode: 'absolute'
    } , arguments[1] || {}  );
    this.start(options);
  },
  setup: function() {
    if (this.options.continuous && !this.element._ext ) {
      this.element.cleanWhitespace();
      this.element._ext=true;
      this.element.appendChild(this.element.firstChild);
    }
   
    this.originalLeft=this.element.scrollLeft;
    this.originalTop=this.element.scrollTop;
   
    if(this.options.mode == 'absolute') {
      this.options.x -= this.originalLeft;
      this.options.y -= this.originalTop;
    } 
  },
  update: function(position) {   
    this.element.scrollLeft = this.options.x * position + this.originalLeft;
    this.element.scrollTop  = this.options.y * position + this.originalTop;
  }
});



function setActiveGlind(id,indId){
var x=1;

while (isDefined(GetId(indId+'_Ind_'+x))){
	GetId(indId+'_Ind_'+x).className='Indicator';
	x = x + 1;
	}
	GetId(id).className='active';
}
function glindPrev(indId){
	var x=1;
	//veo si ya no estoy en el 1
	if ('active'==GetId(indId+'_Ind_1').className){
		while (isDefined(GetId(indId+'_Ind_'+x))){
			GetId(indId+'_Ind_'+x).className='Indicator';
			x = x + 1;
			}
		x = x - 1;
		GetId(indId+'_Ind_'+x).className='active';
		}else{
			/* Obtengo el actual */
			x=1;
			
			while ('active'!=(GetId(indId+'_Ind_'+x).className)){
				x = x + 1;
				}
			/* x es el actual */
			
			GetId(indId+'_Ind_'+x).className='Indicator';
			x = x - 1;
			GetId(indId+'_Ind_'+x).className='active';
			}
	}
function glindNext(indId){
	var x=1;
	/*obtengo el actual*/
	while ('active'!=(GetId(indId+'_Ind_'+x).className)){
		x = x + 1;
		}
  	  x = x + 1;
	  if(isDefined(GetId(indId+'_Ind_'+x))){
	  	x = x - 1;
		GetId(indId+'_Ind_'+x).className='Indicator';
		x = x + 1;
		GetId(indId+'_Ind_'+x).className='active';
	  	}else{
			x = x - 1;
			GetId(indId+'_Ind_'+x).className='Indicator';
			GetId(indId+'_Ind_1').className='active';
			}
	}
	var KEY_GSTATIC_MAP = window['KEY_GSTATIC_MAP'] ? window['KEY_GSTATIC_MAP']  : (location.href.indexOf('local')!=-1 ? 'ABQIAAAAl3l7uHrKScJW5A8LoyZrWRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSL7TUWwkCU_EINqK7fr0Iz4ITa6Q' : 'ABQIAAAAl3l7uHrKScJW5A8LoyZrWRT2iLvoZZ4ypVVFuTZD1_70S9nIeBRkQo5r_Vqe2t-D4r_NxWEwreSF1g');
var SHOW_TIP_DELAY = 200;
var HIDE_TIP_DELAY =  100;

function PosObj(obj) {
	var b = obj.getBoundingClientRect(), doc = obj.ownerDocument, body = doc.body, docElem = doc.documentElement,
		clientTop = docElem.clientTop || body.clientTop || 0, 
		clientLeft = docElem.clientLeft || body.clientLeft || 0;

	return {x: b.left +  (docElem.scrollLeft || body.scrollLeft) - clientLeft,
			y: b.top  +  (docElem.scrollTop || body.scrollTop) - clientTop};

}


function g (id){
		return document.getElementById(id);
}

function gSzW(d) {
	var t = [0, 0], d=d || [document,window]; 
	if(typeof(d[1].innerWidth)=='number'){ 
		t = [d[1].innerWidth,d[1].innerHeight];
	}else if(d[0].documentElement && (d[0].documentElement.clientWidth||d[0].documentElement.clientHeight)){ 
		t = [d[0].documentElement.clientWidth,d[0].documentElement.clientHeight];
	}else if(d[0].body && ( d[0].body.clientWidth || d[0].body.clientHeight)){
		t = [d[0].body.clientWidth,d[0].body.clientHeight];
	}
		return t;
}

function showTip(o, data) {
		if (!o.getAttribute ('onmouseout')){
			o.setAttribute ('onmouseout', 'hideTip(this)');
		}
		if (o.shTm)return;
		if (o.hdTm)clearInterval (o.hdTm);
		
		o.shTm = setTimeout (function() {
						if (o.hdTm)clearInterval(o.hdTm);
						o.shTm = null;
						o.hdTm = null;
						o.className = 'tooltips_over';
						display_tooltip (o,data);
						o.tip = true;
				}, SHOW_TIP_DELAY);
}

function hideTip(o) {
	if (o.hdTm) return;
	if (o.shTm) clearInterval(o.shTm);
	
	o.hdTm = setTimeout(function(){
				if(o.shTm) clearInterval (o.shTm);
				o.shTm = null;
				o.hdTm = null;
					if (o.tip){ 
					o.className = 'tooltips';
					hidden_tooltip(o);
					o.tip=false;
					}
			}, HIDE_TIP_DELAY);
}

function display_tooltip (o, data){
	if (!window.ttip){
			ttip = document.createElement('div');
			ttip.className = 'tooltip_box';
			ttip.innerHTML = '<div class="arrow arrow_up" id="tooltip:arrow"><div></div></div> <div id="tooltip:content" class="content">aaa</div>';
			
			with(ttip.style){visibility='hidden'; top='0px'; left='-1000px';}
			document.body.appendChild(ttip);
			
	} else {
			ttip.style.visibility='hidden';
	}
	
			ttip.onmouseover = function(){ if (o.hdTm){ clearInterval (o.hdTm); o.hdTm = null;} };
			ttip.onmousemove = ttip.onmouseover;
			ttip.onmouseout = function(){ hideTip(o); };
			
		var type = typeof(data), pos = PosObj(o), Pos={x:0, y:0}, SzWin = gSzW(), html = '';
	
		ttip.style.width = 'auto';
		
		if (type=='string'){
			html = data;
			g('tooltip:content').innerHTML = html;
			var W = g('tooltip:content').offsetWidth;
			if( W<20)W = 20;
			ttip.style.width = (W>284) ? '300px' : (W)+'px';
		} else {
			html = '<a href="http://maps.google.com/maps?hl=en'+(data.m?'&q='+data.m:'')+''+(data.c?'&spn='+data.c:'')+'&z='+data.z+'" target="_blank" title="Go to Google Maps"><img src="http://maps.google.com/staticmap?zoom='+data.z+'&size=300x200&key='+KEY_GSTATIC_MAP;
			if (data.c)html += '&center='+data.c; 
			if (data.m)html +='&markers='+data.m;
			html += '" border="0"></a> ';
			if (data.t){ html += '<div class="c_">'+data.t+'</div>';}
			
			g('tooltip:content').innerHTML = html;
			ttip.style.width = '316px';
		}
		
			var H = ttip.offsetHeight;
			Pos.y = pos.y+o.offsetHeight+15;
			Pos.x = pos.x+((o.offsetWidth-ttip.offsetWidth)/2);
			
		if (Pos.x<10){
			Pos.x = 10;
			g('tooltip:arrow').style.left = ((pos.x-Pos.x)+(o.offsetWidth/2))+'px';
		} else {
			g('tooltip:arrow').style.left = '50%';
		}
		
		
		if (Pos.y+H > SzWin[1]){
			Pos.y = pos.y-H-15;
			g('tooltip:arrow').className='arrow arrow_down';
		} else {
			g('tooltip:arrow').className='arrow arrow_up';
		}
		
	ttip.style.top = Pos.y+'px';
	ttip.style.left = Pos.x+'px';
	ttip.style.visibility = 'visible';
}

function hidden_tooltip (o){
	if (window.ttip){
		ttip.style.visibility = 'hidden';
	}
}
	/*
Last Mod 2008-03-03
*/
function showHideBlock(id){
	showHide('blkContent'+id);
	}
function availableFlexPages(){

	showWin('z/controller.php?controller=availableFlexPages','Choose a Flex Page','600','500');
	centerDivWindow('winChooseaFlexPage');
	return false;
	}
function makeBackup(){
	if(confirm('Are you sure, you want to make a backup?')){
		diplayOverlay();
		goAJAX('sInteractLR','z/controller.php','controller=makeBackup','GetId("sOverlay").style.display="none";');
		}
	return false;
	}
function restoreBackup(id, id_current){
	if(confirm('Are you sure, you want to restore the backup?')){
		diplayOverlay();
		goAJAX('sInteractLR','z/controller.php','controller=restoreBackup&id_flex='+id+'&id_current='+id_current,'sRefresh();GetId("sOverlay").style.display="none";');
	}
	Windows.close("winChooseYourRestore");
	return false;
	}
function deleteBackup(id, name_backup){
	if(id<1){
		alert('Please, select any backup to delete.');
		return false;
	}
	if(confirm('Are you sure, you want to delete this ('+name_backup+') backup?')){
		diplayOverlay();
		goAJAX('sInteractLR','z/controller.php','controller=deleteBackup&id_flex='+id,'sRefresh();GetId("sOverlay").style.display="none";');
	}
	Windows.close("winChooseYourRestore");
	return false;
}
function showRestoreBackup(){
	showWin('z/controller.php?controller=showRestoreBackup','Choose Your Restore','600','400');
	//centerDivWindow('winConfigureModule');
	return false;
}
function writeFlexPage(){
	diplayOverlay();
	goAJAX('sInteractLR','z/controller.php','controller=writeFlexPage','GetId("sOverlay").style.display="none";');
	return false;
	}
function ExportE_template(){
	diplayOverlay();
	goAJAX('sInteractLR','z/controller.php','controller=exportE_template','GetId("sOverlay").style.display="none";');
	return false;
	}	
function saveOrder(order,column){
	var xP=(order) + '&c=' + column + '&controller=changeOrder';
	goAJAX('sGlobal','z/controller.php',xP);
	}
function makeSortable(cont){
		var clases=new Array('Left','Right','Horizontal');
   Sortable.create(cont,{tag:'div',hoverclass:'redBorder',constraint: false,only:clases,
      onChange:function(){
	  var order=Sortable.serialize(cont);
	  saveOrder(order,cont);
	  }
    })
	}
function loadCurrentFlexPage(){
	var xP='controller=loadCurrentFlexPage';
	goAJAX('cA','z/controller.php',xP,'sRefresh();');
	}
/* loads a form with a combo box of flex pages and the current flex page*/
/*function loadFormPages(){
	var xP='controller=loadFormPages';
	goAJAX('frmLoadPage','z/controller.php',xP);
	}*/
/* loads a combo box with the catalog editions of a flexpage*/
/*function loadEditions(flex_page_id){
	var xP='controller=loadEditions';
	xP = xP + '&flex_page_id=' + flex_page_id;
	goAJAX('Dcatalog_id','z/controller.php',xP);
	}*/
/* Lock / unlock Current page*/
function lockFlexPage(a){
	var xP='controller=lockFlexPage';
	xP = xP + '&acc=' + a;
	goAJAX('sLockButton','z/controller.php',xP);
	return false;
	}
/* sets the flex page and the edition, and then calls LoadCurrentpage and loadFormPages*/
function changePage(flex_page_id,catalog_id){
	var xP='controller=changePage';
	xP = xP + '&flex_page_id=' + flex_page_id;
	xP = xP + '&catalog_id=' + catalog_id;
	goAJAX('frmLoadPage','z/controller.php',xP,'loadCurrentFlexPage();Windows.close("winChooseaFlexPage");','','0','0');
	return false;
	}
/* make hidden a block*/
function hideBlock(i){
	var xP='controller=hideBlock';
	xP = xP + '&i=' + i;
	goAJAX('frmLoadPage','z/controller.php',xP,'loadCurrentFlexPage();');
	}
	


function showBlock(i){
	var xP='controller=showBlock';
	xP = xP + '&i=' + i;
	goAJAX('frmLoadPage','z/controller.php',xP,'loadCurrentFlexPage();');
	}

function makeSortable(cont){
		var clases=new Array('Left','Right','Horizontal');
   Sortable.create(cont,{tag:'div',hoverclass:'redBorder',constraint: false,only:clases,
      onChange:function(){
	  var order=Sortable.serialize(cont);
	  saveOrder(order,cont);
	  }
    })
	}
function sRefresh(){
	hideAllWindows();
	goAJAX('cA','z/controller.php','controller=LoadBlocks','makeSortable(\'cA\');');
	goAJAX('cB','z/controller.php','controller=LoadBlocksR','makeSortable(\'cB\');');

	goAJAX('hiddenBlocksContent','z/controller.php','controller=loadHiddenBlocks','');
	GetId("sOverlay").style.display="none";
}
function sChangeside(side,i){
	goAJAX('sInteractLR','z/controller.php','controller=sChangeside&side='+side+'&i='+i,'sRefresh();');
	//goAJAX('sInteractLR','z/hed.change.side.php','side='+side+'&i='+i,'sRefresh();');
}


/* Borrar un bloque */
function DeleteBlock(i){
	if (confirm('Are you sure?')){
		goAJAX('sInteractLR','z/controller.php','controller=DeleteBlock&i='+ i +'&d=d');
		 try { 
		 	Element.remove('BLK_'+i); 
		} 
		catch(err){ }
	}else{
		return false;
	}
}



/*marca*/
function editLoadArt(i){
	goAJAX('sArtZone','z/controller.php','controller=editLoadArt&i='+ i);
}


/* aï¿½adir un bloque a la izquierda */
function addNewBlock(){
	centerDivWindow('wAddNM');
	get('wAddNM').style.display='';
	goAJAX('wAddNMContent','z/controller.php','controller=NewBlock','centerDivWindow(\'wAddNM\');');
}
/* insertar un bloque a la izquierda */
function insertNewBlock(i,ii){
	//i Tipo Bloque
	//ii side
	goAJAX('wAddNMContent','z/controller.php','controller=NewBlock&i='+ i +'&d=n&ii='+ii,'get("wAddNM").style.display=\'none\';eval(respuesta)');
}
/* configurar un bloque*/
function configureBlock(i,ii){

	if (ii==1 || ii==31) {
		showWin('z/controller.php?controller=configureBlock&i='+i+'&ii='+ii,'Configure Module','850','540');	
	} else {
		showWin('z/controller.php?controller=configureBlock&i='+i+'&ii='+ii,'Configure Module','600','500');
	}
	
	centerDivWindow('winConfigureModule');
	return false;
}

/* Cambiar clase a un bloque */
function chchassl(id){
	GetId(id).className='Left';
	goAJAX('sInteractLR','z/controller.php', 'controller=changeClass&i='+id+'&c=1');
}
function chchassr(id){
	GetId(id).className='Right';
	goAJAX('sInteractLR','z/controller.php', 'controller=changeClass&i='+id+'&c=2');
}
function chchasslr(id){
	GetId(id).className='Horizontal';
	goAJAX('sInteractLR','z/controller.php', 'controller=changeClass&i='+id+'&c=0');
}

function showAddArticles(){
	//winajax('Articles','900','0','admins/Flex.Articles.Add.php','ajax=true','','');
	showWin('wcp/flex.articles.php?ajax=1','Insert Articles','950','500');
	return false;
}
function showAddBlogs(){
	//winajax('Blogs','900','0','admins/Flex.Blogs.Add.php','ajax=true','','');
	showWin('wcp/flex.blogs.php?ajax=1','Insert Blogs','950','500');
	return false;
}
function showAdminArticles(){
	winajax('Admin Articles','700','0','admins/Articles.php','ajax=true','','');
	return false;
}
function adminFlexPagesIssues(){
	putIn('winTit600','Manage Flex Pages Issues');
	goAJAX('winCont600','admins/Flex.Pages.Issues.php','ajax=true','centerDivWindow(\'win600\');showWindow(\'win600\');');
	return false;
}

function adminFlexPages(){
	showWin('wcp/flex.pages.php?ajax=1','Manage Flex Pages','800','500');
	return false;
}

function adminFlexPage(id){
	putIn('winTit600','Manage Flex Pages');
	//goAJAX('winCont600','admins/Flex.Pages.php?ak_m=E&ak_pk_id='+id,'ajax=true','showWindow(\'win600\');');
	showWin('wcp/flex.pages.php?ajax=1&ak_m=E&ak_pk_id='+id,'Manage Flex Pages','800','500');
	return false;
}

function addToFlex(article,hidden,row){
	goAJAX('','z/controller.php', 'controller=addArticle&i='+article+'&hidden='+hidden,"get('ak_row"+row+"').style.display='none';",'','0','0');
}



function addToFlexBlog(Blog,hidden,row){
	goAJAX('','z/controller.php', 'controller=addBlog&i='+Blog+'&hidden='+hidden,"get('ak_row"+row+"').style.display='none';",'','0','0');
}
function finishAddArticles(){
	get('sVentana').style.display='none';
	hideAllWindows();
	Windows.close("winConfigureModule");
	sRefresh();
}
function finishAddBlogs(){
	get('sVentana').style.display='none';
	hideAllWindows();
	sRefresh();
}
function akiSysAjax(a,b,exec){
	goAJAX(b,a+'&ajax=yeah','',exec);
	return false;
}
function akiSysAjaxPost(a,b,c){
	goAJAX(b,a,c+'&ajax=yeah');
	return false;
}
function akiSysAjaxG(a,b){
	closeWindow('win600');
	putIn('winTit700',b);
	goAJAX('winCont700',a,'ajax=true','showWindow(\'win700\');');
	return false;
}
function showQuickAdmin(){
	hideAllWindows();
	putIn('winTit600',' &raquo; Quick Open Admin');
	goAJAX('winCont600','admins/Quick.Open.Admin.menu.php','ajax=true','showWindow(\'win600\');');
	return false;
	}
	
	
function showSysWindow(winName,winTitle,winDiv,File,w,h){

	if(!isDefined(get(winName))){
		var win = new Window({id: winName, className: "alphacube", title: winTitle, width:w, height:h, wiredDrag: true,showEffectOptions:{duration:'0.2'},hideEffectOptions:{duration:'0.2'},recenterAuto:false}); 
		win.setDestroyOnClose(); 
		win.showCenter();
		win.setConstraint(true, {left:0, right:0, top: 90, bottom:10});
		win.toFront();
		win.setHTMLContent('<div id="'+winDiv+'"></div>');
		
		goAJAX(winDiv,File);
		get(winName).toFront;
		win.toFront();
	}else{
		get(winName).toFront;
	}

}
function showWin(href,title,w,h){
	if(!isDefined(w)||(w=='')){w=600;}
	if(!isDefined(h)||(h=='')){h=400;}
	var winTitle='win'+str_replace(' ','',title);
	var divTitle='div'+str_replace(' ','',title);
	href=href+'&hwnd='+Math.floor(Math.random( ) * 999 - 2) + 1;

	showSysWindow(winTitle,title,divTitle,href,w,h);
	return false;
	}
	

/* reemplazar el articulo de un bloque*/
function replaceBlock(i){
	showWin('wcp/flex.articles.replace.php?ajax=1&i='+i,'Replace Articles','950','500');
	new Effect.ScrollTo('winReplaceArticles', {offset: -150, duration: 1});
	return false
}

/* editar el articulo de un bloque

	http://core2.wehaa-server2.com/state/wcp/Articles.php?ak_m=EfF&ak_pk_id=8170&ak_sM2=0

*/
function editArtBlock(i){
	showWin('wcp/Articles.php?ajax=1&ak_m=EfF&ak_sM2=0&ak_pk_id='+i,'Edit Articles','950','500');
	new Effect.ScrollTo('winEditArticles', {offset: -150, duration: 1});
	return false
}


function replaceInFlex(articleID, moduleID){
	goAJAX('', 'z/controller.php', 'controller=replaceArticle&articleID='+articleID+'&moduleID='+moduleID, 'sRefresh();Windows.close("winReplaceArticles");', '', '0', '0');
}
	
