// (c)adxon.com
// <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

_[102]={
	$:function(d){
		var b=document.body;
		_.Attach(b,'onclick',this,'_C');
		b=b.$;
		b.Goto=this._G;
		window.onresize=this._P;
		this._P();
		d=d.contentWindow.document;
		d.open('text/html; charset=utf-8','replace');
		d.write('<!doctype html><html><head><link rel=stylesheet href=/css/ctrl.css type=text/css><link rel=stylesheet href=/css/app.css type=text/css><link rel=stylesheet href=/css/ type=text/css><style>html{overflow-x:hidden;overflow-y:scroll}</style></head><body id=frame></body></html>');
		d.close();
		_.Try(this,'_A');
		d=location.href.replace(/%23/,'#').split('#');
		this._ax=d.shift();
		this._an=this._ax.length;
		b.ref=d.join('#');
		b.Sign(1);
	},
	_A:function(x){_.Attach(document.body.firstChild.contentWindow.document.body,'onclick',this,'_C');},
	_C:function(d,e){
		var b,x;
		d=e.target;
		while(d){
			switch(d.tagName){
			case 'A':
				if(d.target=='_top')return true;
				e=d.href;
				if(e.substr(0,this._an)==this._ax){
					e=e.substr(this._an);
					b=document.body;
					if(e.charAt(0)=='#'){
						if((d=e.indexOf('('))>0){
							x=e.substring(d+1,e.length-1);
							e=e.substring(1,d);
							_.Exe(e,x);
						}
						else b.$.Goto(e);
					}
					else{
						if(e)b.$.Goto('/'+e);
						else return true;
					}
					return false;
				}
				else{
					d.target='_blank';
					return true;
				}
				break;
			}
			d=d.parentNode;
		}
		return true;
	},
	_E:function(x){
		var b=document.body,o;
		o=b.firstChild;
		o.style.display='block';
		if(!(o=o.contentWindow.document.body)){
			o=this;
			setTimeout(function(){o._E(x)},100);
			return;
		}
		o.style.visibility='hidden';
		_.$$(o);
		o.innerHTML=x[1];
		o.parentNode.scrollTop=0;
		o.scrollTop=0;
		o.style.visibility='visible';
		b=b.$;
		b.Attrs(o.firstChild);
		b.Footer(o);
		location.replace('#'+b.src);
		_.Msg();
		try{
			if(!_.$(o)){
				o.$={}
				o.$.$$=_(o);
			}
		}
		catch(e){
			o.style.visibility='visible';
			_.Msg(e);
		}
	},
	_F:function(x){
		var b;
		switch(x.status){
		case 200:
			if(x=x.responseText){
				if(b=x.match(/<body[^>]*>([\s\S]*)<\/body>/)){
					if(x=x.match(/<title[^>]*>([\s\S]*)<\/title>/))document.title=x[1];
					this._E(b);
				}
				else _.Msg('Error page format.',1);
				break;
			}
			break;
		case 204:
			if(_.Exe(x.statusText.split('; ')[1]))_.Msg();
			break;
		default:
			_.Msg(x.status+' '+x.statusText,2);
		}
	},
	_G:function(x){	//Goto
		if(x.charAt(0)=='#'){
			var u=location.href.replace(/%23/,'#').split('#');
			x=x.split('#');
			location.replace(u[0]+'#'+u[1]+'#'+x[1]);
		}
		else{
			this.ref=this.src;
			x=x.replace(/%23/,'#');
			this.src=x;
			x=x.split('#')[0];
			if(x){
				_.Msg('Loading...');
				_.xmlhttp.Flush(x,document.body.firstChild.$,'_F');
			}
		}
	},
	_P:function(){
		var d=document.body.firstChild
		return d.$._S(d.nextSibling);
	},
	_Q:function(){
		return this._S(document.body.firstChild.contentWindow.document.body.firstChild);
	},
	_R:function(){
		var b=document.body;
		b.$.Try(b.firstChild.$,'_Q');
		return true;
	},
	_S:function(d){
		var w,x;
		w=d.firstChild;
		x=w.offsetLeft;
		while(w=w.offsetParent)x+=w.offsetLeft;
		w=d.clientWidth;
		document.getElementById('top').style.left=x+'px';
		return;
		if(w>c.maxw)w=c.maxw;
		if(w!=c._w){
			c._w=w;
//			s=c._s;
//			c._S(document,'.pw','width',w-120);
//			c._S(b.firstChild.contentWindow.document,'.bw','width',w-s-60);
		}
	},
	_T:function(d,x,w){
		var c,i,t;
		t=d.styleSheets;
		t=t[t.length-1][document.all?'rules':'cssRules'];
		for(i=t.length;i;){
			c=t[--i];
			switch(c.selectorText){
			case '#page':
				break;
			case '.x':
				c.style.left=x;
				break;
			}
		}
	}
}
_[1001]={
	$:function(d,i){
		var a=d.ownerDocument;
		Menu=this._M;
		Message=this._G;
		Exec=this._X;
		Nav=this._S;
		Undo=this._U;
		_.Attc(a.getElementById('cont'),'onload',this._C);
		_.Attc(a.getElementById('nav'),'onload',this._D);
		a=location.href.split('#');
		if(!a[1])a[1]='/popular/';
		cont.location.replace(a.join(''));
	},
	_C:function(){
		_[100]._K()
		var d=cont.document,i,k,s=d.getElementsByTagName('META'),t=d.title;
		document.title=t?t:'Adxon';
		for(i=s.length-1;i>=0;){
			k=s[i--]
			switch(k.name){
			case 'menu':
				Menu(k.content)
				break;
			case 'nav':
				Nav(k.content);
				break;
			}
		}
		var s=d.location.href
		if(s=='about:blank')return;
		if(s)location.replace('#'+s.split('/').slice(3).join('/'))
		_(d.documentElement)
	},
	_D:function(){
		_[100]._K()
		_(nav.document.documentElement)
	},
	_K:function(){
	},
	_G:function(x,u){
		var o=document.getElementById('msge');
		o.style.visibility='visible';
		o.innerHTML=x?x:'';
	},
	_M:function(x){
		var o=document.getElementById('menu');
		o.innerHTML=x;
		_(o);
	},
	_S:function(x){
		var c=this._c[0],d=nav.document.body;
		nav.location.replace(c?c+'/'+x:'guest/nav.html');
		if(d.$){d.$.$(d,0);}
	},
	_U:function(x){
	},
	_X:function(x){
		if(cont.Exec)return cont.Exec(x)
		var d=cont.document.body
		if(d.$)d.$.Exec(d,x)
	}
}
_[246]={	//Backend
	$:function(d){
		var o=document.body.$;
		o.Toolbar();
		o.Menu('<a href="/" class=c3>Home</a> <a href="/settings/" class=c3>Settings</a> <a href="/tools/" class=c3>Tools</a>');
		this.$$=_(d);
	}
}

var b=document.body;
if(!top._.$(b)){
	b.$={};
	b.$.$$=top._(b);
}