/**
 * -----------------------------------------------------------------------------
 * Dimensions 
 * Version: 1.2 http://brandonaaron.net
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(5($){$.19={P:\'1.2\'};$.u([\'j\',\'w\'],5(i,d){$.q[\'O\'+d]=5(){p(!3[0])6;g a=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';6 3.B(\':y\')?3[0][\'L\'+d]:4(3,d.x())+4(3,\'n\'+a)+4(3,\'n\'+e)};$.q[\'I\'+d]=5(b){p(!3[0])6;g c=d==\'j\'?\'s\':\'m\',e=d==\'j\'?\'D\':\'C\';b=$.F({t:Z},b||{});g a=3.B(\':y\')?3[0][\'8\'+d]:4(3,d.x())+4(3,\'E\'+c+\'w\')+4(3,\'E\'+e+\'w\')+4(3,\'n\'+c)+4(3,\'n\'+e);6 a+(b.t?(4(3,\'t\'+c)+4(3,\'t\'+e)):0)}});$.u([\'m\',\'s\'],5(i,b){$.q[\'l\'+b]=5(a){p(!3[0])6;6 a!=W?3.u(5(){3==h||3==r?h.V(b==\'m\'?a:$(h)[\'U\'](),b==\'s\'?a:$(h)[\'T\']()):3[\'l\'+b]=a}):3[0]==h||3[0]==r?S[(b==\'m\'?\'R\':\'Q\')]||$.N&&r.M[\'l\'+b]||r.A[\'l\'+b]:3[0][\'l\'+b]}});$.q.F({z:5(){g a=0,f=0,o=3[0],8,9,7,v;p(o){7=3.7();8=3.8();9=7.8();8.f-=4(o,\'K\');8.k-=4(o,\'J\');9.f+=4(7,\'H\');9.k+=4(7,\'Y\');v={f:8.f-9.f,k:8.k-9.k}}6 v},7:5(){g a=3[0].7;G(a&&(!/^A|10$/i.16(a.15)&&$.14(a,\'z\')==\'13\'))a=a.7;6 $(a)}});5 4(a,b){6 12($.11(a.17?a[0]:a,b,18))||0}})(X);',62,72,'|||this|num|function|return|offsetParent|offset|parentOffset|||||borr|top|var|window||Height|left|scroll|Left|padding|elem|if|fn|document|Top|margin|each|results|Width|toLowerCase|visible|position|body|is|Right|Bottom|border|extend|while|borderTopWidth|outer|marginLeft|marginTop|client|documentElement|boxModel|inner|version|pageYOffset|pageXOffset|self|scrollTop|scrollLeft|scrollTo|undefined|jQuery|borderLeftWidth|false|html|curCSS|parseInt|static|css|tagName|test|jquery|true|dimensions'.split('|'),0,{}));

/**
 * ----------------------------------------------------------------------------- 
 * Создание MD5 из получаемой строки 
 * Обращение к функции: hex_md5(something); 
 */
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}('q I=0;r R(a){s O(S(J(a)))}r 19(a,b){s O(T(J(a),J(b)))}r 1a(){s R("1b").1c()=="1d"}r S(a){s P(D(K(a),a.x*8))}r T(c,f){q e=K(c);A(e.x>16){e=D(e,c.x*8)}q a=L(16),d=L(16);B(q b=0;b<16;b++){a[b]=e[b]^1e;d[b]=e[b]^1f}q g=D(a.U(K(f)),V+f.x*8);s P(D(d.U(g),V+z))}r O(c){1g{I}1h(g){I=0}q f=I?"1i":"1j";q b="";q a;B(q d=0;d<c.x;d++){a=c.M(d);b+=f.W((a>>>4)&15)+f.W(a&15)}s b}r J(c){q b="";q d=-1;q a,e;1k(++d<c.x){a=c.M(d);e=d+1<c.x?c.M(d+1):0;A(1l<=a&&a<=1m&&1n<=e&&e<=1o){a=1p+((a&X)<<10)+(e&X);d++}A(a<=1q){b+=E.F(a)}Q{A(a<=1r){b+=E.F(1s|((a>>>6)&1t),z|(a&C))}Q{A(a<=N){b+=E.F(1u|((a>>>12)&15),z|((a>>>6)&C),z|(a&C))}Q{A(a<=1v){b+=E.F(1w|((a>>>18)&7),z|((a>>>12)&C),z|((a>>>6)&C),z|(a&C))}}}}}s b}r K(b){q a=L(b.x>>2);B(q c=0;c<a.x;c++){a[c]=0}B(q c=0;c<b.x*8;c+=8){a[c>>5]|=(b.M(c/8)&Y)<<(c%G)}s a}r P(b){q a="";B(q c=0;c<b.x*G;c+=8){a+=E.F((b[c>>5]>>>(c%G))&Y)}s a}r D(p,k){p[k>>5]|=z<<((k)%G);p[(((k+1x)>>>9)<<4)+14]=k;q o=1y;q n=-1z;q m=-1A;q l=1B;B(q g=0;g<p.x;g+=16){q j=o;q h=n;q f=m;q e=l;o=t(o,n,m,l,p[g+0],7,-1C);l=t(l,o,n,m,p[g+1],12,-1D);m=t(m,l,o,n,p[g+2],17,1E);n=t(n,m,l,o,p[g+3],22,-1F);o=t(o,n,m,l,p[g+4],7,-1G);l=t(l,o,n,m,p[g+5],12,1H);m=t(m,l,o,n,p[g+6],17,-1I);n=t(n,m,l,o,p[g+7],22,-1J);o=t(o,n,m,l,p[g+8],7,1K);l=t(l,o,n,m,p[g+9],12,-1L);m=t(m,l,o,n,p[g+10],17,-1M);n=t(n,m,l,o,p[g+11],22,-1N);o=t(o,n,m,l,p[g+12],7,1O);l=t(l,o,n,m,p[g+13],12,-1P);m=t(m,l,o,n,p[g+14],17,-1Q);n=t(n,m,l,o,p[g+15],22,1R);o=u(o,n,m,l,p[g+1],5,-1S);l=u(l,o,n,m,p[g+6],9,-1T);m=u(m,l,o,n,p[g+11],14,1U);n=u(n,m,l,o,p[g+0],20,-1V);o=u(o,n,m,l,p[g+5],5,-1W);l=u(l,o,n,m,p[g+10],9,1X);m=u(m,l,o,n,p[g+15],14,-1Y);n=u(n,m,l,o,p[g+4],20,-1Z);o=u(o,n,m,l,p[g+9],5,24);l=u(l,o,n,m,p[g+14],9,-25);m=u(m,l,o,n,p[g+3],14,-26);n=u(n,m,l,o,p[g+8],20,27);o=u(o,n,m,l,p[g+13],5,-28);l=u(l,o,n,m,p[g+2],9,-29);m=u(m,l,o,n,p[g+7],14,2a);n=u(n,m,l,o,p[g+12],20,-2b);o=v(o,n,m,l,p[g+5],4,-2c);l=v(l,o,n,m,p[g+8],11,-2d);m=v(m,l,o,n,p[g+11],16,2e);n=v(n,m,l,o,p[g+14],23,-2f);o=v(o,n,m,l,p[g+1],4,-2g);l=v(l,o,n,m,p[g+4],11,2h);m=v(m,l,o,n,p[g+7],16,-2i);n=v(n,m,l,o,p[g+10],23,-2j);o=v(o,n,m,l,p[g+13],4,2k);l=v(l,o,n,m,p[g+0],11,-2l);m=v(m,l,o,n,p[g+3],16,-2m);n=v(n,m,l,o,p[g+6],23,2n);o=v(o,n,m,l,p[g+9],4,-2o);l=v(l,o,n,m,p[g+12],11,-2p);m=v(m,l,o,n,p[g+15],16,2q);n=v(n,m,l,o,p[g+2],23,-2r);o=w(o,n,m,l,p[g+0],6,-2s);l=w(l,o,n,m,p[g+7],10,2t);m=w(m,l,o,n,p[g+14],15,-2u);n=w(n,m,l,o,p[g+5],21,-2v);o=w(o,n,m,l,p[g+12],6,2w);l=w(l,o,n,m,p[g+3],10,-2x);m=w(m,l,o,n,p[g+10],15,-2y);n=w(n,m,l,o,p[g+1],21,-2z);o=w(o,n,m,l,p[g+8],6,2A);l=w(l,o,n,m,p[g+15],10,-2B);m=w(m,l,o,n,p[g+6],15,-2C);n=w(n,m,l,o,p[g+13],21,2D);o=w(o,n,m,l,p[g+4],6,-2E);l=w(l,o,n,m,p[g+11],10,-2F);m=w(m,l,o,n,p[g+2],15,2G);n=w(n,m,l,o,p[g+9],21,-2H);o=y(o,j);n=y(n,h);m=y(m,f);l=y(l,e)}s L(o,n,m,l)}r H(h,e,d,c,g,f){s y(Z(y(y(e,h),y(c,f)),g),d)}r t(g,f,k,j,e,i,h){s H((f&k)|((~f)&j),g,f,e,i,h)}r u(g,f,k,j,e,i,h){s H((f&j)|(k&(~j)),g,f,e,i,h)}r v(g,f,k,j,e,i,h){s H(f^k^j,g,f,e,i,h)}r w(g,f,k,j,e,i,h){s H(k^(f|(~j)),g,f,e,i,h)}r y(a,d){q c=(a&N)+(d&N);q b=(a>>16)+(d>>16)+(c>>16);s(b<<16)|(c&N)}r Z(a,b){s(a<<b)|(a>>>(G-b))};',62,168,'||||||||||||||||||||||||||var|function|return|md5_ff|md5_gg|md5_hh|md5_ii|length|safe_add|128|if|for|63|binl_md5|String|fromCharCode|32|md5_cmn|hexcase|str2rstr_utf8|rstr2binl|Array|charCodeAt|65535|rstr2hex|binl2rstr|else|hex_md5|rstr_md5|rstr_hmac_md5|concat|512|charAt|1023|255|bit_rol||||||||||hex_hmac_md5|md5_vm_test|abc|toLowerCase|900150983cd24fb0d6963f7d28e17f72|909522486|1549556828|try|catch|0123456789ABCDEF|0123456789abcdef|while|55296|56319|56320|57343|65536|127|2047|192|31|224|2097151|240|64|1732584193|271733879|1732584194|271733878|680876936|389564586|606105819|1044525330|176418897|1200080426|1473231341|45705983|1770035416|1958414417|42063|1990404162|1804603682|40341101|1502002290|1236535329|165796510|1069501632|643717713|373897302|701558691|38016083|660478335|405537848|||||568446438|1019803690|187363961|1163531501|1444681467|51403784|1735328473|1926607734|378558|2022574463|1839030562|35309556|1530992060|1272893353|155497632|1094730640|681279174|358537222|722521979|76029189|640364487|421815835|530742520|995338651|198630844|1126891415|1416354905|57434055|1700485571|1894986606|1051523|2054922799|1873313359|30611744|1560198380|1309151649|145523070|1120210379|718787259|343485551'.split('|'),0,{}));

