function _cpage(t, l, m, lg, lo, mo) {
	this.tittle = t;
	this.leftd = l;
	this.main = m;
	this.data = null;
	this.lobj = lo;
	this.mobj = mo;
	this.lgd = 'en';
	this.lg = (lg) ? lg : this.lgd;
	this.jstittle;
	this.js;
	this.changed = {};
	this.hasjs = function(t) {return (document.ALPAS.pages[t][3]) ? document.ALPAS.pages[t][3] : false;};
	this.setxt = function() {
		if(this.changed.l) this.lobj.innerHTML = this.leftd;
		if(this.changed.c) this.mobj.innerHTML = this.main;
		this.changed = {};
	};
	this.getxt = function(p) {
		if(p.l) {this.leftd = p.l;this.changed.l = 1;}
		if(p.c) {this.main = p.c;this.changed.c = 1;}
		if(p.d) this.data = p.d;
	};
	this.reset = function() {this.loaded = {'l':0, 'c':0, 'd':0};};
	this.setload = function(l, v) {this.loaded[l] = v;};

	this.reset();
}

function _cdoc(p, l, m, lg) {
	var PAGE, temtxt = {}, nodat = "";
	document.CPAS = new Array();
	document.CJS = new Array();
	PAGE = new _cpage(p, document.ALPAS.loadtxt[lg], document.ALPAS.loadtxt[lg], lg, getOBJ(l), getOBJ(m));

	this.init = function(t, l) {
		if(t) PAGE.tittle = t;
		window.setpage = this.setpage;
		window.loadpage = this.loadpage;
		window.setjs = this.setjs;
		if(!t && l) {
			this.setlang(l);
			this.setloading(this.setlotxt(PAGE.tittle));
		}
		this.setheader();
		this.setpage(PAGE.tittle, 1);
	};
	
	this.setlotxt = function(t) {
		var ttex = {}, y = document.ALPAS.pages[t][4];
		if(!y) return null;
		for(var x in y) if((x=='l' || x=='c') && y[x]=='l') ttex[x] = 1;
		return ttex;
	}	
		
	this.setpage = function(t, l) {
		if(!document.CPAS[t]) document.CPAS[t] = {'c':{}};
		if(!document.CPAS[t][PAGE.lg]) document.CPAS[t][PAGE.lg] = {};
		var fsrc, x, y = document.ALPAS.pages[t][4];
		for(x in y) {
			PAGE.setload(x, ((y[x]=='l') ? PAGE.lg : 'c'))
			if(!document.CPAS[t][PAGE.loaded[x]][x] && !nodat) {
				fsrc = (document.ALPAS.pages[t][2][x]=='js') ? document.ALPAS.js.path + PAGE.loaded[x] + "/" + x + "/" + t + ".js" : document.ALPAS.php.path + document.ALPAS.php.file + "?p=" + t + ':l=' + PAGE.lg;
				loads(fsrc, document.ALPAS.js.jsid[x]);
				window.loadpage(t, x, PAGE.loaded[x], l);
				return;
			} else if(!l || !(!t && PAGE.loaded[x]=='c')) temtxt[x] = document.CPAS[t][PAGE.loaded[x]][x];
		}
		PAGE.getxt(temtxt);
		PAGE.setxt();
		window.setpage = window.loadpage = null;
		PAGE.reset();
		temtxt = {};
		PAGE.jstittle = PAGE.hasjs(t);
		if(PAGE.jstittle && !nodat) {
			if(document.CJS[PAGE.jstittle]) {
				PAGE.js = document.CJS[PAGE.jstittle];
				PAGE.js.init(PAGE.data, PAGE.lg, PAGE.tittle);
				window.setrest();/////////////////////1////////////////
			} else {
				loads(document.ALPAS.js.path + 'j/' + PAGE.jstittle + ".js", document.ALPAS.js.jsid.j);
				window.setjs(t);
			}
		} else {
			nodat = '';
			window.setrest();/////////////////////2////////////////
		}
	};
		
	this.loadpage = function(t, x, a, l) {
		if(window[t] || (window.stimer && window.stimer==500)) {
			window.stimer = null;
			if(window[t]) {
				temtxt[x] = document.CPAS[t][a][x] = window[t]();
				window[t] = null;
			} else if(x!='d') temtxt[x] = document.CPAS[t][a][x] = document.ALPAS.uc[PAGE.lg];
			else alert(nodat=document.ALPAS.nd[PAGE.lg]);
			window.setpage(t, l);
		} else {
			if(!window.stimer) window.stimer = 0;
			window.stimer++;
			setTimeout(function() {window.loadpage(t, x, a, l)}, 10);
		}
	};
		
	this.setjs = function(t) {
		if(window[PAGE.jstittle] || (window.stimer && window.stimer==500)) {
			window.setjs = window.stimer = null;
			if(window[PAGE.jstittle]) {
			PAGE.js = document.CJS[PAGE.jstittle] = eval("new " + PAGE.jstittle + "()");
			PAGE.js.init(PAGE.data, PAGE.lg, PAGE.tittle);
			window[PAGE.jstittle] = null;
			window.setrest();/////////////////////3////////////////
			} else alert(document.ALPAS.nd[PAGE.lg]);
		} else {
			if(!window.stimer) window.stimer = 0;
			window.stimer++;
			setTimeout(function() {window.setjs(t)}, 10);
		}
	};
	
	this.stopjs = function() {PAGE.js.clean();};
	
	this.hasjs = function(t) {return PAGE.hasjs(t);};
	
	this.setloading = function(w) {
		PAGE.getxt({'l':((!w || w.l) ? document.ALPAS.loadtxt[PAGE.lg] : null), 'c':((!w || w.c) ? document.ALPAS.loadtxt[PAGE.lg] : null)});
		PAGE.setxt();
	};
	
	this.getlang = function() {return PAGE.lg;};
	
	this.setlang = function(l) {PAGE.lg = (l) ? l : PAGE.lgd;};
	
	this.getittle = function() {return PAGE.tittle;};
	
	this.setheader = function() {getOBJ(document.ALPAS.contentds.lhead).innerHTML = document.ALPAS.pages[PAGE.tittle][0][PAGE.lg] + "<span class='ov'>" + document.ALPAS.pages[PAGE.tittle][0][PAGE.lg] + "</span>";};
	
	this.getheader = function(ti) {return (ti) ? document.ALPAS.pages[ti][0][PAGE.lg] : document.ALPAS.pages[PAGE.tittle][0][PAGE.lg];};
	
	this.getlimg = function(ti) {return document.ALPAS.pages[ti][1];};
	
	PAGE.setxt();
}

