var I={w:window,d:document,l:window.location,
		C:{},CN:{},
		SC:function(){return self.pageYOffset || (I.d.documentElement && I.d.documentElement.scrollTop) || (I.d.body &&I.d.body.scrollTop)},
		CS:function(){return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;},
		A:{
			C:{},
			A:function (){var X;try{X = new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try {X = new ActiveXObject("Microsoft.XMLHTTP");}catch(E){X = !1;}};if (!X && typeof XMLHttpRequest!='undefined'){X = new XMLHttpRequest();};return X;},
			M:function (c, t, p){
				if(!I.A.C){
					alert('Дождитесь окончания загрузки страницы!');
					return;
				}
				var AA=new Array(),n=0;
				for(var Q in p){AA[n]=Q+'='+encodeURIComponent(p[Q]);++n;}
				var q=AA.join('&');
				var u='/ajx';
				if(I.A.C[q]&&!t){
					I.A.RA=I.A.C[q];
					c();
					return;
				}else{
					var m=I.A.A();
					m.open("POST", u, true);
					m.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					m.onreadystatechange = function(){
						if (m.readyState != 4) return;
						if (m.status==200){
							I.A.R=m.responseText;
							I.A.C[q]=I.A.RA=I.A.R.split('@@');
							if(I.A.RA[2])
								eval(I.A.RA[2]);
							c();
						}
					};
					
					m.send(q);
					/*var timeout = setTimeout( function(){ m.abort(); alert("Time over") }, 10000);*/
				}
			}
		},
		EV:function (e,y) {var e = e || I.w.event;var T = e.target || e.srcElement;if (T.nodeType == 3){T = T.parentNode;};return y?Array(e,T):T;},
		P:function (E){if(typeof E !='object')var E = I.$(E);var w = E.offsetWidth;var h = E.offsetHeight;var l = 0;var t = 0;while (E){l += E.offsetLeft;t += E.offsetTop;E = E.offsetParent;}return {"l":l, "t":t, "w": w, "h":h};},
		TR:function(S,C){C = !C ? ' \s\xA0' : C.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '\$1');var R = new RegExp('^[' + C + ']+|[' + C + ']+$', 'g');return S.replace(R, '');},
		ISOB:function(E){return typeof E !='object'?I.$(E):E;},
		PI:function(I){return parseInt(I.replace(/[^\d]+/g,''));},
		AC:function(A){var K, C = 0;for (K in A){C++;};return C;},
		ST:function(S){return S.replace(/<\/?[^>]+>/gi, '');},
		SH:{
			C:{},
			SH:function (E){E = I.ISOB(E);E.style.display=E.style.display!='none'?'none':'block';},
			S:function (E){E = I.ISOB(E);E.style.display='block';},
			H:function (E){E = I.ISOB(E);E.style.display='none';},
			/*M:function(E){
				I.SH.E = I.ISOB(E);
				I.SH.C[I.SH.E.id]=!I.SH.C[I.SH.E.id]?I.SH.E.offsetHeight:I.SH.C[I.SH.E.id];
				I.SH.E.style.overflow='hidden';
				if(I.SH.E.style.display!='none'){
					I.SH.N=I.SH.C[I.SH.E.id];
					I.SH.I=setInterval('I.SH.D()', 10);
				}
				if(I.SH.E.style.display=='none'){
					I.SH.E.style.display='block';
					I.SH.N=0;
					I.SH.I=setInterval('I.SH.F()', 10); 
				}
			},
			D:function(){
				if(I.SH.N<=0){
					clearInterval(I.SH.I);
					I.SH.E.style.display='none';
				}
				I.SH.N=I.SH.E.style.height=I.SH.E.offsetHeight-10;
			},
			F:function(){
				if(I.SH.N>=I.SH.C[I.SH.E.id]){
					clearInterval(I.SH.I);
				}
				I.SH.N=I.SH.E.style.height=I.SH.E.offsetHeight+10;
			},*/
			AD:{
				A:function(x){
					I.SH.AD.O = (I.MS.style.opacity)?parseFloat(I.MS.style.opacity):I.PI(I.MS.style.filter)/100;
					if(I.SH.AD.O < x) {
						clearTimeout(I.SH.AD.T2);
						I.SH.AD.O += 0.05;
						I.MS.style.opacity = I.SH.AD.O;
						I.MS.style.filter='alpha(opacity='+I.SH.AD.O*100+')';
						I.SH.AD.T=setTimeout('I.SH.AD.A('+x+')',30);
					}
				},
				D:function(x){
					I.SH.AD.O = (I.MS.style.opacity)?parseFloat(I.MS.style.opacity):I.PI(I.MS.style.filter)/100;
					if(I.SH.AD.O <= x ){I.SH.H(I.MS)};
					if(I.SH.AD.O > x) {
						clearTimeout(I.SH.AD.T2);
						I.SH.AD.O -= 0.05;
						I.MS.style.opacity = I.SH.AD.O;
						I.MS.style.filter='alpha(opacity='+I.SH.AD.O*100+')';
						I.SH.AD.T2=setTimeout('I.SH.AD.D('+x+')',30);
					}
				}
			}
		},
		$:function(E,T){
			return I.C[E]=T==1?(I.d.getElementById(E)):(I.C[E]?I.C[E]:I.d.getElementById(E));
		},
		T:function(e){
			I.TT=I.EV(e).value.split(',');
			var P={};
			P['tags']=I.TT[I.AC(I.TT)-1];
			if(!P.tags)
				return;
			I.A.M(I.CBT,0,P);
		},
		TC:function(E){
			I.TT[I.AC(I.TT)-1]=I.ST(I.EV(E).innerHTML)+',';
			I.$('tags').value=I.TT.join(',');
			I.$('tags').focus();
		},
		TO:function(E){
			I.EV(E).className='oh';
		},
		TU:function(E){
			I.EV(E).className='';
		},
		CBT:function(){
			I.TS=1;
			if(I.A.RA[1]!='<ol></ol>'){
				I.$('o').innerHTML=I.A.RA[1];
				I.SH.S(I.$('o'));
				I.$('o').firstChild.onclick=I.TC;
				var l=I.$('o').firstChild.childNodes.length;
				for(i=0;i<l;++i){
					I.$('o').firstChild.childNodes[i].onmouseover=I.TO;
					I.$('o').firstChild.childNodes[i].onmouseout=I.TU;
				}
			}else{
				I.SH.H(I.$('o'));
			}
		},
		RL:function(){
			var i=I.CE('IMG',{src:'/captcha.png?'+Math.floor(Math.random()*9999999)});
			I.$('cha').replaceChild(i,I.$('cha').firstChild);
		},
		V:function(E){
			var P={},t=E.parentNode.parentNode.parentNode.id;
			P['vo']=E.id;
			P['id']=I.PI(t);
			if(t.substring(0,1)=='c'){
				P['c']=1;
			}
			I.A.M(I.CBV,1,P);
		}/*,GC:function(id,p){
			var P={};
			P['gc']=id;
			if(p){
				P['page']=p;
			}
			I.A.M(I.CGC,1,P);
		}*/,CBV:function(){
			I.SM(I.A.RA[0],I.A.RA[1]);
		}/*,CGC:function(){
			alert(I.A.RA[1]);
		}*/,
		SM:function(t,e){
			I.MS.className=t;
			I.MS.innerHTML=e;
			I.MS.style.top=I.SC()+'px';
			I.MS.style.left=I.CS()-400+'px';
			I.SH.S(I.MS);
			I.SH.AD.A(1);
			I.SH.AD.TU=setTimeout('I.HM()',3000);
		},
		HM:function(){
			I.SH.AD.D(0);
			clearTimeout(I.SH.AD.TU);
		},
		SCOM:function(o){
			var P={};
			P['pc']=I.PI(o.parentNode.parentNode.parentNode.id);
			P['t']=o.previousSibling.previousSibling.value;
			if(P['t']){
				I.C['acb']=o;
				I.B(true,'Добавляю','l');
				I.A.M(I.PCR,1,P);
			}else{
				I.SM('err','Текст комментария не может быть пустым');
			}
		},
		PCR:function(){
			I.B(false,'Добавить','');
			I.C['acb'].previousSibling.previousSibling.value='';
		},
		CE:function(N,O){
			var E=I.d.createElement(N);
			for(var i in O){
				if(i=='style'){
					for(var j in O[i]){
						E.style[j]=O[i][j];
					}
				}else{
					E[i]=O[i];
				}
			}
			return E;
		},
		S:function(F){
			var E=0, M=[];
			if(F.post.value==''){
				M[0]='Ваше мнение не может быть пустым';
				E=1;
			}
			if(F.tags.value==''){
				M[E==1?1:0]='Укажите хотя бы один тэг';
				E=1;
			}
			if(E==1){
				I.SM('err', M.join('<br>'));
				return false;
			};
			I.C['acb']=F.lastChild;
			I.B(true,'Добавляю','l');
			return true;
		},
		/*Q:function(W,Q){
			var T=I.$('ct');
			T.value+=Q
			?'<quote to="'+Q+'">'+W.innerHTML
			.replace(/\<a href="#c(\d+)" class="s"\>#.\<\/a\>/img,'<reply to="$1">')
			.replace(/\<fieldset\>\<legend\>\<a href="\/ip\/p\/(\d+)#c(\d+)"\>#.\<\/a\>\<\/legend\>/img,'<quote to="$2">')
			.replace(/\<\/fieldset\>/img,'</quote>')
			.replace(/\<br\>/img,'\r\n')+'</quote>'
			:'<reply to="'+W+'">\r\n';
			T.focus();
			T.scrollTop = T.scrollHeight;
			return false;
		},*/
		F:function(F){
			var P={};
			if(F.email){P['e']=F.email.value;}
			if(F.to){P['t']=F.to.value;}
			P['m']=F.post.value;
			I.C['acb']=F.lastChild;
			I.B(true,'Отправляю','l');
			I.A.M(I.FB,1,P);
			return false;
		},
		FB:function(){
			I.B(false,'Отправить','');
			I.C['acb'].previousSibling.previousSibling.value='';
		},
		NU:function(A){
			if(!I.CN[A.name]){I.CN[A.name]=A.value;}
			if(A.name=='pass'&&A.type=='text'){I.CT(A,'password');}
			A.value=I.CN[A.name]==A.value?'':A.value;
		},
		UN:function(A){
			if(A.name=='pass'&&A.type=='password'&&A.value==''){A=I.CT(A,'text');}
			A.value=A.value==''?I.CN[A.name]:A.value;
		},
		B:function(D,V,C){
			I.C['acb'].disabled=D;
			I.C['acb'].value=V;
			I.C['acb'].className=C;
			return;
		},
		CT:function(A,T){
			var Z=I.CE('INPUT',{name:A.name,type:T,className:A.className,onfocus:A.onfocus,onblur:A.onblur});
			A.parentNode.replaceChild(Z,A);
			if(T=='password'){Z.focus();Z.select();}
			return Z;
		},
		PK:function(){
			var K=1024, ko=960, t=I.$('post'), l;
			t.onkeyup=function(){
				l=t.value.length;
				if(l>=ko && l<K){
					t.style.background='#ffc';
				}else if(l>=K){
					t.value=t.value.substring(0,K);
					t.style.background='#fc9';
					t.focus();
					t.scrollTop = t.scrollHeight;
				}else if(l<ko){
					t.style.background='#fff';
				};
				I.$('cp').innerHTML=K-l;
			}
		},
		FLW:function(O,M,F){
			I.C['acb']=O;
			I.B(true,'Работаю','l');
			if(F=='fc'){
				I.A.M(I.N,1,{'fc':M});
			}else{
				I.A.M(I.N,1,{'fi':M});
			}
			
		},
		N:function(){
			
		}
	};
	if(I.$('tags')){
		I.$('tags').onkeyup=I.T;
	};
	if(I.$('post')){
		I.PK();
	};
	if(I.$('rl')){
		I.$('rl').onclick=I.RL;
	};
	I.$('x').onclick=x;
	I.$('x').previousSibling.onkeypress=function(D){
		D=D||window.event;
		if(D.keyCode==13){
			x();
		}
	};
	function x(){
		var s=I.$('x').previousSibling.value;
		if(!s){
			I.SM('err','Поле не может быть пустым');
			return;
		};
		window.location='/'+s;
	}
	I.d.onclick=function(E){
		E = I.EV(E);
		if(I.PRMU){
			I.SH.H(I.PRMU);
			delete(I.PRMU);
		}
		if(E.id=='plus' || E.id=='min'){
			I.V(E);
		}
		if(E.id=='prof'||E.parentNode.id=='prof'){
			I.PRMU=E.id=='prof'?E.nextSibling:E.parentNode.nextSibling;
			I.SH.S(I.PRMU);
			return !1;
		}
		/*if(E.id=='com'){
			var d=E.parentNode.parentNode;
			id=I.PI(d.id);
			if(d.lastChild.id=='com'+id){
				I.SH.M(d.lastChild);
			}else{I.GC(id);}
		}*/
		if(I.TS){
			I.SH.H(I.$('o'));I.TS=0;
		}
	};
	/*I.w.onload=function(){*/
		I.MS=I.CE('DIV',{id:'ms',style:{opacity:0,filter:'alpha(opacity=0)'}});
		I.d.body.appendChild(I.MS);
		if(I.l.hash && I.l.pathname=='/ip/m'){
			w=I.l.hash.replace('#','');
			I.A.M(mc,1,{'um':w});
		}
	/*};*/