/**
 * -----------------------------------------------------------------------------
 * jQuery Tooltip plugin 1.3 - Всплывающие подсказки
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 * http://docs.jquery.com/Plugins/Tooltip
 *
 * Copyright (c) 2006 - 2008 Jorn Zaefferer
 *
 * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(b($){g 2={},c,l,C,D=$.1G.1H&&/1I\\s(5\\.5|6\\.)/.1J(1K.1L),K=L;$.j={w:L,1e:{T:"::",U:1M,t:L,1f:L,V:"",m:25,f:-15,W:0.1N,X:"j"},1O:b(){$.j.w=!$.j.w}};$.M.1g({j:b(7){7=$.1g({},$.j.1e,7);1h(7);d 3.E(b(){$.1i(3,"j",7);3.Y=2.9.k("W");3.Z=3.l;$(3).1P("l");3.1Q=""}).1R(1j).1S(o).1T(o)},N:D?b(){d 3.E(b(){g O=$(3).k(\'10\');a(O.1U(/^p\\(["\']?(.*\\.1V)["\']?\\)$/i)){O=1W.$1;$(3).k({\'10\':\'1X\',\'1k\':"1Y:1Z.20.21(22=23, 24=26, 1l=\'"+O+"\')"}).E(b(){g F=$(3).k(\'F\');a(F!=\'27\'&&F!=\'1m\')$(3).k(\'F\',\'1m\')})}})}:b(){d 3},1n:D?b(){d 3.E(b(){$(3).k({\'1k\':\'\',10:\'\'})})}:b(){d 3},1o:b(){d 3.E(b(){$(3)[$(3).G()?"n":"o"]()})},p:b(){d 3.1p(\'28\')||3.1p(\'1l\')}});b 1h(7){a(2.9)d;2.9=$(\'<u X="\'+7.X+\'"><11></11><u 1q="e"></u><u 1q="p"></u></u>\').29(P.e).o();a($.M.Q)2.9.Q();2.l=$(\'11\',2.9);2.e=$(\'u.e\',2.9);2.p=$(\'u.p\',2.9)}b 7(1r){d $.1i(1r,"j")}b 1s(q){a(7(3).U)C=2a(n,7(3).U);r n();K=!!7(3).K;$(P.e).2b(\'12\',z);z(q)}b 1j(){a($.j.w||3==c||(!3.Z&&!7(3).13))d;c=3;l=3.Z;a(7(3).13){2.l.o();g H=7(3).13.2c(3);a(H.2d||H.2e){2.e.1t().14(H)}r{2.e.G(H)}2.e.n()}r a(7(3).T){g 16=l.2f(7(3).T);2.l.G(16.2g()).n();2.e.1t();2h(g i=0,17;(17=16[i]);i++){a(i>0)2.e.14("<2i/>");2.e.14(17)}2.e.1o()}r{2.l.G(l).n();2.e.o()}a(7(3).1f&&$(3).p())2.p.G($(3).p().2j(\'2k://\',\'\')).n();r 2.p.o();2.9.18(7(3).V);a(7(3).N)2.9.N();1s.2l(3,2m)}b n(){C=19;a((!D||!$.M.Q)&&7(c).t){a(2.9.R(":1u"))2.9.1a().n().1b(7(c).t,c.Y);r 2.9.R(\':1v\')?2.9.1b(7(c).t,c.Y):2.9.2n(7(c).t)}r{2.9.n()}z()}b z(q){a($.j.w)d;a(q&&q.2o.2p=="2q"){d}a(!K&&2.9.R(":1v")){$(P.e).1w(\'12\',z)}a(c==19){$(P.e).1w(\'12\',z);d}2.9.1c("A-B").1c("A-1x");g f=2.9[0].1y;g m=2.9[0].1z;a(q){f=q.2r+7(c).f;m=q.2s+7(c).m;g B=\'1A\';a(7(c).2t){B=$(I).1B()-f;f=\'1A\'}2.9.k({f:f,B:B,m:m})}g v=A(),h=2.9[0];a(v.x+v.1C<h.1y+h.1D){f-=h.1D+7(c).f;2.9.k({f:f+\'1d\'}).18("A-B")}a(v.y+v.1E<h.1z+h.1F){m-=h.1F+8+7(c).m;2.9.k({m:m+\'1d\'}).18("A-1x");2.9.k({f:f-4+\'1d\'})}}b A(){d{x:$(I).2u(),y:$(I).2v(),1C:$(I).1B(),1E:$(I).2w()}}b o(q){a($.j.w)d;a(C)2x(C);c=19;g J=7(3);b S(){2.9.1c(J.V).o().k("W","")}a((!D||!$.M.Q)&&J.t){a(2.9.R(\':1u\'))2.9.1a().1b(J.t,0,S);r 2.9.1a().2y(J.t,S)}r S();a(7(3).N)2.9.1n()}})(2z);',62,160,'||helper|this||||settings||parent|if|function|current|return|body|left|var|||tooltip|css|title|top|show|hide|url|event|else||fade|div||blocked|||update|viewport|right|tID|IE|each|position|html|bodyContent|window|tsettings|track|false|fn|fixPNG|image|document|bgiframe|is|complete|showBody|delay|extraClass|opacity|id|tOpacity|tooltipText|backgroundImage|h3|mousemove|bodyHandler|append||parts|part|addClass|null|stop|fadeTo|removeClass|px|defaults|showURL|extend|createHelper|data|save|filter|src|relative|unfixPNG|hideWhenEmpty|attr|class|element|handle|empty|animated|visible|unbind|bottom|offsetLeft|offsetTop|auto|width|cx|offsetWidth|cy|offsetHeight|browser|msie|MSIE|test|navigator|userAgent|200|85|block|removeAttr|alt|mouseover|mouseout|click|match|png|RegExp|none|progid|DXImageTransform|Microsoft|AlphaImageLoader|enabled|true|sizingMethod||crop|absolute|href|appendTo|setTimeout|bind|call|nodeType|jquery|split|shift|for|br|replace|http|apply|arguments|fadeIn|target|tagName|OPTION|pageX|pageY|positionLeft|scrollLeft|scrollTop|height|clearTimeout|fadeOut|jQuery'.split('|'),0,{}));

/**
 * -----------------------------------------------------------------------------
 * Cornerz 0.6 Закругливание углов
 * http://parkerfox.co.uk/
 */
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}(';(9($){7($.M.N&&R.S["v"]==1e){R.S.1f("v","1g:1h-1i-1j:1k","#1l#1m")}$.1n.1o=9(i){9 T(t,l,r,a,b,c){4 d,B,1p,C,D,x,y,p=1.1q,n="q:E;";7(t){d=-p;D=r;y=0;n+="O:-"+a+"6;"}s{d=p;D=0;y=r;n+="F:-"+a+"6;"}7(l){B=p*2;C=r;x=0;n+="G:-"+a+"6;"}s{B=0;C=0;x=r;n+="H:-"+a+"6;"}4 e=$("<U u="+r+"6 I="+r+"6 o=\'"+n+"\' ></U>");4 f=e[0].1r(\'1s\');f.1t();f.V=a*2;f.W(C,D,r,d,B,!(t^l));f.1u=b;f.1v();f.V=0;f.1w(x,y);f.1x=c;f.1y();z e};9 X(a,r,b,c,d){4 e=$("<A o=\'1z: 1A\' />");$.P(a.Y(" "),9(){e.Z(T(8[0]=="t",8[1]=="l",r,b,c,d))});z e};9 Q(r,b,c,m,a,d,e){4 l=m-a-e;4 t=m-d;z"<v:W 1B=\'1C\' 1D=\'"+b+"6\' 1E=\'"+c+"\' 1F=\'0\' 1G=\'1H\' o=\' O:"+t+"6;G: "+l+"6;u:"+r+"6; I:"+r+"6\' />"}9 11(b,r,c,d,e,w){4 h="<A o=\'1I-1J:G; \'>";$.P($.1K(b).Y(" "),9(){4 a,J=1,K=1,L=0;7(8.12(0)=="t"){a="O:-"+c+"6;"}s{a="F:-"+c+"6;";K=r+1}7(8.12(1)=="l")a+="G:-"+c+"6;";s{a+="H:-"+(c)+"6; ";J=r;L=1}h+="<A o=\'"+a+"; q: E; 1L:1M; u:"+r+"6; I: "+r+"6;\'>";h+="<v:13  o=\'u:14;I:14;q:E;\' 1N=\'15,15\' >";h+=Q(r*3,r+c,e,-r/2,J,K,L);7(c>0)h+=Q(r*2-c,c,d,1O.1P(c/2+0.5),J,K,L);h+="</v:13>";h+="</A>"});h+="</A>";z h};4 j={16:"1Q 1R 1S 1T",17:10,18:"1U",19:0,1a:1V};$.1W(j,i||{});4 k=9(a,b,x){4 y=1b(a.n(b),10)||0;a.n(b,x+y)};z 8.P(9(){4 a=$(8);4 r=j.17*1.0;4 b=(j.19||1b(a.n("1X"),10)||0)*1.0;4 c=j.18;4 d=j.1Y;d=d||(b>0?a.n("1Z"):c);4 e=j.16;7($.M.N){h=11(e,r,b,d,c,$(8).u());8.20(\'21\',h)}s a.Z(X(e,r,b,d,c));7(8.o.q!="E")8.o.q="22";8.o.23=1;7($.M.N&&j.1a){4 f=a.24();4 g=a.25();7(f%2==1){k(a,"1c-H",1);k(a,"1d-H",1)}7(g%2==1){k(a,"1c-F",1);k(a,"1d-F",1)}}})}})(26);',62,131,'||||var||px|if|this|function||||||||||||||css|style||position||else||width|||||return|div|ea|sx|sy|absolute|bottom|left|right|height|ml|mt|right_fix|browser|msie|top|each|vmlCurve|document|namespaces|canvasCorner|canvas|lineWidth|arc|canvasCorners|split|append||vmlCorners|charAt|group|1000px|1000|corners|radius|background|borderWidth|fixIE|parseInt|padding|margin|null|add|urn|schemas|microsoft|com|vml|default|VML|fn|cornerz|cw|57|getContext|2d|beginPath|strokeStyle|stroke|lineTo|fillStyle|fill|display|inherit|filled|False|strokeweight|strokecolor|startangle|endangle|361|text|align|trim|overflow|hidden|coordsize|Math|floor|tl|tr|bl|br|white|true|extend|borderTopWidth|borderColor|borderTopColor|insertAdjacentHTML|beforeEnd|relative|zoom|outerWidth|outerHeight|jQuery'.split('|'),0,{}));


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


