/**
 * @author	RubaXa		<trash@rubaxa.org>
 * @created	2007-11-07 20:45
 * @build	2009-11-12 16:17:06
 * @version 2.5μ
 * Ядрышко
 */
var RubaXa={},jsCore={version:2.5,build:8};(function(){var DR=[],plugins=[];window.$R=function(r,c){window.domReady(function(){jsLoader.require(r,c)})};window.isDomReady=false;window.domReady=function(f){if(f){window.isDomReady?f():window._drLength=DR.push(f)}else{window.isDomReady=true;for(var i=0;DR[i];i++)DR[i]()}};window.$PP=function(id,p,o){plugins.push([id,p,o])};domReady(function(){if(n=plugins.length){$R('{plugins}jsPlugins',function(){$P.start('jsPlugins.processing ('+n+')');for(var i=0,p;p=plugins[i];i++){debug.log(p);$P.start(p[0]);jsPlugins.set($F(p[0]),(typeof p[1]=='string'?p[1]:'plugin'),(typeof p[1]=='string'?p[2]:p[1])||{});$P.stop()}$P.stop()})}});window.$P={s:'                                                  ',init:function(){this.clear();if(0&&!/(js-?prof(ile)?|debug=s)/i.test(document.location.href)){$P.start=$P.stop=$P.print=function(){return this}}if(window.profiler){for(var i=0;profiler[i];i+=2){$P.start(profiler[i],profiler[i+1])}}},start:function(s,t){this.p=this.t.push([this.p,s,t||(new Date()).getTime()])-1;this.l=this.o.push(this.p);return this},stop:function(){var i=this.o.splice(--this.l,1)[0];this.p=this.t[i][0];this.t[i][2]=(new Date()).getTime()-this.t[i][2];if(this.p==0)this.t[0][2]+=this.t[i][2];else if(this.p==1)this.t[0][1]+=this.t[i][2];return this},_print:function(p,o,x){var s='',ind=this.s.match(new RegExp('^(.{'+x+'})'))[1];for(var i=o;this.t[i];i++){if(this.t[i][0]==p){s+=ind+'> '+this.t[i][1]+': '+this.t[i][2]/1000 +' ('+ Math.round(this.t[i][2]/this.t[p][2]*100,3)+"%)\n";s+=this._print(i,i,x+4)}}return s},clear:function(){this.t=[[0,0,0]];this.o=[];this.l=0;this.p=0;this.i=0},print:function(){var s=this._print(0,1,1),u=this.t[0][2]-this.t[0][1];(debug||console).log('~~~~~~  jsCore.Profiler  ~~~~~~  ');(debug||console).log(debug.enabled?s.replace(/[\r\n]/g,'<br/>').replace(/\s/g,'&nbsp;'):s);(debug||console).log('~~~~~~ total: '+this.t[0][2]/1000+', sum: ' + this.t[0][1]/1000+', unknow: '+u/1000+' ('+Math.round(u/this.t[0][2]*100,3)+'%) ~~~~~~');this.clear()}};$P.init()})();var HTML=document.getElementsByTagName('HTML')[0],HEAD=HTML.firstChild,BODY=null,undefined;HTML.id='jsHtml';HTML.className+=' jsHtml';var defined=function(v,d){return(typeof d=='undefined')?(typeof v!='undefined'):(typeof v=='undefined'?d:v)};var $A=function(a){var r=[];r.push.apply(r,(arguments.length>1)?arguments:a);return r};Array.uniq=function(a){var r=[],i=0,n=a.length,u={};for(;i<n;i++){if(!u[a[i]]){u[a[i]]=1;r.push(a[i])}}delete u;return r};if(!Array.indexOf){Array.indexOf=function(a,e,f){var l=a.length;var f=f||0;f=(f<0)?Math.ceil(f):Math.floor(f);if(f<0)f+=l;for(;f<l;f++){if((f in a)&&(a[f]===e))return f}return-1}}Array.search=function(a,f,T){for(var i=0,n=a.length;i<n;i++)if(f.apply(T,[a[i],i]))return i;return-1};if(!Array.filter){Array.filter=function(a,f,This){if(typeof f!='function')throw new TypeError();var r=[],i=0,n=a.length;for(;i<n;i++){if(i in a){var v=a[i];if(f.call(This,v,i,a))r.push(v)}}return r}};Array.remove=function(a,i,s){if(s){i=Array.indexOf(a,i)}else{i=Math.floor(i<0?a.length-i:i);if(i<0)return[]}return a.slice(0,i).concat(a.slice(i+1))};var unserialize=function(v,d){if(typeof(v)=='undefined')v=this.value;if(typeof(v)!='string'||!v)return v;try{return eval("("+(d?decodeURIComponent(v):v)+")")}catch(e){debug.log(e);return false}};window.userAgent=navigator.userAgent.toLowerCase();bVer=(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1];var jsCore={browser:{userAgent:userAgent,ver:parseInt(bVer),version:bVer,safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)},F:function(a){return a},random:Math.random(),time:(new Date()).getTime(),version:2,local:/jsLocal|pp\.ru|rubaxa|web3|mmm3|ll1/i.test(document.location.href)||window.JS_LOCAL,loaded:0,disabled:0,build:jsCore.version+'.'+jsCore.build,currentId:0,unloadConfirm:0,_wList:{},emailRegExp:/^.+@.+\..{2,4}$/i,getNextId:function(){return jsCore.getCounter()},getCounter:function(){return jsCore.currentId++},getUniqId:function(o){return o?(o.uniqId?o.uniqId:(o.uniqId=this.getUniqId())):this.time+this.getCounter()},getTimer:function(){return(new Date()).getTime()-this.time},$:function(id){return typeof id=='string'?document.getElementById(id.replace(/^#/,'')):(id.append?id[0]:id)},apply:function(O,m,a){switch(a.length){case 1:O[m](a[0]);break;case 2:O[m](a[0],a[1]);break;case 3:O[m](a[0],a[1],a[2]);break;case 4:O[m](a[0],a[1],a[2],a[3]);break;case 5:O[m](a[0],a[1],a[2],a[3],a[4]);break;case 6:O[m](a[0],a[1],a[2],a[3],a[4],a[5]);break;default:O[m]()}},crc32:function(s,c){var t='00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D';var x=y=0;c=defined(c,0)^(-1);for(var i=0,n=s.length;i<n;i++){y=(c^s.charCodeAt(i))&0xFF;x='0x'+t.substr(y*9,8);c=(c>>>8)^x}return c^(-1)},each:function(o,I,a){if(o){if((o.constructor==Array)||a){for(var i=0,n=o.length;i<n;i++){I(i,o[i])}}else{for(var i in o){I(i,o[i])}}}},extend:function(d,s){var v,i=1,p,a;for(;arguments[i];i++){a=arguments[i]||{};for(p in a){if(((v=a[p])!=null)&&(typeof v!='undefined')){d[p]=v}}}v=null;return d},cloneObject:function(o){var c={};for(var k in o){c[k]=o[k]}return c},delegate:function(o,m){var ca=Array.prototype.slice.call(arguments,2);if(typeof(m)=='string')m=o[m];return function(){var a=[];a.push.apply(a,arguments);return m.apply(o,ca.concat(a))}},elm:function(e,a,v){if(e){if(e.append)e=e[0];if(e.target||e.srcElement)e=(e.target||e.srcElement);if(!a||(e==BODY))return e;var _a,_v,_r=v&&v.test;do{_v=typeof v!='undefined';_a=e[a]||e.getAttribute(a)||'';if((_v&&((_a==v)||(_a==v)||(_r&&v.test(_a))))||(!_v&&((_a!=='')&&(_a!==null)))){return e}}while(e&&(e=e.parentNode)&&(e.parentNode!=BODY))}return false},hitTest:function(x,y,c){return(x>=c.x1)&&(c.y1<=y)&&(x<=c.x2)&&(c.y2>=y)},wait:function(w,c){if(!c||c.constructor!=Function)throw new Error('Second argument must be function in jsCore.wait or jsCore.require');if(typeof w=='string')w=w.split(',');var w=Array.filter(w,function(v){if(!this._wList[v=v.toLowerCase()])this._wList[v]={r:0,l:[]};return!this._wList[v].r},this),i=0,_i=0,_c=w.length,n,p,wc;if(!_c){c();return}else wc=function(o){if(++_i>=_c){c(o)}};for(;w[i];i++){p=w[i].split(':');n=w[i].toLowerCase();this._wList[n].l.push(wc);if((p[0]=='file')||(p[0]=='include')||(p[0]=='require')){jsLoader.require(p[1],wc)}}},notify:function(w,o){if(typeof w=='string')w=w.split(',');for(var j=0,p,n;w[j];j++){p=w[j].split(':');n=w[j].toLowerCase();if(!this._wList[n])this._wList[n]={r:0,l:[]};if(this._wList[n].l)for(var i=0,ni=this._wList[n].l.length;i<ni;i++){try{this._wList[n].l[i](o)}catch(err){console.log(err)}}if(p[0]!='event')this._wList[n]={r:1}}},confirmUnload:function(y,t){if(defined(y)){this.unloadConfirm=y;window.onbeforeunload=y?function(){return(t||false)}:null;jsCore.notify('event:confirmUnload',y)}return this.unloadConfirm},error:function(m,u,l){debug.log('<b style="color: red;">',m,u,l,'</b>')},ready:function(f){if(f&&f.constructor==Function){jsCore.loaded?f():jsCore.wait('jsCore:ready',f)}else{if(jsCore.loaded)return true;BODY=document.body;jsCore.loaded=jsCore.isReady=true;Timeout.create(function(){var buffer=document.getWriteBuffer();if(buffer)$R('{jQuery}jquery',function(){for(var id in buffer)$F('#'+id).innerHTML=buffer[id]});debug.log('<b>jsCore.loaded: true</b>, time: ',jsCore.getTimer()/1000);jsCore.notify('jsCore:ready,jsCore:loaded,document:loaded'.split(','))},10);if(/js-/.test(BODY.innerHTML))jsCore.wait('loaded:Alias',function(){jsLoader.require('{plugins}jsPlugins')})}},unload:function(f){if(f&&f.constructor==Function){jsCore.wait('jsCore:unload',f)}else{try{jsCore.notify('jsCore:unload');window.onerror=this.loaded=HTML=HEAD=$HEAD=BODY=$BODY=null;jsEvent.remove(window,'unload',jsCore.unload);Interval.destroy();jsCore.destroy(jsLoader);jsCore.destroy(Registry);jsCore.destroy()}catch(e){}}},destroy:function(o){if(typeof o==undefined){window['jsLoader']=null;window['jsClass']=null;window['jsCore']=null}else{for(var k in o){o[k]=null;delete o[k]}k=null;delete k;o=null;delete o}},isEmail:function(s){return this.emailRegExp.test(s)},request:function(o){o.data=String.toQuery(o.data);o.pid=o.pid||(o.cache?this.crc32(o.data):jsCore.getUniqId());var r='request:'+o.pid;if(!o.cache)this._wList[r]={r:0,l:[]};if(o.success){jsCore.wait(r,$D(null,function(R){if(!o.cache||(o.cache&&defined(R)))jsCore[o.pid]=R;(o.success)(jsCore[o.pid])}))}if(!this._wList[r]||!this._wList[r].r){jsLoader.file(o.url+(/\?/.test(o.url)?'&':'?')+'pid='+o.pid+'&'+o.data+'&_sr_=Y'+(o.cache?'':'&_='+jsCore.getUniqId()))}}};var $E=jsCore.extend,$D=jsCore.delegate,$B=jsCore.browser,$G=jsCore.elm,$SA=function(N,a,v){N[a]=v;N.setAttribute?N.setAttribute(a,v):0;return N},$AA=function(N,a,v){return $SA(N,a,$GA(N,a)+v)},$RA=function(N,a,r,v){return $SA(N,a,$GA(N,a).replace(r,v))},$DA=function(N,a){N[a]=null;delete N[a];N.removeAttribute?N.removeAttribute(a):0;return N},$GA=function(e,a){return typeof e[a]=='undefined'?e.getAttribute(a):e[a]},$GV=function(e,a){return $GA($G.apply($G,arguments),a)},$WTF=function(t){throw t},$F=jsCore.$,$FS=function(id){return $F(id).style},$clone=jsCore.cloneObject,_apply_=jsCore.apply;jsCore.uniqId=jsCore.getUniqId();Object.extend=$E;Object.clone=$clone;Object.forEach=function(o,f,T){for(var k in o)if(f.call(T,o[k],k,o)==false)break};$CO=function(n){var o=window,i=0;n=n.split('.');for(i=0;i<n.length;i++){if(!o[n[i]])o[n[i]]={};o=o[n[i]]}return o};var jsClass={classes:{},__m:{},methods:{},dependence:{},instance:{},collector:[],create:function(n){var classUniqId=jsCore.getUniqId();var NewClass=function(){this.uniqId=jsCore.getUniqId();this.parentClassUniqId=0;if(this.__construct)this.__construct.apply(this,arguments)};jsCore.each(jsClass.Base,function(k,m){if(k!='prototype'){NewClass[k]=m}});NewClass.classUniqId=NewClass.prototype.classUniqId=classUniqId;jsClass.classes[classUniqId]=NewClass;jsClass.__m[classUniqId]={};jsClass.methods[classUniqId]={};jsClass.dependence[classUniqId]=[];NewClass.extend(jsClass.Base);NewClass.prototype.parent=jsClass.Base.prototype.parent;if(n){if(n.constructor==String)n=n.split(',');for(var i=0;n[i];i++){window[n[i]]=jsClass.classes[classUniqId]}}return jsClass.classes[classUniqId]},inherit:function(F,T,m){return F.prototype[m].apply(T,(Array.prototype.slice.call(arguments,3)||[]))},destroy:function(){while(this.collector.length){try{this.collector.shift()()}catch(e){}}this.collector=null}};jsClass.Base=function(){};jsClass.Base.classUniqId=jsCore.getUniqId();jsClass.Base.prototype={parent:function(m){var i=--jsClass.__m[this.classUniqId][m];var r=jsClass.classes[jsClass.methods[this.classUniqId][m][i<0?jsClass.methods[this.classUniqId][m].length-1:i]].prototype[m].apply(this,Array.prototype.slice.call(arguments,1));jsClass.__m[this.classUniqId][m]++;return r},callMethod:function(n){if(this[n]){return this[n].apply(this,Array.prototype.slice.call(arguments,1))}return null},destroy:function(){jsCore.destroy(this)}};$E(jsClass.Base,{getInstance:function(){if(!jsClass.instance[this.prototype.classUniqId]){jsClass.instance[this.prototype.classUniqId]=new this}return jsClass.instance[this.prototype.classUniqId]},extend:function(E){for(var c=0,cId,Klass;Klass=arguments[c];c++){cId=Klass.classUniqId;for(var p in Klass.prototype){if((p!='classUniqId')&&(p!='uniqId')&&(p!='parent')){this.prototype[p]=Klass.prototype[p];if(!jsClass.methods[this.classUniqId][p]){jsClass.methods[this.classUniqId][p]=[]};if(jsClass.methods[cId]&&jsClass.methods[cId][p]){jsClass.methods[this.classUniqId][p]=Array.uniq(jsClass.methods[this.classUniqId][p].concat(jsClass.methods[cId][p]))};if(Array.indexOf(jsClass.methods[this.classUniqId][p],cId)==-1){jsClass.methods[this.classUniqId][p].push(cId)};jsClass.__m[this.classUniqId][p]=jsClass.methods[this.classUniqId][p].length}}this.prototype.parentClassUniqId=Klass.classUniqId}return this},setMethods:function(Methods){$E(this.prototype,Methods);return this}});var jsCEvents={pool:{},name:function(n){return'on'+n.substr(0,1).toUpperCase()+n.substr(1)}};jsClass.Base.setMethods({addEventListener:function(n,h){n=n.toLowerCase();if(!this.__ce_uniqId)this.__ce_uniqId=jsCore.getUniqId();if(!jsCEvents.pool[this.__ce_uniqId])jsCEvents.pool[this.__ce_uniqId]={};if(!jsCEvents.pool[this.__ce_uniqId][n])jsCEvents.pool[this.__ce_uniqId][n]=[];jsCEvents.pool[this.__ce_uniqId][n].push(h);return this},removeEventListener:function(n,h){n=n.toLowerCase();if(jsCEvents.pool[this.__ce_uniqId]&&jsCEvents.pool[this.__ce_uniqId][n]){jsCEvents.pool[this.__ce_uniqId][n]=Array.remove(jsCEvents.pool[this.__ce_uniqId][n],h,1)}return this},dispatchEvent:function(n){var pN=jsCEvents.name(n);var args=Array.prototype.slice.call(arguments,1);if(!this[pN]||(this[pN].apply(this,args)!==false)){if(this.__ce_uniqId&&jsCEvents.pool[this.__ce_uniqId][n=n.toLowerCase()]){var h=jsCEvents.pool[this.__ce_uniqId][n];for(var i=0;i<h.length;i++){try{if(h[i]&&h[i].apply(this,args)===false){return false}}catch(e){debug.log('CE->dispatchEvent:',arguments,e);h[i]=null}}h=null;delete h}return}return false}});var jsLoader={cache:!jsCore.local,script:{},aliases:{},css:{},Libraries:{},fL:{},files:{},file:function(u,t,a){if(!this.files[u]){var N=document.createElement(t=t||'SCRIPT');try{a=a||{};if(t=='LINK')a.rel='stylesheet';a.type=t=='LINK'?'text/css':'text/javascript';a.encoding='utf-8';a[t=='LINK'?'href':'src']=u+(u.indexOf('?')==-1?'?':'&')+'b='+jsCore.build+(this.cache?'':'&r='+jsCore.getUniqId());for(var k in a)$SA(N,k,a[k]);HEAD.insertBefore(N,HEAD.firstChild);this.files[u]=1}catch(e){}N=null}},includeCSS:function(n){this.file(this.getFileUrl(n)+'.css','LINK')},getFileUrl:function(n){return this.aliases[this.getAlias(n)]+this.getName(n)},addAlias:function(n,p){if(!this.aliases[n]){this.aliases[n]=(n=='jsCore'||(/^(http:\/\/|\/)/.test(p))?p:this.aliases['jsCore']+p);jsCore.notify('alias:'+n)}},getAlias:function(n,d){if(this.aliases[n]){return n}else{var n=n.match(/\{([\w_.\/-]+)\}\.?/i);return(n?n[1]:defined(d,'jsCore'))}},getName:function(r){return r.replace(/\{[\w._\/-]+\}/ig,'')},_require:function(){},require:function(r,c){if(typeof r=='string')r=r.split(',');var r=Array.filter(r,function(v){if(!this.fL[v]){this.fL[v]={r:0,t:(new Date()).getTime()};this.file(this.getFileUrl(v)+'.js')}return!this.fL[v].r},this);c=c||jsCore.F;r.length?jsCore.wait(r,c):c()},isLoaded:function(s){return this.fL[s]&&this.fL[s].r},loaded:function(s){if(!this.fL[s])this.fL[s]={t:(new Date()).getTime()};if(this.fL[s])this.fL[s].r=1;jsCore.notify(s)}};var d=document.location.href.toLowerCase().match(/debug=(\w+)($|&|#)/);var debug={_flog:[],screen:d&&/y|yes|s|show/.test(d[1])};if(debug.screen){debug._text='';debug.log=function(a){a=Array.prototype.join.call(arguments,' ');this._text=a+'<br />'+this._text};if(debug.screen)jsCore.wait('loaded:Alias',function(){jsLoader.require('{utils}debug')})}else{debug.log=function(){if(jsCore.local&&window.console&&!console.fake)console.log.apply(console,arguments)}}debug.file=function(d){return;if(!this._file){this._file=document.createElement('IMG');$E(this._file.style,{position:'absolute',top:-1000,visibility:'hidden'});this._head=document.getElementsByTagName('HEAD')[0].firstChild}this._flog.push('http://194.67.27.119/js-debug?d='+encodeURIComponent(jsCore.uniqId+"\t"+d));do{this._file=this._file.cloneNode(true);this._file.src=this._flog.shift();this._head.parentNode.insertBefore(this._file,this._head)}while(this._flog.length)};var Registry={_data:{},has:function(key){return typeof(this._data[key])!='undefined'},get:function(key){return this._data[key]},put:function(key,value){this._data[key]=value;return this},remove:function(key){this._data[key]=jsCore.undefined;return this},inc:function(key,name,count){this._data[key][name]=this._data[key][name]*1+(count||1)*1;return this},dec:function(key,name,count){this._data[key][name]=this.inc(key,name,count||-1);return this},destroy:function(){jsCore.destroy(this._data);jsCore.destroy(this)}};var Interval={pool:[],create:function(func,mSec,loop){var id;if(loop=defined(loop,true)){id=setInterval(func,mSec||0)}else{id=setTimeout(function(){func();Interval.remove(id)},mSec||0)}this.pool.push(id);return id},remove:function(id){this.pool=Array.remove(this.pool,id,1);clearTimeout(id);clearInterval(id)},destroy:function(){while(this.pool.length)this.remove(this.pool[0]);this.pool=null}};var Timeout={create:function(func,mSec){return Interval.create(func,mSec,false)},remove:function(id){Interval.remove(id)}};var jsEvent={Key:{'up':38,'down':40,'left':37,'right':39,'esc':27,'home':36,'end':35,'pageup':33,'pagedown':34,'ins':45,'del':46,'insert':45,'delete':46,'back':8,'backspace':8,'space':32,'bar':32,'spacebar':32,'enter':13,'pause':19,'break':3,'alt':18,'ctrl':17,'shift':16,'tab':9,'caps':20,'capslock':20,'plus':107,'minus':109,isControl:function(c){return c<47}},add:function(o,name,listener,captures){if(o){captures=(captures?true:false);o.attachEvent?o.attachEvent('on'+name,listener,captures):o.addEventListener(name,listener,captures)}},remove:function(o,name,listener,captures){if(o){captures=(captures?true:false);o.detachEvent?o.detachEvent('on'+name,listener,captures):o.removeEventListener(name,listener,captures)}},fire:function(e,n){do{jQuery(e).trigger(n)}while((e=e.parentNode)&&(e.parentNode!=document))}};if(debug.screen){window.onerror=function(){jsCore.error.apply(jsCore,arguments);return true}}if(window.jsCoreAlias){if(typeof jsCoreAlias=='string')jsCoreAlias={jsCore:jsCoreAlias};for(var a in jsCoreAlias)jsLoader.addAlias(a,jsCoreAlias[a])}(function(){jsEvent.add(window,'unload',jsCore.unload);if(document.addEventListener){document.addEventListener('DOMContentLoaded',function(){document.removeEventListener('DOMContentLoaded',arguments.callee,false);jsCore.ready()},false)}else if(document.attachEvent){document.attachEvent('onreadystatechange',function(){if(document.readyState==='complete'){document.detachEvent('onreadystatechange',arguments.callee);jsCore.ready()}});if(document.documentElement.doScroll&&window==window.top)(function(){if(jsCore.isReady)return;try{document.documentElement.doScroll('left')}catch(error){setTimeout(arguments.callee,0);return}jsCore.ready()})()}jsEvent.add(window,'load',jsCore.ready)})();$E(Math,{KB:1024,MB:Math.pow(1024,2),TB:Math.pow(1024,3),sign:function(a){return(a>=0)?1:-1},_round:Math.round,round:function(v,z){return(z&&(z=Math.pow(10,z))?Math._round(v*z)/z:Math._round(v))},rand:function(min,max){if(defined(min)){return defined(max)?min+Math.round(Math.random()*max):Math.round(Math.random()*min)}return Math.random()},min_max:function(v,m,M){return Math.max(m,Math.min(v,M))}});if(!window.console)window.console={fake:true};if(!window.console.log)window.console.log=function(){debug.log.apply(debug,arguments)};if(window.jsLoaderLoaded&&(jsLoaderLoaded.constructor==Array)){for(var i=0;i<jsLoaderLoaded.length;i++){jsLoader.loaded(jsLoaderLoaded[i])}jsLoaderLoaded=null}(function(d){var buffer={},e=1;d.write2Buffer=function(id,s){buffer[id]=(buffer[id]||'')+s;e=0};d.getWriteBuffer=function(){return e?0:buffer}})(document);;
jsLoader.loaded('{jsCore}jsCore');


jsLoader.addAlias('mamba.project', 'Projects/mamba.ru/'); jsLoader.addAlias('labs','labs/');jsLoader.addAlias('utils','utils/');jsLoader.addAlias('jQuery','jquery/');jsLoader.addAlias('lang.data','build/lang-ru.js');jsLoader.addAlias('plugins','plugins/');jsLoader.addAlias('highlight','plugins/highlight/');jsLoader.addAlias('frameMaker.css','../f/');jsLoader.addAlias('BugTracer.css','../bt/');jsLoader.addAlias('adv.mamba','components/mamba/adv/');jsLoader.addAlias('mamba','components/mamba/');jsLoader.addAlias('mamba.travel','plugins/mamba/travel/');jsLoader.addAlias('mamba.plugins','plugins/mamba/');jsLoader.addAlias('mamba.weborama','plugins/mamba/weborama/');jsLoader.addAlias('mamba.mirtesen','plugins/mamba/mirtesen/');jsLoader.addAlias('mamba.messenger','components/messenger/');jsLoader.addAlias('components','components/');jsLoader.addAlias('component.users','components/Users/');jsLoader.addAlias('rubaxa.org','components/rubaxa.org/');jsLoader.addAlias('img.pixel','/i/');jsCore.notify('loaded:Alias');
jsLoader.loaded('{jsCore}Alias');


/**
 * Расширение объекта String
 * @author	RubaXa	<trash@rubaxa.org>
 * @version	1.0
 */
(function(){String._as={"'":new RegExp('(^|[^\\\\])((\\\\)*)\'','g'),'"':new RegExp('(^|[^\\\\])((\\\\)*)"','g')};$E(String,{addSlashes:function(s,q){return String(s).replace(String._as[q=(q||"'")],"$1$2\\"+q)},trim:function(s){return String(s).replace(/^\s+|\s+$/g,'')},num:function(n,L,i){if(L==null)return'';var x=((n%100<=10)||(n%100>=20))?n%10:0;var l=L.length;if(l==2&&x==1)x=0;else if(l==3&&x>1){x=x<5?2:0}return(i?n+(i&&(i!=1)?i:''):'')+(typeof(L)!='string'?(L[x]||L[(x>1&&x<5)?x:0]||L[x>1?1:0]):L)},ucfirst:function(s){return s.charAt(0).toUpperCase()+s.substr(1).toLowerCase()},repeat:function(s,n){var r='';for(var i=0;i<n;i++){r+=s}return r},toQuery:function(o){var s='';if(o){if(typeof(o)=='string'){s=o}else{for(var p in o)s+='&'+p+'='+encodeURIComponent(o[p]);s=s.substr(1)}}return s},toObject:function(s){if(s=String(s)){if(s.indexOf('?')>-1)s=s.split('?')[1];s=s.split('&'),o={};for(var i=0,n=s.length;i<n;i++){s[i]=s[i].split('=');o[s[i][0]]=decodeURIComponent(s[i][1])||''}s=null;return o}return{}},html2text:function(h){return String(h).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;')},nl2br:function(t){return String(t).replace(/[\r\n]/g,'<br />')},wordWrap:function(t,m,l,e){t=String(t).replace(new RegExp('(\\S{'+(m||20)+'})','ig'),'$1 ');if(l&&t.length>l){var m=t.match(new RegExp('^(\\S{'+l+'})','ig'));t=(m?m[0]:t.substr(0,l))+e}return t},numberFormat:function(n,d,p,t){var n=Math.round(n,d).toString().split('.'),x='',i=n[0].length-1;for(;i>=0;i-=3)x=n[0].substr(i-3,i)+x;return x+(n[1]?p+n[1]:'')}})})();;
jsLoader.loaded('{jsCore}String');


/**
 * @class	JSON
 * @author	RubaXa	<trash@rubaxa.org>
 * @version	1.0
 */
var JSON=function(){this.__construct.apply(this,arguments)};JSON.quote="'";JSON.prototype={__construct:function(value){this.value=value},serialize:function(value){this.quoteRE=new RegExp('(^|[^\\\\])((\\\\)*)'+JSON.quote,'g');if(typeof(value)=='undefined')value=this.value;var result='';if(value==null)return'null';switch(typeof(value)){case'object':{if(value){if(value.constructor==Array){result=this.serializeArray(value)}else{result=this.serializeObject(value)}}}break;case'number':result=this.serializeNumber(value);break;case'boolean':result=this.serializeBoolean(value);break;default:result=this.serializeString(value);break}return result},serializeString:function(v){return JSON.quote+String.addSlashes(String(v).replace(/([^\\])'/g,'$1\'').replace(/[\r\n]/g,'\\n'),JSON.quote)+JSON.quote},serializeArray:function(array){var result=[];var value;for(var i=0,n=array.length;i<n;i++){result.push(this.serialize(array[i]))}return'['+result.join(',')+']'},serializeBoolean:function(bool){return new String(bool)},serializeDate:function(date){function f(n){return n<10?'0'+n:n};return'\''+date.getUTCFullYear()+'-'+f(date.getUTCMonth()+1)+'-'+f(date.getUTCDate())+'T'+f(date.getUTCHours())+':'+f(date.getUTCMinutes())+':'+f(date.getUTCSeconds())+'Z\''},serializeNumber:function(number){return isFinite(number)?new String(number):'null'},serializeObject:function(obj){var a=[];if(obj){for(var i in obj){a.push(this.serialize(i)+':'+this.serialize(obj[i]))}}return'{'+a.join(',')+'}'}};jsCore.JSON=new JSON();var serialize=function(v){return jsCore.JSON.serialize(v)};;
jsLoader.loaded('{jsCore}JSON');


/**
 * @object	Lang
 * @author	RubaXa	<trash@rubaxa.org>
 * @version	1.0
 * Объект для работы с разными языками.
 */
var Lang=({data:{},vars:{},locals:[],def:'',path:'',init:function(){this.setDataPath(jsLoader.aliases['lang.data']||'');this.setLocal(window['LANG_DEFAULT']||'RU');return this},setDataPath:function(p){this.path=p},addLocal:function(l){if(typeof(l)=='string')l=l.split(',');for(var i=0;i<l.length;i++){if(!this.data[l[i]=l[i].toUpperCase()]){this.locals.push(l[i]);this.data[l[i]]={}}}this.load()},setLocal:function(l){this.def=l.toUpperCase();this.addLocal(l)},load:function(v,s){if(v){if(typeof(v)=='string')v=v.split(',');for(var i=0,n=v.length;i<n;i++){if(!this.vars[v[i]]){this.vars[v[i]]=1}}}var r=0,w='';for(var v in this.vars){for(var j=0,nl=this.locals.length;j<nl;j++){if(!this.data[this.locals[j]][v]){this.data[this.locals[j]][v]=1;if(!r)r={};if(!r[this.locals[j]])r[this.locals[j]]=[];r[this.locals[j]].push(v);wId=',lang:'+this.locals[j]+'-'+v}}}if(r){jsCore.request({url:this.path,data:'l='+serialize(r),cache:1,success:$D(this,'add')});if(s)jsCore.wait(wId.substr(1),s)}else if(s){s()}},add:function(d){var n=[];for(var l in d){for(var v in d[l]){this.data[l][v]=d[l][v];n.push('lang:'+l+'-'+v)}}jsCore.notify(n)},get:function(v,l){return this.data[l||this.def][v]},fileSize:function(s,L){var x=Math.floor(Math.log(s||1)/Math.log(1024));return L?String.num(Math.round(s/Math.pow(1024,x)),L[x],' '):x}}).init();;
jsLoader.loaded('{utils}Lang');
Lang.add({"RU":{"Base":1,"Date":{"months":[["\u044f\u043d\u0432\u0430\u0440\u044c","\u0444\u0435\u0432\u0440\u0430\u043b\u044c","\u043c\u0430\u0440\u0442","\u0430\u043f\u0440\u0435\u043b\u044c","\u043c\u0430\u0439","\u0438\u044e\u043d\u044c","\u0438\u044e\u043b\u044c","\u0430\u0432\u0433\u0443\u0441\u0442","\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c","\u043e\u043a\u0442\u044f\u0431\u0440\u044c","\u043d\u043e\u044f\u0431\u0440\u044c","\u0434\u0435\u043a\u0430\u0431\u0440\u044c"],["\u044f\u043d\u0432\u0430\u0440\u044f","\u0444\u0435\u0432\u0440\u0430\u043b\u044f","\u043c\u0430\u0440\u0442\u0430","\u0430\u043f\u0440\u0435\u043b\u044f","\u043c\u0430\u044f","\u0438\u044e\u043d\u044f","\u0438\u044e\u043b\u044f","\u0430\u0432\u0433\u0443\u0441\u0442\u0430","\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f","\u043e\u043a\u0442\u044f\u0431\u0440\u044f","\u043d\u043e\u044f\u0431\u0440\u044f","\u0434\u0435\u043a\u0430\u0431\u0440\u044f"]]},"FileSize":{"0":["\u0431\u0430\u0439\u0442","\u0431\u0430\u0439\u0442\u0430"],"1":["\u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442","\u043a\u0438\u043b\u043e\u0431\u0430\u0439\u0442\u0430"],"2":["\u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442","\u043c\u0435\u0433\u0430\u0431\u0430\u0439\u0442\u0430"],"3":["\u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442","\u0433\u0438\u0433\u0430\u0431\u0430\u0439\u0442\u0430"],"4":["\u0442\u0435\u0440\u0430\u0431\u0430\u0439\u0442","\u0442\u0435\u0440\u0430\u0431\u0430\u0439\u0442\u0430"],"short":["B","KB","MB","T"]},"send":"\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c","pleaseWait":"\u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u043f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435","InternalError":"\u041e\u0449\u0438\u0431\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0435 \u0440\u0430\u0437","sex":{"be":{"M":"\u0431\u044b\u043b","F":"\u0431\u044b\u043b\u0430","MF":"\u0431\u044b\u043b\u0438","FF":"\u0431\u044b\u043b\u0438","MM":"\u0431\u044b\u043b\u0438","T":"\u0431\u044b\u043b\u043e"},"his":{"M":"\u0435\u0433\u043e","F":"\u0435\u0451","MF":"\u0438\u0445","FF":"\u0438\u0445","MM":"\u0438\u0445","T":"\u0435\u0433\u043e"},"add":{"M":"\u0434\u043e\u0431\u0430\u0432\u0438\u043b","F":"\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0430","MF":"\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438","FF":"\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438","MM":"\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438","T":"\u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e"}},"unread":["\u043d\u043e\u0432\u044b\u0445","\u043d\u043e\u0432\u043e\u0435","\u043d\u043e\u0432\u044b\u0445"],"messages":["\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439","\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435","\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f"]}});

/**
 * Расширение класса Date
 * @author	"RubaXa"		<trash@rubaxa.org>
 */
$E(Date,{is:function(d){if(d){return d.setTime||/(^\d+$|^((\d{1,4}[-:\s\/]?)+)$)/.test(d+'')}return 1},_timer:(new Date()).getTime(),timeZone:(window.timeZone||window.TIMEZONE||4),getTime:function(){this.changeNow();return this.getNow().getTime()},getUnixtime:function(){return Math.round(this.getTime()/1000)},setNow:function(time){this._now_=new Date(time);this._today_=new Date(time);this._yesterday_=new Date(time);this._today_.setHours(0);this._today_.setMinutes(0);this._yesterday_.setTime(this._today_.getTime());this._yesterday_.setDate(this._yesterday_.getDate()-1);return this},getNow:function(){return this.changeNow()._now_},changeNow:function(){var now=(new Date()).getTime();Date.setNow(Date._now_.getTime()+(now-Date._timer));Date._timer=now;return this},_f:function(n){return((n>9)?n:'0'+n)},_parse:Date.parse,parse:function(s){if(s&&s.setTime)return s;try{var D=Date._parse(s);if(isNaN(D)||D.constructor!=Date)D=new Date(s.replace(/^(\d{4})-(\d{2})-(\d{2})/,'$2/$3/$1'))}catch(e){debug.log('Date',e)}return D}});$E(Date.prototype,{timeZone:Date.timeZone,isNow:function(interval){Date.changeNow();return(Date._now_.getTime()-this.getTime())<interval},isToday:function(){return(Date._today_.getTime()<this.getTime())},isYesterday:function(){return!this.isToday()&&(Date._yesterday_.getTime()<this.getTime())},setTimeZone:function(z){this.timeZone=z*1;return this},format:function(f){var t=this.getTime();var r='',f=f.split('');this.setTime(t+(this.getTimezoneOffset()*60+this.timeZone*60*60)*1000);for(var i=0,n=f.length;i<n;i++){switch(f[i]){case'Y':r+=this.getFullYear();break;case'y':r+=Date._f(this.getFullYear()%100);break;case'N':r+=String.ucfirst(Lang.get('Date').months[1][this.getMonth()]);break;case'n':r+=Lang.get('Date').months[1][this.getMonth()];break;case'M':r+=Date._f(this.getMonth()+1);break;case'm':r+=this.getMonth()+1;break;case'D':r+=Date._f(this.getDate());break;case'd':r+=this.getDate();break;case'H':r+=Date._f(this.getHours());break;case'h':r+=this.getHours();break;case'I':r+=Date._f(this.getMinutes());break;case'i':r+=this.getMinutes();break;case'S':r+=Date._f(this.getSeconds());break;case's':r+=this.getSeconds();break;default:r+=f[i];break}}this.setTime(t);return r},diffYears:function(Y,M,D){if(isNaN(Y)){Y=Date.parse(Y);D=Y.getDate();M=Y.getMonth()+1;Y=Y.getFullYear()}var cM=this.getMonth()+1;Y=this.getFullYear()-Y;if((M>cM)||(D>this.getDate()&&M==cM))Y--;return Y}});Lang.load('Date',function(){Date.setNow(window.time||window.TIME||(new Date).getTime());Interval.create(Date.changeNow,60*1000)});;
jsLoader.loaded('{jsCore}Date');


/**
 * @class	PropertiesMapper
 * @author	RubaXa		<trash@rubaxa.org>
 */
jsClass.create('PropertiesMapper').setMethods({__construct:function(o,n){this.__properties(n||'$',o)},__properties:function(n,d){this.__pn__=n;this.__cpn__='_'+n;this[this.__pn__]=(d||{});this[this.__cpn__]={}},set:function(p,v){this.isChanged=0;this[this.__cpn__]={};if(typeof p=='string'){var k=p;p={};p[k]=v}for(var k in p){if(this[this.__pn__][k]!==p[k]){this[this.__cpn__][k]=this[this.__pn__][k];this[this.__pn__][k]=p[k];this.isChanged=1}}if(this.isChanged)this.dispatchEvent('change',this);return this},get:function(n){if(!n)return this[this.__pn__];else if(typeof n=='string')return this[this.__pn__][n];else return Array.extract(this[this.__pn__],n)},cloneProperties:function(){return $E({},this.get())},getChanges:function(){return this[this.__cpn__]},toObject:function(){return $clone(this[this.__pn__])}});;
jsLoader.loaded('{jsCore}PropertiesMapper');


/**
 * @object	jsCookie
 * @author	"RubaXa"		<trash@rubaxa.org>
 */
var jsCookie={DAY:86400,WEEK:86400*7,MONTH:86400*30,YEAR:86400*365,set:function(key,value,expires,path){if(!value)value=0;if((typeof(expires)!='undefined')&&(expires!==true)){expires='expires='+(new Date((new Date).getTime()+(expires*1000))).toGMTString()+';'}else expires='';this.remove(key);document.cookie=key+'='+value+'; path='+(path||'/')+'; '+expires;return this},get:function(key,def){if(!key)return document.cookie;var keyEx=new RegExp(key+'=');var cookie=document.cookie.split(/;\s+/);for(var i=0,n=cookie.length;i<n;i++){if(keyEx.test(cookie[i])){return cookie[i].split('=')[1]}}return def},has:function(key){var value=this.get(key);return(value&&!((value=='false')||(value=='null')||(value=='')))},remove:function(key){e=(new Date(1)).toGMTString();document.cookie=key+'=null; expires='+e;document.cookie=key+'=null; path=/; expires='+e}};if(window['jsLoader']){};
jsLoader.loaded('{jsCore}jsCookie');


(function(){if(!document.nodeType){window.tagName=window.nodeName='WINDOW';document.tagName=document.nodeName='DOCUMENT';window.nodeType=document.nodeType=1}var window=this,undefined,_jQuery=window.jQuery,_$=window.$,jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context)},quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;this.context=selector;return this}if(typeof selector==="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem&&elem.id!=match[3])return jQuery().find(selector);var ret=jQuery(elem||[]);ret.context=document;ret.selector=selector;return ret}}else return jQuery(context).find(selector)}else if(jQuery.isFunction(selector))return jQuery(document).ready(selector);if(selector.selector&&selector.context){this.selector=selector.selector;this.context=selector.context}return this.setArray(jQuery.isArray(selector)?selector:jQuery.makeArray(selector))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(num){return num===undefined?Array.prototype.slice.call(this):this[num]},pushStack:function(elems,name,selector){var ret=jQuery(elems);ret.prevObject=this;ret.context=this.context;if(name==="find")ret.selector=this.selector+(this.selector?" ":"")+selector;else if(name)ret.selector=this.selector+"."+name+"("+selector+")";return ret},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this},each:function(callback,args){return jQuery.each(this,callback,args)},index:function(elem){return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this)},attr:function(name,value,type){var options=name;if(typeof name==="string")if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name))})},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS")},text:function(text){if(typeof text!=="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this])})});return ret},wrapAll:function(html){if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).clone();if(this[0].parentNode)wrap.insertBefore(this[0]);wrap.map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem}).append(this)}return this},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html)})},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html)})},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1)this.appendChild(elem)})},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild)})},before:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this)})},after:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling)})},end:function(){return this.prevObject||jQuery([])},push:[].push,sort:[].sort,splice:[].splice,find:function(selector){if(this.length===1){var ret=this.pushStack([],"find",selector);ret.length=0;jQuery.find(selector,this[0],ret);return ret}else{return this.pushStack(jQuery.unique(jQuery.map(this,function(elem){return jQuery.find(selector,elem)})),"find",selector)}},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var html=this.outerHTML;if(!html){var div=this.ownerDocument.createElement("div");div.appendChild(this.cloneNode(true));html=div.innerHTML}return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else return this.cloneNode(true)});if(events===true){var orig=this.find("*").andSelf(),i=0;ret.find("*").andSelf().each(function(){if(this.nodeName!==orig[i].nodeName)return;var events=jQuery.data(orig[i],"events");for(var type in events){for(var handler in events[type]){jQuery.event.add(this,type,events[type][handler],events[type][handler].data)}}i++})}return ret},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i)})||jQuery.multiFilter(selector,jQuery.grep(this,function(elem){return elem.nodeType===1})),"filter",selector)},closest:function(selector){var pos=jQuery.expr.match.POS.test(selector)?jQuery(selector):null,closer=0;return this.map(function(){var cur=this;while(cur&&cur.ownerDocument){if(pos?pos.index(cur)>-1:jQuery(cur).is(selector)){jQuery.data(cur,"closest",closer);return cur}cur=cur.parentNode;closer++}})},not:function(selector){if(typeof selector==="string")if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true),"not",selector);else selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector})},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector==="string"?jQuery(selector):jQuery.makeArray(selector))))},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0},hasClass:function(selector){return!!selector&&this.is("."+selector)},val:function(value){if(value===undefined){var elem=this[0];if(elem){if(jQuery.nodeName(elem,'option'))return(elem.attributes.value||{}).specified?elem.value:elem.text;if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery(option).val();if(one)return value;values.push(value)}}return values}return(elem.value||"").replace(/\r/g,"")}return undefined}if(typeof value==="number")value+='';return this.each(function(){if(this.nodeType!=1)return;if(jQuery.isArray(value)&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0)});if(!values.length)this.selectedIndex=-1}else this.value=value})},html:function(value){return value===undefined?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(value)},replaceWith:function(value){return this.after(value).remove()},eq:function(i){return this.slice(i,+i+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(args,table,callback){if(this[0]){var fragment=(this[0].ownerDocument||this[0]).createDocumentFragment(),scripts=jQuery.clean(args,(this[0].ownerDocument||this[0]),fragment),first=fragment.firstChild;if(first)for(var i=0,l=this.length;i<l;i++)callback.call(root(this[i],first),this.length>1||i>0?fragment.cloneNode(true):fragment);if(scripts)jQuery.each(scripts,evalScript)}return this;function root(elem,cur){return table&&jQuery.nodeName(elem,"table")&&jQuery.nodeName(cur,"tr")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem}}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem)}function now(){return+new Date}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2}if(typeof target!=="object"&&!jQuery.isFunction(target))target={};if(length==i){target=this;--i}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy==="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy}return target};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{},toString=Object.prototype.toString;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery},isFunction:function(obj){return toString.call(obj)==="[object Function]"},isArray:function(obj){return toString.call(obj)==="[object Array]"},isXMLDoc:function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&jQuery.isXMLDoc(elem.ownerDocument)},globalEval:function(data){if(data&&/\S/.test(data)){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.support.scriptEval)script.appendChild(document.createTextNode(data));else script.text=data;head.insertBefore(script,head.firstChild);head.removeChild(script)}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase()},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length===undefined){for(name in object)if(callback.apply(object[name],args)===false)break}else for(;i<length;)if(callback.apply(object[i++],args)===false)break}else{if(length===undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break}else for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return typeof value==="number"&&type=="curCSS"&&!exclude.test(name)?value+"px":value},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className})},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!==undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className)}).join(" "):""},has:function(elem,className){return elem&&jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name]}callback.call(elem);for(var name in options)elem.style[name]=old[name]},css:function(elem,name,force,extra){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;if(extra==="border")return;jQuery.each(which,function(){if(!extra)val-=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;if(extra==="margin")val+=parseFloat(jQuery.curCSS(elem,"margin"+this,true))||0;else val-=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0})}if(elem.offsetWidth!==0)getWH();else jQuery.swap(elem,props,getWH);return Math.max(0,Math.round(val))}return jQuery.curCSS(elem,name,force)},curCSS:function(elem,name,force){var ret,style=elem.style;if(name=="opacity"&&!jQuery.support.opacity){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle)ret=computedStyle.getPropertyValue(name);if(name=="opacity"&&ret=="")ret="1"}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase()});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft}}return ret},clean:function(elems,context,fragment){context=context||document;if(typeof context.createElement==="undefined")context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;if(!fragment&&elems.length===1&&typeof elems[0]==="string"){var match=/^<(\w+)\s*\/?>$/.exec(elems[0]);if(match)return[context.createElement(match[1])]}var ret=[],scripts=[],div=context.createElement("div");jQuery.each(elems,function(i,elem){if(typeof elem==="number")elem+='';if(!elem)return;if(typeof elem==="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">"});var tags=elem.replace(/^\s+/,"").substring(0,10).toLowerCase();var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!jQuery.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(!jQuery.support.tbody){var hasBody=/<tbody/i.test(elem),tbody=!tags.indexOf("<table")&&!hasBody?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&!hasBody?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j])}if(!jQuery.support.leadingWhitespace&&/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);elem=jQuery.makeArray(div.childNodes)}if(elem.nodeType)ret.push(elem);else ret=jQuery.merge(ret,elem)});if(fragment){for(var i=0;ret[i];i++){if(jQuery.nodeName(ret[i],"script")&&(!ret[i].type||ret[i].type.toLowerCase()==="text/javascript")){scripts.push(ret[i].parentNode?ret[i].parentNode.removeChild(ret[i]):ret[i])}else{if(ret[i].nodeType===1)ret.splice.apply(ret,[i+1,0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))));fragment.appendChild(ret[i])}}return scripts}return ret},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&elem.parentNode)elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";if((name=='id'||name=='name'||name=='action'||name=='method')&&elem.tagName=='FORM'){try{$SA(elem,name,value)}catch(e){}}else elem[name]=value}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;if(name=="tabIndex"){var attributeNode=elem.getAttributeNode("tabIndex");return attributeNode&&attributeNode.specified?attributeNode.value:elem.nodeName.match(/(button|input|object|select|textarea)/i)?0:elem.nodeName.match(/^(a|area)$/i)&&elem.href?0:undefined}return elem[name]}if(!jQuery.support.style&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=!jQuery.support.hrefNormalized&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr}if(!jQuery.support.opacity&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")")}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':""}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase()});if(set)elem[name]=value;return elem[name]},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"")},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||typeof array==="string"||jQuery.isFunction(array)||array.setInterval)ret[0]=array;else while(i)ret[--i]=array[i]}return ret},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1},merge:function(first,second){var i=0,elem,pos=first.length;if(!jQuery.support.getAll){while((elem=second[i++])!=null)if(elem.nodeType!=8)first[pos++]=elem}else while((elem=second[i++])!=null)first[pos++]=elem;return first},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i])}}}catch(e){ret=array}return ret},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value}return ret.concat.apply([],ret)}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,'0'])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};jQuery.each({parent:function(elem){return elem.parentNode},parents:function(elem){return jQuery.dir(elem,"parentNode")},next:function(elem){return jQuery.nth(elem,2,"nextSibling")},prev:function(elem){return jQuery.nth(elem,2,"previousSibling")},nextAll:function(elem){return jQuery.dir(elem,"nextSibling")},prevAll:function(elem){return jQuery.dir(elem,"previousSibling")},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem)},children:function(elem){return jQuery.sibling(elem.firstChild)},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes)}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret),name,selector)}});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector);for(var i=0,l=insert.length;i<l;i++){var elems=(i>0?this.clone(true):this).get();jQuery.fn[original].apply(jQuery(insert[i]),elems);ret=ret.concat(elems)}return this.pushStack(ret,name,selector)}});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name)},addClass:function(classNames){jQuery.className.add(this,classNames)},removeClass:function(classNames){jQuery.className.remove(this,classNames)},toggleClass:function(classNames,state){if(typeof state!=="boolean")state=!jQuery.className.has(this,classNames);jQuery.className[state?"add":"remove"](this,classNames)},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).length){jQuery("*",this).add([this]).each(function(){jQuery.event.remove(this);jQuery.removeData(this)});if(this.parentNode)this.parentNode.removeChild(this)}},empty:function(){jQuery(this).children().remove();while(this.firstChild)this.removeChild(this.firstChild)}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments)}});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0}var expando="jQuery"+now(),uuid=0,windowData={};jQuery.extend({cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem)}}else{try{delete elem[expando]}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando)}delete jQuery.cache[id]}},queue:function(elem,type,data){if(elem){type=(type||"fx")+"queue";var q=jQuery.data(elem,type);if(!q||jQuery.isArray(data))q=jQuery.data(elem,type,jQuery.makeArray(data));else if(data)q.push(data)}return q},dequeue:function(elem,type){var queue=jQuery.queue(elem,type),fn=queue.shift();if(!type||type==="fx")fn=queue[0];if(fn!==undefined)fn.call(elem)}});jQuery.fn.extend({data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data}else return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value)})},removeData:function(key){return this.each(function(){jQuery.removeData(this,key)})},queue:function(type,data){if(typeof type!=="string"){data=type;type="fx"}if(data===undefined)return jQuery.queue(this[0],type);return this.each(function(){var queue=jQuery.queue(this,type,data);if(type=="fx"&&queue.length==1)queue[0].call(this)})},dequeue:function(type){return this.each(function(){jQuery.dequeue(this,type)})}});(function(){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,done=0,toString=Object.prototype.toString;var Sizzle=function(selector,context,results,seed){results=results||[];context=context||document;if(context.nodeType!==1&&context.nodeType!==9)return[];if(!selector||typeof selector!=="string"){return results}var parts=[],m,set,checkSet,check,mode,extra,prune=true;chunker.lastIndex=0;while((m=chunker.exec(selector))!==null){parts.push(m[1]);if(m[2]){extra=RegExp.rightContext;break}}if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context)}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);while(parts.length){selector=parts.shift();if(Expr.relative[selector])selector+=parts.shift();set=posProcess(selector,set)}}}else{var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&context.parentNode?context.parentNode:context,isXML(context));set=Sizzle.filter(ret.expr,ret.set);if(parts.length>0){checkSet=makeArray(set)}else{prune=false}while(parts.length){var cur=parts.pop(),pop=cur;if(!Expr.relative[cur]){cur=""}else{pop=parts.pop()}if(pop==null){pop=context}Expr.relative[cur](checkSet,pop,isXML(context))}}if(!checkSet){checkSet=set}if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector)}if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet)}else if(context.nodeType===1){for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i])}}}else{for(var i=0;checkSet[i]!=null;i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i])}}}}else{makeArray(checkSet,results)}if(extra){Sizzle(extra,context,results,seed);if(sortOrder){hasDuplicate=false;results.sort(sortOrder);if(hasDuplicate){for(var i=1;i<results.length;i++){if(results[i]===results[i-1]){results.splice(i--,1)}}}}}return results};Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set)};Sizzle.find=function(expr,context,isXML){var set,match;if(!expr){return[]}for(var i=0,l=Expr.order.length;i<l;i++){var type=Expr.order[i],match;if((match=Expr.match[type].exec(expr))){var left=RegExp.leftContext;if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");set=Expr.find[type](match,context,isXML);if(set!=null){expr=expr.replace(Expr.match[type],"");break}}}}if(!set){set=context.getElementsByTagName("*")}return{set:set,expr:expr}};Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.match[type].exec(expr))!=null){var filter=Expr.filter[type],found,item;anyFound=false;if(curLoop==result){result=[]}if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);if(!match){anyFound=found=true}else if(match===true){continue}}if(match){for(var i=0;(item=curLoop[i])!=null;i++){if(item){found=filter(item,match,i,curLoop);var pass=not^!!found;if(inplace&&found!=null){if(pass){anyFound=true}else{curLoop[i]=false}}else if(pass){result.push(item);anyFound=true}}}}if(found!==undefined){if(!inplace){curLoop=result}expr=expr.replace(Expr.match[type],"");if(!anyFound){return[]}break}}}if(expr==old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr}else{break}}old=expr}return curLoop};var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href")}},relative:{"+":function(checkSet,part,isXML){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;if(isTag&&!isXML){part=part.toUpperCase()}for(var i=0,l=checkSet.length,elem;i<l;i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}checkSet[i]=isPartStrNotTag||elem&&elem.nodeName===part?elem||false:elem===part}}if(isPartStrNotTag){Sizzle.filter(part,checkSet,true)}},">":function(checkSet,part,isXML){var isPartStr=typeof part==="string";if(isPartStr&&!/\W/.test(part)){part=isXML?part:part.toUpperCase();for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){var parent=elem.parentNode;checkSet[i]=parent.nodeName===part?parent:false}}}else{for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part}}if(isPartStr){Sizzle.filter(part,checkSet,true)}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck}checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML)},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;if(typeof part==="string"&&!part.match(/\W/)){var nodeCheck=part=isXML?part:part.toUpperCase();checkFn=dirNodeCheck}checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML)}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?[m]:[]}},NAME:function(match,context,isXML){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);for(var i=0,l=results.length;i<l;i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i])}}return ret.length===0?null:ret}},TAG:function(match,context){return match[1]=='*'&&context.all||context.getElementsByTagName(match[1])}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";if(isXML){return match}for(var i=0,elem;(elem=curLoop[i])!=null;i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").indexOf(match)>=0)){if(!inplace)result.push(elem)}else if(inplace){curLoop[i]=false}}}return false},ID:function(match){return match[1].replace(/\\/g,"")},TAG:function(match,curLoop){for(var i=0;curLoop[i]===false;i++){}return curLoop[i]&&isXML(curLoop[i])?match[1]:match[1].toUpperCase()},CHILD:function(match){if(match[1]=="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]=="even"&&"2n"||match[2]=="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);match[2]=(test[1]+(test[2]||1))-0;match[3]=test[3]-0}match[0]=done++;return match},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name]}if(match[2]==="~="){match[4]=" "+match[4]+" "}return match},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if(match[3].match(chunker).length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop)}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);if(!inplace){result.push.apply(result,ret)}return false}}else if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true}return match},POS:function(match){match.unshift(true);return match}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden"},disabled:function(elem){return elem.disabled===true},checked:function(elem){return elem.checked===true},selected:function(elem){elem.parentNode.selectedIndex;return elem.selected===true},parent:function(elem){return!!elem.firstChild},empty:function(elem){return!elem.firstChild},has:function(elem,i,match){return!!Sizzle(match[3],elem).length},header:function(elem){return/h\d/i.test(elem.nodeName)},text:function(elem){return"text"===elem.type},radio:function(elem){return"radio"===elem.type},checkbox:function(elem){return"checkbox"===elem.type},file:function(elem){return"file"===elem.type},password:function(elem){return"password"===elem.type},submit:function(elem){return"submit"===elem.type},image:function(elem){return"image"===elem.type},reset:function(elem){return"reset"===elem.type},button:function(elem){return"button"===elem.type||elem.nodeName.toUpperCase()==="BUTTON"},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName)}},setFilters:{first:function(elem,i){return i===0},last:function(elem,i,match,array){return i===array.length-1},even:function(elem,i){return i%2===0},odd:function(elem,i){return i%2===1},lt:function(elem,i,match){return i<match[3]-0},gt:function(elem,i,match){return i>match[3]-0},nth:function(elem,i,match){return match[3]-0==i},eq:function(elem,i,match){return match[3]-0==i}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];if(filter){return filter(elem,i,match,array)}else if(name==="contains"){return(elem.textContent||elem.innerText||"").indexOf(match[3])>=0}else if(name==="not"){var not=match[3];for(var i=0,l=not.length;i<l;i++){if(not[i]===elem){return false}}return true}},CHILD:function(elem,match){var type=match[1],node=elem;switch(type){case'only':case'first':while(node=node.previousSibling){if(node.nodeType===1)return false}if(type=='first')return true;node=elem;case'last':while(node=node.nextSibling){if(node.nodeType===1)return false}return true;case'nth':var first=match[2],last=match[3];if(first==1&&last==0){return true}var doneName=match[0],parent=elem.parentNode;if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;for(node=parent.firstChild;node;node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count}}parent.sizcache=doneName}var diff=elem.nodeIndex-last;if(first==0){return diff==0}else{return(diff%first==0&&diff/first>=0)}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName===match},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!=check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];if(filter){return filter(elem,i,match,array)}}}};var origPOS=Expr.match.POS;for(var type in Expr.match){Expr.match[type]=RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var makeArray=function(array,results){array=Array.prototype.slice.call(array);if(results){results.push.apply(results,array);return results}return array};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(e){makeArray=function(array,results){var ret=results||[];if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array)}else{if(typeof array.length==="number"){for(var i=0,l=array.length;i<l;i++){ret.push(array[i])}}else{for(var i=0;array[i];i++){ret.push(array[i])}}}return ret}}var sortOrder;if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;if(ret===0){hasDuplicate=true}return ret}}else if("sourceIndex"in document.documentElement){sortOrder=function(a,b){var ret=a.sourceIndex-b.sourceIndex;if(ret===0){hasDuplicate=true}return ret}}else if(document.createRange){sortOrder=function(a,b){var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();aRange.selectNode(a);aRange.collapse(true);bRange.selectNode(b);bRange.collapse(true);var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);if(ret===0){hasDuplicate=true}return ret}}(function(){var form=document.createElement("form"),id="script"+(new Date).getTime();form.innerHTML="<input name='"+id+"'/>";var root=document.documentElement;root.insertBefore(form,root.firstChild);if(!!document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[]}};Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");return elem.nodeType===1&&node&&node.nodeValue===match}}root.removeChild(form)})();(function(){var div=document.createElement("div");div.appendChild(document.createComment(""));if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);if(match[1]==="*"){var tmp=[];for(var i=0;results[i];i++){if(results[i].nodeType===1){tmp.push(results[i])}}results=tmp}return results}}div.innerHTML="<a href='#'></a>";if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2)}}})();if(document.querySelectorAll)(function(){var oldSizzle=Sizzle,div=document.createElement("div");div.innerHTML="<p class='TEST'></p>";if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return}Sizzle=function(query,context,extra,seed){context=context||document;if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra)}catch(e){}}return oldSizzle(query,context,extra,seed)};Sizzle.find=oldSizzle.find;Sizzle.filter=oldSizzle.filter;Sizzle.selectors=oldSizzle.selectors;Sizzle.matches=oldSizzle.matches})();if(document.getElementsByClassName&&document.documentElement.getElementsByClassName)(function(){var div=document.createElement("div");div.innerHTML="<div class='test e'></div><div class='test'></div>";if(div.getElementsByClassName("e").length===0)return;div.lastChild.className="e";if(div.getElementsByClassName("e").length===1)return;Expr.order.splice(1,0,"CLASS");Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1])}}})();function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;elem.sizset=i}elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break}if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;elem.sizset=i}if(elem.nodeName===cur){match=elem;break}elem=elem[dir]}checkSet[i]=match}}}function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;for(var i=0,l=checkSet.length;i<l;i++){var elem=checkSet[i];if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;elem.sizset=i}elem=elem[dir];var match=false;while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];break}if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;elem.sizset=i}if(typeof cur!=="string"){if(elem===cur){match=true;break}}else if(Sizzle.filter(cur,[elem]).length>0){match=elem;break}}elem=elem[dir]}checkSet[i]=match}}}var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16}:function(a,b){return a!==b&&(a.contains?a.contains(b):true)};var isXML=function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&isXML(elem.ownerDocument)};var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];selector=selector.replace(Expr.match.PSEUDO,"")}selector=Expr.relative[selector]?selector+"*":selector;for(var i=0,l=root.length;i<l;i++){Sizzle(selector,root[i],tmpSet)}return Sizzle.filter(later,tmpSet)};jQuery.find=Sizzle;jQuery.filter=Sizzle.filter;jQuery.expr=Sizzle.selectors;jQuery.expr[":"]=jQuery.expr.filters;Sizzle.selectors.filters.hidden=function(elem){return elem.offsetWidth===0||elem.offsetHeight===0};Sizzle.selectors.filters.visible=function(elem){return elem.offsetWidth>0||elem.offsetHeight>0};Sizzle.selectors.filters.animated=function(elem){return jQuery.grep(jQuery.timers,function(fn){return elem===fn.elem}).length};jQuery.multiFilter=function(expr,elems,not){if(not){expr=":not("+expr+")"}return Sizzle.matches(expr,elems)};jQuery.dir=function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir]}return matched};jQuery.nth=function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur};jQuery.sibling=function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n)}return r};return;window.Sizzle=Sizzle})();jQuery.event={fixType:function(t){return String(t).replace(/mousewheel/i,$B.msie||$B.opera?'mousewheel':'DOMMouseScroll')},add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(elem.setInterval&&elem!=window)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!==undefined){var fn=handler;handler=this.proxy(fn);handler.data=data}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(arguments.callee.elem,arguments):undefined});handle.elem=elem;jQuery.each(this.fixType(types).split(/\s+/),function(index,type){var namespaces=type.split(".");type=namespaces.shift();handler.type=namespaces.slice().sort().join(".");var handlers=events[type];if(jQuery.event.specialAll[type])jQuery.event.specialAll[type].setup.call(elem,data,namespaces);if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem,data,namespaces)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle)}}handlers[handler.guid]=handler;jQuery.event.global[type]=true});elem=null},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;types=this.fixType(types);var events=jQuery.data(elem,"events"),ret,index;if(events){if(types===undefined||(typeof types==="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type}jQuery.each(types.split(/\s+/),function(index,type){var namespaces=type.split(".");type=namespaces.shift();var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");if(events[type]){if(handler)delete events[type][handler.guid];else for(var handle in events[type])if(namespace.test(events[type][handle].type))delete events[type][handle];if(jQuery.event.specialAll[type])jQuery.event.specialAll[type].teardown.call(elem,namespaces);for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem,namespaces)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"))}ret=null;delete events[type]}}})}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle")}}},trigger:function(event,data,elem,bubbling){var type=event.type||event;if(!bubbling){event=typeof event==="object"?event[expando]?event:(window.$E||jQuery.extend)(jQuery.Event(type),event):jQuery.Event(type);if(type.indexOf("!")>=0){event.type=type=type.slice(0,-1);event.exclusive=true}if(!elem){event.stopPropagation();if(this.global[type])jQuery.each(jQuery.cache,function(){if(this.events&&this.events[type])jQuery.event.trigger(event,data,this.handle.elem)})}if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;event.result=undefined;event.target=elem;data=jQuery.makeArray(data);data.unshift(event)}event.currentTarget=elem;var handle=jQuery.data(elem,"handle");if(handle)handle.apply(elem,data);if((!elem[type]||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)event.result=false;if(!bubbling&&elem[type]&&!event.isDefaultPrevented()&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]()}catch(e){}}this.triggered=false;if(!event.isPropagationStopped()){var parent=elem.parentNode||elem.ownerDocument;if(parent)jQuery.event.trigger(event,data,parent,true)}},handle:function(event){var all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);event.currentTarget=this;var namespaces=event.type.split(".");event.type=namespaces.shift();all=!namespaces.length&&!event.exclusive;var namespace=RegExp("(^|\\.)"+namespaces.slice().sort().join(".*\\.")+"(\\.|$)");handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||namespace.test(handler.type)){event.handler=handler;event.data=handler.data;var ret=handler.apply(this,arguments);if(ret!==undefined){event.result=ret;if(ret===false){event.preventDefault();event.stopPropagation()}}if(event.isImmediatePropagationStopped())break}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(event){if(event[expando])return event;var originalEvent=event;event=jQuery.Event(originalEvent);for(var i=this.props.length,prop;i;){prop=this.props[--i];event[prop]=originalEvent[prop]}if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0)}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event},proxy:function(fn,proxy){proxy=proxy||function(){return fn.apply(this,arguments)};proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy},special:{ready:{setup:bindReady,teardown:function(){}}},specialAll:{live:{setup:function(selector,namespaces){jQuery.event.add(this,namespaces[0],liveHandler)},teardown:function(namespaces){if(namespaces.length){var remove=0,name=RegExp("(^|\\.)"+namespaces[0]+"(\\.|$)");jQuery.each((jQuery.data(this,"events").live||{}),function(){if(name.test(this.type))remove++});if(remove<1)jQuery.event.remove(this,namespaces[0],liveHandler)}}}}};jQuery.Event=function(src){if(!this.preventDefault)return new jQuery.Event(src);if(src&&src.type){this.originalEvent=src;this.type=src.type}else this.type=src;this.timeStamp=now();this[expando]=true};function returnFalse(){return false}function returnTrue(){return true}jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;if(!e)return;if(e.preventDefault)e.preventDefault();e.returnValue=false},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;if(!e)return;if(e.stopPropagation)e.stopPropagation();e.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue;this.stopPropagation()},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var withinElement=function(event){var parent=event.relatedTarget;while(parent&&parent!=this)try{parent=parent.parentNode}catch(e){parent=this}if(parent!=this){event.type=event.data;jQuery.event.handle.apply(this,arguments)}};jQuery.each({mouseover:'mouseenter',mouseout:'mouseleave'},function(orig,fix){jQuery.event.special[fix]={setup:function(){jQuery.event.add(this,orig,withinElement,fix)},teardown:function(){jQuery.event.remove(this,orig,withinElement)}}});jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data)})},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments)});return this.each(function(){jQuery.event.add(this,type,one,fn&&data)})},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn)})},trigger:function(type,data){return this.each(function(){jQuery.event.trigger(type,data,this)})},triggerHandler:function(type,data){if(this[0]){var event=jQuery.Event(type);event.preventDefault();event.stopPropagation();jQuery.event.trigger(event,data,this[0]);return event.result}},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false}))},hover:function(fnOver,fnOut){return this.mouseenter(fnOver).mouseleave(fnOut)},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else jQuery.readyList.push(fn);return this},live:function(type,fn){var proxy=jQuery.event.proxy(fn);proxy.guid+=this.selector+type;jQuery(document).bind(liveConvert(type,this.selector),this.selector,proxy);return this},die:function(type,fn){jQuery(document).unbind(liveConvert(type,this.selector),fn?{guid:fn.guid+this.selector+type}:null);return this}});function liveHandler(event){var check=RegExp("(^|\\.)"+event.type+"(\\.|$)"),stop=true,elems=[];jQuery.each(jQuery.data(this,"events").live||[],function(i,fn){if(check.test(fn.type)){var elem=jQuery(event.target).closest(fn.data)[0];if(elem)elems.push({elem:elem,fn:fn})}});elems.sort(function(a,b){return jQuery.data(a.elem,"closest")-jQuery.data(b.elem,"closest")});jQuery.each(elems,function(){if(this.fn.call(this.elem,event,this.fn.data)===false)return(stop=false)});return stop}function liveConvert(type,selector){return["live",type,selector.replace(/\./g,"`").replace(/ /g,"|")].join(".")}jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document,jQuery)});jQuery.readyList=null}jQuery(document).triggerHandler("ready")}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);jQuery.ready()},false)}else if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);jQuery.ready()}});if(document.documentElement.doScroll&&window==window.top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left")}catch(error){setTimeout(arguments.callee,0);return}jQuery.ready()})()}jQuery.event.add(window,"load",jQuery.ready)}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,"+"change,select,submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name)}});jQuery(window).bind('unload',function(){for(var id in jQuery.cache)if(id!=1&&jQuery.cache[id].handle)jQuery.event.remove(jQuery.cache[id].handle.elem)});(function(){jQuery.support={};var root=document.documentElement,script=document.createElement("script"),div=document.createElement("div"),id="script"+(new Date).getTime();div.style.display="none";div.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var all=div.getElementsByTagName("*"),a=div.getElementsByTagName("a")[0];if(!all||!all.length||!a){return}jQuery.support={leadingWhitespace:div.firstChild.nodeType==3,tbody:!div.getElementsByTagName("tbody").length,objectAll:!!div.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!div.getElementsByTagName("link").length,style:/red/.test(a.getAttribute("style")),hrefNormalized:a.getAttribute("href")==="/a",opacity:a.style.opacity==="0.5",cssFloat:!!a.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};script.type="text/javascript";try{script.appendChild(document.createTextNode("window."+id+"=1;"))}catch(e){}root.insertBefore(script,root.firstChild);if(window[id]){jQuery.support.scriptEval=true;delete window[id]}root.removeChild(script);if(div.attachEvent&&div.fireEvent){div.attachEvent("onclick",function(){jQuery.support.noCloneEvent=false;div.detachEvent("onclick",arguments.callee)});div.cloneNode(true).fireEvent("onclick")}jQuery(function(){var div=document.createElement("div");div.style.width=div.style.paddingLeft="1px";document.body.appendChild(div);jQuery.boxModel=jQuery.support.boxModel=div.offsetWidth===2;document.body.removeChild(div).style.display='none'})})();var styleFloat=jQuery.support.cssFloat?"cssFloat":"styleFloat";jQuery.props={"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!=="string")return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off)}var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null}else if(typeof params==="object"){params=jQuery.param(params);type="POST"}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);if(callback)self.each(callback,[res.responseText,status,res])}});return this},serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:jQuery.isArray(val)?jQuery.map(val,function(val,i){return{name:elem.name,value:val}}):{name:elem.name,value:val}}).get()}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f)}});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type})},getScript:function(url,callback){return jQuery.get(url,null,callback,"script")},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json")},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={}}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type})},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajaxLoading:function(o,s){if(o.loading){if(o.loading.constructor==Function){o.loading(!!s)}else{jQuery(o.loading)[s?'show':'hide']()}}},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(!s.loading&&(s.data&&s.data.loading)){s.loading=s.data.loading;s.data.loading=null;delete s.data.loading}var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!=="string")s.data=jQuery.param(s.data);if(s.baseData&&String.toQuery)s.data+=(s.data?'&':'')+String.toQuery(s.baseData);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?"}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json"}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp]}catch(e){}if(head)head.removeChild(script)}}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"")}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null}if(debug.screen)debug.log('<b style="color: #000">'+s.type+': '+s.url+'</b> | '+decodeURIComponent(s.data));if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var parts=/^(\w+:)?\/\/([^\/?#]+)/.exec(s.url);if(s.dataType=="script"&&type=="GET"&&parts&&(parts[1]&&parts[1]!=location.protocol||parts[2]!=location.host)){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();script.onload=script.onreadystatechange=null;head.removeChild(script)}}}head.appendChild(script);return undefined}var requestDone=false;var xhr=s.xhr();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default)}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");xhr.abort();return false}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(xhr.readyState==0){if(ival){clearInterval(ival);ival=null;if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop")}}else if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null}status=isTimeout=="timeout"?"timeout":!jQuery.httpSuccess(xhr)?"error":s.ifModified&&jQuery.httpNotModified(xhr,s.url)?"notmodified":"success";xhr=(jQuery.ajaxResult||window.jsCore&&jsCore.F)(xhr,status);if(debug.screen)debug.log('SR: <span style="color: #c00">'+xhr.responseText+'</span>');if(jQuery.ajaxResult||status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s)}catch(e){status="parsererror"}}if(jQuery.ajaxResult||status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified")}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success()}else jQuery.handleError(s,xhr,status);complete();if(isTimeout)xhr.abort();if(s.async)xhr=null}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr&&!requestDone)onreadystatechange("timeout")},s.timeout)}try{xhr.send(s.data);jQuery.ajaxLoading(s,1)}catch(e){jQuery.handleError(s,xhr,null,e)}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s])}function complete(){jQuery.ajaxLoading(s,0);s.loading=null;if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop")}return!s.async&&jQuery.ajaxResult&&jQuery.ajaxResult(xhr,status,s.dataType)||xhr},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e])},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223}catch(e){}return false},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]}catch(e){}return false},httpData:function(xhr,type,s){if(xhr.__xhr__)return xhr;var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(s&&s.dataFilter)data=s.dataFilter(data,type);if(typeof data==="string"){if(type=="script")jQuery.globalEval(data);if(type=="json")data=window["eval"]("("+data+")")}return data},param:function(a){var s=[];function add(key,value){s[s.length]=encodeURIComponent(key)+'='+encodeURIComponent(value)};if(jQuery.isArray(a)||a.jquery)jQuery.each(a,function(){add(this.name,this.value)});else for(var j in a)if(jQuery.isArray(a[j]))jQuery.each(a[j],function(){add(j,this)});else add(j,jQuery.isFunction(a[j])?a[j]():a[j]);return s.join("&").replace(/%20/g,"+")}});var elemdisplay={},timerId,fxAttrs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function genFx(type,num){var obj={};jQuery.each(fxAttrs.concat.apply([],fxAttrs.slice(0,num)),function(){obj[this]=type});return obj}jQuery.fn.extend({show:function(speed,callback){if(speed==-1)for(var i=0,l=this.length;i<l;i++)$FS(this[i]).display='';else if(speed){return this.animate(genFx("show",3),speed,callback)}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");this[i].style.display=old||"";if(jQuery.css(this[i],"display")==="none"){var tagName=this[i].tagName,display;if(elemdisplay[tagName]){display=elemdisplay[tagName]}else{var elem=jQuery("<"+tagName+" />").appendTo("body");display=elem.css("display");if(display==="none")display="block";elem.remove();elemdisplay[tagName]=display}jQuery.data(this[i],"olddisplay",display)}}for(var i=0,l=this.length;i<l;i++){this[i].style.display=jQuery.data(this[i],"olddisplay")||""}return this}},hide:function(speed,callback){if(speed==-1)for(var i=0,l=this.length;i<l;i++)$FS(this[i]).display='none';else if(speed){return this.animate(genFx("hide",3),speed,callback)}else{for(var i=0,l=this.length;i<l;i++){var old=jQuery.data(this[i],"olddisplay");if(!old&&old!=="none")jQuery.data(this[i],"olddisplay",jQuery.css(this[i],"display"))}for(var i=0,l=this.length;i<l;i++){this[i].style.display="none"}return this}},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){var bool=typeof fn==="boolean";return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn==null||bool?this.each(function(){var state=bool?fn:jQuery(this).is(":hidden");jQuery(this)[state?"show":"hide"]()}):this.animate(genFx("toggle",3),fn,fn2)},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback)},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){var opt=jQuery.extend({},optall),p,hidden=this.nodeType==1&&jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if((p=="height"||p=="width")&&this.style){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit)}else e.custom(start,val,"")}});return true})},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1)}});if(!gotoEnd)this.dequeue();return this}});jQuery.each({slideDown:genFx("show",1),slideUp:genFx("hide",1),slideToggle:genFx("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(name,props){jQuery.fn[name]=function(speed,callback){return this.animate(props,speed,callback)}});jQuery.extend({speed:function(speed,easing,fn){var opt=typeof speed==="object"?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&!jQuery.isFunction(easing)&&easing};opt.duration=jQuery.fx.off?0:typeof opt.duration==="number"?opt.duration:jQuery.fx.speeds[opt.duration]||jQuery.fx.speeds._default;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this)};return opt},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum}},timers:[],fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={}}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style)this.elem.style.display="block"},cur:function(force){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;var self=this;function t(gotoEnd){return self.step(gotoEnd)}t.elem=this.elem;if(t()&&jQuery.timers.push(t)&&!timerId){timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(timerId);timerId=undefined}},13)}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());jQuery(this.elem).show()},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(gotoEnd){var t=now();if(gotoEnd||t>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block"}if(this.options.hide)jQuery(this.elem).hide();if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);this.options.complete.call(this.elem)}return false}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now)},_default:function(fx){if(fx.elem.style&&fx.elem.style[fx.prop]!=null)fx.elem.style[fx.prop]=fx.now+fx.unit;else fx.elem[fx.prop]=fx.now}}});if(document.documentElement["getBoundingClientRect"])jQuery.fn.offset=function(){if(!this[0])return{top:0,left:0};if(this[0]===this[0].ownerDocument.body)return jQuery.offset.bodyOffset(this[0]);var box=this[0].getBoundingClientRect(),doc=this[0].ownerDocument,body=doc.body,docElem=doc.documentElement,clientTop=docElem.clientTop||body.clientTop||0,clientLeft=docElem.clientLeft||body.clientLeft||0,top=box.top+(self.pageYOffset||jQuery.boxModel&&docElem.scrollTop||body.scrollTop)-clientTop,left=box.left+(self.pageXOffset||jQuery.boxModel&&docElem.scrollLeft||body.scrollLeft)-clientLeft;return{top:top,left:left}};else jQuery.fn.offset=function(){if(!this[0])return{top:0,left:0};if(this[0]===this[0].ownerDocument.body)return jQuery.offset.bodyOffset(this[0]);jQuery.offset.initialized||jQuery.offset.initialize();var elem=this[0],offsetParent=elem.offsetParent,prevOffsetParent=elem,doc=elem.ownerDocument,computedStyle,docElem=doc.documentElement,body=doc.body,defaultView=doc.defaultView,prevComputedStyle=defaultView.getComputedStyle(elem,null),top=elem.offsetTop,left=elem.offsetLeft;while((elem=elem.parentNode)&&elem!==body&&elem!==docElem){computedStyle=defaultView.getComputedStyle(elem,null);top-=elem.scrollTop,left-=elem.scrollLeft;if(elem===offsetParent){top+=elem.offsetTop,left+=elem.offsetLeft;if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(elem.tagName)))top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0;prevOffsetParent=offsetParent,offsetParent=elem.offsetParent}if(jQuery.offset.subtractsBorderForOverflowNotVisible&&computedStyle.overflow!=="visible")top+=parseInt(computedStyle.borderTopWidth,10)||0,left+=parseInt(computedStyle.borderLeftWidth,10)||0;prevComputedStyle=computedStyle}if(prevComputedStyle.position==="relative"||prevComputedStyle.position==="static")top+=body.offsetTop,left+=body.offsetLeft;if(prevComputedStyle.position==="fixed")top+=Math.max(docElem.scrollTop,body.scrollTop),left+=Math.max(docElem.scrollLeft,body.scrollLeft);return{top:top,left:left}};jQuery.offset={initialize:function(){if(this.initialized)return;var body=document.body,container=document.createElement('div'),innerDiv,checkDiv,table,td,rules,prop,bodyMarginTop=body.style.marginTop,html='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';rules={position:'absolute',top:0,left:0,margin:0,border:0,width:'1px',height:'1px',visibility:'hidden'};for(prop in rules)container.style[prop]=rules[prop];container.innerHTML=html;body.insertBefore(container,body.firstChild);innerDiv=container.firstChild,checkDiv=innerDiv.firstChild,td=innerDiv.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(checkDiv.offsetTop!==5);this.doesAddBorderForTableAndCells=(td.offsetTop===5);innerDiv.style.overflow='hidden',innerDiv.style.position='relative';this.subtractsBorderForOverflowNotVisible=(checkDiv.offsetTop===-5);body.style.marginTop='1px';this.doesNotIncludeMarginInBodyOffset=(body.offsetTop===0);body.style.marginTop=bodyMarginTop;body.removeChild(container);this.initialized=true},bodyOffset:function(body){jQuery.offset.initialized||jQuery.offset.initialize();var top=body.offsetTop,left=body.offsetLeft;if(jQuery.offset.doesNotIncludeMarginInBodyOffset)top+=parseInt(jQuery.curCSS(body,'marginTop',true),10)||0,left+=parseInt(jQuery.curCSS(body,'marginLeft',true),10)||0;return{top:top,left:left}}};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left}}return results},offsetParent:function(){var offsetParent=this[0].offsetParent||document.body;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent)}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return null;return val!==undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method]}});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom",lower=name.toLowerCase();jQuery.fn["inner"+name]=function(){return this[0]?jQuery.css(this[0],lower,false,"padding"):null};jQuery.fn["outer"+name]=function(margin){return this[0]?jQuery.css(this[0],lower,false,margin?"margin":"border"):null};var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(document.documentElement["client"+name],document.body["scroll"+name],document.documentElement["scroll"+name],document.body["offset"+name],document.documentElement["offset"+name]):size===undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,typeof size==="string"?size:size+"px")}})})();var $HTML=jQuery(HTML),$WIN=jQuery(window),$DOC=jQuery(document),$HEAD=jQuery('HEAD'),$BODY=jQuery('BODY');if(window.jsLoader){var jQ=jsCore.jQuery=jQuery};
jsLoader.loaded('{jQuery}jquery');


/**
 * @object	Window
 * @author	RubaXa	<trash@rubaxa.org>
 * @version	1.0
 */
var Window=0;window['jsWindow']=1;Window=window['jsWindow'];var wEvents='resize,scroll,blur,focus,unload,keydown,keyup,keypress,'+'sessionStorage,localStorage,globalStorage';wEvents=wEvents.split(',');var CWindow=jsClass.create().setMethods({__construct:function(){var This=this;this.Listeners={};jsCore.each(wEvents,function(i,n){This.Listeners[n]=function(e){jsWindow.dispatchEvent(n,e||window.Event)};jsEvent.add(n.indexOf('key')>-1?document.body:window,n,This.Listeners[n])});This=null},destroy:function(){var This=this;jsCore.each(wEvents,function(i,n){jsEvent.remove(n.indexOf('key')>-1?document.body:window,n,This.Listeners[n])});This=null;jsCore.destroy(This)},open:function(u,p){var p=$E({name:'window'+jsCore.getUniqId(),fullscreen:0,location:1,menubar:1,resizable:1,scrollbars:1,status:1,titlebar:1,toolbar:1,left:'',top:'',width:'',height:''},p);var _p=[];if((p.left=='')&&(p.width>0))p.left=Math.max(0,(screen.width-p.width)/2);if((p.top=='')&&(p.height>0))p.top=Math.max(0,(screen.height-p.height)/2);jsCore.each(p,function(k,v){if(v!=='')_p.push(k+'='+v)});return window.open(u,p.name,_p.join(','))},openPopUp:function(u,p){return this.open(u,$E({location:0,menubar:0,resizable:0,toolbar:0},p))},setTitle:function(t){document.title=t},refresh:function(){document.location.reload()},resize:function(w,h){if(w>screen.width)w=screen.width;if(h>screen.height)h=screen.height;window.resizeTo(w,h)},scrolling:function(enable){if(defined(enable)){document.body.style.overflow=enable?'hidden':''}return this},hasScrolling:function(x){if(x){return(this[x=='X'?'getWidth':'getHeight']()<document.body[x=='X'?'scrollWidth':'scrollHeight'])}else{return(this.hasScrolling('X')||this.hasScrolling('Y'))}},getWidth:function(){window.width=window.innerWidth?window.innerWidth:(document.documentElement?(document.documentElement.clientWidth||document.body.clientWidth):0);return window.width},getHeight:function(){window.height=window.innerHeight?window.innerHeight:(document.documentElement?(document.documentElement.clientHeight||document.body.clientHeight):0);return window.height},focus:function(){this.dispatchEvent('focus');window.focus()},blur:function(){this.dispatchEvent('blur');window.blur()}});window['jsWindow']=new CWindow();jsCore.each('Left,Top,Width,Height'.split(','),function(i,p){var name='scroll'+p;window['jsWindow'][name]=function(){return document.body[name]}});Window=window['jsWindow'];;
jsLoader.loaded('{jsCore}Window');


/**
 * @author				RubaXa	<trash@rubaxa.org>
 * @compatibility		JavaScript 1.5+
 * http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array 
 */
if(!Array.lastIndexOf){Array.lastIndexOf=function(a,e,f){var l=a.length;var f=Number(f);if(isNaN(f)){f=l-1}else{f=(f<0)?Math.ceil(f):Math.floor(f);if(f<0)f+=l;else if(f>=l)f=l-1}for(;f>-1;f--){if((f in a)&&(a[f]===e))return f}return-1}};if(!Array.forEach){Array.forEach=function(a,f,This){if(typeof f!='function')throw new TypeError();for(var i=0,n=a.length;i<n;i++){if(f.call(This,a[i],i,a)==false){break}}}};if(!Array.every){Array.every=function(a,f,This){if(typeof f!='function')throw new TypeError();for(var i=0,n=a.length;i<n;i++){if((i in a)&&!f.call(This,a[i],i,a))return false}return true}};if(!Array.some){Array.some=function(a,f,This){if(typeof f!='function')throw new TypeError();for(var i=0,n=a.length;i<n;i++){if((i in a)&&f.call(This,a[i],i,a))return true}return false}};if(!Array.map){Array.map=function(a,f,This){if(typeof f!='function')throw new TypeError();var l=a.length;var r=new Array(l);for(var i=0;i<l;i++){if(i in a)r[i]=f.call(This,a[i],i,a)}return r}};if(!Array.reduce){Array.reduce=function(a,f,i){if(typeof f!='function')throw new TypeError();var l=a.length;if(l==0&&arguments.length==1)throw new TypeError();var i=0;if(arguments.length>=2){var rv=arguments[1]}else{do{if(i in a){rv=a[i++];break}if(++i>=l)throw new TypeError()}while(true)}for(;i<l;i++){if(i in this)rv=f.call(null,rv,a[i],i,a)}return rv}};if(!Array.reduceRight){Array.reduceRight=function(a,f,i){return this.reduce(a.reverse(),f,i)}};$E(Array,{insert:function(a,v,i){return a.slice(0,i).concat(v).concat(a.slice(i))},push:function(a,v,f){if(f){return[v].concat(a)}else{a.push(v);return a}},create:function(a){return a?(a.constructor==Array?a:[a]):[]},keys:function(a){var k=[];for(var i in a)k.push(i);return k},first:function(a,k){for(var i in a)return k?i:a[i]},firstKey:function(a){return this.first(a,1)},end:function(a){return a[a.length-1]},empty:function(a){return!a||(a.length==0)},extract:function(o,p){if(typeof(props)=='string')p=p.split(',');var a=o.constructor==Array;var r=a?[]:{};for(var i=0,n=p.length;i<n;i++){a?r.push(o[p[i]]):r[p[i]]=o[p[i]]}return r},fill:function(a,l,v){var r=[];r.push.apply(r,a);for(var i=0;i<l;i++)r.push(v);return r},replace:function(a,r,i){if(r.constructor!=Array)r=[r];return a.slice(0,i).concat(r,a.slice(i+r.length))},move:function(a,f,t){var i=a[f];return this.insert(this.remove(a,f),i,t)},sum:function(a,F,T){var r=0;for(var i=0,n=a.length;i<n;i++){r+=(F||jsCore.F).call(T,a[i])}return r}});;
jsLoader.loaded('{jsCore}Array');


/**
 * @object		jsFix
 * @author		"RubaXa"		<trash@rubaxa.org>
 */
var jsFix={pixel:'{img.pixel}1.gif',ready:function(){},elm:function(e,c){if(e&&e.append)e=e[0];if(!e)return;this._elm(e);this.png(e);if(defined(c,1)){var e=e.getElementsByTagName('*');for(var i=0,n=e.length;i<n;i++){this._elm(e[i]);this.png(e[i])}}e=null;delete e},_hasClass:function(e,c){return(new RegExp('(^|\\s)'+c+'($|\\s)')).test(e.className)},_elm:function(e){if(!e.__fixed){e.__fixed=1;switch(e.tagName){case'INPUT':{if(!this._hasClass(e,e.type))e.className+=' '+e.type;if((e.type=='xradio')||(e.type=='checkbox')){jQuery(e).click(jsFix._checkBox);jsFix._checkBox.call(e)}}break;case'SELECT':case'TEXTAREA':{if(!this._hasClass(e,e.tagName.toLowerCase())){e.className+=' '+e.tagName.toLowerCase()}}break}}},_checkBox:function(){this.parentNode.className=this.parentNode.className.replace(/(\s|^)checked(\s|$)/,'$2')+(this.checked?' checked':'')},png:function(e){if($B.msie&&($B.ver<7)){var src;if(this.isPngFile(e.src)){if(e.width&&e.height){e.style.width=e.width;e.style.height=e.height}e.rsrc=e.src;e.src=this.iPixel;e.runtimeStyle.filter='none';e.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+e.rsrc+"',sizingMethod='crop')"}else if(e.background&&this.isPngFile(e.background)){e.rsrc=this.getSrc(e.background);e.background='none';e.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+e.rsrc+"',sizingMethod='crop')"}else if(e.style.backgroundImage&&this.isPngFile(e.style.backgroundImage)){e.rsrc=this.getSrc(e.style.backgroundImage);e.style.backgroundImage='none';e.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+e.rsrc+"',sizingMethod='crop')"}else if(e.currentStyle.backgroundImage&&this.isPngFile(e.currentStyle.backgroundImage)){e.rsrc=this.getSrc(e.currentStyle.backgroundImage);e.currentStyle.backgroundImage='none';e.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+e.rsrc+"',sizingMethod='crop')"}}},label:function(e){if($B.msie){if(e[0])e=e[0];e=e.getElementsByTagName('LABEL');for(var i=0,n=e.length;i<n;i++){if($GA(e[i],'htmlFor')){jQuery(e[i]).bind('click',function(){try{var I=jQuery(document.getElementById(this.getAttribute('htmlFor')));if(I[0]){I[0].checked=true;I.click().focus()}I=null}catch(e){}})}}}},isPngFile:function(f){return f&&/\.png$/.test(f)},getSrc:function(s){return(s.indexOf('url(')>-1)?/url\((.*)\)/i.exec(s)[1].replace(/['"]/g, ''):s}};jsCore.ready(function(){jsFix.ready()});;
jsLoader.loaded('{utils}jsFix');


/**
 * Необходимые расширения для jQuery
 * @author	"RubaXa"		<trash@rubaxa.org>
 */
var PositionFixedStyleSheets=0;if($B.msie&&(!jQuery.boxModel||($B.ver<7))){var S=document.createElement('STYLE'),i=0,sS=document.styleSheets;try{S.setAttribute('type','text/css');HEAD.insertBefore(S,HEAD.firstChild);for(;sS[i];i++){if(document.location.href.indexOf(sS[i].href)!=-1){PositionFixedStyleSheets=sS[i];break}}}catch(e){};S=sS=null}jsCore.jQuery.fn.extend({F:function(){return this},elm:function(n){return jQuery(this[0].elements[n])},replaceClass:function(s,r){this.each(function(){this.className=this.className.replace(s,r)});return this},cleenHtml:function(lvl){if(this[0]&&this[0].childNodes&&this[0].childNodes.length){for(var n,i=this[0].childNodes.length-1;i>=0;i--){n=this[0].childNodes[i];if(n.nodeType==1){if(isNaN(lvl)?lvl:--lvl)jQuery(n).cleenHtml(lvl)}else{n.parentNode.removeChild(n)}}n=null}return this},fix:function(c){this.each(function(){jsFix.elm(this,c)});return this},_parents:jQuery.fn.parents,parents:function(r,v){if(defined(v)){return jQuery($G(this,r,v))}return this._parents(r)},item:function(i){return jQuery(this[i])},unselectable:function(offOn){if(defined(offOn)){this.each(function(){$SA(this,'unselectable',offOn?'On':'Off');var e=this.getElementsByTagName('*');for(var i=0;e[i];i++){$SA(e[i],'unselectable',this.unselectable?'On':'Off');e[i].style['user-select']=e[i].style['-moz-user-select']=e[i].style['-khtml-user-select']=(this.unselectable?'none':'normal')}e=null})}else{return(this[0].unselectable.toLowerCase()=='on')}return this},hitTest:function(e){if(e.constructor==String)e=jQuery(e)[0];else if(e[0])e=e[0];else if(e.target)e=e.target;for(var i=0,a;i<this.length;i++){a=this[i];var x=e;do{if(a==x){a=x=e=null;return true}}while(x=x.parentNode)};a=x=e=null;return false},insertFirst:function($T){$T=jQuery($T);if($T){if($T[0].firstChild&&$T[0].parentNode){$T[0].firstChild.parentNode.insertBefore(this[0],$T[0].firstChild)}else{$T.append(this)}}return this},toObject:function(f){var data={};this.find('INPUT,TEXTAREA,SELECT').each(function(){try{if(this.name&&(!this.disabled||f)){switch(this.tagName){case'INPUT':case'TEXTAREA':{if(this.type=='checkbox'){if(this.checked){if(!data[this.name])data[this.name]=[];data[this.name].push(this.value)}}else if(this.type=='radio'){if(this.checked)data[this.name]=this.value}else{data[this.name]=((window.InputValidator?InputValidator.get(this):0)||this).value}}break;case'SELECT':data[this.name]=this.options[this.selectedIndex].value;break}}}catch(e){debug.log(e)}});return data},scrollWidth:function(){return(this[0]&&this[0].scrollWidth)?this[0].scrollWidth:0},scrollHeight:function(){return(this[0]&&this[0].scrollHeight)?this[0].scrollHeight:0},setPositionFixed:function(x,y){if(PositionFixedStyleSheets){var c=('p-fixed-'+x+'-'+y).replace(/%/g,'pr');if(!Registry.get('PFSS'+c)){if((typeof x!='number')&&(x.indexOf('%')>0))x='Window.getWidth()*'+(parseFloat(x)/100);else x=parseInt(x);if((typeof y!='number')&&(y.indexOf('%')>0))y='Window.getHeight()*'+(parseFloat(y)/100);else y=parseInt(y);PositionFixedStyleSheets.addRule('.'+c,'position: absolute;'+"left: expression(eval($WIN.scrollLeft()+"+x+") + 'px');"+"top: expression(eval($WIN.scrollTop()+"+y+") + 'px');");Registry.put('PFSS'+c,true)}this.removePositionFixed();this.each(function(){this.style.position='';this.style.left='';this.style.top='';this.className+=' '+c})}else{this.css({position:'fixed',left:x,top:y})}return this},removePositionFixed:function(){this.each(function(){this.className=this.className.replace(/\s+p-fixed([\d.,pr-]+)/gi,'');this.style.position=''});return this}});;
jsLoader.loaded('{jQuery}extensions');


window.jQuery=jsCore.jQuery;window.jsPlugins=(new(jsClass.create().setMethods({__construct:function(){this.elms={}},processing:function(e){jQuery(e).find('.js-plugin').each(function(){this.className=this.className.replace('js-plugin','');jsPlugins.set(this,'plugin')})},set:function(e,name,o){if(!e)return this;var uId=jsCore.getUniqId(e=$F(e));if(!this.elms[uId])this.elms[uId]={};var x=e.onclick?e.onclick():0;o=o||{};if(typeof x=='string')name=x;else o=$E(x||{},o);e.removeAttribute('click');e.onclick=null;if(name=='plugin'){if(o.plugin){this.set(e,o.plugin,(o.options||o))}else if(o[0]){for(var i=0;o[i];i++){this.set(e,o[i].plugin,o[i].options)}}else{for(var n in o){this.set(e,n,o[n])}}}else{var alias=o.__pAlias||jsLoader.getAlias(name,'plugins'),name=jsLoader.getName(name),require='{'+alias+'}'+name,i=0,n=name.split('.'),Klass=window;for(;n[i]&&(Klass=Klass[n[i]]);i++){}if(jsLoader.isLoaded(require)||Klass){this.elms[uId][name]=new Klass(jQuery(e),o)}else{o.__pAlias=alias;jsLoader.require(require,function(){jsPlugins.set(e,name,o)})}}return this},get:function(e,n){var uId=jsCore.getUniqId(e&&$F(e));return this.elms[uId]&&this.elms[uId][n]}})));jQuery.fn.extend({setPlugin:function(n,o,e,r){if(!e||!this.hasPlugin(n))jsPlugins.set(this[0],n,o);return r?this.getPlugin(n):this},getPlugin:function(n){return jsPlugins.get(this[0],jsLoader.getName(n))},hasPlugin:function(n){return!!jsPlugins.get(this[0],n)},processPlugins:function(){for(var i=0;this[i];i++)if(/js-plugin/.test(this[i].innerHTML))jsPlugins.processing(this);return this}});;
jsLoader.loaded('{plugins}jsPlugins');


/**
 * @class   InputValidator
 * @author  RubaXa 	<trash@rubaxa.org>
 * @events	blur, focus, click, valid
 * Базовый класс для валидации Input'ов, Select'ов и подобного хлама
 */
jsClass.create('InputValidator').setMethods({__construct:function($T,o){InputValidator[this.uniqId]=this;$T=jQuery($T);o=o||{};this.beforeInit($T,o);if(!this.$Group)this.$Group=o.group?jQuery(o.group):this.$Input;this.counters=!!o.group;o.group=undefined;if(this.$Input[0].onclick){o=$E(this.$Input[0].onclick(),o);this.$Input[0].onclick=null}this.$Input[0].ivUniqId=this.uniqId;this.event={};this.name=this.$Input[0].name.replace('[]','');this.type=(this.$Input[0].type||'text').toLowerCase();this.tagName=this.$Input[0].tagName.toUpperCase();this.isInput=this.tagName=='INPUT';this.isSelect=this.tagName=='SELECT';this.isTextarea=this.tagName=='TEXTAREA';this.isText=this.type=='text';this.isPass=this.type=='password';this.isFile=this.type=='file';this.isImage=this.type=='image';this.isRadio=this.type=='radio';this.isCheckbox=this.type=='checkbox';this.isChecked=this.isSelected=!!this.$Input[0][this.isCheckbox?'checked':'selected'];$E(this,this.getDefOptions(),o);if((this.format&&(typeof this.format=='string'))||(this.validator&&(typeof this.validator=='string'))){if(InputValidator.Formats[this.format]){this.format=InputValidator.Formats[this.format]}else if(InputValidator.Validators[this.validator||this.format]){this.validator=InputValidator.Validators[this.validator||this.format];this.format=0}else{this.format=0;this.validator=0}}this._pV=-1;this.$Error=this.errNode?jQuery(this.errNode):0;this._udv=!this.isPass&&this.dValue!=='';if($B.msie&&this._udv&&this.isPass){this.$FixInput=jQuery('<input type="text" />').insertAfter(this.$Input).hide(-1).val(this.dValue).focus($D(this,'fireEvent','_focus'))}this.callMethod('init');this.initCounters();setTimeout($D(this,function(){this.fireEvent(this.inFocus?'focus':'blur');if(this.inFocus)this.setFocus()}),0)},beforeInit:function($T,o){if(!InputValidator.TAGS[$T[0].tagName.toUpperCase()]){this.$Input=$T.find(o.target||'INPUT,TEXTAREA,SELECT').filter(':first')}else{this.$Input=$T}return this.$Input},bindEvents:function(e){Array.forEach(e.split(','),function(n){this.$Input.bind(n.toLowerCase(),$D(this,'fireEvent',n))},this);return this},initCounters:function(){if(this.counters){this.$Length=this.$Group.find(this.length);this.$Remain=this.$Group.find(this.remain);this._dCounters=$D(this,function(){if(this.$Length[0])this.$Length[0].innerHTML=this.value.length;if(this.$Remain[0])this.$Remain[0].innerHTML=this.maxLength-this.value.length});this.addEventListener('keyUp',this._dCounters)}else{this._dCounters=jsCore.F}},getDefOptions:function(){return{target:'.v-target',errors:0,errNode:0,length:'.length',remain:'.remain',sEmpty:0,sIndex:0,sMinIndex:-1,sMaxIndex:-1,minLength:($GA(this.$Input[0],'minlength')||0)*1,maxLength:($GA(this.$Input[0],'maxlength')||0)*1,format:($GA(this.$Input[0],'format')||0),validator:0,dValue:($GA(this.$Input[0],'dValue')||''),defaultValue:($GA(this.$Input[0],'defaultValue')||''),inFocus:0,selectOn:0,def:'default',focus:'focus',empty:'empty',valid:'valid',invalid:'invalid'}},changeType:function(t){if(this.$FixInput){this.$FixInput[t=='text'?'show':'hide'](-1);this.$Input[t!='text'?'show':'hide'](-1);try{this.$FixInput[0].focus()}catch(err){}}else if(this.isInput){this.$Input[0].type=t}},fireEvent:function(n,e){this.event=e||this.event||{};this.event.name=n;if(this._st){if(this._st==this.event.type){this._se=this._st=0}return false}if(n=='_focus'){this.$Input.focus()}else{if(n=='focus'||n=='blur')this.inFocus=n=='focus';if(n=='focus'||n=='keyDown'||n=='change'||n=='click'){this._pV=-1}if(this._udv&&(n=='focus')&&this._isEmpty){this.$Input[0].value='';this.changeType(this.type);this.isDefaultValue=0}this.isClicked=n=='click';this.validate(n,e);this.displayErrors(n);if(this._udv&&(n=='blur')&&this._isEmpty){this.changeType('text');this.$Input[0].value=this.dValue;this.isDefaultValue=1}switch(n){case'focus':if(this.$RE)this.$RE.html(this._error);this.___v=this.value;case'blur':{this.changed=this.___v!=this.value;if(this.focus)this.$Input[this.inFocus?'addClass':'removeClass'](this.focus);if(this._udv&&this.def)this.$Input[(!this.inFocus&&this._isEmpty)?'addClass':'removeClass'](this.def);if(this.invalid){this.$Group[!this.inFocus&&(!this._isValid||!this._pV)&&(!this._isEmpty||this._iE)?'addClass':'removeClass'](this.invalid)}}break}if(this.selectOn==n.toLowerCase()){this.$Input.select()}if(this.$FixInput)this.$FixInput[0].className=this.$Input[0].className;this._dCounters();this.dispatchEvent(n,this,e);if(this._se){this._se=0;return false}}},displayErrors:function(n){var s=n=='blur',e=this.errors;if(e&&(s||(n=='focus')||(n=='keyUp'))){s&=!this.isEmpty()&&!this.isValid();this.$Error[s?'show':'hide'](-1)[s?'html':'F'](e)}},stopEvent:function(){this._se=1;this._st=this.event.type=='keydown'?'keyup':0;return this},setValidate:function(v,e){if((this._isValid!==!!v)||(!!e!==this.__e)||(this._pV!=-1)){if(this.empty)this.$Group[e?'addClass':'removeClass'](this.empty);if(this.valid)this.$Group[!e&&v?'addClass':'removeClass'](this.valid);if(this.invalid&&!this._isValid&&v)this.$Group.removeClass(this.invalid);this.__e=this._isEmpty=!!e;this._isValid=!!v;this._iE=!this._pV;this.dispatchEvent('valid',this)}return this},validate:function(n,e){},isChanged:function(){return!!this.changed},getInput:function(){return this.$Input},isFocus:function(){return this.inFocus},isEmpty:function(){return this._isEmpty},isValid:function(){return this.notValid?!1:this.validate()&&!!this._pV},attr:function(k,v){if(k.constructor==Object){this.$Input.attr(n);return this}else{k=this.$Input.attr(k,v);return defined(v)?this:k}},val:function(v){if(defined(v)){this.$Input[0].value=v;this.fireEvent('blur');return this}return this._isEmpty?'':this.value},setFocus:function(){try{this.$Input[0].focus()}catch(e){};return this},setIsValid:function(v,t){if(t){this.$RE=this.$Group.find('.error');this._error=this.$RE.html();this.$RE.html(t)}this._pV=v;this.fireEvent('blur');return this},destroy:function(){}});InputValidator.TAGS={INPUT:1,SELECT:1,TEXTAREA:1};InputValidator.Formats={'int':/^\d*$/,'float':/^\d*((\.|,)\d*)?$/,'wmNumber':/^[a-z]?\d*?$/i};InputValidator.Validators={'int':function(v,V){return InputValidator.Formats.test(v=parseInt(v))&&(V.min<=v)&&(V.max>=v)},'phone':function(v,V){return/^(\+\d+\s?)?(\(?\d+\)?\s)?(\d{2,}[-\s]?){3,}$/.test(v)},'email':function(v,V){return jsCore.isEmail(v)},'equal':function(v,V){return(V.valueModifier||jsCore.F)(v)==(typeof V.equal=='String'?V.equal:(V.equal.val||V.equal)())},'location':function(v){return v=='0_0_0'||!/\d+_\d+_0$/.test(v)}};$E(InputValidator,{names:[],add:function(n){this.names.push(n);return this},get:function(N){if(N.append)N=N[0];if(N.ivUniqId)return InputValidator[N.ivUniqId];var V,i=0,n;for(;n=this.names[i]&&!V;i++)V=jsPlugins.get(N,n);return V},getName:function(N){if(N.append)N=N[0];if(N.tagName=='INPUT')return'Input'+String.ucfirst(N.type=='password'?'Text':N.type);else if(N.tagName=='SELECT')return'InputSelect';else if(N.tagName=='TEXTAREA')return'InputText';else throw Error('InputValidator.getName — unknow bred')},auto:function(N,P){if(N.append)N=N[0];var V=this.get(N),n;if(!V){if(N.tagName=='INPUT'||N.tagName=='SELECT'||N.tagName=='TEXTAREA'){n=this.getName(N);V=jsPlugins.set(N,n,{group:P}).get(N,n)}else{V=this.auto(jQuery(N).find('INPUT,SELECT,TEXTAREA'),N)}}return V}});;
jsLoader.loaded('{plugins}InputValidator');


/**
 * @class   InputText
 * @author  RubaXa 	<trash@rubaxa.org>
 * @require	InputValidator
 * Валидатор текстовых полей.
 */
jsClass.create('InputText').extend(InputValidator).setMethods({init:function(){this.bindEvents('blur,focus,click,keyDown,keyPress,keyUp')},validate:function(n){var v=this.isDefaultValue?'':this.$Input[0].value,e=this._isEmpty,isValid=this._isValid,l=0,k=ok=this.event.charCode||this.event.keyCode;if((this.value!==v)||(this._pV==-1)){l=v.length;e=l==0;if(!e&&((this.format&&!this.format.test(v))||(this.maxLength>0)&&(this.maxLength<l))){var s=this.getSelection();this.val(v=this.value).setCaretPos(s.end-1).stopEvent()}else{isValid=!e}if(this.validator&&!this.validator(v,this)){isValid=0}l=v.length;if(this.minLength)isValid&=this.minLength<=l;e=!l;this.value=v}this.setValidate(isValid,e);return(this.minLength||this.format||this.validator)?isValid:true},getSelection:function(){var s={start:0,end:0},l=this.value.length;if(this.$Input[0].createTextRange){var r=document.selection.createRange().duplicate();r.moveEnd('character',l);if(r.text==''){s.start=s.end=l+1}else{s.start=this.value.lastIndexOf(r.text);var r=document.selection.createRange().duplicate();r.moveStart('character',-l);s.end=r.text.length}}else{s.start=this.$Input[0].selectionStart;s.end=this.$Input[0].selectionEnd}s.text=this.value.substring(this.start,this.end);return s},setSelection:function(s,e){if(this.$Input[0].createTextRange){var range=this.$Input[0].createTextRange();range.collapse(true);range.moveEnd('character',e);range.moveStart('character',s);range.select()}else if(this.$Input[0].setSelectionRange){this.$Input[0].setSelectionRange(s,e)}return this},setCaretPos:function(p){return this.setSelection(p,p)}});InputValidator.add('InputText');;
jsLoader.loaded('{plugins}InputText');


/**
 * @class   InputRadio
 * @author  RubaXa 	<trash@rubaxa.org>
 * @require	InputValidator
 * Валидатор кружочгов.
 */
jsClass.create('InputRadio').extend(InputValidator).setMethods({beforeInit:function($T,o){this.$Group=($T[0].tagName=='INPUT'?jQuery(o.group):$T);this.$Input=this.$Group.find(o.target||'INPUT[type=radio]');this.count=this.$Input.length;this.radio=this.$Input.filter(':checked')[0];this._isValid=this.isChecked=this.isSelected=!!this.radio;if(this.$Group[0].onclick){$E(this,this.$Group[0].onclick());this.$Group[0].onclick=null}this.bindEvents('click')},validate:function(n,e){var v=this._isValid;if(this.isClicked){v=this.isChecked=this.isSelected=true}if(this.validator)v&=this.validator(this);this.radio=this.$Input.filter(':checked')[0];this.value=this.radio?this.radio.value:'';this.changed=this.value!=this._value;this._value=this.value;this.setValidate(v,!this.isChecked);this.dispatchEvent('change',this,e);return this._isValid},size:function(){return this.count},getSelected:function(){return jQuery(this.radio)}});InputValidator.add('InputRadio');;
jsLoader.loaded('{plugins}InputRadio');


/**
 * @class   InputCheckbox
 * @author  RubaXa 	<trash@rubaxa.org>
 * @require	InputValidator
 * Валидатор квадратика с галочкой.
 */
jsClass.create('InputCheckbox').extend(InputValidator).setMethods({beforeInit:function($T,o){this.$Group=($T[0].tagName=='INPUT'?jQuery(o.group):$T);this.$Input=this.$Group.find(o.target||'INPUT[type=checkbox]');this.count=this.$Input.length;this.sCount=this.getSelected().length;this.isChecked=this.isSelected=this.sCount>0;if(this.$Group[0].onclick){$E(this,this.$Group[0].onclick());this.$Group[0].onclick=null}this.bindEvents('click,focus,blur')},validate:function(n,e){this.sCount=0;this.value=[];for(var i=0;this.$Input[i];i++){if(this.$Input[i].checked){this.sCount++;this.value.push(this.$Input[i].value)}}v=this.sCount>=(this.min||0);if(this.validator)v&=this.validator(this);this.isChecked=this.isSelected=this.sCount>0;this.setValidate(v,!this.sCount);if(this.changed=(this._sCount!==this.sCount)){this._sCount=this.sCount;this.dispatchEvent('change',this,e)}return this._isValid},setValidate:function(v,e){if(this._pV!=-1)v=this._pV;if((this._isValid!==!!v)||(!!e!==this.__e)||(this._pV!=-1)){if(this.empty)this.$Group[e?'addClass':'removeClass'](this.empty);if(this.valid)this.$Group[!e&&v?'addClass':'removeClass'](this.valid);if(this.invalid&&!this._isValid&&v)this.$Group.removeClass(this.invalid);this.__e=this._isEmpty=!!e;this._isValid=!!v;this._iE=!this._pV;this.dispatchEvent('valid',this)}return this},size:function(){return this.count},selected:function(){return this.sCount},getItems:function(){return this.$Input},getSelected:function(){return this.getItems().filter(':checked')}});InputValidator.add('InputCheckbox');;
jsLoader.loaded('{plugins}InputCheckbox');


/**
 * @class   InputCheckbox
 * @author  RubaXa 	<trash@rubaxa.org>
 * @require	InputValidator
 * Валидатор спсиков.
 */
jsClass.create('InputSelect').extend(InputValidator).setMethods({init:function(){this.bindEvents('blur,focus,change')},validate:function(n,e){var i=this.$Input[0].selectedIndex,v=this._isValid,e=this._isEmpty;if(i!==this.index){v=1;if(this.sIndex!=-1)v&=i!=this.sIndex;if(this.sMinIndex!=-1)v&=i>=this.sMinIndex;if(this.sMaxIndex!=-1)v&=i<=this.sMaxIndex;this.index=this.selectedIndex=i;this.option=this.$Input[0].options[this.selectedIndex];this.value=this.option.value;if(this.validator){if(!(v&=this.validator(this.value,this))&&(n=='change')){this.$Group[!v?'addClass':'removeClass'](this.invalid)}}}this.setValidate(v,this.sEmpty==this.value);return this._isValid},val:function(v){if(defined(v)){var O=this.getOptions(),i=0;for(;O[i];i++){if(O[i].value==v){this.selIndex(i);break}}O=null;return this}return this.value},getOptions:function(){return this.$Input[0].options},getSelected:function(){return jQuery(this.option)},selIndex:function(i){if(defined(i)){this.$Input[0].selectedIndex=i;this.$Input[0].options[i].selected=true;return this.validate()}return this.selectedIndex}});InputValidator.add('InputSelect');;
jsLoader.loaded('{plugins}InputSelect');


/**
 * @class   FormValidator
 * @author  RubaXa 	<trash@rubaxa.org>
 * Валидатор формы
 */
var __ss__=function(n,s,o,r){FormValidator.submitStatus(n,s,o,r)};jsClass.create('FormValidator').setMethods({__construct:function($F,o){this.$Form=jQuery($F).submit($D(this,'_submit'));this.$Submit=this.$Form.find('INPUT[type=submit]');$E(this,FormValidator.defaultOptions,{name:this.$Form.attr('name'),action:(this.$Form.attr('action')||0),method:(this.$Form.attr('method')||'POST').toUpperCase()},o);this.name=this.$Form.attr('name',this.name||this.$Form.attr('id')||jsCore.getUniqId()).attr('name');this.eInputOnValid=$D(this,'validate');this.__v={};this.__p=[];this.__pe={};this.validators=[];this._ignors='';this.disabled=0;this.initForm();this.__init=function(){this.callMethod('init');this.isReady=1;this.validate()};if(this.iForce)this.__init();else setTimeout($D(this,'__init'),5);FormValidator.add(this)},initForm:function(){var $V=this.$Form.find(this.input),i=0,E,V;for(;E=$V[i];i++){this.addValidator(InputValidator.auto(E))}if(this.isReady)this.validate();$V=E=V=null},_submit:function(){return!!((this.__fs||this.submit())&&!this.ajax&&this.isValid())},addValidator:function(V){if(this.dispatchEvent('addValidator',this,V)!==false){this.__v[V.name]=this.validators.push(V);V.addEventListener('blur',this.eInputOnValid).addEventListener('focus',this.eInputOnValid).addEventListener('valid',this.eInputOnValid)}},validate:function(tV,e){var v=0,i=0,V,ce=0,f=0;if(this.dispatchEvent('beforeValidate',this,e)!==false){v=!this.__p.length;if(v){for(;V=this.validators[i];i++){if(!this.isIgnor(V.name)){if(V.inFocus)f=1;if(V.isEmpty())ce=1;if(v&&!V.isValid())v=0}}}else if(tV){this.validateErrors(tV,e);if(v=!this.__p.length)this.validate(tV,e)}v&=(this.dispatchEvent('validate',this,tV,e)!==false)}V=null;if((this.__ce!==ce)||(this._isValid!==v)||(this.__f!==f)){if(this.valid)this.$Form[!ce&&v?'addClass':'removeClass'](this.valid);if(this.invalid)this.$Form[!f&&!ce&&!v?'addClass':'removeClass'](this.invalid);this.__f=f;this.__ce=ce;if(this._isValid!==v){if(this.dSubmit)this.$Submit.attr('disabled',!v);this._isValid=v}}this.dispatchEvent('change',this)},validateErrors:function(){},submitStatus:function(s,o,r){if(this.send)this.$Form.removeClass(this.send);if(s){if(this.enable().dispatchEvent('success',o,r,this)!==false){if(this.clearInputs)this.clear()}}else{if(this.dispatchEvent('error',o,r,this)===true){this.ajax=0;this.$Form[0].submit()}else{this.enable()}}},isActive:function(){return!this.disabled},attr:function(k,v){if(!v&&k&&(k.constructor!==Object)){return this.$Form.attr(k)}this[k]=v;this.$Form.attr(k,v);return this},addIgnor:function(n){n=typeof n=='string'?n.split(','):n;for(var i=0;n[i];i++)if(!this.isIgnor(n[i]))this._ignors+=n[i]+',';this.validate();return this},delIgnor:function(n){if(defined(n)){n=typeof n=='string'?n.split(','):n;for(var i=0;n[i];i++)if(this.isIgnor(n[i]))this._ignors=this._ignors.replace(n[i]+',','')}else this._ignors='';this.validate();return this},isIgnor:function(n){return this._ignors.indexOf(n+',')>-1},toObject:function(){return this.$Form.toObject()},isValid:function(){return this._isValid},clear:function(f){if(defined(f)){Array.forEach(typeof f=='string'?f.split:f,function(n){this.elm(n).value=''},this)}else{this.$Form.find(':text,:password,TEXTAREA').val('').keyup().blur()}return this},enable:function(){return this.disable(0)},disable:function(d,e){this.disabled=defined(d,1);this.$Form.find(':submit').attr('disabled',(this.dSubmit&&!this._isValid)||this.disabled)[this.sDisabled?(this.disabled?'addClass':'removeClass'):'F'](this.sDisabled);for(var i=0;V=this.validators[i];i++){V.$Input.attr('readonly',this.disabled)[this.sDisabled?(this.disabled?'addClass':'removeClass'):'F'](this.sDisabled)}return this},submit:function(f){if(this.isActive()&&(this.dispatchEvent('beforeSubmit',this)!==false)&&(this.isValid()||!this.dSubmit)&&(this.dispatchEvent('submit',this)!==false)){this.disable();if(this.send)this.$Form.addClass(this.send);var o=this.toObject();if(this.ajax){jQuery.ajax({url:this.action,type:this.method,data:o,dataType:this.ajaxDataType||FormValidator.ajaxDataType,success:$D(null,__ss__,this.name,1,o),error:$D(null,__ss__,this.name,0,o)})}else{Array.forEach(this.$Form[0].elements,function(i,E){if(E.name)E.value=defined(o[E.name],'')},1);this.__fs=1;this.$Form[0].submit();this.__fs=0}return true}return false},get:function(n){return this.validators[this.__v[n]-1]},elm:function(n){return this.$Form[0][n]},elmVal:function(n){return this.elm(n).value},addError:function(n,t){if(this.__v[n]){this.get(n).setIsValid(0,t)}else if(!this.__pe[n]){this.__pe[n]=1;this.__p.push(n);this.$Form.find('.e-'+n)[t?'html':'F'](t).show();this.validate()}return this},removeError:function(n,v){if(this.__v[n])this.get(n).setIsValid(-1);else if(this.__pe[n]){this.__pe[n]=0;this.__p=Array.remove(this.__p,n,1);this.$Form.find('.e-'+n).hide();this.validate()}return this},getForm:function(){return this.$Form},reset:function(){this.$Form[0].reset();this.validate();return this}});$E(FormValidator,{defaultOptions:{dSubmit:1,valid:'f-valid',invalid:'f-invalid',send:'f-sendForm',input:'.v-target',sDisabled:'disabled',ajax:0,clearInputs:1},forms:{},add:function(F){this.forms[F.name]=F},get:function(n){return this.forms[n]},resultPrepare:function(r,s){return r},resultHandler:function(n,s,o,r){},submitStatus:function(n,s,o,r){this.resultHandler(n,s,o,r=this.resultPrepare(r,s));this.forms[n].submitStatus(s,o,r)}});;
jsLoader.loaded('{plugins}FormValidator');


/**
 * Разные зарисовки для создания основных объектов в проекте
 * @author	RubaXa	<trash@rubaxa.org>
 */
RubaXa.Project=jsClass.create().extend(PropertiesMapper).setMethods({__construct:function(p){this.__properties('$',p);this.callMethod('beforeInit');if(this.Ajax)this.Ajax=new this.Ajax(this,this.Ajax.Result);if(this.JSON)$E(JSON,this.JSON);if(this.Forms)$E(FormValidator,this.Forms);if(this.Alert)this.Alert=new this.Alert(this.lang);this.Elms={};this.Pages={};this.Forms={};this.Plugins={};this.callMethod('init')},getName:function(){return this.name},getCurDate:function(){return new Date()},isAuth:function(){return!!this.$.auth},isMyPage:function(){return this.isAuth()&&this.$.vUserId==this.$.aUserId},logout:function(){return this.set({auth:false})},reload:function(){location.href=location.href.split('#')[0]},redirect:function(u){document.location.href=u}});RubaXa.Project.Ajax=jsClass.create().setMethods({__construct:function(Project,Result){this.parent=function(){return Project};this.Result=Result;jQuery.ajaxSetup({complete:$D(this,'complete'),beforeSend:$D(this,'beforeSend'),data:Project.get('ajaxBaseData')});jQuery.ajaxResult=$D(this,'getResult');jsCore.ready($D(this,'iLoading'))},getLoading:function(){return $('#AjaxLoading').setPositionFixed('5px','5px').css('zIndex',1500)},iLoading:function(){this.$Loading=this.getLoading()},beforeSend:function(R){if(jQuery.active==1)this.loading(1)},complete:function(R){if(jQuery.active==1)this.loading(0);this.parseResult(R)},incActive:function(){jQuery.active++;this.loading(1)},decActive:function(){if(!--jQuery.active)this.loading(0)},parseResult:function(R,t){R=this.getResult(R,'success',t);if(R.isOK()){if(R.isJSON()){if(R.redirect){this.parent().redirect(R.redirect)}else if(this.parent().isAuth()!=!!parseInt(R.auth)){this.parent().set({auth:parseInt(R.auth)})}}}else if(R.isSysError()){this.parent().Alert.systemError()}this.dispatchEvent('complete',this,R);return R},get:function(){return jQuery.get.apply(jQuery,arguments)},post:function(){return jQuery.post.apply(jQuery,arguments)},send:function(){return jQuery.ajax.apply(jQuery,arguments)},getResult:function(R,s,t){if(typeof R=='string')R={responseText:R};return R.constructor!=this.Result?new this.Result(R,s,t):R},loading:function(s){if(this.$Loading)this.$Loading[s?'show':'hide'](-1)}});RubaXa.Project.Ajax.Result=jsClass.create().setMethods({__construct:function(R,s,t){this.__=this.getSettings();this.__ok__=(s=='success');this.__xhr__=R;var t=t||this.getResponseHeader('content-type')||'';if(t.indexOf('xml')>-1){this.__xml__=1;this.responseXML=R.responseXML;if(R&&R.responseXML.documentElement.tagName=="parsererror")throw"parsererror"}else{this.responseText=R.responseText;if(t.indexOf('json')>-1){var r;try{r=eval('('+this.responseText+')')}catch(e){r=this.__.evalError;debug.log(e)}$E(this,r);this.__json__=1}else{this.__text__=1}}},getSettings:function(){return{evalError:{status:0,errors:{SYSTEM:true}},errorStatus:0,systemError:'SYSTEM',status:'s',errors:'e',data:'d'}},isOK:function(){return!(this.isER()||this.isSysError())},isER:function(){return!this.__ok__},isSuccess:function(){return this.isOK()},isError:function(){return this.isER()},isSysError:function(){return this.isXHRError()||this.isER()||this.hasError(this.__.systemError)},getData:function(n){return n&&this[this.__.data]?this[this.__.data][n]:this[this.__.data]},getErrors:function(){return this[this.__.errors]},hasError:function(n){return!!this.getError(n)},getError:function(n){return(this.getErrors()||{})[n]},isXML:function(){return this.__xml__},isJSON:function(){return this.__json__},isText:function(){return!(this.isJSON()||this.isXML())},toXML:function(){return this.responseXML},toJSON:function(){return this.isJSON()?this:new this.constructor(this.__.evalError)},toText:function(){return this.isText()?this.responseText:''},tojQuery:function(){return jQuery(this.isText()?this.toText():document.createTextNode(''))},isXHRError:function(){return!this.__ok__},isXHRSuccess:function(){return this.__ok__},getResponseHeader:function(n){return this.__xhr__.getResponseHeader(n)},abort:function(){return this.__xhr__.abort()}});RubaXa.Project.Forms={resultPrepare:function(R,s){return R},resultHandler:function(n,s,o,R){if(R.isER()&&!R.isSysError()){Object.forEach(R.getErrors(),function(v,k){if(this.get(n))this.get(n)&&this.get(n).addError(k)},this)}}};RubaXa.Project.Alert=jsClass.create().setMethods({__construct:function(){},create:function(t){alert(t)},confirm:function(t,o,c){var s=!0;if(typeof(t)=='string')s=confirm(t);((s?o:c)||jsCore.F)(s);return s},systemError:function(){this.create('Ошибка сервера, попробуйте еще раз')}});jsCore.Project={get:function(name){return this[name]},create:function(name,properties){debug.log('jsCore.Project.create: '+name);this[name]=jsClass.create().extend(RubaXa.Project).setMethods({beforeInit:function(){this.name=name;this.Ajax=jsCore.Project.get(name).Ajax;this.Alert=jsCore.Project.get(name).Alert;this.JSON=jsCore.Project.get(name).JSON;this.Forms=jsCore.Project.get(name).Forms}});this[name].Ajax=jsClass.create().extend(RubaXa.Project.Ajax);this[name].Ajax.Result=jsClass.create().extend(RubaXa.Project.Ajax.Result);this[name].Alert=jsClass.create().extend(RubaXa.Project.Alert);this[name].JSON={};this[name].Forms=$E({},RubaXa.Project.Forms);return this[name]}};;
jsLoader.loaded('{project}Project');


/**
 * @object	GVar
 * @author	RubaXa	<trash@rubaxa.org>
 */
var GVar=new(jsClass.create().setMethods({__construct:function(){this.d={}},parse:function(e){Array.forEach(((e?e[0]||e:0)||document.body).getElementsByTagName('VAR'),function(V){GVar.add(V)});return e},add:function(V){if(V[0])V=V[0];if(!V.__GVar){V.name=$GA(V,'name');if(!/#\w+#/.test(V.name)){V.__GVar=1;if(!this.d[V.name])this.d[V.name]=[];this.d[V.name].push(V);this.dispatchEvent('add',V)}}return this},val:function(n,v){if(defined(v)){if(this.d[n]){for(var i=0,c=this.d[n].length;i<c;i++){this.d[n][i].v=v;switch(this.d[n][i].tagName){case'SELECT':break;case'INPUT':{this.d[n][i].value=v}break;default:this.d[n][i].innerHTML=v;break}}};return this}else{return this.d[n]?(this.d[n][0].v||this.d[n][0].value||this.d[n][0].innerHTML):''}},set:function(n,v){return this.val(n,v)},inc:function(n,c){return this.val(n,this.val(n)*1+defined(c,1)).val(n)*1},dec:function(n,c){return this.inc(n,-defined(c,1))}}));;
jsLoader.loaded('{utils}GVar');


/**
 * @object	HotKeys
 * @author	RubaXa	trash@rubaxa.org
 */
window.HotKeys={collection:[],init:function(){jQuery(document).keydown($D(this,'fire'))},add:function(e,h,c,s){var k,mK;if(defined(c)&&(c.constructor!=Function)){s=!!c;c=0}else{s=defined(s,1)}h=h.toLowerCase().split('+');k=h[h.length-1];mK=h.length==1?0:h[0];HotKeys.collection.push({'key':String(k).toUpperCase(),'keyCode':HotKeys.getKeyCode(k),'metaKey':mK,'method':c,'stop':s,'$Elm':jQuery(e)});return this},getKeyCode:function(k){return jsEvent.Key[k]||k.toUpperCase().charCodeAt(0)},fire:function(e){var keys=this.collection,r,rt=true;for(var i=0,n=keys.length;i<n;i++){if((keys[i])&&(keys[i].keyCode==e.keyCode)&&(!keys[i].metaKey||e[keys[i].metaKey+'Key'])){try{r=1;if(keys[i].method)r=keys[i].method(e)!==false;if(r){try{keys[i].$Elm.triggerHandler('focus').triggerHandler('click')}catch(err){};if(!keys[i].stop){switch(keys[i].$Elm[0].tagName){case'A':document.location.href=keys[i].$Elm[0].href;break;case'INPUT':{if((keys[i].$Elm[0].type=='submit')||(keys[i].$Elm[0].type=='image')){keys[i].$Elm.parent('FORM').submit()}}break;case'FORM':keys[i].$Elm.submit();break}}else{r=false}}rt=r&&rt}catch(err){keys[i].method=null;keys[i].$Elm=null;keys[i]=null}}}keys=null;return rt}};jsCore.ready($D(HotKeys,'init'));jQuery.fn.setHotKey=function(h,c,s){HotKeys.add(this[0],h,c,s);return this};;
jsLoader.loaded('{utils}HotKeys');


/**
 * @class   LightBox
 * @author  RubaXa 	<trash@rubaxa.org>
 */
jsClass.create('LightBox').setMethods({__construct:function($Box,options){LightBox.count++;$E(this,{position:'fixed',left:'50%',top:'50%',fadeNode:0,fadeColor:'#000',fadeOpacity:0.6,hideSelects:1,hideObjects:0,visible:0,disabledHide:0,disabledShow:0,disable:0,controls:0,lbControls:'.lb-controls'},options);this._dFire=$D(this,'fireControl');this.$Fade=this.fadeNode?jQuery(this.fadeNode):jQuery('<div></div>').css({opacity:this.fadeOpacity,backgroundColor:this.fadeColor,width:'100%',height:'100%',display:'none'}).setPositionFixed(0,0).insertFirst('BODY');this.$Box=jQuery($Box).processPlugins();if(this.position=='fixed'){this.$Box.setPositionFixed(this.left,this.top)}else if(this.position){this.$Box.css({position:this.position,left:this.left,top:this.top})}if(this.controls)this.initControls(this.controls.constructor==Array?this.controls:jQuery(this.controls));this.initControls(this.$Box);if($B.msie)this.$BODY=jQuery('BODY');this.callMethod('init');if(this.visible)this.show(true)},custom:function(){var p=['customFunc'];Array.prototype.push.apply(p,arguments);return!(this.callMethod.apply(this,p)!==false)},initControls:function($X,s){for(var i=0;$X[i];i++){if($X[i]&&$X[i].getAttribute&&(c=$GA($X[i],'lightBox'))){c=c.indexOf('{')>-1?eval("("+(c||'{}')+")"):{m:c};if(c&&c.m&&this[c.m]){$X[i].___c=c;jQuery($X[i]).bind($X[i].tagName=='FORM'?'submit':'click',$D(this,this.fireControl))}$X[i].removeAttribute('lightBox');$X[i].lightBox=null}}if(!s&&!this.lbFast&&$X.find)this.initControls($X.find('.lb-control,A'),true)},fireControl:function(e){this.__e=e;this.__c=jsCore.elm(e,'___c');if(!(this._cDisable||e.disabled)&&(this.__c.___c&&this.__c.___c.m&&this[this.__c.___c.m])){return(this[this.__c.___c.m].apply(this,(this.__c.___c.p||[]))===true)}},getEvent:function(){return this.__e},getControl:function(){return this.__c},fixPos:function(){if(this.position){this.$Box.css({marginLeft:-this.$Box[0].offsetWidth/2,marginTop:-this.$Box[0].offsetHeight/2})}return this},controlDisable:function(s){this._cDisable=!!s;return this},isDisabled:function(){return this._cDisable},html:function(html){this.$Box[0].style.visibility='hidden';this.$Box.html(html).processPlugins();this.initControls(this.$Box);this.fixPos();this.$Box[0].style.visibility='';return this},isVisible:function(){return this.visible},toggle:function(f,s){var d=defined(s,!this.visible)?'':'none',e=!d?'show':'hide';if(this.dispatchEvent('before'+String.ucfirst(e),this)!==false){this._visible=this.visible;this.visible=!d;$FS(this.$Box[0]).zIndex=1001+LightBox.active;$FS(this.$Box[0]).display=d;if(!this.$Fade[0].__lb||(this.$Fade[0].__lb==this.uniqId)){this.$Fade[0].__lb=!d?this.uniqId:0;this.$Fade.css('zIndex',1000+LightBox.active);this.$Fade.css('display',d)}LightBox.active+=this.visible?1:-1;if(!d){this.fixPos();LightBox.last=this;LightBox.open.push(this)}else{LightBox.open=Array.remove(LightBox.open,this,1);LightBox.last=LightBox.open[LightBox.active-1]}if(this.$BODY){if(this.hideSelects)this.$BODY[this.visible?'addClass':'removeClass']('hidden-all-selects');if(this.hideObjects)this.$BODY[this.visible?'addClass':'removeClass']('hidden-all-objects')}this.dispatchEvent(e,this)}return this},hide:function(f){return this.disabledHide?this:this.toggle(f,false)},show:function(f){return this.disabledShow?this:this.toggle(f,true)},destroy:function(){LightBox.count--;if(this.isVisible)this.hide()}});LightBox.last=0;LightBox.open=[];LightBox.count=0;LightBox.active=0;$BODY.setHotKey('esc',function(){if(LightBox.active&&!LightBox.last.isDisabled())LightBox.last.hide()});;
jsLoader.loaded('{plugins}LightBox');


/**
 * @class	PixelPost.User
 * @author	RubaXa	<trash@rubaxa.org>
 */
jsClass.create('User').extend(PropertiesMapper).setMethods({__construct:function(u){this.__properties('$',{id:0,name:0,age:0,sex:'M',country:0,city:0,access:0,messages:0,unreadMessages:0,status:1});if(u){this.set(u)}User.ids[this.$.id]=1;this.callMethod('init');debug.log('new User: '+this.$.id)},init:function(){this.updView(1);this.addEventListener('change',$D(this,'updView',0))},updView:function(f){for(var k in(f?this.$:this._$)){v=this.$[k];switch(k){case'count_albums':v=String.num(v,Lang.get('albums'),' ');break;case'count_invite':{if(jsCore.loaded)BODY.className=BODY.className.replace(/(aUserInvite)(No)?/,v?'$1':'$1No');v=String.num(v,Lang.get('invites'),' ')}break}GVar.val('u'+this.$.id+'.'+k,v)}},getId:function(){return this.$.id},isAuth:function(){return(this.$.id>0)&&this.isActive()},isActive:function(){return this.$.status==1},isAdmin:function(){return this.$.access&(1<<1)},isModer:function(){return this.$.access&(1<<2)},getUrl:function(s){if(s=='addPost')s='/post/add.php?uId='+this.$.id;else s=(s?'/'+s:'')+'/?uId='+this.$.id;return'/user'+s},check:function(){if(this.$.id&&this.isActive()&&!this.$.name){User.get(this.$.id,true)}}});User.ids={};User.has=function(id){return defined(User[id])};User.get=function(id,p){if(!p)p=(id.constructor==Object)?(id.$||id):0;id=(id.id||(id.$?id.$.id:id))*1;if((p!==true)&&User[id]){if(p){if(p.constructor==Function){p(User[id])}else User[id].set(p)}}else{id=id;if(p&&((p===true)||(p.constructor==Function))){$.get('?a=getUser','uId='+id,$D(this,'upd'));if(p!==true)jsCore.wait('user:'+id,p)}else if(p){p.id=id;User[id]=new User(p);jsCore.notify('user:'+id,User[id])}}return User[id]};User.upd=function(p){if(p.constructor==String){p=unserialize(p);if(!(p&&p.id))return}else if(p.constructor==Array){Array.forEach(p,function(u){User.upd(u)});return}return User.get(p.id,p)};;
jsLoader.loaded('{pixelpost}PixelPost.User');


/**
 * @object	PixelPost
 * @author	RubaXa	<trash@rubaxa.org>
 */
var PP;var PPProject=jsCore.Project.create('PixelPost');PPProject.setMethods({getUser:function(id){return User.get(defined(id,this.$.auth))},getAuthUser:function(){return this.getUser()},getUrl:function(n){s='';if(n='upload')s='?XForm=UploadPhoto&uId='+PP.getUser().getId()+'&_fl_=Y&s='+this.$.sessionId;return location.href.split('?')[0]+s}});PPProject.Alert.setMethods({__constructor:function(){},isJSON:function(R){if(R&&R.isJSON())return true;this.systemError();return false},create:function(t){if(this.LB){this.$Text.html(t);this.LB.show()}else this.parent('create',t)}});PPProject.JSON.quote='"';PPProject.Ajax.setMethods({getLoading:function(){return $('#AjaxLoading').setPositionFixed('50%','2px').css('zIndex',1500)},parseResult:function(R,t){R=this.getResult(R,'success',t);if(R.isOK()){if(R.isJSON()){if(R.redirect){this.parent().redirect(R.redirect)}else if(this.parent().isAuth()!=!!parseInt(R.auth)){this.parent().set({auth:parseInt(R.auth)})}else{for(var n in R.upd){if(n=='u')User.upd(R.upd.u)}}}}else if(R.isError()){var Err=R.getErrors();for(var n in Err){this.parent().Alert.create(Err[n])}}this.dispatchEvent('complete',this,R);return R}});PPProject.Ajax.Result.setMethods({isXFormER:function(){return!!this.getXFormErrors()},getXFormErrors:function(){return this.XForm},getSettings:function(){return{evalError:{s:0,e:{SYSTEM:'Ошибка сервера'}},errorStatus:0,systemError:'SYSTEM',status:'s',errors:'e',data:'d'}}});PPProject.Forms.ajaxDataType='json';PPProject.Forms.resultHandler=function(n,s,o,R){if(R.isXFormER()){Object.forEach(R.getXFormErrors(),function(E,F){for(var k in E)this.get(F).addError(k,E[k].error)},this)}};FormValidator.defaultOptions.ajax=1;FormValidator.defaultOptions.clearInputs=0;$E(InputValidator.Validators,{});PixelPost=new PPProject(PixelPost);PP=PixelPost;PP.addEventListener('change',function(){if(this._$.auth)PP.reload()});Lang.load('Base',function(){jsCore.ready(function(){GVar.parse(BODY)})});;
jsLoader.loaded('{pixelpost}PixelPost');


/**
 * @class	PixelPost.AlbumMenu
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.AlbumMenu=jsClass.create().setMethods({__construct:function(){this.$Menu=$('#SelectedPhotos').setPositionFixed('10%','30%').find('.i-close').setHotKey('esc').click($D(this,'fire','close')).end().find('.a-post').click($D(this,'fire','post')).end().find('.sp-delete').click($D(this,'fire','remove')).end().find('.a-move A').click($D(this,'fire','move')).end().find('.ok').click($D(this,'fire','moveOk')).end().find('.cancel').click($D(this,'fire','moveCancel')).end();this.$Albums=this.$Menu.find('SELECT');this.clear(1)},fire:function(n){switch(n){case'post':PP.redirect('/user/post/add/?uId='+PP.getUser().getId()+'&aId='+this.Content.getId()+'&ids='+this.ids.join(','));break;case'remove':{PP.Alert.confirm('Точно?',$D(this,function(){this.Content.remove(this.ids);this.clear().hide()}))}break;case'close':this.hide().clear();break;case'move':this.$Menu.removeClass('actions').addClass('move');break;case'moveOk':{this.Content.move(this.$Albums.val(),this.ids);this.fire('close')}break;case'moveCancel':this.$Menu.removeClass('move').addClass('actions');break}return false},_toggle:function(s){if(this.__s!==s){this.__s=s;this.$Menu[s?'show':'hide']()}return this},setContent:function(C){this.Content=C;return this},updView:function(){GVar.val('selectedPhotos',this.ids.length);return this},clear:function(x){if(!x){$('#PhotoList').find('.selected').removeClass('selected').end().find('INPUT').attr('checked',false)}this.ids=[];return this.updView()},addId:function(id){if(Array.indexOf(this.ids,id)==-1)this.ids.push(id);return this.updView()},removeId:function(id){this.ids=Array.remove(this.ids,id,1);if(this.ids.length==0)this.hide();return this.updView()},isVisible:function(){return this.__s},show:function(){if(!this.isVisible()){var n=0,a=this.Browser.Select.options.length;this.$Menu[a>1?'removeClass':'addClass']('one-album');if(a>1){a=this.Browser.Select.options;this.$Albums.empty();for(var i=0;a[i];i++){if(!a[i].selected)this.$Albums[0].options[n++]=new Option(a[i].name,a[i].id)}}a=null;this.fire('moveCancel')}return this._toggle(1)},hide:function(){return this._toggle(0)},setBrowser:function(B){this.Browser=B}});;
jsLoader.loaded('{pixelpost}PixelPost.AlbumMenu');


/*****
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright В© 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/
(function($){$.easing['jswing']=$.easing['swing'];$.extend($.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return $.easing[$.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},easeInBounce:function(x,t,b,c,d){return c-$.easing.easeOutBounce(x,d-t,0,c,d)+b},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return $.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return $.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b}})})(jsCore.jQuery);;
jsLoader.loaded('{jQuery}easing');


/**
 * @class	PixelPost.AlbumContent
 * @author	RubaXa	<trash@rubaxa.org>
 */
var _contentOut=function(){jQuery.className.add(this,'hover')};var _contentOver=function(){jQuery.className.remove(this,'hover')};PixelPost.AlbumContent=jsClass.create().setMethods({__construct:function(A){PixelPost.$AlbumContentTpl=$('#ContentTpl');this.Album=A;this.$View=$('#PL-'+A.id);this.loaded=1;this.isEmpty=A.count_contents<=0;this.__fireControl=$D(this,'fireControl');this.__deleteOk=$D(this,'_deleteOk');if(!this.$View[0]){this.loaded=0;this.$View=$('<div id="PL-'+A.id+'" class="photos"></div>').appendTo('#PhotoList .PL-Holder')}else if(PP.isMyPage()){Array.forEach(this.$View.find('.photo'),function(P){this.initContent($(P))},this)}if(!A.count_contents){this.loaded=1;this.$View.empty().append('<div class="has-empty">Альбом пуст</div>')}},load:function(){this.loaded=1;this.$View.empty();$.get('?action=loadContents',{aId:this.Album.id},$D(this,function(r){this.$View.empty();this.dispatchEvent('load',this);if(r&&(r=unserialize(r))){for(var i=0;r.contents[i];i++){this.add(r.contents[i])}}}))},fireControl:function(e){e=jsCore.elm(e);var $C=$(e).parents('.photo');if(e.tagName=='INPUT'||e.tagName=='LABEL'){this.select($C,e.checked);$C=null}else{var c=e.className;if(!/del/.test(c)||confirm('Точно?'))this[/del/.test(c)?'remove':'rotate']($C,/rot-r/.test(c));return false}},initContent:function($Content){if(PP.isMyPage()){$Content.hover(_contentOut,_contentOver).find('.p-del,.p-rot-r,.p-rot-l').click(this.__fireControl).end().find('INPUT').attr('checked',false).click(this.__fireControl)}},_rotateOk:function(id){var $Img=$('#P-'+id),u;$Img[0].src+=u=jsCore.getNextId();$('#BP-'+id).removeClass('is-hold');$Img.attr({oW:$Img.attr('oH'),oH:$Img.attr('oW'),u:u}).animate({opacity:1});$Img=null},getId:function($Content){return($Content?$Content[0].id.substr(3):this.Album.id)*1},select:function($Content,s){$Content[s?'addClass':'removeClass']('selected');PixelPost.AlbumMenu.getInstance().setContent(this).show()[s?'addId':'removeId'](this.getId($Content));return this},move:function(aId,ids){this.remove(ids,1);this.dispatchEvent('move',this.Album.id,aId*1,ids);$.post('/?edit=Content',{aId:aId,'pId[]':ids,action:'move'})},remove:function($Content,nAjax){if($Content.constructor==Array){var ids=$Content;for(var i=0,n=ids.length;i<n;i++){this.remove($('#BP-'+ids[i]),true)}if(!nAjax)PP.Ajax.post('?edit=Content&action=remove',{'pId[]':ids})}else{if(typeof($Content)=='number')$Content=$('#BP-'+$Content);var id=this.getId($Content);$Content.removeClass('hover').addClass('is-hold').unbind('mouseout',_contentOut).unbind('mouseover',_contentOver).hide('slow');if(!nAjax){PP.Ajax.post('?edit=Content&action=remove','pId='+id)}this.dispatchEvent('remove',this.Album.id,id)}return this},rotate:function($Content,r){$Content.addClass('is-hold').find('IMG').animate({opacity:0.3});$.post('/?edit=Content',{pId:this.getId($Content),right:r?1:0,action:'rotate'},$D(this,'_rotateOk',this.getId($Content)))},add:function(C){if(this.isEmpty){this.isEmpty=0;this.$View.empty()}var $Content=PixelPost.$AlbumContentTpl.clone();$Content[0].innerHTML=$Content[0].innerHTML.replace(/#id#/g,C.id).replace(/\/#public_src#/g,C.public_src).replace(/#extension#/g,C.extension).replace(/#updated#/g,C.updated).replace(/#width#/g,C.width).replace(/#height#/g,C.height).replace(/#created#/g,C.created);this.initContent($Content.find('B').hide().prependTo(this.$View).fadeIn('slow'));this.dispatchEvent('add',C.type_id)},reload:function(){this.loaded=0;return this},show:function(){if(!this.loaded){this.load()}this.$View.show();return this},hide:function(){this.$View.hide();return this}});PixelPost.AlbumContent.find=function(id,Browser){if(!this[id]){this[id]=new PixelPost.AlbumContent(Browser.Select.get(id*1));Browser.addContent(this[id]);PixelPost.AlbumMenu.getInstance().setBrowser(Browser)}return this[id]};;
jsLoader.loaded('{pixelpost}PixelPost.AlbumContent');


/**
 * 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( !window.SWFObject )
{
	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",escape(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;
	
	// by RubaXa
	var SWF	=
	{
		defParams: { allowScriptAccess: 'always', menu: false },
		
		
		build: function (id/*String*/, p/*Object*/)/*SWFNode*/
		{
			if( typeof id == 'string' )	id = $F( id );	// by id
			else if( id.append )		id = id[0];		// jQuery
			
			var
				  m	= p.movie/*MovieParams*/
				, v	= p.vars||{}/*FlashVars*/
				, p	= $E(this.defParams, p.params)/*Params*/
				, fId, k
				, so= new SWFObject(m.url, fId=(m.name||jsCore.getUniqId()), m.width||'100%', m.height||'100%', m.ver||m.version||'9', m.bg||m.bgColor||m.background)
			;
			
			for( k in v )	so.addVariable(k, encodeURIComponent( v[k] ));
			for( k in p )	so.addParam(k, p[k]);
			
			so.write( id );
			id = so = null;
			
			return	$F('#'+fId);
		}
	};
	
	
};
jsLoader.loaded('{jsCore}swfobject');


/**
 * @class	jsUploader
 * @author	RubaXa		<trash@rubaxa.org>
 * @flash	Muxys
 * @version 2.0a
 * @events	init, hover, tbrowseCancel, securityError, IOErrorm loading, progress, complete, serverAnswer, loaded
 */
jsClass.create('jsUploader').setMethods({__construct:function(o,$B){this.isInit=0;this.params={};this.param($E({maxfiles:0,max_file_size:10000000,max_summary_size:0,server_url:'/',flashUrl:'{utils}uploader.swf',types:[],cursor:1},o));jsCore.ready($D(this,'init'));this.setBrowseBtn($B);this.reset();this.__X={}},init:function(){var url=this.param('flashUrl');if(/^\{/.test(url))url=jsLoader.getFileUrl(url);var div=document.createElement('div');div.id='h_'+this.uniqId;window[this.params.jsHandler='f'+this.uniqId]=$D(this,'flashEvent');$E(div.style,{position:'absolute',left:'0px',top:'0px',bottom:'0px',width:'1px',overflow:'hidden',zIndex:1000});BODY.appendChild(div);this.$DIV=jQuery(div);this.SWF=SWF.build(div,{movie:{url:url,width:'100%',height:'100%'},vars:this.params,params:{wmode:'transparent'}});return this},flash:function(m){try{if((m=='setParameter')||(this.dispatchEvent(m,this)!==false)){_apply_(this.SWF,m,Array.prototype.slice.call(arguments,1))}}catch(e){debug.log(FO,e)}return this},_eName:function(n){switch(n){case'browse_cancel':n='browseCancel';break;case'security_error':n='securityError';break;case'io_error_occured':n='IOError';break;case'start_uploading':n='loading';break;case'upload_progress':n='progress';break;case'file_upload_completed':n='complete';break;case'server_return_value':n='serverAnswer';break;case'total_upload_completed':n='loaded';break}return n},flashEvent:function(n){var args=Array.prototype.slice.call(arguments,1);debug.log(n,args[0],args[1]);switch(n){case'init':{this.isInit=!0;this.setBrowseBtn();this.param(this.params);this.dispatchEvent(n,this)}break;case'hover':this.dispatchEvent(n,this,args[0].status);break;case'browse_cancel':this.dispatchEvent(this._eName(n),this);break;case'select':{debug.log('server_url:',this.param('server_url'));this.queue.push.apply(this.queue,args[0]);this.rejected.push.apply(this.rejected,args[1]);this.bytesTotal=Array.sum(this.queue,function(F){return F.size*1});this.dispatchEvent(this._eName(n),this,args[0],args[1])}break;case'io_error_occured':{console.log('Помни, что server_url = "/", то это значит, что он загрузит файл в root сервера, где лежит сама флешка!!!');$E(this.getById(args[0].id),{error:1,io_error:1});this.dispatchEvent(this._eName(n),this,args[0])}break;case'security_error':{$E(this.getById(args[0].id),{error:1,security_error:1});this.dispatchEvent(this._eName(n),this,args[0])}break;case'start_uploading':case'upload_progress':this.isUpload=1;case'file_upload_completed':{args[0].uploadPart=args[0].bytes_loaded/args[0].size;$E(this.getById(args[0].id),args[0]);this.bytesLoaded=Array.sum(this.queue,function(F){return F.bytes_loaded*1});if(!this.__X[args[0].id]&&args[0].uploadPart==1){this.__X[args[0].id]=1;this.dispatchEvent('fileUploaded',this,args[0])}if(n=='file_upload_completed'){this.dispatchEvent('progress',this,args[0])}this.dispatchEvent(this._eName(n),this,args[0]);this.dispatchEvent('bytesLoaded',this,this.bytesLoaded)}break;case'server_return_value':{args[0].bytes_loaded=args[0].size;this.flashEvent('upload_progress',args[0]);this.dispatchEvent(this._eName(n),this,args[0],args[1])}break;case'total_upload_completed':{this.isUpload=0;this.dispatchEvent(this._eName(n),this)}break}},setBrowseBtn:function($B){this.$Btn=$B?jQuery($B):this.$Btn;if(this.$Btn){if(this.isInit){this.$DIV.css(this.$Btn.offset()).css({width:this.$Btn.width(),height:this.$Btn.height()})}}return this},reset:function(){this.queue=[];this.rejected=[];this.bytesTotal=0;this.bytesLoaded=0;return this},param:function(k,v){if(v||(k&&(k.constructor==Object))){if(v){t=k;k={};k[t]=v}$E(this.params,k);if(this.isInit){for(var n in k){this.flash('setParameter',n,k[n])}}return this}return this.params[k]},browse:function(){return this.flash('browse')},upload:function(){return this.flash('upload')},cancel:function(){return this.flash('cancel').reset()},getQueue:function(){return this.queue},getFiles:function(){return this.filter(function(U){return!U.is_uploaded})},isEmpty:function(){return!this.getQueue().length},filter:function(f){return Array.filter(this.getQueue(),f)},getById:function(id){return this.queue[Array.search(this.queue,function(F){return F.id==id})]},clear:function(){this.quque=[]}});;
jsLoader.loaded('{utils}jsUploader');


/**
 * @class	Toggle
 * @author	RubaXa	<tarsh@rubaxa.org>
 */
Registry.put('ToggleGroups',{});jsClass.create('Toggle').setMethods({__construct:function($T,o){this.$Target=jQuery($T);this.options=$E(this.getDefaultOptions(),o);Array.forEach('Show,Hide,Toggle,BeforeShow,BeforeHide,HitTest'.split(','),function(v){this['on'+v]=this.options['on'+v]},this);if(this.options.group){var $Groups=this.$Target.find(this.options.group);if($Groups[0]){var This=this;$Groups.each(function(){jQuery(this).setPlugin('Toggle',This.options)});This=null;this.toggle=function(f,a){this.notifyGroup('toggle',f,a);return this};return true}else{this.add2Group(this.options.group)}$Groups=null}if(this.options.saveState)this.options.state=jsCookie.get(this.options.name);this.build();this.toggle(true,this.options.state);this.$Target.click($D(this,'_onClick'));this.init()},_onClick:function(e){if(this.dispatchEvent('click',e)===false)return false},getDefaultOptions:function(){return{name:this.$Target[0].id,group:0,hideByClick:0,saveState:0,state:'hide',expand:'expand',collapsed:'collapsed',hover:0,show:'.t-show',hide:'.t-hide',toggle:'.t-toggle',element:'.t-element',zIndex:300,parentIndex:3,effect:0,effectSpeed:'fast'}},init:function(){},controller:function(item){this[item.__toggleAction||'hide']();if(item.tagName!='INPUT')return false},getAnimateOpts:function(a){var anim={};switch(this.options.effect){case'width':anim.width=a;break;case'height':anim.height=a;break;case'fade':anim.opacity=a;break;default:anim={width:a,height:a,opacity:(a=='show')?1:0};break}return anim},animate:function(a,f){if(!f&&this.options.effect){if(this.options.parentIndex)this.$Elements.parents(this.options.parentIndex).css({zIndex:(a=='show')?this.options.zIndex:''});this.$Elements.animate(this.getAnimateOpts(a),this.options.effectSpeed);return 1}else{this.$Elements[a=='show'?'show':'hide']();return 0}},notifyGroup:function(method){var groups=this.options.group;if(typeof(groups)=='string')groups=groups.split(',');var Group,uniqId=this.uniqId,args=Array.prototype.slice.call(arguments,1);for(var i=0,n=groups.length;i<n;i++){jsCore.each(Registry.get('ToggleGroups')[groups[i].toLowerCase()],function(o,Group){if(Group.uniqId!=uniqId){Group[method].apply(Group,args)}})}Group=null},hoverControl:function(h,e){this.dispatchEvent('hover',this,jQuery(e)[h?'addClass':'removeClass'](this.options.hover))},markAsControl:function(N){if(N.nodeType==1){N.__toggleControl=this.uniqId;for(var i=0,n=N.childNodes.length;i<n;i++){this.markAsControl(N.childNodes[i])}}return this},isControl:function(e){return(e&&((e.__toggleControl)||(e[0]?(e.__toggleControl):(e.target?e.target.__toggleControl:false))))==this.uniqId},_buildC:function($Items,i){Array.forEach($Items,function(Item){this.markAsControl(Item);Item.__toggleAction=!i?'show':(i<2?'hide':'toggle');jQuery(Item).bind('click',$D(this,'controller',Item));if(this.options.hover){jQuery(Item).hover($D(this,'hoverControl',true,Item),$D(this,'hoverControl',false,Item))}},this)},build:function(){Array.forEach([this.options.show,this.options.hide,this.options.toggle],function(rules,i){if(rules){if(rules.append){this._buildC(rules,i)}else{Array.forEach(rules.split(','),function(rule,t){if(rule){this._buildC(rule.charAt(0)=='#'?jQuery(rule):this.$Target.find(rule),i)}},this)}}},this);this.$Elements=null;this.$Elements=[];if(this.options.element.append){this.$Elements=this.options.element}else{var $E;Array.forEach(this.options.element.split(','),function(rule){$E=(rule.charAt(0)=='#'?jQuery(rule):this.$Target.find(rule));if($E[0]){for(var i=0,n=$E.length;i<n;i++)this.$Elements.push($E[i])}},this);$E=null;delete $E;this.$Elements=jQuery(this.$Elements)}return this},setCallback:function(n,f){this[n]=this.options[n]=f;return this},add2Group:function(name){if(name.getGroup)name=name.getGroup();if(name){if(typeof(name)=='string')name=name.split(',');var Groups=Registry.get('ToggleGroups');for(var i=0,n=name.length;i<n;i++){name[i]=name[i].toLowerCase();if(!Groups[name[i]])Groups[name[i]]=[];Groups[name[i]].push(this)}Registry.put('ToggleGroups',Groups);Groups=null}return this},getGroup:function(){return this.options.group},show:function(f){return this.toggle(f,'show')},hide:function(f){return this.toggle(f,'hide')},toggle:function(f,a){var a=(a||(this.isExpand()?'hide':'show'));var e=String.ucfirst(a);if((f||(a!=(this.isExpand()?'show':'hide')))&&(this.dispatchEvent('before'+e,this)!==false)){this.options.state=a;if(a=='show')this.notifyGroup('hide',f);this.animate(a,f);if(this.options.toggle&&this.options.expand)this.$Target.find(this.options.toggle).andSelf()[this.isExpand()?'addClass':'removeClass'](this.options.expand);if(this.options.toggle&&this.options.collapsed)this.$Target[this.isExpand()?'removeClass':'addClass'](this.options.collapsed);if(this.options.saveState)jsCookie.set(this.options.name,this.options.state,this.options.saveState);this.dispatchEvent(a,this);this.dispatchEvent('toggle',this)}return this},isExpand:function(){return(this.options.state=='show')}});Toggle.Broadcast=({pool:[],init:function(){jQuery(document).bind('click',$D(this,'fire',false));return this},add:function(T){this.pool.push(T)},remove:function(T){for(var i=0,n=this.pool.length;i<n;i++){if(this.pool[i].uniqId==T.uniqId){this.pool[i]=null;this.pool=Array.remove(this.pool,i);break}}},fire:function(ignor){for(var i=0,n=this.pool.length;i<n;i++){if(!ignor||(ignor&&(this.pool[i].uniqId!=ignor.uniqId)))this.pool[i].hide()}this.ignor=null}});Toggle.Broadcast.init();;
jsLoader.loaded('{plugins}Toggle');


/**
 * @class   ToggleMenu
 * @author  RubaXa 	<trash@rubaxa.org>
 * @require	Toggle
 */
jsClass.create('ToggleMenu').extend(Toggle).setMethods({getDefaultOptions:function(){return{group:'BaseMenuGroup',state:'hide',expand:'expand',show:'.m-show',hide:'.m-hide',toggle:'.m-toggle',element:'.m-items',zIndex:510,parentIndex:10,effect:0,effectSpeed:100,hideByClick:0}},init:function(){this.$HitTest=this.$Target.find(this.options.element);ToggleMenu.Broadcast.start(this.options.group)},hitTest:function(e){if(this.isControl(e)){return true}else{if((this.dispatchEvent('hitTest',this,e)!==false)&&this.$HitTest&&!this.options.hideByClick){return this.$HitTest.hitTest(e)}else return false}}});ToggleMenu.Broadcast=({_init:0,e:0,groups:[],init:function(){if(!this._init){this._init=1;this._fire=$D(this,'fire',null);jQuery('BODY').bind('mouseup',$D(this,'mouseup'))}},start:function(n){if(Array.indexOf(this.groups,n)==-1){if(this.groups.push(n)==1){this.init()}}},stop:function(n){if(n=Array.indexOf(this.groups,n)!=-1){this.groups=Array.remove(this.groups,n)}},mouseup:function(e){if(!this.fire((this.target=e.target).__toggleControl)){clearTimeout(this._tFire);this._tFire=setTimeout(this._fire,100)}},fire:function(uId){if((uId===null)||uId){for(var i=0,n=this.groups.length;i<n;i++){Array.forEach(Registry.get('ToggleGroups')[this.groups[i].toLowerCase()],function(TM){if((uId!=TM.uniqId)&&TM.isExpand()&&!TM.hitTest(this.target)){TM.hide()}},this)}}}});;
jsLoader.loaded('{plugins}ToggleMenu');


/**
 * @class	PixelPost.ContentView
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.ContentView=jsClass.create().extend(LightBox).setMethods({init:function(){if(PixelPost.isAuth()){this.aSizes=[100,300,500,700];this.$Img=this.$Box.find('IMG').load($D(this,'fire','loaded')).click($D(this,'fire','next'));this.$Sizes=this.$Box.find('LI A').click($D(this,'fire','size'));this.$Info=this.$Box.find('.bottom').find('.delete').click($D(this,'fire','delete')).end().find('.postIt').click($D(this,'fire','postIt')).end().find('.info');this.Code=this.$Box.find('.bottom').setPlugin('ToggleMenu',{toggle:'.postIt',element:'.get-code'},1,1);this.Code.$Target.find('INPUT').click(function(){this.select()});this._dHide=$D(this,'hide')}},fire:function(n,e){switch(n){case'next':this.hitTest(this.Content.next,0);break;case'size':this.selSize(e.target.i);break;case'loaded':this.$Img.animate({opacity:1});break;case'delete':{PP.Alert.confirm('Точно?',$D(this,function(){this.hide();this.dispatchEvent('delete',this.browseId,this.Content.id)}))}break}return false},hitTest:function(e,ns){if(e&&(e=$G(e))&&(e.tagName=='IMG')){var O={id:e.id.split('-')[1]*1,created:$GA(e,'c'),width:$GA(e,'ow')*1,height:$GA(e,'oh')*1,path:e.src.substr(0,e.src.lastIndexOf('/')+1),ext:e.src.substr(e.src.lastIndexOf('.')).match(/(\.\w+)\?|$/)[1],upd:$GA(e,'u')},$P=$(e).parent(),$N=$P.next();$N=$N[0]&&($N[0].tagName=='B')?$N:$P.siblings(':first');O.next=$N[0]&&($N[0].tagName=='B')?$N.find('IMG'):0;$P=null;if(O.id&&O.width){this.setContent(O);if(ns){$FS(this.$Box[0]).display='none';$FS(this.$Box[0]).display=''}else{this.show()}return true}}return false},selSize:function(i){var S=this.$Sizes[i],s=S.innerHTML.split('x'),w,h,o='hidden';this.$Sizes.removeClass('selected');S.className+=' selected';this.$Img.css('opacity',0).attr({src:S.src,width:s[0],height:s[1]});if((s[0]>Window.getWidth()-50)||(s[1]>Window.getHeight()-100)){w=Math.max(Math.min(s[0],Window.getWidth()-50),300);h=Math.min(900,Window.getHeight()-100);o='scroll'}this.$Box.width(Math.max(Math.min(s[0],900),300)+60).find('.center').css({width:w||'auto',height:h||'auto',overflow:o});this.Code.$Target.find('INPUT[name=html]').val('<a href="'+this.oSrc+'" target="_blank"><img src="'+S.src+'" width="'+s[0]+'" height="'+s[1]+'" border="0" alt="" /></a>').end().find('INPUT[name=bbcode]').val('[url='+this.oSrc+'][img]'+S.src+'[/img][/url]').end().find('INPUT[name=src]').val(S.src);S=null;return this.fixPos()},setContent:function(C){this.Content=C;for(var i=3,w,h,r,s,m;i>=0;i--){h=0;m=this.aSizes[i];if((C.width>=m)||(C.height>=m)){r=C.width/C.height;w=Math.round(r>=1?m:m*r);h=Math.round(r<1?m:m/r);this.$Sizes[i].i=i;this.$Sizes[i].src=C.path+m+C.id+C.ext+'?u='+C.upd;this.$Sizes[i].innerHTML=w+'x'+h;if(!s){s=i}}this.$Sizes[i].style.display=!h?'none':''}this.$Info.find('DIV').html(Date.parse(C.created).format('d n Y')).end().find('A').attr('href',this.oSrc=(C.path+C.id+C.ext)).end().find('SPAN').html(C.width+'x'+C.height).end();this.selSize(s);return this},show:function(){this.Code.hide();return this.parent('show')}});domReady(function(){$('BODY')[/albums/.test(location.href)?'click':'F'](function(e){if(PixelPost.ContentView.getInstance().hitTest(e)===true){return false}})});PixelPost.ContentView.getInstance=function(){if(!this.instance)this.instance=new PixelPost.ContentView('#ContentView');return this.instance};;
jsLoader.loaded('{pixelpost}PixelPost.ContentView');


/**
 * @class	AlbumView
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Albums=jsClass.create().setMethods({__construct:function(PP){this.$View=PP.$Page;$E(this,{isMy:PP.isMyPage(),userId:PP.$.isAuth,albumId:PP.$.GET.aId,isEdit:0,isUpload:0});PP.addEventListener('change',$D(this,function(){this.isMy=PP.isMyPage();this.userId=PP.$.isAuth;this.selectAlbum(PP.$.GET.aId*1)}));this.$AName=this.$View.find('.v-name');this.jsName=this.$AName.find('.vn-edit').setPlugin('InputCounter',{},1,1);this.$Name=this.$AName.find('SPAN');this.$Album=$('#A-'+this.albumId);this.$AlbumPrev=this.$View.find('.v-prev');this.$AlbumNext=this.$View.find('.v-next');this.aIds=[];this.Albums={};this.AlbumContent={};this.prevUploadTime=Date.getUnixtime();this.queuePhotos=0;this.uploadPhotos=0;this.jsSelect=$('#AlbumSelect').setPlugin('ToggleMenu',{},1,1);this._checkUpload=$D(this,'checkUpload',1);this.init();this.initEdit();this.initUploader();this.selectAlbum(this.albumId,1);PixelPost.Albums.instance=this;this.ContentView=new PixelPost.ContentView('#ContentView');$BODY.click($D(this,function(e){e=jsCore.elm(e);if((e.tagName=='IMG')&&(/^P-\d+/.test(e.id))){this.ContentView.setContent({id:e.id.substr(2),path:e.src.substr(0,e.src.lastIndexOf('/')+1),ext:e.src.substr(e.src.lastIndexOf('.')),width:$GA(e,'oW'),height:$GA(e,'oH'),created:$GA(e,'c')}).show();return false}}))},init:function(){this.$View.find('.a-nav,.v-nav').click($D(this,'fire','selectAlbum')).end().find('.add-album').click($D(this,'fire','addAlbum'));Array.forEach(this.$View.find('.as-options A'),function(A){var id=A.id.substr(2)*1;var i=this.aIds.push(id)-1;this.Albums[id]={id:id,url:A.href,is_default:A.getAttribute('d')*1,created:A.getAttribute('c'),name:A.firstChild.innerHTML,count_contents:A.getAttribute('p')*1};if(i){this.Albums[id].Prev=this.Albums[this.aIds[i-1]];this.Albums[this.aIds[i-1]].Next=this.Albums[id]}if(!this.albumId&&/selected/.test(A.className)){this.albumId=id;this.$Album=$('#A-'+id)}},this);this.$View.find('.as-options .selected').removeClass('selected')},initEdit:function(){this.$AName.hover($D(this,'fire','hoverName',1),$D(this,'fire','hoverName',0)).click($D(this,'fire','editName')).find('.vne-save').click($D(this,'fire','saveName',1)).end().find('.vne-cancel').click($D(this,'fire','saveName',0)).end();this.$View.find('.v-remove').click($D(this,'fire','removeAlbum')).end()},initUploader:function(){this.jsUploader=new jsUploader({types:[{description:"Изображения (*.gif, *.jpeg, *.jpg, *.png, *.bmp, *.tiff)",extension:"*.gif;*.jpeg;*.jpg;*.png;*.bmp;*.tiff"}],addPhoto:'.add-photo',flashUrl:'/i/uploader.swf',serverUrl:'/?s='+jsCookie.get('s')+'&aId='+this.albumId,limit:100000,onSelect:$D(this,'uploaderFire','Select'),onProgress:$D(this,'uploaderFire','onProgress'),onComplete:$D(this,'uploaderFire','onComplete'),onLoad:$D(this,'uploaderFire','onLoad'),onCancel:$D(this,'uploaderFire','Close')});this.$Upload=$('#ViewerUploadLog');this.$UploadLog=this.$Upload.find('.log');this.$UploadLogItem=this.$UploadLog.find('.l-file').clone();this.$View.find('.add-photo').click($D(this,'uploaderFire','Open')).end().find('.u-close').click($D(this,'uploaderFire','Close')).end()},fire:function(n,e){switch(n){case'addAlbum':{if((r=unserialize(PP.Request.syncXForm('album')))&&r.album){this.addAlbum(r.album)}}break;case'hoverName':{if(!this.isHold())this.$AName[0].className=this.$AName[0].className.replace(/(fm-5-)\w+/,'$1'+(e?'fff9bb':'eff0f5'))}break;case'editName':{if(!this.isEdit&&!this.isUpload){this.updateView();this.$View.addClass('is-edit');this.isEdit=1}}break;case'saveName':{e?this.updateAlbum({name:this.jsName.val()}):this.updateView();this.$View.removeClass('is-edit');this.isEdit=0}break;case'selectAlbum':this.selectAlbum(jsCore.elm(e,'href').href.match(/aId=(\d+)/)[1]);break;case'removeAlbum':this.removeAlbum();break}return false},uploaderFire:function(n,F){switch(n){case'Open':case'Close':this['uploader'+n]();break;case'Select':{F=F[0];for(var i=0,n=F.length;i<n;i++){this.$UploadLogItem.clone().attr('id','F-'+F[i].id).find('.f-name').html(F[i].name).end().find('.f-size').html('0%').end().show().appendTo(this.$UploadLog)}this.$View.addClass('is-upload').addClass('is-uploading');this.isUpload=1;this.queuePhotos+=this.jsUploader.getFiles().length;this.jsUploader.upload('/?s='+jsCookie.get('s')+'&aId='+this.albumId);this.checkUpload()}break;case'onProgress':{$('#F-'+F.id).find('.f-size').html(Math.round(F.uploadPart*100)+'%')}break;case'onComplete':$('#F-'+F.id).addClass('complete');break;case'onLoad':{this.$View.removeClass('is-uploading');this.Albums[this.albumId].created=(new Date()).format('D n Y');this.updateView()}break}return false},checkUpload:function(s,r){clearTimeout(this.___cu);this.___cu=setTimeout(this._checkUpload,5000);if(s){if(r&&(r=unserialize(r))&&r.upload){if(!this._uploads)this._uploads=[];for(var i=0,n=r.upload.length;i<n;i++){if(Array.indexOf(this._uploads,r.upload[i].id)==-1){this.Albums[r.upload[i].type_id].count_contents++;this._uploads.push(r.upload[i].id);this.getAlbumContent(r.upload[i].type_id).add(r.upload[i]);this.uploadPhotos++;this.updateView(r.upload[i].type_id)}}}if(this.queuePhotos>this.uploadPhotos){$.get('/?a=checkUpload','s='+this.prevUploadTime+'&e='+(this.prevUploadTime=Date.getUnixtime()),this._checkUpload)}}},isHold:function(){return(this.isEdit||this.isUpload)},removeContent:function(id){this.Albums[id].count_contents--;this.updateView()},updateAlbum:function(A,ns){if(!A.id)A.id=this.albumId;$E(this.Albums[A.id],A);this.updateView(A.id);if(!ns)PP.Request.XForm('album',$E(A,{aId:A.id}))},updateView:function(id,upd){if(upd){upd.id=id;this.updateAlbum(upd,1)}if(!id)id=this.albumId;this.$Album.find('U').html(this.Albums[id].name+'').end().find('SPAN').html(this.Albums[id].count_contents+'');$('#V-photos').html(this.Albums[id].count_contents+'');$('#V-created').html(this.Albums[id].created);this.$Name.html(this.Albums[id].name+'');this.jsName.val(this.Albums[id].name+'')},getAlbums:function(){return this.Albums},getCountAlbums:function(){return this.aIds.length},selectAlbum:function(id,f){if(!this.Albums[id])id=this.aIds[0];if(!this.Albums[this.albumId])this.albumId=this.aIds[0];if(!this.isHold()&&((this.albumId!=id)||f)){this.$View[this.Albums[id].is_default?'addClass':'removeClass']('ud-default')[this.Albums[id].count_contents?'removeClass':'addClass']('is-empty');PixelPost.AlbumMenu.getInstance().clear().hide();this.getAlbumContent(this.albumId).hide();this.getAlbumContent(id).show();this.Albums[this.albumId].selected=0;this.$Album.removeClass('selected');this.$Album=$('#A-'+(this.albumId=id)).addClass('selected');this.Albums[id].selected=1;this.jsUploader.setOptions('serverUrl','/?s='+jsCookie.get('s')+'&aId='+this.albumId).swf();PP.add2History(this.Albums[id].url);if(this.aIds.length>0){this.Albums[id].Prev?this.$AlbumPrev.fadeIn('fast').attr('href',this.Albums[id].Prev.url):this.$AlbumPrev.fadeOut('fast');this.Albums[id].Next?this.$AlbumNext.fadeIn('fast').attr('href',this.Albums[id].Next.url):this.$AlbumNext.fadeOut('fast');this.updateView(id)}}},getAlbumContent:function(id){if(!this.AlbumContent[id])this.AlbumContent[id]=new PixelPost.AlbumContent(this.Albums[id]);return this.AlbumContent[id]},removeAlbum:function(id){if(!id)id=this.albumId*1;if(!this.isHold()&&this.Albums[id]&&confirm('При удалении альбома, также будут удалены фотографии')){if(this.aIds.length==1){document.location.reload()}else{var nextId;if(this.Albums[id].Next){nextId=this.Albums[id].Next.id;this.Albums[id].Next.Prev=this.Albums[id].Prev}if(this.Albums[id].Prev){nextId=this.Albums[id].Prev.id;this.Albums[id].Prev.Next=this.Albums[id].Next}this.aIds=Array.remove(this.aIds,id,1);this.Albums[id]=null;this.selectAlbum(nextId);$('#A-'+id).parent().remove();PP.Request.XForm('album','aId='+id+'&remove=Y')}}},uploaderOpen:function(){this.$UploadLog.empty();this.jsUploader.browse()},uploaderClose:function(){this.isUpload=0;this.$View.removeClass('is-upload')},addAlbum:function(A){A=$E(A,{url:'/user/albums/?uId='+A.userId+'&aId='+A.id,created:(new Date()).format('d n Y')});var i=this.aIds.push(A.id)-1;this.Albums[A.id]=A;this.Albums[this.aIds[i]].Prev=this.Albums[this.aIds[i-1]];this.Albums[this.aIds[i-1]].Next=this.Albums[this.aIds[i]];$PA=$('#A-'+this.aIds[i-1]).parent();$PA.clone().find('A').attr({id:'A-'+A.id,href:A.url}).click($D(this,'fire','selectAlbum')).end().insertAfter($PA);this.selectAlbum(A.id);this.fire('editName')}});;
jsLoader.loaded('{pixelpost}PixelPost.Albums');


/**
 * @class	EditableText
 * @author	RubaXa	<trash@rubaxa.org>
 * @events	onBeforeEdit, onBeforeCancel, onBeforeSave, onEdit, onCancel, onSave
 */
jsClass.create('EditableText').extend(Toggle).setMethods({__construct:function($T,o){this.$Target=jQuery($T);$E(this,o=$E({eText:'.et-text',input:'.et-input',block:0,editor:'.et-editor',minHeight:0,maxHeight:0,sIsEmpty:'is-empty',sIsEdit:'is-edit',cEdit:'.et-edit',cSave:'.et-save',cCancel:'.et-cancel'},o));this.isChanged=false;this.$Text=this.$Target.find(this.eText);this.$Block=this.block?this.$Target.find(this.block):this.$Text;this.jsInput=this.$Target.find(this.editor).setPlugin('InputText',{target:this.input,group:this.$Target,onKeyUp:$D(this,function(I){if(this.minHeight||this.maxHeight){this.$CInput[0].value=I.value+'!';var h=this.$CInput[0].scrollHeight+30;if(this.minHeight)h=Math.max(h,this.minHeight);if(this.maxHeight)h=Math.min(h,this.maxHeight);I.$Input.css({height:h})}}),onValid:$D(this,function(I){if(this.$Save)this.$Save[0].disabled=!I.isValid()})},1,1);if(this.minHeight)this.$CInput=this.jsInput.$Input.clone().css({left:0,height:1,position:'absolute',visibility:'hidden'}).insertAfter(this.jsInput.$Input);this.val(this.jsInput.val()||this.$Text.text());this.$Save=this.$Target[!this.sIsEmpty||this.value.length?'F':'addClass'](this.sIsEmpty).find(this.cEdit).click($D(this,'fire','Edit')).end().find(this.cCancel).click($D(this,'fire','Cancel')).end().find(this.cSave).click($D(this,'fire','Save'));this.parent('__construct',$T,this.toToggleOpts(o));this.__edit=$D(this,function(){this.isEdit=false});this.addEventListener('show',$D(this,function(){this.jsInput.setFocus()})).addEventListener('beforeShow',$D(this,function(TM){return!this.isEdit&&(this.dispatchEvent('beforeEdit',this)!==false)}));this.callMethod('init')},toToggleOpts:function(o){return $E({toggle:0,show:o.cEdit,hide:[o.cSave,o.cCancel].join(','),element:o.editor,parentIndex:0},o)},fire:function(n,e){if(this.dispatchEvent('before'+n,this,e)!==false){switch(n=n.toLowerCase()){case'edit':{if(!this.isEdit){if(this.minHeight||this.maxHeight){this.jsInput.$Input.css('height',Math.max(this.minHeight,this.$Target[0].offsetHeight))}this.$Target.removeClass(this.sIsEmpty).addClass(this.sIsEdit);setTimeout(this.__edit,10)}}break;case'save':case'cancel':{this[n]();this.redraw()}break}this.dispatchEvent(n,this,e)}else{return false}},fixIsEdit:function(){clearTimeout(this.__eId);this.__eId=setTimeout(this.__edit,10);return this},animate:function(a,f){if(Toggle.prototype.animate.apply(this,arguments)){this.$Block.animate(this.getAnimateOpts(a=='hide'?'show':'hide'),this.options.effectSpeed)}else this.$Block[a=='hide'?'show':'hide']()},getInput:function(){return this.jsInput},redraw:function(){this.$Target.removeClass(this.sIsEdit)[this.value.length?'removeClass':'addClass'](this.sIsEmpty);return this},isEmpty:function(){return!this.value.length},edit:function(){if(this.fire('edit')!==false){this.show()}return this},save:function(){this.isChanged=(this.value!==this.jsInput.val());return this.val(this.jsInput.val()).hide().fixIsEdit()},cancel:function(){this.isChanged=false;return this.val(this.value).hide().fixIsEdit()},val:function(v){if(defined(v)){this.jsInput.val(this.value=v);this.$Text.html(String.nl2br(v));return this.redraw()}else{return this.value}}});;
jsLoader.loaded('{plugins}EditableText');


/**
 * @class	PixelPost.ContentBrowser
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.ContentBrowser=jsClass.create().setMethods({__construct:function($V,o){this.$View=$($V).attr('name',o.XForm).setPlugin('FormValidator',{onSuccess:$D(this,function(o,R){if(R.isOK()&&!R.isXFormER())this.upd({name:o.name})})}).find('.v-nav').click($D(this,'_nextPrev')).end().find('.v-remove').click($D(this,'_remove')).end();this.Form=this.$View.getPlugin('FormValidator');this.contents={};this.Content=o.Content;this.Form.elm('XForm').value=o.XForm;if(o.XForm=='Album')$('.add-album').click($D(this,'_add')).end();this.$Name=this.$View.find('.v-name').hover($D(this,'_hover',1),$D(this,'_hover',0));this.$Prev=this.$View.find('.v-prev');this.$Next=this.$View.find('.v-next');this.$Date=$('#V-created');this.$Count=$('#V-photos');this.jsName=new EditableText(this.$View,{onSave:$D(this,'_edit',1),onCancel:$D(this,'_edit',0),onBeforeEdit:$D(this,function(){this._hover(0);return PP.isMyPage()})});this.Select=o.Select;this._select(o.Select.addEventListener('change',$D(this,'_select')),1);PixelPost.Ajax.addEventListener('complete',$D(this,function(P,R){if(R.isOK()&&R.upload){this.getContents(R.upload.type_id).add(R.upload)}}))},_add:function(){if(PP.isMyPage()){$.post('/','XForm=Album&name=new',$D(this,function(R){if(R.isOK())this.add(R.album)}))}return false},_hover:function(h){this.$Name[0].className=this.$Name[0].className.replace(/(fm-5-)\w+/,'$1'+(h==2||(h&&!this.jsName.isEdit&&!this.isUpload&&PP.isMyPage())?'fff9bb':'eff0f5'))},_edit:function(s,ET){if(s){this.upd({name:ET.val()})}this._hover(2)},_select:function(S){this.select(S.id)},_nextPrev:function(e){if(e=jsCore.elm(e,'href')){this.select((this.Select[e.className.indexOf('next')>-1?'next':'prev']()||{id:this.id}).id)}return false},_remove:function(){if(PP.isMyPage()&&confirm('Вы уверены?')){$.post('/?edit='+this.Form.elmVal('XForm')+'&action=remove',this.Select.get(this.id).url.split('?')[1]);this.Select.remove(this.id);this.dispatchEvent('remove',this)}return false},getCount:function(){return this.Select.options.length},add:function(A){A.created=Date.parse(A.created).format('d n Y');this.Select.add(A);this.select(A.id).edit();this.dispatchEvent('add',this,A);return this},select:function(id,f){if(this.id!==id){var O=this.Select.get(id);this.$View[O.is_default?'addClass':'removeClass']('ud-default');$('#PhotoList')[O.count_contents*1?'removeClass':'addClass']('is-empty');this.Form.attr('action',O.url);this.jsName.val(O.name);if(this.id)this.getContents(this.id).hide();this.getContents(this.id=id).show();if(PixelPost.AlbumMenu){PixelPost.AlbumMenu.getInstance().clear().hide()}this.Select.select(id);this.upd(O);if(O=this.Select.prev()){this.$Prev.fadeIn('fast').attr('href',O.url)}else this.$Prev.fadeOut('fast');if(O=this.Select.next()){this.$Next.fadeIn('fast').attr('href',O.url)}else this.$Next.fadeOut('fast');O=null;this.dispatchEvent('change',this,id)}return this},edit:function(){this.jsName.edit();return this},upd:function(O){O=$E(this.Select.get(this.id),O);this.Select.upd(this.Select.sIndex,O);this.$Date.html(O.created);this.$Count.html(O.count_contents+'');return this},getContents:function(id){return PixelPost[this.Content].find(id*1,this)},addContent:function(Content){Content.addEventListener('load',$D(this,function(C){this.Select.upd(this.Select.index(C.getId()),{count_contents:0})})).addEventListener('add',$D(this,function(id){var O=this.Select.get(id*1);O.count_contents++;this.upd(O)})).addEventListener('move',$D(this,function(fId,tId,ids){var O=this.Select.get(tId*1);O.count_contents+=ids.length;this.Select.upd(O);this.getContents(tId*1).reload()})).addEventListener('remove',$D(this,function(aId,id){var O=this.Select.get(aId);O.count_contents--;this.upd(O)}));return this},addUploader:function(Upd){this.__us=function(s){this.isUpload=s};Upd.addEventListener('hide',$D(this,'__us',0)).addEventListener('upload',$D(this,'__us',1)).addEventListener('browseCancel',$D(this,'__us',0)).addEventListener('serverAnswer',$D(this,function(U,F,R){PixelPost.Ajax.parseResult({responseText:R},'json')}))}});;
jsLoader.loaded('{pixelpost}PixelPost.ContentBrowser');


/**
 * @class	PixelPost.Forms.ChangePass
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Forms.ChangePass=jsClass.create().extend(FormValidator).setMethods({init:function(){this.LB=new LightBox(this.$Form,{controls:this.idLinks,top:'30%'})},onSuccess:function(o,R,F){if(R.isOK()&&!R.isXFormER()){if(F.step()==1){F.delIgnor('pass');F.$Form.addClass('next')}this.LB.fixPos()}},first:function(){this.step(0);this.clear();this.addIgnor('pass');return this},step:function(s){defined(s)?this._s=s:++this._s;this.elm('step').value=this._s;this.$Form.replaceClass(/step-\d/,'step-'+this._s);return this._s},show:function(){this.LB.show();return this},hide:function(){this.LB.hide();return this}});;
jsLoader.loaded('{pixelpost}PixelPost.Forms.ChangePass');


/**
 * @class	PixelPost.Forms.Invite
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Forms.Invite=jsClass.create().extend(LightBox).setMethods({__construct:function($B,o){this.parent('__construct',$B,$E({fadeNode:'#Darkening,#FixedLayout',position:0},o));this.Form=new FormValidator(this.$Box,{init:function(V){this.get('email').addEventListener('focus',$D(this,function(){this.removeError('user')}))},onSuccess:$D(this,function(o,R){if(R.isOK()&&!R.isXFormER()){this.done();if(this.idInviteUser&&this.$Invites[0]){this.$Invites.getPlugin('PixelPost.Pages.UserInvites').add(o.type,o.name,o.email,o.message).filter('given')}}})});this.Form.addIgnor('name,message');this._iList()},_iList:function(){this.$Invites=$(this.idInviteUser)},done:function(){this.$Box.addClass('f-done').find('.form').slideUp('fast');this.$Box.find('.done').slideDown('fast')},show:function(){this.Form.get('email').val('').setFocus();this.$Box.removeClass('f-done').find('.form').show();this.$Box.find('.done').hide();return this.parent('show')}});;
jsLoader.loaded('{pixelpost}PixelPost.Forms.Invite');


/**
 * @class	PixelPost.Forms.Login
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Forms.Login=jsClass.create().extend(LightBox).setMethods({__construct:function($B,o){this.parent('__construct',$B,$E({fadeNode:'#Darkening,#FixedLayout',controls:'#LoginBtn',position:0},o));this.Form=new FormValidator(this.$Box,{validateErrors:function(V){this.removeError('found')}})},forgotPassword:function(){this.hide();$(this.idForgotForm).getPlugin('PixelPost.Forms.ForgotPassword').show().getForm().get('email').val(this.getForm().get('email').val())},onShow:function(){if(this.Form.get('email').setFocus().isValid()){this.Form.get('pass').setFocus()}},getForm:function(){return this.Form}});;
jsLoader.loaded('{pixelpost}PixelPost.Forms.Login');


/**
 * @class	PixelPost.Forms.Reg
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Forms.Reg=jsClass.create().extend(LightBox).setMethods({__construct:function($B,o){this.parent('__construct',$B,$E({fadeNode:'#Darkening,#FixedLayout',controls:'#RegBtn',position:0,type:0},o));this.isReg=this.type=='reg';this.Form=new FormValidator(this.$Box,{onSuccess:$D(this,'_next')})},_next:function(o,R){if(R.isOK()&&!R.isXFormER())this.$Box.find('.s-invite').slideUp('fast').end().find('.s-done').slideDown('fast')},onShow:function(){this.Form.get('email').setFocus()}});;
jsLoader.loaded('{pixelpost}PixelPost.Forms.Reg');


/**
 * @class	PixelPost.Forms.Support
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Forms.Support=jsClass.create().extend(FormValidator).setMethods({init:function(){if(PP.isAuth())this.addIgnor('email');this.t=0;this.$Tabs=Array.map($(this.idTabs).click($D(this,'_sTab')),function(T,i){T.tab=i;return $(T)});this.$STabs=Array.map($(this.idSTabs),function(T){return $(T)})},_sTab:function(e){this.tab($GV(e,'tab'))},onSuccess:function(o,R){if(R.isOK()&&!R.isXFormER()){this.$Form.find('.form').slideUp('fast').end().find('.done').slideDown('fast')}},tab:function(t){this.$Form[0].name=this.elm('XForm').value=this.XForms[t];this.$STabs[this.t].slideUp('fast');this.$Tabs[this.t].removeClass('selected');this.$STabs[t].slideDown('fast');this.$Tabs[this.t=t].addClass('selected');this[t?'addIgnor':'delIgnor']('message')}});;
jsLoader.loaded('{pixelpost}PixelPost.Forms.Support');


/**
 * @class	PixelPost.Forms.ForgotPassword
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Forms.ForgotPassword=jsClass.create().extend(LightBox).setMethods({__construct:function($B,o){this.parent('__construct',$B,$E({fadeNode:'#Darkening,#FixedLayout',position:0},o));this.Form=new FormValidator(this.$Box,{onSuccess:$D(this,'_success')})},_success:function(o,R){if(R.isOK()&&!R.isXFormER())this.$Box.find('.s-first').slideUp('fast').end().find('.s-done').find('.u-email').html(o.email).end().slideDown('fast')},getForm:function(){return this.Form},onShow:function(){this.Form.get('email').setFocus()}});;
jsLoader.loaded('{pixelpost}PixelPost.Forms.ForgotPassword');


/**
 * @class	PixelPost.Pages.Profile
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Pages.Profile=jsClass.create().extend().setMethods({__construct:function($V,o){this.$View=$($V);$E(this,o);this.init();if(PP.isAuth())this._iEdit()},init:function(){},_iEdit:function(){this.Pass=new PixelPost.Forms.ChangePass(this.idChangePassForm,{idLinks:this.idChangePass});$(this.idAddBlock).click($D(this,'_bName','add'));$(this.idChangePass).click($D(this,function(){this.Pass.first().show();return false}));this.$BName=$(this.idEditBlockName).find(this.cssEditNameCancel).click($D(this,'_bName','cancel')).end().find(this.cssDeleteBlock).click($D(this,'_bName','remove')).end().setPlugin('FormValidator',{ajax:1,clearInputs:0,onSuccess:$D(this,'_bName','saved')});this._iBlocks()},_iBlocks:function(){this.$Blocks=this.$View.find(this.cssBlocks);this._dsBlockVal=$D(this,'_sBlockVal');Array.forEach(this.$Blocks.setHotKey('esc',$D(this,'_bName','cancel')).find(this.cssBlockName).click($D(this,'_bName','edit')).end().find(this.cssBlockValue),function(DL){var n=$GA(DL,'n'),t=(n=='about')||(DL.className.indexOf('default')==-1);new EditableText(DL,{name:n,onSave:this._dsBlockVal,effect:t,minHeight:t?100:0,maxHeight:t?400:0})},this)},_sBlockVal:function(ET){if(ET.name=='homepage'){var v=ET.val();ET.val(v=/^http/.test(v)?v:'http://'+v);ET.$Target.find('A')[0].href=v}PP.Ajax.post('?XForm=UserBlockValue',{block:ET.name,value:ET.val()})},_bName:function(n,e){var B=0;if(e.target)e=e.target;switch(n){case'edit':{var p=e.parentNode;B={name:p.getAttribute('n'),value:e.innerHTML.substr(0,e.innerHTML.length-1),def:/default/.test(p.className)};p=null}case'add':{if(!B)B={name:'b-'+jsCore.getUniqId(),value:'',def:1};if(B.name!='name')this.showBlockNameEdit(B,e.offsetTop-40)}break;case'saved':this.updBlock(e);case'cancel':this.hideBlockNameEdit();break;case'remove':this.removeBlock().hideBlockNameEdit();break}},updBlock:function(B){var $B=this.$View.find('.'+B.block);if(!$B[0]){if(!this.$UBTpl)this.$UBTpl=$(this.idBlockTpl).attr('id','');$B=this.$UBTpl.clone().addClass(B.block).find('DT').click($D(this,'_bName','edit')).end().attr('n',B.block).hide().appendTo(this.$Blocks).slideDown('fast');new EditableText($B,{name:B.block,onSave:this._dsBlockVal,minHeight:100,maxHeight:400})}$B.find('DT').html(B.name+':');$B=null;return this},removeBlock:function(){var n=this.getEditBlockName();PP.Ajax.post('?edit=Profile',{action:'RemoveBlock',block:n},$D(this,function(){this.$Blocks.find('.'+n).slideUp('fast')}));return this},getEditBlockName:function(){return this.$BName.find('[name=block]').val()},showBlockNameEdit:function(B,y){this.$BName[B.def?'addClass':'removeClass']('default')[y?'css':'F']('marginTop',y).find('[name=block]').val(B.name).end().find('[type=text]').val(B.value).keyup().end().show();return this},hideBlockNameEdit:function(){this.$BName.hide();return this}});;
jsLoader.loaded('{pixelpost}PixelPost.Pages.Profile');


/**
 * @class	PixelPost.Pages.UserInvites
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Pages.UserInvites=jsClass.create().extend().setMethods({__construct:function($V,o){this.$View=$($V);$E(this,o);this._iFilter();this._iList();this.filter(this.cFilter)},_iFilter:function(){$(this.idFilter).click($D(this,function(e){this.filter($GV(e,'filter'));return false}))},_iList:function(){this.$List=$(this.idInviteList);this.$Tpl=$(this.idInviteRowTpl).attr('id','');$(this.idListActions).click($D(this,function(e){e=$G(e,'href');if(!e.h){e.h=1;PP.Ajax.get(e.href,'',$D(this,function(R){e.h=0;if(R.isOK())$(e).parent().removeClass('s-wait').addClass('s-approved')}))}return false}))},filter:function(f){this.$View.attr('className',f)[this.count[f]?'removeClass':'addClass']('empty');return this},add:function(t,n,e,m){this.count[t]++;var $R=this.$Tpl.clone().addClass('t-'+t);$R.find('.name').html(n||e).end().find('.email')[n?'html':'F']('('+e+')').end().insertBefore(this.$Tpl).show();return this}});;
jsLoader.loaded('{pixelpost}PixelPost.Pages.UserInvites');


/**
 * @class	PixelPost.PostContent
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.PostContent=jsClass.create().setMethods({__construct:function(P){this.id=P.id;this.$View=$('#Post-'+P.id);this.loaded=this.$View[0]?1:0;if(this.loaded){this._iCode($GET.code=='Y')}else{this.$View=$('<div id="Post-'+P.id+'"></div>').appendTo('#PostHolder')}},load:function(){this.loaded=1;this.$View.empty();PP.Ajax.get('?action=loadPost',{pId:this.id},$D(this,function(R){if(R.isOK()&&R.isText()){this.$View.html(R.toText());this._iCode()}else{this.reload();PP.Alert.systemError()}}))},_iCode:function(s){var T=new Toggle('#PostCode-'+this.id,{effect:'height',state:(s?'show':'hide')});T.$Target.find('TEXTAREA,INPUT').click(function(){this.select()})},reload:function(){this.loaded=0;return this},show:function(){if(!this.loaded){this.load()}this.$View.show();return this},hide:function(){this.$View.hide();return this}});PixelPost.PostContent.find=function(id,Browser){if(!this[id]){this[id]=new PixelPost.PostContent(Browser.Select.get(id*1));Browser.addContent(this[id])}return this[id]};;
jsLoader.loaded('{pixelpost}PixelPost.PostContent');


/**
 * @class	PixelPost.Select
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Select=jsClass.create().setMethods({__construct:function($T,o){this.$Target=jQuery($T);if(o&&o.menu)new ToggleMenu($T,o);this.$Item=this.$Target.find('.s-item:first');this.$Items=this.$Target.find('.s-items');this.prefix=o.prefix;this.options=[];this.sIndex=0;this._init()},_init:function(){this._dClick=$D(this,'_click');var $Items=this.$Items.find('A').click(this._dClick);for(var i=0,O,d;$Items[i];i++){O=$Items[i];id=O.id.split('-')[1]*1;d=$GA(O,'c');d=Date.is(d)?Date.parse(d).format('d n Y'):d;this.options.push({id:id,url:O.href,is_default:$GA(O,'d')*1,created:d,name:O.firstChild.innerHTML,count_contents:$GA(O,'p')*1,selected:O.className.indexOf('selected')>-1});if(this.options[i].selected){this.id=id;this.sIndex=i}}if(!this.id){this.select(this.options[0].id)}$Items=O=null},_click:function(e){this.select(jsCore.elm(e,'href').id.split('-')[1]*1);return false},add:function(O){var i;if((i=this.index(O.id))==-1){i=this.options.push(O)-1;this.$Item.clone().appendTo(this.$Items).find('A').attr({id:this.prefix+O.id,href:O.href}).removeClass('selected').click(this._dClick)}return this.upd(i,O)},get:function(id){return this.options[this.index(id||this.id)]},index:function(id){return Array.search(this.options,function(V){return V.id==id})},upd:function(i,O){if(!O){O=i;i=this.index(O.id)}this.options[i]=(O=$E(this.options[i],O));$('#'+this.prefix+O.id).find('.name').html(O.name+'').end().find('.count').html(O.count_contents+'');return this},remove:function(id){var i=this.index(id);if((i>=0)&&!this.options[i].is_default){this.options=Array.remove(this.options,i);$('#'+this.prefix+id).parent().remove();if((this.id==id)&&this.options.length){this.select((this.options[i]||this.options[i-1]||this.options[i+1]).id)}}return this},select:function(id){if(this.id!==id){$('#'+this.prefix+this.id).removeClass('selected');$('#'+this.prefix+(this.id=id)).addClass('selected');if(this.options[this.sIndex])this.options[this.sIndex].selected=0;this.options[this.sIndex=this.index(id)].selected=1;this.dispatchEvent('change',this)}return this},getById:function(id){return this.options[this.index(id)]},prev:function(){return this.options[this.sIndex-1]},next:function(){return this.options[this.sIndex+1]}});;
jsLoader.loaded('{pixelpost}PixelPost.Select');


/**
 * @class	PixelPost.Uploader
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Uploader=jsClass.create().extend(jsUploader).setMethods({__construct:function(Browser){this.parent('__construct',{types:[{description:'Изображения (*.gif, *.jpeg, *.jpg, *.png, *.bmp, *.tiff)',extension:'*.gif;*.jpeg;*.jpg;*.png;*.bmp;*.tiff'}],server_url:PP.getUrl('upload')+'&aId='+(this.id=Browser.id),flashUrl:'/i/uploader.swf'});this.$Browser=Browser.addEventListener('change',$D(this,function(B){this.param('server_url',PP.getUrl('upload')+'&aId='+(this.id=B.id))})).$View;$('.add-photo').mouseover($D(this,function(e){this.setBrowseBtn(jsCore.elm(e,'href'))}));this.$View=$('#ViewerUploadLog').find('.u-close').click($D(this,'fire','hide')).end();this.$Files=this.$View.find('.log');this.$File=this.$Files.find('.l-file');this.onSelect=$D(this,'fire','select',1);this.onBrowseCancel=$D(this,'fire','select',0);this.onUpload=$D(this,'fire','upload',1);this.onLoaded=$D(this,'fire','upload',0);this.onProgress=$D(this,'fire','progress',0);this.onComplete=$D(this,'fire','progress',1);this.prevUploadTime=Date.getUnixtime();this._checkUpload=$D(this,'check');Browser.addUploader(this);Browser.addEventListener('add',$D(this,'hide'))},onIOError:function(){this.hide();this.$Browser.removeClass('is-uploading');PP.Alert.systemError()},fire:function(n,a,U,b){switch(n){case'browse':{this.param('server_url','/?s='+jsCookie.get('s')+'&aId='+this.id).param('types',this.param('types')).cancel().browse();return false}break;case'hide':{this.fire('select',0);this.dispatchEvent('hide',this);return false}break;case'select':{this.$Browser[a?'addClass':'removeClass']('is-upload');if(a){this.$Files.empty();for(var i=0;b[i];i++){this.$File.clone().attr('id','UF-'+b[i].id).find('.f-name').html(b[i].name).end().appendTo(this.$Files).fadeIn()}this.upload()}}break;case'upload':{this.$Browser[a?'addClass':'removeClass']('is-uploading')}break;case'progress':{$('#UF-'+b.id).find('.f-size').html(Math.round(b.uploadPart*100)+'%');if(a){$('#UF-'+b.id).addClass('complete')}}break}},hide:function(){this.fire('hide')}});;
jsLoader.loaded('{pixelpost}PixelPost.Uploader');


/**
 * @class		Draggable
 * @author		"RubaXa"		<trash@rubaxa.org>
 * @events		start, move, stop + before --> Draggable.onStart(this, Event)
 */
jsClass.create('Draggable').setMethods({__construct:function($T,o){this.$T=jQuery($T);$E(this,{zIndex:5000,ghost:1,ghostOpacity:0.5,opacity:0.8,type:'absolute',enabled:1,scroll:0,group:0,byX:1,byY:1},o||{});this._dDStart=function(){return false};this._dStart=$D(this,'fire','Start');this._dStop=$D(this,'fire','Stop');this._dMove=$D(this,'fire','Move');if(this.group){if(!Draggable[this.group])Draggable[this.group]=[];Draggable[this.group].push(this)}this.callMethod('init');this[this.enabled?'enable':'disable']()},_gost:function($D){if(this.ghost){return this.$D.clone().attr('id','').css({opacity:this.ghostOpacity,position:'absolute',zIndex:this.zIndex,margin:0}).insertBefore(this.$D)}return $D},_drag:function(e){return this.$T},fire:function(n,e){Draggable.mouse=this.mouse={x:e.pageX,y:e.pageY};if(!this.__d&&((this.hold&&n!='Move')||(this.dispatchEvent('before'+n,this,e)!==false)&&(Draggable['onBefore'+n](this,e)!==false))){switch(n){case'Move':this._move(e.pageX,e.pageY);break;case'Stop':case'Start':{if(this.hold=(n=='Stop')){this.$D.css(this.css)}else{this.$D=this._drag(e);this.pos=this.$D.offset({local:1,scroll:1});this.width=this.$D.width();this.height=this.$D.height();this.click=this.mouse;this.offset={x:e.pageX-this.pos.left,y:e.pageY-this.pos.top};this.$G=this._gost(this.$D);this.css={zIndex:this.$D.css('zIndex'),opacity:this.$D.css('opacity'),position:this.$D.css('position')};this.$D.css({opacity:this.opacity,position:this.ghost?this.css.position:'absolute'});this.$G.css({width:this.width,height:this.height})}$DOC[this.hold?'unbind':'bind']('mouseup',this._dStop)[this.hold?'unbind':'bind']('mousemove',this._dMove);Draggable.isDrag=!this.hold;if(this.hold&&this.ghost){this.$G.remove();this.$G=null}}break}if(n!='Move')this.fire('Move',e);this.dispatchEvent(n,this,e);Draggable['on'+n](this,e)}return false},_move:function(x,y){this.lX=1*(this.ghost?0:1)-(this.click.x-x);this.lY=1*(this.ghost?0:1)-(this.click.y-y);this.x=this.lX-this.width;this.y=this.lY-this.height;if(this.$G){if(this.byX)$FS(this.$G[0]).marginLeft=this.lX+'px';if(this.byY)$FS(this.$G[0]).marginTop=this.lY+'px'}},isDrag:function(){return!this.hold},getCoords:function(){return{x1:this.x,y1:this.y,x2:this.x+this.width,y2:this.y+this.height}},getPos:function($N){var o=this.getOffset($N);return{x:o.left,y:o.top}},getOffset:function($N){var o={left:this.x+(this.scroll?$WIN.scrollLeft():0),top:this.y+(this.scroll?$WIN.scrollTop():0)};if($N){var nO=jQuery($N).offset();o.left-=nO.left;o.top-=nO.top}return o},enable:function(){return this.disable(false)},disable:function(s){this.$T[(this.disabled=s=defined(s,false))?'unbind':'bind']('mousedown',this._dStart)[s?'unbind':'bind']('dragstart',this._dDStart);return this},remove:function(){this.destroy(1);this.$T.remove();jsCore.destroy(this)},moveTo:function($N){var $T=this.$T.clone(true).appendTo($N);this.$T.remove();this.$T=$T;return this},getTarget:function(c){return this.$T[c?'clone':'F']()},setTarget:function($T){this.disable();this.$T=jQuery($T);return this.enable()},destroy:function(f){this.disable();$DOC.unbind('mouseup',this._dStop).unbind('mousemove',this._dMove);if(!f)jsCore.destroy(this)}});$E(Draggable,{mouse:{x:0,y:0},onStart:jsCore.F,onMove:jsCore.F,onStop:jsCore.F,onBeforeStart:jsCore.F,onBeforeMove:jsCore.F,onBeforeStop:jsCore.F,getGroup:function(n){return Draggable[n]},delGroup:function(n){var Group=Draggable[n];if(Group){for(var i=0;Group[i];i++){Group[i].destroy();Group[i]=null}}Draggable[n]=Group=null}});;
jsLoader.loaded('{utils}Draggable');


/**
 * @class	Droppables
 * @events	onDrop
 * @author	RubaXa	<trash@rubaxa.org>
 */
jsClass.create('Droppables').setMethods({__construct:function($T,o){this.$Target=jQuery($T);$E(this,{minX:10,minY:10,byCursor:0,hover:'hover'},o);Droppables.Manager.add(this)},prepare:function(){this.p=this.$Target.offset();this.x=this.p.left;this.y=this.p.top;this.width=this.$Target.width();this.height=this.$Target.height();this.xw=this.width/2;this.yw=this.height/2},add:function(D){this.$Target.removeClass(this.hover);this.dispatchEvent('drop',D,this);return this},collision:function(D,e,f){var h=0;if(this.byCursor&&!f){h=(e.pageX>=this.x)&&(e.pageY>=this.y)&&(e.pageX<=this.x+this.width)&&(e.pageY<=this.y+this.height)}else{var dX=(this.x+this.width/2)-(D.x+D.width/2);var dY=(this.y+this.height/2)-(D.y+D.height/2);if((Math.abs(dX)<(this.width+D.width)/2)&&(Math.abs(dY)<(this.height+D.height)/2)){dX-=Math.sign(dX)*(this.width+D.width)/2;dY-=Math.sign(dY)*(this.height+D.height)/2;h=(Math.abs(dX)>=this.minX)&&(Math.abs(dY)>=this.minY)}if(f)return h}if(h!==this.__h){this.$Target[(this.__h=h)?'addClass':'removeClass'](this.hover)}return h},destroy:function(){Droppables.Manager.remove(this);jsCore.destroy(this)}});Droppables.Manager=new(jsClass.create().setMethods({__construct:function(){this.items=[];Draggable.onStart=$D(this,'_start');Draggable.onMove=$D(this,'_move',0);Draggable.onStop=$D(this,'_move',1);return this},_start:function(){this.drag=1;for(var i=0;this.items[i];i++){this.items[i].prepare()}},_move:function(d,D,e){if(this.drag){this.c={};for(var i=0;this.items[i];i++){if((this.c[i]=this.items[i].collision(D,e))){if(d){this.drag=0;this.items[i].add(D)}}}}},_entry:function(e,D,DL,DR){return DL.collision(D,e,1)&&DR.collision(D,e,1)},add:function(D){this.items.push(D)},remove:function(D){this.items=Array.remove(this.items,D,1)}}));;
jsLoader.loaded('{utils}Droppables');


/**
 * @class	PixelPost.PostItem
 * @author	RubaXa	<trash@rubaxa.org>
 */
var aSizes=[100,300,500,700];PixelPost.PostItem=jsClass.create().setMethods({__construct:function(Block,Item){if(Item.append)Item={src:Item.attr('src'),width:Item.attr('oW'),height:Item.attr('oH')};this.isInit=0;this.tplId='#ItemTpl';this.src=Item.src;this.$View=$(this.tplId);this.aSize=[];this.width=this.oWidth=Item.width*1;this.height=this.oHeight=Item.height*1;this.ratio=this.oWidth/this.oHeight;for(var i=0,m;aSizes[i];i++){m=aSizes[i];if(this.oWidth>=m){w=Math.round(this.ratio>=1?m:m*this.ratio);h=Math.round(this.ratio<1?m:m/this.ratio);this.aSize.push([w,h])}}this.isText=0;this._dHoverOut=$D(this,function(){this.$View.removeClass('hover')});this._dHoverOver=$D(this,function(){this.$View.addClass('hover')});this._fixResize=$D(this,function(){this.dispatchEvent('resize',this)})},moveTo:function(B){this.__r=0;this.dispatchEvent('remove',this);this.$View.remove();this.$View=$(this.tplId);return this.addTo(B)},addTo:function(B){this.isInit=1;this.$View=this.$View.clone().attr('id','').hover(this._dHoverOver,this._dHoverOut).insertBefore(B.$View.find('.b-items')).find('.remove').click($D(this,function(){this.destroy()})).end().show();this.$Img=this.$View.find('IMG');this.$Sizes=this.$View.find('.sizes UL');new Draggable(this.$Img,{Item:this});for(var i=0;this.aSize[i];i++){this.$Sizes[0].innerHTML+='<li><u i="'+i+'">'+this.aSize[i].join('x')+'</u></li>'}this.$Sizes.find('U').click($D(this,function(e){this.setSize(e.target.getAttribute('i'));return false}));return this},filterSizes:function(w){for(var i=this.aSize.length-1;i>=0;i--){this.$Sizes[0].childNodes[i].style.display=(w>=this.aSize[i][0])?'':'none'}return this},setMaxSize:function(w){var s=[0,0];this.filterSizes(w);if(w>=500)w*=2/3;for(var i=0;this.aSize[i];i++){if(this.aSize[i][0]>w)break;if(s[0]<this.aSize[i][0]){s=this.aSize[i]}}return this.setSize(Math.max(0,i-1))},setSize:function(i,f){var dW=this.aSize[i][0]-this.width;this.size=i;this.width=this.aSize[i][0];this.height=this.aSize[i][1];this.$Sizes.find('.selected').removeClass('selected').end()[0].childNodes[i].className+=' selected';this.$Img.attr('src',this.src.replace(/\/\d{3}(\d+\.)/,'/'+aSizes[i]+'$1')).dequeue()[this.__r&&!f?'animate':'css']({width:this.width,height:this.height},{complete:this._fixResize});this.__r=1;this._fixResize();return this},toArray:function(){return{oWidth:this.oWidth,oHeight:this.oHeight,width:this.width,height:this.height,size:this.size,text:this.val(),src:this.isText?'':this.getSrc()}},val:function(){return''},getSrc:function(){return this.$Img[0].src},destroy:function(){if(this.isInit){this.$View.animate({width:0,height:0},'fast',$D(this,function(){this.dispatchEvent('remove',this);this.$View.remove();jsCore.destroy(this)}))}}});;
jsLoader.loaded('{pixelpost.lego}PixelPost.PostItem');


/**
 * @class	PixelPost.PostItem.Text
 * @author	RubaXa	<trash@rubaxa.org>
 */
var aSizes=[100,300,500,700];PixelPost.PostItem.Text=jsClass.create().extend(PixelPost.PostItem).setMethods({__construct:function(Block,text){this.text=text;this.isNew=!defined(text);this.isText=1;this.tplId='#ItemTextTpl';this.$View=$(this.tplId);this.width=0;this.height=0;this._dHoverOut=$D(this,function(){this.$View.removeClass('hover')});this._dHoverOver=$D(this,function(){this.$View.addClass('hover')})},eSave:function(ET){if(ET.isEmpty()){this.destroy()}else if(ET.isChanged){this.isNew=0;this.dispatchEvent('resize',this)}},eCancel:function(ET){if(this.isNew&&ET.isEmpty()){this.destroy()}},addTo:function(B){this.$View=this.$View.clone().attr('id','').appendTo(B.$View.find('.b-items')).hover(this._dHoverOver,this._dHoverOut).find('.remove').click($D(this,function(){this.destroy()})).end().show();this.ET=new EditableText(this.$View,{effect:'height',minHeight:50,maxHeight:300});this.ET.addEventListener('save',$D(this,'eSave')).addEventListener('cancel',$D(this,'eCancel'))[this.isNew?'edit':'val'](this.text);return this},filterSizes:function(w){return this.setSize(w)},setMaxSize:function(w){return this.setSize(w)},setSize:function(w){this.$View.css('width',this.width=w);return this},val:function(v){return this.ET.val(v)},getSrc:function(){return''},destroy:function(){this._destroy=$D(this,function(){this.$View.remove();this.dispatchEvent('remove',this);jsCore.destroy(this)});if(0&&this.isNew){this._destroy()}else{this.$View.animate({width:0,height:0},'fast',this._destroy)}}});;
jsLoader.loaded('{pixelpost.lego}PixelPost.PostItem.Text');


/**
 * @class	PixelPost.PostBlock
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.PostBlock=jsClass.create().setMethods({__construct:function(Post){this.width=0;this.mWidth=Post.$.width;this.items=[];this.countPhotos=0;Post.addEventListener('change',$D(this,function(P){if(P._$.width){this.mWidth=P.$.width;this.rebuildItems()}}));this.aText=$D(this,function(){this.isText=1;this.addItem(new PixelPost.PostItem.Text(this));return false});this.$View=Post.getBlockTpl().show().find('A').click(this.aText).end();this.Droppables=new Droppables(this.$View,{minX:0,minY:0,byCursor:1,Block:this,onDrop:$D(this,function(D){if(D.Item){var p=Array.indexOf(this.items,D.Item);if(p==-1){if(this.canAddItem(D.Item)){this.addItem(D.Item,1)}}else{var cX=D.getOffset().left+D.width/2,X=0,dX;for(var i=0;this.items[i];i++){if(p!=i){X+=this.items[i].width;dX=cX-(X/2);if(Math.abs(dX)<(D.width-this.item[i].width)/2){if((p>i)&&(cX<X)){}}}X+=this.items[i].width}debug.log('@todo: Sort')}}else{var Item=new PixelPost.PostItem(this,D.getTarget());if(this.canAddItem(Item)){this.addItem(Item)}else Item.destroy()}})});this._dResizeItem=$D(this,function(){this.rebuildItems();this.dispatchEvent('change',this)});this._dRemoveItem=$D(this,'removeItem')},getView:function(){return this.$View},addItem:function(Item,move){if(!Item.classUniqId)Item=new PixelPost.PostItem(this,Item);if(!Item.isText)this.countPhotos++;this.isText=Item.isText;Item[move?'moveTo':'addTo'](this).setMaxSize(this.mWidth-this.width).addEventListener('resize',this._dResizeItem).addEventListener('remove',this._dRemoveItem);if(!this.items.length){this.$View.addClass('is-empty').find('.has-empty').hide()}this.items.push(Item);this.rebuildItems();this.dispatchEvent('addItem',this);return Item},canAddItem:function(I){return(this.mWidth-this.width)>=100},rebuildItems:function(I,dW){var w=0,h=0;this.lastItem=this.items[this.items.length-1];if(this.isText){w=this.mWidth}else{for(var i=0;this.items[i];i++)w+=this.items[i].width}for(var i=0;this.items[i];i++){h=Math.max(h,this.items[i].height);this.items[i].filterSizes(this.mWidth-w+this.items[i].width)}this.width=w;this.height=h},removeItem:function(I){if(!I.isText)this.countPhotos--;this.items=Array.remove(this.items,I,1);this.rebuildItems(I,-I.width);if(!this.items.length)this.$View.addClass('is-empty');this.dispatchEvent('removeItem',this)},toArray:function(){var Items=[];Array.forEach(this.items,function(I){Items.push(I.toArray())});return Items},isEmpty:function(){return this.items.length==0},destroy:function(){this.Droppables.destroy();this.$View.remove();jsCore.destroy(this)}});;
jsLoader.loaded('{pixelpost.lego}PixelPost.PostBlock');


/**
 * @class	PixelPost.Cut
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Cut=jsClass.create().setMethods({__construct:function(P){this.Post=P.addEventListener('change',$D(this,'postChanged'));this.Text=new EditableText('#CutText');this.Left=new Draggable('#CutLeft',{idx:1,ghost:0,byX:0,left:1,onStop:$D(this,'_drag')});this.Right=new Draggable('#CutRight',{idx:1,ghost:0,byX:0,right:1,onStop:$D(this,'_drag')});this.reset()},_drag:function(D){var x=i=1,y,h,B=this.Post.getBlocks(),n=B.length-1;for(i;i<n;i++){y=B[i].getView()[0].offsetTop;h=B[i].getView().height();if(D.y>=y&&D.y<=y+h){x=i+((D.y-y)/h<.5?0:1);break}}D.idx=x;this._pos(D);this.dispatchEvent('drag',this)},_pos:function(C){if(this.Left.idx>this.Right.idx){this.Right.idx=this.Left.idx;this._pos(this.Right)}var B=this.Post.getBlocks()[C.idx-1].getView();C.getTarget().css('marginTop',B[0].offsetTop+B.height()+5);B=null;this.Right.isEnd=this.Right.idx==this.Post.$.items},set:function(b,e){this.Right.idx=b;this.Left.idx=e;return this},isEnabled:function(){return this.__v},redraw:function(){this._pos(this.Left);this._pos(this.Right)},reset:function(){this.lAuto=this.rAuto=1;this.lPos=this.rPos=0},postChanged:function(){var B=this.Post.getBlocks();if(B.length>2){this.Left.idx=Math.min(this.Left.idx,this.Post.$.items);this.Right.idx=Math.min(this.Right.idx,this.Post.$.items);if(this.Right.isEnd)this.Right.idx=this.Post.$.items;this.redraw()}else{this.visiblity(0)}},visiblity:function(v){if(this.__v!==v){this.__v=!!v;this.Left.getTarget()[v?'show':'hide']()}return this}});
jsLoader.loaded('{pixelpost.lego}PixelPost.Cut');


/**
 * @class	PixelPost.Post
 * @author	RubaXa	<trash@rubaxa.org>
 */
var hSizes={500:0,750:1,1000:2};PixelPost.Post=jsClass.create().extend(PropertiesMapper).setMethods({__construct:function(p){this.$View=$('#NewPost');this.NameET=this.$View.find('#P-Delete').click($D(this,function(){this.remove();return false})).end().find('.p-name').setPlugin('EditableText',{init:function(){this.title=' /'+document.title.split('/')[1];this.jsInput.addEventListener('keyUp',$D(this,'_title'))},_title:function(){document.title=this.jsInput.val()+this.title},onCancel:function(){this._title()},onSave:$D(this,function(ET){if(ET.isChanged)this.set('changed',1);this.$.name=ET.val()})},1,1);this.$Size=this.$View.find('.s-arrow DIV').click($D(this,function(e){var i=0,n=this.blocks.length,nW=jsCore.elm(e,'tagName','DIV').className.match(/s(\d+)/)[1]*1;for(;i<n;i++){if(!this.blocks[i].isText&&this.blocks[i].width>nW){nW=0;break}}if(nW)this.set({'width':nW,changed:1});return false}));this.$Blocks=this.$View.find('.Blocks');this.$Save=this.$View.find('.b-save').click($D(this,function(){this.save();return false}));this.__properties('$',{id:0,width:0,items:0,name:'',cut_text:'',cut_begin:0,cut_end:0,created:'',changed:0,hold:0});this.set(p);this.blocks=[];this._dChangeBlock=$D(this,function(){this.set('changed',1);this.dispatchEvent('change',this)});this._dAddItem=$D(this,function(B){if(!this.$.hold&&(this.blocks[this.blocks.length-1]==B)){this.addBlock(new PixelPost.PostBlock(this))}this.updView();this.dispatchEvent('change',this)});this._dRemoveItem=$D(this,function(B){if(!B.items.length&&(this.blocks[this.blocks.length-1]!=B)){this.blocks=Array.remove(this.blocks,B,1);B.destroy()}this.updView();this.dispatchEvent('change',this)});this._dSaved=$D(this,function(R){if(R.isOK()){}});this._iCut()},_iCut:function(){this.Cut=new PixelPost.Cut(this);this.Cut.addEventListener('drag',$D(this,function(){this.set('changed',1)}));$('#AddCut').click($D(this,function(){this.addCut(1,1)})).hover(function(){this.className+=' js-hover'},function(){this.className=this.className.replace(/\s*js-hover/,'')});$('#CutLeft I').click($D(this,function(){this.removeCut();return false}))},addCut:function(b,e,t){{$('#Cut').removeClass('is-empty');this.set('changed',1);this.Cut.set(b,e).visiblity(1);this.Cut.Text[t?'val':'edit'](t)}return this},removeCut:function(){this.Cut.visiblity(0);$('#Cut').addClass('is-empty');this.set('changed',1)},updView:function(){this.set('items',Array.sum(this.blocks,function(B){return B.countPhotos}));return this},getBlocks:function(){return this.blocks},set:function(k,v){this.parent('set',k,v);var n,nV,oV;for(n in this._$){nV=this.$[n];oV=this._$[n];switch(n){case'items':GVar.val('items',nV+'');break;case'changed':this.$Save[nV?'removeClass':'addClass']('disabled');break;case'created':GVar.val('created',nV);break;case'name':this.NameET.val(nV);break;case'width':{this.$View.width(nV);if(oV)this.$Size[hSizes[oV]].className='s'+oV;this.$Size[hSizes[nV]].className+=' sel'}break}}return this},addBlock:function(B,i){i=defined(i,-1);B.addEventListener('change',this._dChangeBlock).addEventListener('addItem',this._dAddItem).addEventListener('removeItem',this._dRemoveItem);if(i>-1)this.blocks=Array.insert(this.blocks,B,i);else this.blocks.push(B);this.set('changed',1);return B},getBlockTpl:function(){if(!this.$BlockTpl)this.$BlockTpl=this.$Blocks.find('.b-tpl').removeClass('b-tpl');return this.$BlockTpl.clone().appendTo(this.$Blocks)},toArray:function(){var Post=$E({},this.get());Post.Blocks=[];Array.forEach(this.blocks,function(B){if(!B.isEmpty()){Post.Blocks.push(B.toArray())}});return Post},save:function(){if(!this.$.id)this.$View.removeClass('is-new');var post=this.toArray();debug.log(post);$.post('/',{edit:'UserPost',action:'save',post:serialize(post),name:this.NameET.val(),cut:this.Cut.isEnabled()?'Y':'N',cut_text:this.Cut.Text.val(),cut_begin:this.Cut.Left.idx,cut_end:this.Cut.Right.idx},this._dSaved);return this.set('changed',0)},getUrl:function(){return PP.getUser().getUrl('post')+'&id='+this.$.id},remove:function(){if(confirm('Вы уверерены?')){PP.Ajax.post('/?edit=UserPost&remove=Y',{id:this.$.id},function(R){if(R.isOK())PP.redirect(PP.getUser().getUrl('post'))})}}});;
jsLoader.loaded('{pixelpost.lego}PixelPost.Post');


/**
 * @class	PixelPost.Lego
 * @author	RubaXa	<trash@rubaxa.org>
 */
PixelPost.Lego=jsClass.create().setMethods({__construct:function(){this.Select=new PixelPost.Select('#AlbumSelect',{hideByClick:1,menu:1,prefix:'AS-'});this.Select.addEventListener('change',$D(this,function(S){var A=S.get();GVar.val('a-name',A.name).val('a-created',A.created).val('a-count_contents',A.count_contents);this.$AlbumList.empty();PP.Ajax.get('?action=loadContents',{aId:S.id},$D(this,function(R){if(R.isOK()){var r=R.contents;for(var i=0;r[i];i++){$('<b><img /></b>').find('IMG').attr({id:r[i].id,c:r[i].created,ow:r[i].width,oh:r[i].height,src:r[i].public_src+'100'+r[i].id+'.'+r[i].extension+'?u='+[i].created}).end().appendTo(this.$AlbumList)}this.initList()}}))}));this.initAlbum()},initAlbum:function(){$('#NewPost').css({zIndex:20});this.$FCol=$('#FixedCol').setPositionFixed('30px','100px').css({width:270,zIndex:1000});this.$Album=$('#AlbumContents');this.$AlbumList=this.$Album.find('.list');this.initList();var _fixCol=$D(this,function(){this.$AlbumList.height(Window.getHeight()-Math.max(190,280-$HTML.scrollTop()));this.$FCol[0].style.top=Math.max(15,100-$HTML.scrollTop())+'px'});Window.addEventListener('resize',_fixCol).addEventListener('scroll',_fixCol);_fixCol()},initList:function(){Draggable.delGroup('PP.Lego');this.$AlbumList.find('IMG').each(function(){new Draggable(this,{fixed:1,group:'PP.Lego'})})},init:function(Post){this.Post=new PixelPost.Post($E({width:500,name:'Новый фото-пост',created:(new Date()).format('d n Y')},Post));return this.Post}});;
jsLoader.loaded('{pixelpost.lego}PixelPost.Lego');


/***
 * И этот JS-builder написан тоже мной (RubaXa <trash@rubaxa.org>)
 * с использованием http://dean.edwards.name/packer/ 
 * всем приятного дня!
 */