/**
 * -----------------------------------------------------------------------------
 * Cookie plugin - Запись в куки по нажатия на toggleElements 
 * (c) 2006 Klaus Hartl (stilbuero.de)
 */
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}('j.5=q(8,9,2){6(e 9!=\'r\'){2=2||{};6(9===k){9=\'\';2.3=-1}4 3=\'\';6(2.3&&(e 2.3==\'l\'||2.3.m)){4 7;6(e 2.3==\'l\'){7=s t();7.u(7.v()+(2.3*w*n*n*x))}o{7=2.3}3=\'; 3=\'+7.m()}4 a=2.a?\'; a=\'+(2.a):\'\';4 b=2.b?\'; b=\'+(2.b):\'\';4 c=2.c?\'; c\':\'\';d.5=[8,\'=\',y(9),3,a,b,c].z(\'\')}o{4 f=k;6(d.5&&d.5!=\'\'){4 g=d.5.A(\';\');B(4 i=0;i<g.h;i++){4 5=j.C(g[i]);6(5.p(0,8.h+1)==(8+\'=\')){f=D(5.p(8.h+1));E}}}F f}};',42,42,'||options|expires|var|cookie|if|date|name|value|path|domain|secure|document|typeof|cookieValue|cookies|length||jQuery|null|number|toUTCString|60|else|substring|function|undefined|new|Date|setTime|getTime|24|1000|encodeURIComponent|join|split|for|trim|decodeURIComponent|break|return'.split('|'),0,{}));
 
 /**
 * -----------------------------------------------------------------------------
 * Step Carousel Viewer- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com
 * Script Download/ http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm
 * Usage Terms: http://www.dynamicdrive.com/notice.htm
 * Current version (Sept 29th, 09'): 1.8 See http://www.dynamicdrive.com/dynamicindex4/stepcarouselchangelog.txt for details
 */
var stepcarousel={
	ajaxloadingmsg: '<div style="margin: 1em; font-weight: bold"><img src="/templates/images/loading.gif" style="vertical-align: middle" /> Fetching Content. Please wait...</div>', //customize HTML to show while fetching Ajax content
	defaultbuttonsfade: 0.4, //Fade degree for disabled nav buttons (0=completely transparent, 1=completely opaque)
	configholder: {},

	getCSSValue:function(val){ //Returns either 0 (if val contains 'auto') or val as an integer
		return (val=="auto")? 0 : parseInt(val)
	},

	getremotepanels:function($, config){ //function to fetch external page containing the panel DIVs
		config.$belt.html(this.ajaxloadingmsg)
		$.ajax({
			url: config.contenttype[1], //path to external content
			async: true,
			error:function(ajaxrequest){
				config.$belt.html('Error fetching content.<br />Server Response: '+ajaxrequest.responseText)
			},
			success:function(content){
				config.$belt.html(content)
				config.$panels=config.$gallery.find('.'+config.panelclass)
				stepcarousel.alignpanels($, config)
			}
		})
	},

	getoffset:function(what, offsettype){
		return (what.offsetParent)? what[offsettype]+this.getoffset(what.offsetParent, offsettype) : what[offsettype]
	},

	getCookie:function(Name){ 
		var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
		if (document.cookie.match(re)) //if cookie found
			return document.cookie.match(re)[0].split("=")[1] //return its value
		return null
	},

	setCookie:function(name, value){
		document.cookie = name+"="+value
	},

	fadebuttons:function(config, currentpanel){
		config.$leftnavbutton.fadeTo('fast', currentpanel==0? this.defaultbuttonsfade : 1)
		config.$rightnavbutton.fadeTo('fast', currentpanel==config.lastvisiblepanel? this.defaultbuttonsfade : 1)
		if (currentpanel==config.lastvisiblepanel){
			stepcarousel.stopautostep(config)
		}

	},

	addnavbuttons:function($, config, currentpanel){
		config.$leftnavbutton=$('<img src="'+config.defaultbuttons.leftnav[0]+'">').css({zIndex:50, position:'absolute', left:config.offsets.left+config.defaultbuttons.leftnav[1]+'px', top:config.offsets.top+config.defaultbuttons.leftnav[2]+'px', cursor:'hand', cursor:'pointer'}).attr({title:'Назад на '+config.defaultbuttons.moveby+' кадр'}).appendTo('body')
		config.$rightnavbutton=$('<img src="'+config.defaultbuttons.rightnav[0]+'">').css({zIndex:50, position:'absolute', left:config.offsets.left+config.$gallery.get(0).offsetWidth+config.defaultbuttons.rightnav[1]+'px', top:config.offsets.top+config.defaultbuttons.rightnav[2]+'px', cursor:'hand', cursor:'pointer'}).attr({title:'Вперед на '+config.defaultbuttons.moveby+' кадр'}).appendTo('body')
		config.$leftnavbutton.bind('click', function(){ //assign nav button event handlers
			stepcarousel.stepBy(config.galleryid, -config.defaultbuttons.moveby)
		})
		config.$rightnavbutton.bind('click', function(){ //assign nav button event handlers
			stepcarousel.stepBy(config.galleryid, config.defaultbuttons.moveby)
		})
		if (config.panelbehavior.wraparound==false){ //if carousel viewer should stop at first or last panel (instead of wrap back or forth)
			this.fadebuttons(config, currentpanel)
		}
		return config.$leftnavbutton.add(config.$rightnavbutton)
	},

	alignpanels:function($, config){
		var paneloffset=0
		config.paneloffsets=[paneloffset] //array to store upper left offset of each panel (1st element=0)
		config.panelwidths=[] //array to store widths of each panel
		config.$panels.each(function(index){ //loop through panels
			var $currentpanel=$(this)
			$currentpanel.css({float: 'none', position: 'absolute', left: paneloffset+'px'}) //position panel
			$currentpanel.bind('click', function(e){return config.onpanelclick(e.target)}) //bind onpanelclick() to onclick event
			paneloffset+=stepcarousel.getCSSValue($currentpanel.css('marginRight')) + parseInt($currentpanel.get(0).offsetWidth || $currentpanel.css('width')) //calculate next panel offset
			config.paneloffsets.push(paneloffset) //remember this offset
			config.panelwidths.push(paneloffset-config.paneloffsets[config.paneloffsets.length-2]) //remember panel width
		})
		config.paneloffsets.pop() //delete last offset (redundant)
		var addpanelwidths=0
		var lastpanelindex=config.$panels.length-1
		config.lastvisiblepanel=lastpanelindex
		for (var i=config.$panels.length-1; i>=0; i--){
			addpanelwidths+=(i==lastpanelindex? config.panelwidths[lastpanelindex] : config.paneloffsets[i+1]-config.paneloffsets[i])
			if (config.gallerywidth>addpanelwidths){
				config.lastvisiblepanel=i //calculate index of panel that when in 1st position reveals the very last panel all at once based on gallery width
			}
		}
		config.$belt.css({width: paneloffset+'px'}) //Set Belt DIV to total panels' widths
		config.currentpanel=(config.panelbehavior.persist)? parseInt(this.getCookie(config.galleryid+"persist")) : 0 //determine 1st panel to show by default
		config.currentpanel=(typeof config.currentpanel=="number" && config.currentpanel<config.$panels.length)? config.currentpanel : 0
		var endpoint=config.paneloffsets[config.currentpanel]+(config.currentpanel==0? 0 : config.beltoffset)
		config.$belt.css({left: -endpoint+'px'})
		if (config.defaultbuttons.enable==true){ //if enable default back/forth nav buttons
			var $navbuttons=this.addnavbuttons($, config, config.currentpanel)
			$(window).bind("load resize", function(){ //refresh position of nav buttons when page loads/resizes, in case offsets weren't available document.oncontentload
				config.offsets={left:stepcarousel.getoffset(config.$gallery.get(0), "offsetLeft"), top:stepcarousel.getoffset(config.$gallery.get(0), "offsetTop")}
				config.$leftnavbutton.css({left:config.offsets.left+config.defaultbuttons.leftnav[1]+'px', top:config.offsets.top+config.defaultbuttons.leftnav[2]+'px'})
				config.$rightnavbutton.css({left:config.offsets.left+config.$gallery.get(0).offsetWidth+config.defaultbuttons.rightnav[1]+'px', top:config.offsets.top+config.defaultbuttons.rightnav[2]+'px'})
			})
		}
		if (config.autostep && config.autostep.enable){ //enable auto stepping of Carousel?		
			var $carouselparts=config.$gallery.add(typeof $navbuttons!="undefined"? $navbuttons : null)
			$carouselparts.bind('click', function(){
				config.autostep.status="stopped"
				stepcarousel.stopautostep(config)
			})
			$carouselparts.hover(function(){ //onMouseover
				stepcarousel.stopautostep(config)
				config.autostep.hoverstate="over"
			}, function(){ //onMouseout
				if (config.steptimer && config.autostep.hoverstate=="over" && config.autostep.status!="stopped"){
					config.steptimer=setInterval(function(){stepcarousel.autorotate(config.galleryid)}, config.autostep.pause)
					config.autostep.hoverstate="out"
				}
			})
			config.steptimer=setInterval(function(){stepcarousel.autorotate(config.galleryid)}, config.autostep.pause) //automatically rotate Carousel Viewer
		} //end enable auto stepping check
		this.createpaginate($, config)
		this.statusreport(config.galleryid)
		config.oninit()
		config.onslideaction(this)
	},

	stepTo:function(galleryid, pindex){ /*User entered pindex starts at 1 for intuitiveness. Internally pindex still starts at 0 */
		var config=stepcarousel.configholder[galleryid]
		if (typeof config=="undefined"){
			//alert("There's an error with your set up of Carousel Viewer \""+galleryid+ "\"!")
			return
		}
		stepcarousel.stopautostep(config)
		var pindex=Math.min(pindex-1, config.paneloffsets.length-1)
		var endpoint=config.paneloffsets[pindex]+(pindex==0? 0 : config.beltoffset)
		if (config.panelbehavior.wraparound==false && config.defaultbuttons.enable==true){ //if carousel viewer should stop at first or last panel (instead of wrap back or forth)
			this.fadebuttons(config, pindex)
		}
		config.$belt.animate({left: -endpoint+'px'}, config.panelbehavior.speed, function(){config.onslideaction(this)})
		config.currentpanel=pindex
		this.statusreport(galleryid)
	},

	stepBy:function(galleryid, steps, isauto){
		var config=stepcarousel.configholder[galleryid]
		if (typeof config=="undefined"){
			//alert("There's an error with your set up of Carousel Viewer \""+galleryid+ "\"!")
			return
		}
		if (!isauto) //if stepBy() function isn't called by autorotate() function
			stepcarousel.stopautostep(config)
		var direction=(steps>0)? 'forward' : 'back' //If "steps" is negative, that means backwards
		var pindex=config.currentpanel+steps //index of panel to stop at
		if (config.panelbehavior.wraparound==false){ //if carousel viewer should stop at first or last panel (instead of wrap back or forth)
			pindex=(direction=="back" && pindex<=0)? 0 : (direction=="forward")? Math.min(pindex, config.lastvisiblepanel) : pindex
			if (config.defaultbuttons.enable==true){ //if default nav buttons are enabled, fade them in and out depending on if at start or end of carousel
				stepcarousel.fadebuttons(config, pindex)
			}	
		}
		else{ //else, for normal stepBy behavior
			if (pindex>config.lastvisiblepanel && direction=="forward"){
				//if destination pindex is greater than last visible panel, yet we're currently not at the end of the carousel yet
				pindex=(config.currentpanel<config.lastvisiblepanel)? config.lastvisiblepanel : 0
			}
			else if (pindex<0 && direction=="back"){
				//if destination pindex is less than 0, yet we're currently not at the beginning of the carousel yet
				pindex=(config.currentpanel>0)? 0 : config.lastvisiblepanel /*wrap around left*/
			}
		}
		var endpoint=config.paneloffsets[pindex]+(pindex==0? 0 : config.beltoffset) //left distance for Belt DIV to travel to
		if (pindex==0 && direction=='forward' || config.currentpanel==0 && direction=='back' && config.panelbehavior.wraparound==true){ //decide whether to apply "push pull" effect
			config.$belt.animate({left: -config.paneloffsets[config.currentpanel]-(direction=='forward'? 100 : -30)+'px'}, 'normal', function(){
				config.$belt.animate({left: -endpoint+'px'}, config.panelbehavior.speed, function(){config.onslideaction(this)})
			})
		}
		else
			config.$belt.animate({left: -endpoint+'px'}, config.panelbehavior.speed, function(){config.onslideaction(this)})
		config.currentpanel=pindex
		this.statusreport(galleryid)
	},

	autorotate:function(galleryid){
		var config=stepcarousel.configholder[galleryid]
		this.stepBy(galleryid, config.autostep.moveby, true)
	},

	stopautostep:function(config){
		clearTimeout(config.steptimer)
	},

	statusreport:function(galleryid){
		var config=stepcarousel.configholder[galleryid]
		if (config.statusvars.length==3){ //if 3 status vars defined
			var startpoint=config.currentpanel //index of first visible panel 
			var visiblewidth=0
			for (var endpoint=startpoint; endpoint<config.paneloffsets.length; endpoint++){ //index (endpoint) of last visible panel
				visiblewidth+=config.panelwidths[endpoint]
				if (visiblewidth>config.gallerywidth){
					break
				}
			}
			startpoint+=1 //format startpoint for user friendiness
			endpoint=(endpoint+1==startpoint)? startpoint : endpoint //If only one image visible on the screen and partially hidden, set endpoint to startpoint
			var valuearray=[startpoint, endpoint, config.panelwidths.length]
			for (var i=0; i<config.statusvars.length; i++){
				window[config.statusvars[i]]=valuearray[i] //Define variable (with user specified name) and set to one of the status values
				config.$statusobjs[i].text(valuearray[i]+" ") //Populate element on page with ID="user specified name" with one of the status values
			}
		}
		stepcarousel.selectpaginate(jQuery, galleryid)
	},

	createpaginate:function($, config){
		if (config.$paginatediv.length==1){
			var $templateimg=config.$paginatediv.find('img["data-over"]:eq(0)') //reference first matching image on page
			var controlpoints=[], controlsrc=[], imgarray=[], moveby=$templateimg.attr("data-moveby") || 1
			var asize=(moveby==1? 0:1) + Math.floor((config.lastvisiblepanel+1) / moveby) //calculate # of pagination links to create
			var imghtml=$('<div>').append($templateimg.clone()).html() //get HTML of first matching image
			srcs=[$templateimg.attr('src'), $templateimg.attr('data-over'), $templateimg.attr('data-select')] //remember control's over and out, and selected image src
			for (var i=0; i<asize; i++){
				var moveto=Math.min(i*moveby, config.lastvisiblepanel)
				imgarray.push(imghtml.replace(/>$/, ' data-index="'+i+'" data-moveto="'+moveto+'" title="Move to Panel '+(moveto+1)+'">') +'\n')
				controlpoints.push(moveto) //store panel index each control goes to when clicked on
			}
			var $controls=$('<span></span>').replaceAll($templateimg).append(imgarray.join('')).find('img') //replace template link with links and return them
			$controls.css({cursor:'pointer'})
			config.$paginatediv.bind('click', function(e){
				var $target=$(e.target)
				if ($target.is('img') && $target.attr('data-over')){
					stepcarousel.stepTo(config.galleryid, parseInt($target.attr('data-moveto'))+1)
				}
			})
			config.$paginatediv.bind('mouseover mouseout', function(e){
				var $target=$(e.target)
				if ($target.is('img') && $target.attr('data-over')){
					if (parseInt($target.attr('data-index')) != config.pageinfo.curselected) //if this isn't the selected link
						$target.attr('src', srcs[(e.type=="mouseover")? 1 : 0])
				}
			})
			config.pageinfo={controlpoints:controlpoints, $controls:$controls,  srcs:srcs, prevselected:null, curselected:null}
		}
	},

	
	selectpaginate:function($, galleryid){
		var config=stepcarousel.configholder[galleryid]
		if (config.$paginatediv.length==1){
			for (var i=0; i<config.pageinfo.controlpoints.length; i++){
				if (config.pageinfo.controlpoints[i] <= config.currentpanel) //find largest control point that's less than or equal to current panel shown
					config.pageinfo.curselected=i
			}
			if (typeof config.pageinfo.prevselected!=null) //deselect previously selected link (if found)
				config.pageinfo.$controls.eq(config.pageinfo.prevselected).attr('src', config.pageinfo.srcs[0])
			config.pageinfo.$controls.eq(config.pageinfo.curselected).attr('src', config.pageinfo.srcs[2]) //select current paginate link
			config.pageinfo.prevselected=config.pageinfo.curselected //set current selected link to previous
		}
	},


	loadcontent:function(galleryid, url){
		var config=stepcarousel.configholder[galleryid]
		config.contenttype=['ajax', url]
		stepcarousel.stopautostep(config)
		stepcarousel.resetsettings($, config)
		stepcarousel.init(jQuery, config)

	},

	init:function($, config){
		config.gallerywidth=config.$gallery.width()
		config.offsets={left:stepcarousel.getoffset(config.$gallery.get(0), "offsetLeft"), top:stepcarousel.getoffset(config.$gallery.get(0), "offsetTop")}
		config.$belt=config.$gallery.find('.'+config.beltclass) //Find Belt DIV that contains all the panels
		config.$panels=config.$gallery.find('.'+config.panelclass) //Find Panel DIVs that each contain a slide
		config.$paginatediv=$('#'+config.galleryid+'-paginate') //get pagination DIV (if defined)
		if (config.autostep)
			config.autostep.pause+=config.panelbehavior.speed
		config.onpanelclick=(typeof config.onpanelclick=="undefined")? function(target){} : config.onpanelclick //attach custom "onpanelclick" event handler
		config.onslideaction=(typeof config.onslide=="undefined")? function(){} : function(beltobj){$(beltobj).stop(); config.onslide()} //attach custom "onslide" event handler
		config.oninit=(typeof config.oninit=="undefined")? function(){} : config.oninit //attach custom "oninit" event handler
		config.beltoffset=stepcarousel.getCSSValue(config.$belt.css('marginLeft')) //Find length of Belt DIV's left margin
		config.statusvars=config.statusvars || []  //get variable names that will hold "start", "end", and "total" slides info
		config.$statusobjs=[$('#'+config.statusvars[0]), $('#'+config.statusvars[1]), $('#'+config.statusvars[2])]
		config.currentpanel=0
		stepcarousel.configholder[config.galleryid]=config //store config parameter as a variable
		if (config.contenttype[0]=="ajax" && typeof config.contenttype[1]!="undefined") //fetch ajax content?
			stepcarousel.getremotepanels($, config)
		else
			stepcarousel.alignpanels($, config) //align panels and initialize gallery
	},

	resetsettings:function($, config){
		config.$gallery.unbind()
		config.$belt.stop()
		config.$panels.remove()
		if (config.$leftnavbutton){
			config.$leftnavbutton.remove()
			config.$rightnavbutton.remove()
		}
		if (config.$paginatediv.length==1){
			config.$paginatediv.unbind()
			config.pageinfo.$controls.eq(0).attr('src', config.pageinfo.srcs[0]).removeAttr('data-index').removeAttr('data-moveto').removeAttr('title') //reset first pagination link so it acts as template again
			.end().slice(1).remove() //then remove all but first pagination link
		}
		if (config.autostep)
			config.autostep.status=null
		if (config.panelbehavior.persist){
			stepcarousel.setCookie(window[config.galleryid+"persist"], 0) //set initial panel to 0, overridden w/ current panel if window.unload is invoked
		}
	},

	setup:function(config){
		//Disable Step Gallery scrollbars ASAP dynamically (enabled for sake of users with JS disabled)
		document.write('<style type="text/css">\n#'+config.galleryid+'{overflow: hidden;}\n</style>')
		jQuery(document).ready(function($){
			config.$gallery=$('#'+config.galleryid)
			stepcarousel.init($, config)
		}) //end document.ready
		jQuery(window).bind('unload', function(){ //clean up on page unload
			stepcarousel.resetsettings($, config)
			if (config.panelbehavior.persist)
				stepcarousel.setCookie(config.galleryid+"persist", config.currentpanel)
			jQuery.each(config, function(ai, oi){
				oi=null
			})
			config=null
		})
	}
};
