var iD = FetchNumber();

var gDebug = 0;

//-A-p-p-l-i-c-a-t-i-o-n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

var app = {

	black:0,
	newZ:250,
	cbInput:'',multiInput:'',v:'',vv:'',
	clipboard:'',
	submit:'',
	form:'',
	amx:0,amy:0, mx:0,my:0, sw:1024,sh:768,	state: 0, opaq: '',

	kUp: new Array(0,0,0,0),	kDown: new Array(0,0,0,0),

	pointed:'', down:'', dragged:new Array('',''),	dx:0,dy:0,


	menu:{oid:'',edge:''},
	menu2:{oid:'',edge:''},

	down:{oid:'',edge:'',area:'',op:'',mx:0,my:0},
	buffer:{oid:'',edge:'',area:'',op:''},
	

	ex:new Array(0,0,0,0),

	GetZ:function()			{this.newZ += 50;	return this.newZ;},



clearDown:function()	{		this.down.mod = '';
	this.down.oid = '';		this.down.edge = '';
	this.down.op = '';		this.down.area = '';
	this.down.mx = 0;		this.down.my = 0;	},


setPointed:function(v)
	{this.pointed = v;},


clearPointed:function()	{
if(this.pointed)	{		var o = byId(this.pointed);
	if(o.timer)	{		clearInterval(o.timer);		o.timer = undefined;	}	}

	this.pointed = '';	},


setDown:function(v)
	{this.down = v;},

clearDown:function()
	{this.down = '';},


Key1:function(key)	{
	if(this.kDown[0]==key)	return 1;		return 0;	},

Key2:function(key)	{
	if(this.kDown[0]==(key&0xff))
		if(this.kDown[1]==((key>>8)&0xff))
			return 1;			return 0;	},

Key3:function(key)	{
	if(this.kDown[0]==(key&0xff))
		if(this.kDown[1]==((key>>8)&0xff))
			if(this.kDown[2]==((key>>16)&0xff))
				return 1;		return 0;	},

KeyClear:function()	{
	this.kDown[0] = 0;	this.kDown[1] = 0;	this.kDown[2] = 0;	this.kDown[3] = 0;	},



Action:function(v,e)	{	if(v==undefined)	v = '';

	switch(v)	{
	case 'mousedown':	{	var o;

					this.down.mx = app.mx;		app.down.my = app.my;

					o = parentByAttr(this.pointed, '_drag');
		if(o!=null)	{	var d = o.getAttribute('_drag');				this.dragged[0] = 'drag';
				if(d)	this.dragged[1] = d;	else	this.dragged[1] = o.id;		var a = elemPos(this.dragged[1]);
					this.dx = this.mx - a[0];	this.dy = this.my - a[1];	return false;	}

//					o = parentByAttr(this.pointed, '_resize');
//		if(o!=null)	{	var d = o.getAttribute('_resize');				this.dragged[0] = 'resize';
//				if(d)	this.dragged[1] = d;	else	this.dragged[1] = o.id;		this.ex = elemPos(this.dragged[1]);
//					this.dx = this.mx;		this.dy = this.my;		return false;	}

//					o = parentByAttr(this.pointed, '_rmenu');
					o = byId(this.pointed);
		if(o!=null)	{	this.menu = xExplode(';', o.getAttribute('_rmenu'));		if(this.menu.oid!=undefined)	timer.timeout('menu', 'oMenu(0)', 400);
					return false;	}

		return true;

		break;	}


	case 'mousemove':	{	this.amx = e.clientX;		this.amy = e.clientY;

		this.mx = this.amx + document.documentElement.scrollLeft;
		this.my = this.amy + document.documentElement.scrollTop;


//	if(this.pointed)	{	var o = byId(this.pointed);	if(o)	{
//		var v = o.getAttribute('_autoscroll');
//		if(v!=null)	{	document.title = o.offsetY;	uiScroll(o, e.offsetX-o.scrollLeft,e.offsetY-o.scrollTop);	}	}	}


		switch(this.dragged[0])	{
		case 'drag':	{						var o = byId(this.dragged[1]);
			if(o.style.position!='absolute')	{		o.style.width = o.clientWidth+'px';			o.style.position = 'absolute';	}
			o.style.left = (this.amx-this.dx) + 'px';		o.style.top = (this.amy-this.dy) + 'px';		break;	}

		case 'resize':	{						var o = byId(this.dragged[1]);
			o.style.width = (this.mx - this.dx + this.ex[2])+'px';	o.style.height = (this.my - this.dy + this.ex[3])+'px';

			break;	}

		}


		break;	}


	case 'mouseup':	{		this.dragged[0] = '';

					var o = parentByAttr(this.dragged[1], '_win');
		if(o)	{		fixWinPos(o.getAttribute('_win'));	}

//					o = parentByAttr(this.pointed, '_rmenu');
					o = byId(this.pointed);
		if(o!=null)	{	this.menu2 = xExplode(';', o.getAttribute('_rmenu'));
					if(this.menu.oid!=this.menu2.oid)	if(this.menu2.oid!=undefined)	oMenu(1);
					this.menu2.oid = '';			this.menu2.edge = '';	}


		oMenuClear();


		return true;	}


	case 'keydown':

		for(var i=3; i>0; i--)			this.kDown[i] = this.kDown[i-1];	this.kDown[0] = e.keyCode;

		if(this.Key3(0x111111))	{
//			winRQ('?route=route;test_conductor', 'explore', 866,560);
			winRQ('?route=route;login_who','speakup', '','','','', 1);		this.KeyClear();	}	break;

	case 'keyup':		for(var i=3; i>0; i--)			this.kUp[i] = this.kUp[i-1];	this.kUp[0] = e.keyCode;

		if(this.Key1(0xc0))	{		var xConsoleI = document.getElementById('console_input');
		if(xConsoleI)	{			if(ToggleDisplay('console'))		xConsoleI.focus();		setOpacity('console',0.75);	}	}

		break;

	}

	return true;	}



}

//-A-p-p-l-i-c-a-t-i-o-n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

//-T-i-m-e-r- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

var timer = {				time:{menu:Array(0,0), amor:Array(0,0)},


timeout:function(name,com,delay)	{			if(delay==undefined)	delay = 500;
	this.define(name);
	this.time[name][0] = setTimeout(com, delay);		setTimeout('timer.clear("'+ name +'")', delay+1);	},

interval:function(name,com,step,cancel)	{			if(step==undefined)	step = 100;
	this.define(name);
	this.time[name][1] = setInterval(com, step);		if(cancel!=undefined)	setTimeout('timer.clear("'+ name +'")', cancel+1);	},


define:function(name)	{		if(this.time[name]==undefined)			this.time[name] = new Array(0,0);	return;	},


clearT:function(name)	{		this.define(name);	if(this.time[name][0])	clearTimeout(this.time[name][0]);	this.time[name][0] = 0;	},
clearI:function(name)	{		this.define(name);	if(this.time[name][1])	clearInterval(this.time[name][1]);	this.time[name][1] = 0;	},

clear:function(name)	{		this.define(name);	this.clearI(name);	this.clearT(name);	},


checkT:function(name)	{		if(this.time[name])	return this.time[name][0]!=0;		return 0;	},
checkI:function(name)	{		if(this.time[name])	return this.time[name][1]!=0;		return 0;	}	}

//-T-i-m-e-r- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



var desc = {noId:'Не найден элемент формы...'};



var win = {dx:0,dy:0, bound:'', last:'', id:'', drag:'', pointed:'', head:''};


var iWin;


var aWin = new Array();			var retireWin = '';

var scroll = {name:'', over:''};


var amorT = new Array();



var aElem = new Array(0,0,0,0);
var aHide = new Array();


var time = {con:0};


var xTime = {};
var oOver = {mod:'',oid:'',edge:'',area:'',op:'',xarea:''};
//var oBuffer = {mod:'',oid:'',edge:'',area:'',op:''};


var keyCtrl	= 1;
var keyShift	= 2;





document.onkeyup	= function(aEvent) {return app.Action('keyup', aEvent ? aEvent : window.event);};
document.onkeydown	= function(aEvent) {return app.Action('keydown', aEvent ? aEvent : window.event);};

document.onmousemove	= function(aEvent) {return app.Action('mousemove', aEvent ? aEvent : window.event);};

document.onmouseup	= function(aEvent) {return app.Action('mouseup', aEvent ? aEvent : window.event);};
document.onmousedown	= function(aEvent) {return app.Action('mousedown', aEvent ? aEvent : window.event);};



//-F-u-n-d-a-m-e-n-t-a-l- - - - - - - - - - - - - - - - - -


function elemPos(o)	{					o = byId(o);
	if(o==undefined)					return new Array(0,0,0,0);

if(o.style.position=='absolute')
	if(o.offsetLeft!=0 && o.offsetTop!=0)			return new Array(o.offsetLeft, o.offsetTop, o.clientWidth, o.clientHeight);

	var x = 0,		y = 0,				w = o.clientWidth,	h = o.clientHeight;

while(o)	{						x += o.offsetLeft + o.clientLeft;
	y += o.offsetTop + o.clientTop;				o = o.offsetParent;
if(o)
	if(o.style.position=='absolute')	break;	}	return new Array(x,y,w,h);	}



function inAbsolute(o)	{	if(typeof(o)=='string')		o = document.getElementById(o);
	if(o==undefined)	return 0;			o = o.offsetParent;
while(o)	{
	if(o.style.position=='absolute')	return 1;	o = o.offsetParent;	}

	return 0;	}



function getOffset(parent,child)	{	var a = elemPos(parent);	var b = elemPos(child);
	var x = Array(0,0);			x[0] = b[0]-a[0];		x[1] = b[1]-a[1];

	return x;	}


//-F-u-n-d-a-m-e-n-t-a-l- - - - - - - - - - - - - - - - - -

//-U-I- -E-x-t-e-n-t-i-o-n- - - - - - - - - - - - - - - - -


function xBranch(o,buff)	{		o = byId(o);	if(o==null)	return buff;

	if(buff==undefined)			buff = new Array();		var c = o.childNodes.length;

for(var i=0; i<c; i++)				if(o.childNodes[i].tagName)	{
	buff.push(o.childNodes[i]);		xBranch(o.childNodes[i],buff);	}	}


function fetchBranch(o,zero)	{		var aBuff = new Array();
	o = byId(o);	if(zero!=undefined)	aBuff.push(o);
	xBranch(o,aBuff);			return aBuff;	}





function getAttr(o,attr)	{		o = byId(o);	if(o==null)	return null;
	return					o.getAttribute(attr);	}


function getParent(o,i)	{	o = byId(o);	if(o==null)			return;		if(i==undefined)	i = 1;
	for(var c=0; c<i; c++)	if(o.parentNode!=null)	o = o.parentNode;	else	break;	return o;	}


function parentByAttr(o,attr,val)	{	o = byId(o);
	if(o==null)				return null;			var v = o.getAttribute(attr);

	if(val==undefined)	{		if(v!=undefined)		return o;	}
	else					if(v==val)			return o;

for(var i=0; i<10; i++)	{			o = o.parentNode;
	if(o==null || o==document)		return null;			v = o.getAttribute(attr);

	if(val==undefined)	{		if(v!=undefined)		return o;	}
	else					if(v==val)			return o;

}	return null;	}


function getWindow(o)	{			return parentByAttr(o, '_win');	}


function childrenByAttr(o,attr,val)	{	o = byId(o);	if(o==null)	return null;

	var a = fetchBranch(o);			var aOut = Array();		var c = a.length;

for(var i=0; i<c; i++)	{			var v = a[i].getAttribute(attr);

	if(val==undefined)	{		if(v!=undefined)		aOut.push(a[i]);	}
	else					if(v==val)			aOut.push(a[i]);	}

	if(a.length==0)		return null;	return aOut;	}



function childByAttr(o,attr,val)	{	var a = childrenByAttr(o,attr,val);
	if(a==null)		return null;	return a[0];	}


function complexByAttr(o,parent_attr,parent_val,child_attr,child_val)	{	var o = parentByAttr(o,parent_attr,parent_val);
	if(o==null)				return null;			return childByAttr(o,child_attr,child_val);	}



function prevMark(o)	{	if(o==null)	return;

	var name = o.getAttribute('_content');	var a = childrenByAttr(o,'name', name);
	if(o._index==undefined)			o._index = 0;

	o._index--;		if(o._index<0)	o._index = 0;

	var x = getOffset(o,a[o._index]);	o.scrollLeft = x[0];	}


function nextMark(o)	{	if(o==null)	return;

	var name = o.getAttribute('_content');	var a = childrenByAttr(o,'name', name);
	if(o._index==undefined)			o._index = 0;

	o._index++;		if(o._index>=a.length)		o._index = a.length - 1;


	var x = getOffset(o,a[o._index]);	o.scrollLeft = x[0];	}



function releaseWin(o)	{
	var oWin = parentByAttr(o,'_win');	if(oWin==null)	return;

	var xWin = oWin.getAttribute('_win');	if(app.submit==xWin)		winClear(xWin);

	app.submit = '';	}



function markPoint(o)	{			var id = o.getAttribute('id');
	if(id==null)	{	id = uniqid();	o.setAttribute('id', id);	}

if(o._point==undefined)	{							o._point = 1;
	addEvent(o,'mouseover', function() {app.setPointed(id);} );		addEvent(o,'mouseout', function() {app.clearPointed();} );	}	}





function testMove(aEvent)	{

	var e = aEvent ? aEvent : window.event;

	var p = elemPos(this);

//	document.title = p;
//	document.title = '('+ this.clientWidth +' / '+ this.scrollWidth +')  ' + '('+ this.clientHeight +' : '+ this.scrollHeight +')';

	p[0] = app.mx - p[0];			p[1] = app.my - p[1];
	p[2] = 2*(p[0] / p[2]) - 1;		p[3] = 2*(p[1] / p[3]) - 1;

	uiScroll(this, Math.round(p[2]*20), Math.round(p[3]*20));

}


function clearMove()	{

//	document.title = this.timer +' : '+miliTime();

	clearInterval(this.timer);
	this.timer = undefined;

//	document.title = miliTime();

//	alert(this.tagName);

}



function procTag(o)	{	o = byId(o);	if(o==null)	return;
	if(o.tagName==undefined)				return;


	var c = o.attributes.length;

for(var i=0; i<c; i++)	{			var v = o.attributes[i].value;


	switch(o.attributes[i].name)	{
	case 'ui':	{
		markPoint(o);			break;	}	}


	if(o.attributes[i].name.charAt(0)!='_')					continue;	var name = o.attributes[i].name.substr(1);


	if(o.style[name]!=undefined)	{
		try	{			o.style[name] = eval(v);}	catch(e){	o.style[name] = v;	}


	}	else	switch(o.attributes[i].name)	{

	case '_dot':	{
		o.style.width = '0px';		o.style.height = '0px';
		o.style.position = 'absolute';	break;	}

	case '_alert':	{
		alert(v);	alert(eval(v));	break;	}

	case '_autoscroll':
	if(o.autoscroll==undefined)	{			o.autoscroll = 1;
		o.style.overflow = 'hidden';
		addEvent(o,'mousemove', testMove);              addEvent(o,'mouseout', clearMove);	}		break;

	case '_w':	{
		o.width = eval(v);		break;	}
	case '_h':	{
		o.height = eval(v);		break;	}	}


}	}





function walkTag(o)	{			var t = miliTime();
	var a = fetchBranch(o,1);		var c = a.length;

	for(var i=0; i<c; i++)			procTag(a[i]);
if(gDebug)
	document.title = a.length +' nodes in '+ ((miliTime()-t)/1000) +' ms';	}


function walkTags()	{			walkTag('somebody');	}





function runtimeScroll(o)	{		o = byId(o);		if(o==null)	return;

	var p = Array(o.scrollX,o.scrollY, o.scrollLeft,o.scrollTop);

	p[2] += p[0];		if(p[2]<0)	p[2] = 0;	else	if(p[2]>o.scrollWidth)	p[2] = o.scrollWidth;
	p[3] += p[1];		if(p[3]<0)	p[3] = 0;	else	if(p[3]>o.scrollHeight)	p[3] = o.scrollHeight;

	o.scrollLeft = p[2];			o.scrollTop = p[3];	}



function uiScroll(o,x,y)	{		o = byId(o);
	if(o==null)		return;		markNode(o);

	if(o.timer==undefined)			o.timer = setInterval('runtimeScroll(\''+ o.id +'\')', 40);
	o.scrollX = x;				o.scrollY = y;	}


//-U-I- -E-x-t-e-n-t-i-o-n- - - - - - - - - - - - - - - - -

//-F-u-n-d-a-m-e-n-t-a-l- - - - - - - - - - - - - - - - - -


function getElementsByAttr(attr,val)	{	var elem = document.getElementsByTagName('*'),	aOut = new Array();

for(i=0, iArr=0; i<elem.length; i++)	{	att = elem[i].getAttribute(attr);
	if(att==null)				continue;

	if(val!=undefined)	{
	if(att==val)	{			aOut[iArr] = elem[i];		iArr++;	}	}
	else	{				aOut[iArr] = elem[i];		iArr++;	}	}

	return aOut;	}


function getElementsByTagAttr(tag,attr,val){	var elem = document.getElementsByTagName(tag),	aOut = new Array();

for(i=0, iArr=0; i<elem.length; i++)	{	att = elem[i].getAttribute(attr);
	if(att==val)	{			aOut[iArr] = elem[i];		iArr++;	}	}

	return aOut;	}



function xmlElements(node,tag,prop,pval){	var elem = node.getElementsByTagName(tag),	aOut = new Array();

	if(prop==undefined)	prop = '';	if(pval==undefined)		pval = '';

for(i=0, iArr=0; i<elem.length; i++)	{
	if(prop)	{			att = elem[i].getAttribute(prop);
		if(att!=pval)			continue;	}

	aOut[iArr] = elem[i];			iArr++;	}			return aOut;	}



function checkAcc($key)	{
	if(uAcc.indexOf('|duncan|')!=-1)	return 1;
	if($key=='')		return 1;	return uAcc.indexOf('|'+$key+'|')!=-1;	}



function dTime(id)	{
	if(id==undefined)			id = gen;
	if(xTime[id]==undefined)		xTime[id] = 0;

	var x =	new Date().getTime();		var xx = x - xTime[id];
	xTime[id] = x;				return xx;	}


function uniqid()	{	var s = 'u_'+iD;
	iD++;			return s;	}



function delayHide(id,delay)	{		if(delay==undefined)		delay = 500;
	if(aHide[id]!=undefined)		clearTimeout(aHide[id]);
	var s = "var o = byId('"+ id +"'); if(o) o.style.visibility='hidden'";
	aHide[id] = setTimeout(s,delay);	}

function Show(o)	{	o = byId(o);	if(o)	o.style.visibility = 'visible';	}
function Hide(o)	{	o = byId(o);	if(o)	o.style.visibility = 'hidden';	}

function ToggleVis(o)	{	o = byId(o);	if(o==null)			return;
if(o)	if(o.style.visibility=='hidden')
	o.style.visibility = 'visible';	else	o.style.visibility = 'hidden';	}

function ToggleDisplay(o){	o = byId(o);	if(o==null)			return 0;
if(o)	if(o.style.display=='none')	{
	o.style.display = 'block';		return 1;	}
else{	o.style.display = 'none';		return 0;	}		return 0;	}

function Style(o,v,vv)	{	o = byId(o);	if(!o)	return;			o.style[v] = vv;	}

function cancelHide(id)	{
	if(aHide[id]!=undefined)		clearTimeout(aHide[id]);
	var o = document.getElementById(id);	if(o)				o.style.visibility = 'visible';	}

function clearHide(id)	{			if(aHide[id]!=undefined)	clearTimeout(aHide[id]);	}



function setCookie(name,value,expires)	{	document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires : "");	}


function killCookie(name)	{
	var oDate = new Date();			oDate.setFullYear(oDate.getFullYear() - 1);
	document.cookie = name + "=; expires=" + oDate.toGMTString();	}


function getCookie(name)	{		var cookie = " " + document.cookie;
	var search = " " + name + "=";		var setStr = null;
	var offset = 0;				var end = 0;

if(cookie.length>0)	{			offset = cookie.indexOf(search);
	if(offset!=-1)	{
		offset += search.length;	end = cookie.indexOf(";", offset)
		if(end==-1)			end = cookie.length;

		setStr = unescape(cookie.substring(offset, end));	}

	}	return(setStr);	}



function appCopyText(s)	{	setCookie('clipboard', s);	}



function byId(o)	{	return typeof o == 'string' ? document.getElementById(o) : o;	}
function byName(o)	{	return typeof o == 'string' ? document.getElementsByName(o) : o;	}



function oMultiInput(input,oid)	{			var o = byId(input);	if(o==undefined)		return;
	if(oid==undefined)				oid = 'root';
	app.multiInput = input;	o.blur();		winRQ('?route=route;cms_oLevel;input;'+ o.id +';oid;'+ oid, 'multiInput');	}



function getInput(id)	{	id = byId(id);	if(id)	return id.value;	return '';	}

function buffInput(v,vv){	app.v = v;	if(vv==undefined)	vv = '';	app.vv = vv;	}

function passInput()	{	if(app.v=='')		return;
	var o = byId(app.multiInput);		if(o)	o.value = app.v;
	var oo = byId(app.multiInput+'x');	if(oo)	oo.value = app.vv;		winClear('multiInput');	}

function clearInput()	{
	var o = byId(app.multiInput);		if(o)	o.value = '';
	var oo = byId(app.multiInput+'x');	if(oo)	oo.value = '';			winClear('multiInput');	}

function setInput(id,val){	var o = byId(id);	if(o)	o.value = val;	var o = byId(id+'text');	if(o)	o.value = val;	}

function setName(id,val){	var o = byId(id);	if(o)	o.value = val;	var o = byId(id+'text');	if(o)	o.value = val;	}

function setTagVal(tag,name,val)	{		var a = getElementsByTagAttr(tag,'name', name);
	for(var i in a)					a[i].value = val;	}



function selectRow(o,v)	{	var xTD = o.getElementsByTagName('td');
for(var i=0; i<xTD.length; i++)	{
	if(v)			xTD[i].style.backgroundColor = '#dfdfdf';
	else			xTD[i].style.backgroundColor = '';	}	}



function Print()	{	window.print();	}
function Resign(from,to){	var dst = document.getElementById(to);
	if(dst)			dst.innerHTML = from.innerHTML;	}





var Base64 = {
 
	// private property
	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
 
	// public method for encoding
	encode : function (input) {
		var output = "";
		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
		var i = 0;
 
		input = Base64._utf8_encode(input);
 
		while (i < input.length) {
 
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);
 
			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;
 
			if (isNaN(chr2)) {
				enc3 = enc4 = 64;
			} else if (isNaN(chr3)) {
				enc4 = 64;
			}
 
			output = output +
			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
 
		}
 
		return output;
	},
 
	// public method for decoding
	decode : function (input) {
		var output = "";
		var chr1, chr2, chr3;
		var enc1, enc2, enc3, enc4;
		var i = 0;
 
		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
 
		while (i < input.length) {
 
			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));
 
			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;
 
			output = output + String.fromCharCode(chr1);
 
			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}
 
		}
 
		output = Base64._utf8_decode(output);
 
		return output;
 
	},
 
	// private method for UTF-8 encoding
	_utf8_encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	},
 
	// private method for UTF-8 decoding
	_utf8_decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
 
		}
 
		return string;
	}
 
}





function refreshImage(id,src,q)	{	var o = byId(id);
	if(q==undefined)	q = '?';	else	q = '&';
	if(o)			o.src = src+q+miliTime();	}

function xSetImage(id,src){	var o = byId(id);	if(o)		o.src = src;	}

function setImage(id,src){	var o = byId(id);
	if(o)		{	o.src = 'c/img/blank.gif';		setTimeout('xSetImage("'+ id +'","'+ src +'")', 1);	}	}


function setImageWH(id,src,w,h,anim)	{	var o = byId(id);	if(anim==undefined)	anim = 0;
	if(o==undefined)	return false;	o.src = 'c/img/blank.gif';			setTimeout('xSetImage("'+ id +'","'+ src +'")', 1);
if(anim)
	amorQuery(id, 'w,'+w+',h,'+h);
else{	o.width = w;		o.height = h;	}			return true;	}


function setCheck(id,v){	var o = byId(id);
	if(o)			o.checked = v;	}

function xorCheck(id,v){	var o = byId(id);
	if(o)	if(o.checked)	o.checked = 0;
		else		o.checked = 1;	}





function findNode(types,o)	{	if(types==undefined)		return;
	if(typeof(types)=='string')	types = explode(',', types);

	var c = o.childNodes.length;

for(var i=0; i<c; i++)	{

	for(var t in types)
		if(types[t]==o.childNodes[i].tagName)
			gNodes.push(o.childNodes[i]);

	if(o.childNodes[i].hasChildNodes)
		findNode(types, o.childNodes[i]);	}	}



	var gNodes = Array();

function fetchNodes(types,o)	{	types = types.toUpperCase();

	o = byId(o);	if(o==null)	return Array();
	gNodes = Array();		var aType = explode(',', types);

	findNode(aType, o);		return gNodes;	}



function xUnpackArray(s)	{	var a = {};

	var v = explode(';', s),	c = v.length;

for(var i=0; i<c; i+=3)	{		if(v[i]=='')			continue;

if(v[i+1]==1)	{			a[v[i]] = xUnpackArray(Base64.decode(v[i+2]));
	for(var j in a[v[i]])	{	var sName = v[i]+'$'+j;		a[sName] = a[v[i]][j];	}	}

else	a[v[i]] = Base64.decode(v[i+2]);	}			return a;	}



function findMatch(name,x)	{	if(typeof(name)!='string')	return false;

	var z = name.indexOf('$');	if(z==-1)	z = 0;
for(var i in x)
	if(typeof(x[i])=='string')	{
		if( name==i || name.indexOf('$'+i+'$')==z )		return x[i];	}

	return false;	}



function toInt(a)	{		if(typeof(a)!='object')		return parseInt(a);
for(var i in a)
	a[i] = parseInt(a[i]);		return a;	}



function selectStep(field,v,val)	{				var a = toInt(explode(';', v)),	s = '<select name="'+ field +'">';
for(var i=a[0]; i<=a[1]; i+=a[2])	{				s += '<option ';
	if(i==val)	s += ' selected ';				s += 'value="'+ i +'">'+ i +'</option>';

}	s += '</select>';						return s;	}



function selectStr(field,str,val)	{				var s = '<select name="'+ field +'">';
	var select = explode(';', str),					c = select.length & 0xfe;

for(var i=0; i<c; i+=2)	{						s += '<option ';
	if(select[i+1]==val)		s += ' selected ';		s += 'value="'+ select[i+1] +'">'+ select[i] +'</option>';

}	s += '</select>';						return s;	}



function gatherTime(from,to)	{

//	alert(from +' : '+ to);

	var a = fetchNodes('SELECT', from);

	var t = {day:1,month:1,year:2000, hour:0,minute:0,second:0};


//	alert(a.length);

for(var i in a)	{				var v = a[i].getAttribute('name');
switch(v)	{
case 'day':	case 'month':	case 'year':	case 'hour':	case 'minute':	case 'second':		t[v] = parseInt(a[i].value);	}	}



	var xOut = byId(to);

	var myDate = new Date(t.year,t.month-1,t.day, t.hour,t.minute,t.second);
	var xTime = myDate.getTime()/1000;

if(t.hour==0 && t.minute==0 && t.second==0)
	xOut.value = date('Y-m-d', xTime);	else		xOut.value = date('Y-m-d G:i:s', xTime);



//	alert(t.year+'.'+t.month+'.'+t.day+' '+t.hour+':'+t.minute+':'+t.second);

//	var xxx = strtotime( t.year+'.'+t.month+'.'+t.day+' '+t.hour+':'+t.minute+':'+t.second );

//	alert(xxx);


	winClear(from);

}




function datetimeInput(to,apply,time)	{				var t = getdate(time),		s = '';

	var s = '<table align="center" style="padding:10px"><tr><td><b>День</b></td><td colspan="2" align="center"><b>Месяц</b></td><td align="right"><b>Год</b></td></tr><tr><td align="center">'+ selectStep('day', '1;31;1', t['mday']) +'</td><td colspan="2" align="center">'+ selectStr('month', 'Январь;1;Февраль;2;Март;3;Апрель;4;Май;5;Июнь;6;Июль;7;Август;8;Сентябрь;9;Октябрь;10;Ноябрь;11;Декабрь;12', t['mon']) +'</td><td align="right">'+ selectStep('year', '1939;'+ (parseInt(date('Y'))+5) +';1', t['year']) +'</td></tr>';
	s += '<tr><td align="center">'+ selectStep('hour', '0;23;1', t['hours']) +'</td><td colspan="2" align="center">'+ selectStep('minute', '0;59;1', t['minutes']) +'</td><td align="right">'+ selectStep('second', '0;59;1', t['seconds']) +'</td></tr><tr><td><b>Час</b></td><td colspan="2" align="center"><b>Минута</b></td><td align="right"><b>Секунда</b></td></tr></table>';

	s += '<div style="border-top:1px solid #bfbfbf; text-align:center"><input type="button" value="Применить" onclick="gatherTime(\''+ to +'\',\''+ apply +'\')" /></div>';

	var o = byId(to);		if(o!=undefined)		o.innerHTML = s;	}


function dateInput(to,apply,time)	{				var t = getdate(time),		s = '';

	var s = '<table align="center" style="padding:10px"><tr><td><b>День</b></td><td colspan="2" align="center"><b>Месяц</b></td><td align="right"><b>Год</b></td></tr><tr><td align="center">'+ selectStep('day', '1;31;1', t['mday']) +'</td><td colspan="2" align="center">'+ selectStr('month', 'Январь;1;Февраль;2;Март;3;Апрель;4;Май;5;Июнь;6;Июль;7;Август;8;Сентябрь;9;Октябрь;10;Ноябрь;11;Декабрь;12', t['mon']) +'</td><td align="right">'+ selectStep('year', '1939;'+ (parseInt(date('Y'))+5) +';1', t['year']) +'</td></tr></table>';

	s += '<div style="border-top:1px solid #bfbfbf; text-align:center"><input type="button" value="Применить" onclick="gatherTime(\''+ to +'\',\''+ apply +'\')" /></div>';

	var o = byId(to);		if(o!=undefined)		o.innerHTML = s;	}



function markNode(o)	{		if(o.id=='')			o.id = uniqid();		return o.id;	}



function patchInput(o,x)	{	var sName = o.getAttribute('name');	if(sName==null)		return;

	var v = findMatch(sName, x);



switch(o.tagName)	{

case 'INPUT':

	switch(o.getAttribute('type'))	{
	case 'xdate':				if(v===false) v = 0;	v = parseInt(v);	v += new Date().getTimezoneOffset()*60;
		markNode(o);			o.value = date('Y-m-d', v);			o.setAttribute('readonly', 'readonly');

		o.onclick = function() {	winCreate('xdatetime', '','','','', 1);		dateInput('xdatetime',o.id, v);	}

		return;

	case 'xdatetime':			if(v===false) v = 0;	v = parseInt(v);	v += new Date().getTimezoneOffset()*60;
		markNode(o);			o.value = date('Y-m-d G:i:s', v);		o.setAttribute('readonly', 'readonly');

		o.onclick = function() {	winCreate('xdatetime', '','','','', 1);		datetimeInput('xdatetime',o.id, v);	}

		return;

	case 'hidden':	case 'text':	case 'password':
		if(v===false)			v = '';
		if(o.value=='')			o.value = v;		return;	}

	break;

case 'TEXTAREA':
	if(v!==false)	if(o.value=='')		o.value = v;		return;

case 'SELECT':	{	var aOption = fetchNodes('OPTION', o);

for(var i=0; i<aOption.length; i++)
	if(aOption[i].value==v)		o.selectedIndex = i;		return;	}

}


}



function parseForm(form,s)	{

	var oForm = byId(form);

	var aNode = fetchNodes('INPUT,SELECT,TEXTAREA', oForm);


	var x = xUnpackArray(s);

for(var i in aNode)
	patchInput(aNode[i], x);	}






function patchTag(o,a)	{	var v = findMatch(o.getAttribute('name'), a);
	if(v===false)		return;

	o.innerHTML = v;

}



function parseById(id,s)	{		var oBlock = byId(id);

	var aNode = fetchBranch(oBlock);	var x = xUnpackArray(s);	var v = oBlock.getAttribute('_context');

	x._context = xExplode(';', v);		x._context.raw = v;		oBlock._context = x._context;

for(var i in aNode)
	patchTag(aNode[i], x);

}





function initTiny(id)	{

tinyMCE.init({
// General options
	mode : "exact",
	elements : id,
	theme : "advanced",
	plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

// Theme options
	theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
	theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
	theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
	theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,

// Example content CSS (should be your site CSS)
	content_css : "c/tiny.css",

// Drop lists for link/image/media/template dialogs
	template_external_list_url : "lists/template_list.js",
	external_link_list_url : "lists/link_list.js",
	external_image_list_url : "lists/image_list.js",
	media_external_list_url : "lists/media_list.js",

// Style formats
	style_formats : [
		{title : 'Bold text', inline : 'b'},
		{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
		{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
		{title : 'Example 1', inline : 'span', classes : 'example1'},
		{title : 'Example 2', inline : 'span', classes : 'example2'},
		{title : 'Table styles'},
		{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
	],

// Replace values for the template plugin
	template_replace_values : {
		username : "Some User",
		staffid : "991234"
	}	});

}



function simpleTiny(id)	{

tinyMCE.init({
// General options
	mode : "exact",
	elements : id,
	theme : "simple"
});	}




function packArray(o)	{	var s = '';
for(var i in o)
	s += i +';'+ o[i] +';';	return s;	}



function unpackArray(s)	{

	var a = explode(';', s);	var x = Array();

for(var i=0; i<a.length; i+=2)	{

	if(a[i]=='')	continue;	x[a[i]] = a[i+1];	}

	return x;	}





function winExist(id)	{	return aWin[id]!=undefined;	}

function winMax(id)	{
	amorQuery(id+'_top', 'x,0,y,32,w');
	amorQuery(id+'_frame', 'w,'+(app.sw-16)+',h,'+(app.sh-32));	}

function winHide(id,delay){	if(aWin[id].status=='hidden')	return;
				if(delay==undefined)		delay = 500;

if(delay<=0)	{		var o = byId(id+'_top');	o.style.visibility = 'hidden';
}	else			fadeOut(id+'_top', 500);	aWin[id].status = 'hidden';	}

function winRestore(id)	{	if(aWin[id].status=='')		return;	fadeIn(id+'_top', 500);		aWin[id].status = '';	}

function winHideAll()	{
for(var i in aWin)
	if(aWin[i]!=undefined)	winHide(i);	}


function winRecreate(id){	if(aWin[id]==undefined)		return;

	winCreate(id, aWin[id].w,aWin[id].h, aWin[id].x,aWin[id].y);

	blockReroute(id);	aWin[id].status = '';	}



function winAlter(id)	{
switch(aWin[id].status)	{
case 'fetch':
	winRecreate(id);	break;
case 'hidden':
	winRestore(id);		break;
case '':
	winHide(id);		break;	}	}



function winRetire(id)	{	retireWin += id+';';
	killCookie('win_'+id);	setCookie('retireWin', retireWin);	}



function winClear(o)	{	o = byId(o);	if(o==null)	return;

	var w = parentByAttr(o, '_win');	var id = w.getAttribute('_win');


	if(win.head==id)	win.head = '';
	aWin[id] = undefined;	refreshTaskbar();
if(w)
	KillNode(w);		winRetire(id);

	if(win.last==id)	win.last = '';	}



function winClose(o)	{	winClear(o);	}


function cookWin(id)	{	var s = packArray(aWin[id]);
	if(!s)	return;		setCookie('win_'+id, s);	}



function winClose(o)	{			winClear(o);	}



var oResize = {id:'', x:0,y:0, w:0,h:0};

function setResize()	{

	var o = byId(oOver.area);		if(o==undefined)	return false;

	oResize.id = oOver.area;

	oResize.x = app.mx;			oResize.y = app.my;

	oResize.w = o.clientWidth;		oResize.h = o.clientHeight;

	return false;
}


function unsetResize()	{	oResize.id = '';	}



function aResize()	{	if(oResize.id=='')			return false;

	return false;


	var o = byId(oResize.id);

	o.style.width = (app.mx-oResize.x) + oResize.w + 'px';
	o.style.height = (app.my-oResize.y) + oResize.h + 'px';	}



function onTop(o)	{	o = byId(o);	if(o==null)	return;
	var x = parentByAttr(o, '_win');
	if(x!=null)		o = x;		o.style.zIndex = app.GetZ();	}


function doClear(o)	{	o = byId(o);
	if(!o.v)	{	o.v = 1;	o.value = '';	}	}


function winCreate(id, w,h, x,y, bits)	{	if(id=='this')		return oOver.area;

	if(bits==undefined)			bits = 5;

if(id==undefined || id=='?')	{

	id = 'win'+iD;				iD++;	}

else{	var o = document.getElementById(id);	if(o!=undefined){	cookWin(id);	return id;	}	}


	if(w==undefined || w=='')		w = 200;		if(h==undefined || h=='')	h = 15;

	if(x==undefined || x=='')
		if(aWin[id]==undefined)		x = app.amx-28;	else	x = aWin[id].x;
	if(y==undefined || y=='')
		if(aWin[id]==undefined)		y = app.amy-28;	else	y = aWin[id].y;

	var type = 'c/img/custom';


//	var s = '<table cellpadding="0" cellspacing="0" width="'+ w +'" height="'+ h +'">';
	var s = '<table cellpadding="0" cellspacing="0" id="'+id+'_frame" style="border:1px solid #555; width:'+ w +'px;height:'+ h +'px"><tr><td>';
//	var s = '<table cellpadding="0" cellspacing="0" id="'+id+'_frame" style="box-shadow: 0 0 10px #fff; border:1px solid #555; width:'+ w +'px;height:'+ h +'px"><tr><td>';
//	var s = '<table id="'+id+'_frame" cellpadding="0" cellspacing="0" width="'+ w +'" height="'+ h +'">';


	s += '<table cellpadding="0" cellspacing="0" width="100%" height="24" onclick="onTop(this)" ui _drag="'+ id +'_top" background="c/img/win_top.png" class="cms_title" style="border-bottom:1px solid #5f5f5f"><tr><td id="'+ id +'_title" style="vertical-align:middle; padding:5px"></td><td align="right" width="128" style="vertical-align:top">';
if(bits&4)
	s += '<img onmousedown="winHide(\''+ id +'\')" src="c/img/win_min.png" />';
if(bits&2)
	s += '<img onmousedown="winMax(\''+ id +'\')" src="c/img/win_max.png" />';
if(bits&1)
	s += '<img onmousedown="winClear(\''+ id +'\')" src="c/img/win_close.png" />';

	s += '</td></tr></table>';


	s += '<div id="'+ id +'" style="background-image:url(c/img/custom_x.png)"></div></td></tr></table>';


	var xWin = document.createElement("DIV");

	xWin.id = id+'_top';			xWin.setAttribute('_win', id);

//	xWin.style.width = w+'px';		xWin.style.height = h+'px';

	xWin.style.position = 'absolute';

	xWin.style.backgroundColor = '#fff';

//	xWin.style.visibility = 'hidden';

	xWin.style.left = x +'px';		xWin.style.top = y +'px';

	xWin.style.zIndex = app.GetZ();		xWin.innerHTML = s;

//	alert(s);

if(aWin[id]==undefined)	{

	aWin[id] = Array();			aWin[id].title = 'O_o';
	aWin[id].x = x;				aWin[id].y = y;
	aWin[id].w = w;				aWin[id].h = h;

}	aWin[id].id = id;			aWin[id].status = '';


	byId('core_point').appendChild(xWin);

	cookWin(id);

	walkTag(xWin);

	return id;

}



function makeDragable(o,x)	{		o = byId(o);		if(o==null)	return;
	if(x==undefined)	x = '';		markPoint(o);		o.setAttribute('_drag', x);	}



function createWinShell(id,theme,x,y)	{	if(id==undefined)	id = uniqid();
	if(x==undefined)	x = app.mx;	if(y==undefined)	y = app.my;

	var o = byId(id);			if(o!=null)		return o;


	var aTheme = childrenByAttr('somebody', '_theme',theme);
	if(aTheme.length==0)			return;			var xTheme = aTheme[0];



	var w = document.createElement("DIV");


	w.id = id+'_top';			w.setAttribute('_win', id);


	w.onclick = 'onTop("'+ id +'")';	w.style.position = 'absolute';
	w.style.left = x +'px';			w.style.top = y +'px';
	w.style.zIndex = app.GetZ();		w.innerHTML = xTheme.innerHTML;


	var a = childrenByAttr(w, 'winClose');
for(var i in a)
	addEvent(a[i], 'click', function() {winClose(this);} );

//	a[i].onclick = 'winClose(this);';
//	addEvent(a[i], 'click', 'winClose(this)');



	var a = childrenByAttr(w, 'winDrag');
for(var i in a)
	makeDragable(a[i], id+'_top');



	var a = childByAttr(w, 'winContent');	a.id = id;


	byId('core_point').appendChild(w);


	walkTag(w);				return id;

}



function LoadTaskbar()	{	var s = getCookie('sWin');	if(!s)		return;

	var a = explode(';', s);

for(var i=0; i<a.length; i++)	{	var n = a[i];		if(n=='')	continue;

	var win = getCookie('win_'+n);	if(win==null)	{	winRetire(n);	continue;	}

	aWin[n] = unpackArray(win);	aWin[n].status = 'fetch';	}	}



function refreshTaskbar()	{

	var o = byId('cp_panel');	if(!o)	return;

	var s = '<div class="cms_light">';		var names = '';

for(var i in aWin)
	if(aWin[i]!=undefined)	{	names += i+';';
		if(aWin[i].title=='')	aWin[i].title = '...';
		s += '<div onclick="winAlter(\''+ i +'\')" style="float:left">'+ aWin[i].title +'</div>';	}

	setCookie('sWin', names);	s += '</div>';	o.innerHTML = s;	}



function explode(sep,s)	{	var out = Array();	var p = 0, i = 0;	if(s==null)	return out;
while(p!=-1 && i<s.length)	{
	i = s.indexOf(sep,p);	if(i==-1)		i = s.length;
	out.push( s.substring(p,i) );			p = i+sep.length;	}		return out;	}



function xExplode(sep,s){	var a = explode(sep,s), c = a.length>>1, out = Array();
for(var i=0; i<c; i++)
	out[a[2*i]] = a[2*i+1];	return out;	}



function getHTML(id)	{	var o = document.getElementById(id);
if(o)	return o.innerHTML;	else	return '';	}


function getCleanHTML(id)	{	var o = document.getElementById(id);
if(o)	{
	var s = o.innerHTML;		KillNode(o);
	return s;	}	else	return '';	}



function UnpackArray(s)	{	var xA = new Array();


	var xGroup = explode(String.fromCharCode(1)+String.fromCharCode(1), s);

for(var i=0; i<xGroup.length-1; i++)	{

	var xSub = explode(String.fromCharCode(1), xGroup[i]);


	xA[i] = new Array();

for(var j=0; j<xSub.length; j+=2)	xA[i][xSub[j]] = xSub[j+1];	}


	return xA;	}





function execAttr(attr)	{		var a = getElementsByAttr(attr);
	for(var i in a)	{
		var o = a[i];
		eval(o.getAttribute(attr));	}	}



function blackIt()	{		runFade('blackout',0.85, 250);
	app.black = 1;			execAttr('_onBlack');	}

function inBlack()	{		return app.black;	}


function inWhite()	{		if(dTime('black')<500)	return;			clearScroll();
if(app.black)	{
	runFade('blackout',0, 250);	app.black = 0;

	execAttr('_onWhite');		return 1;	}	return 0;	}





function FindBlocks(s,sign,sign2){	var out = Array();	var i = 0, i2 = 0;

while(i<s.length)	{
	i = s.indexOf(sign,i2);		if(i==-1)		return out;
	i2 = s.indexOf(sign2,i);	if(i2==-1)		i2 = s.length;

	out.push( s.substring(i+sign.length,i2) );	}	return out;	}



function ExecScripts(s)	{

	var xScript = FindBlocks(s, '<SCRIPT>', '</SCRIPT>');
	for(var i=0; i<xScript.length; i++)			setTimeout(xScript[i], 0);

	xScript = FindBlocks(s, '<script>', '</script>');
	for(var i=0; i<xScript.length; i++)			setTimeout(xScript[i], 0);

	xScript = FindBlocks(s, '<span style="display: none;">', '</span>');
	for(var i=0; i<xScript.length; i++)			setTimeout(xScript[i], 0);	}





function parseClip(o)	{		o = byId(o);
	if(o==undefined)		return new Array(0, 0, 0, 0);

	if(o.style.clip=='')		return new Array(0, o.clientWidth, o.clientHeight, 0);

	var a = o.style.clip.indexOf('(')+1,			b = o.style.clip.indexOf(')');
if(o.style.clip.indexOf(' ')==-1)
	var dim = explode(',', o.style.clip.substring(a,b));
else	var dim = explode(' ', o.style.clip.substring(a,b));

for(var i=0; i<4; i++)	{
if(dim[i].indexOf('auto')!=-1)
	dim[i] = 0;	else		dim[i] = parseInt(dim[i]);
	if(isNaN(dim[i]))		dim[i] = 0;	}

	return new Array(dim[0], dim[1], dim[2], dim[3]);	}



function uScreenWH()	{
if(document.documentElement)	{
	app.sw = document.documentElement.clientWidth;		app.sh = document.documentElement.clientHeight;	}
if(document.body)	{
	app.sw = document.body.clientWidth;			app.sh = document.body.clientHeight;	}	}



function fetchWheel()	{		wheelType = (/Firefox/i.test(navigator.userAgent))? "DOMMouseScroll" : "mousewheel";	}



function fetchOpacity()	{		if(app.opaq!='')	return;

if (typeof document.body.style.opacity == 'string')	{					// CSS3 compliant (Moz 1.7+, Safari 1.2+, Opera 9)
	app.opaq = 'opacity';		return;	}
else if (typeof document.body.style.MozOpacity == 'string')	{				// Mozilla 1.6 и младше, Firefox 0.8 
	app.opaq = 'MozOpacity';	return;	}
else if (typeof document.body.style.KhtmlOpacity == 'string')	{				// Konqueror 3.1, Safari 1.1
	app.opaq = 'KhtmlOpacity';	return;	}
else if (document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5)	{	// Internet Exploder 5.5+
	app.opaq = 'filter';		return;	}

	app.opaq = false;		return;	}


//-A-m-o-r- -r-u-n-s- - - - - - - - - - - - - - - - - - - -


function amorThread()	{		var c = amorT.length,	xNow = new Array(0,0,0,0),	t = miliTime(),	cActive = 0;

for(var k=0; k<c; k++)	{		var i = amorT[k];

	if(i.done)			continue;		cActive++;

	var x = (t-i.ta) / i.time;	var o = i.node;
if(x<1)	{				x = Math.sin(x*1.570795);
	for(var j=0; j<i.pc; j++)	xNow[j] = i.va[j] + x * i.vd[j];
}	else	{			x = 1;			xNow = i.vb;			i.done = 1;	}
	for(var j=0; j<i.pc; j++)	o[i.op][j] = xNow[j];


switch(i.op)	{
case '_a':	setOpacity(o, xNow[0]);				break;

case '_c':	{						var q = 'rect(';
		if(i.vb[0]<0)	q += 'auto,';		else	q += parseInt(xNow[0]) +'px,';
		if(i.vb[1]<0)	q += 'auto,';		else	q += parseInt(xNow[1]) +'px,';
		if(i.vb[2]<0)	q += 'auto,';		else	q += parseInt(xNow[2]) +'px,';
		if(i.vb[3]<0)	q += 'auto)';		else	q += parseInt(xNow[3]) +'px)';

		o.style.clip = q;				break;	}

case '_w':	o.style.width = parseInt(xNow[0])+'px';		break;
case '_h':	o.style.height = parseInt(xNow[0])+'px';	break;
case '_x':	o.style.left = parseInt(xNow[0])+'px';		break;
case '_y':	o.style.top = parseInt(xNow[0])+'px';		break;	}	}


if(cActive==0)
	timer.clearI('amor');	}





function amorGetThread(id,op,time){	var c = amorT.length;

for(var i=0; i<c; i++)
	if(amorT[i].id==id && amorT[i].op==op)		break;			if(i>=c)
for(var i=0; i<c; i++)
	if(amorT[i].done==1)				break;

	var o = byId(id);		if(o==undefined)	return 0;	var a;

if(i>=c)	{			a = new Array();
	a.va = new Array(0,0,0,0);	a.vb = new Array(0,0,0,0);
	a.vd = new Array(0,0,0,0);	}		else			a = amorT[i];

	if(o[op]==undefined)		amorReset(o,op);

for(var j=0; j<4; j++)
	a.va[j] = o[op][j];		a.done = 0;

	a.id = id;			a.op = op;				a.node = byId(id);
	a.ta = miliTime();		a.tb = a.ta + time;			a.time = time;

	if(timer.checkI('amor')==0)	timer.interval('amor', 'amorThread()', 1);

	amorT.push(a);			return a;	}



function amorReset(o,op)	{
switch(op)	{
case '_a':
	o._a = new Array(getOpacity(o), 0,0,0);		return;
case '_c':
	o._c = parseClip(o);				return;
case '_w':
	o._w = new Array(o.clientWidth, 0,0,0);		return;
case '_h':
	o._h = new Array(o.clientHeight, 0,0,0);	return;
case '_x':
	o._x = new Array(o.offsetLeft, 0,0,0);		return;
case '_y':
	o._y = new Array(o.offsetTop, 0,0,0);		return;
case '_z':
	o._z = new Array(o.style.zIndex, 0,0,0);	return;	}	}



function amorAppend(id,op,time, v,v2,v3,v4)	{	var h = amorGetThread(id,op, time);
	if(typeof(h)!="object")				return;
if(op=='_c')
	h.pc = 4;	else	h.pc = 1;		h.vb = new Array(v,v2,v3,v4);

	for(var j=0; j<4; j++)				h.vd[j] = h.vb[j] - h.va[j];	}



function amorQuery(id,query,time)	{		var com = explode(',', query),	c = com.length;

	if(id=='')		return;			if(time==undefined)		time = 500;

for(var i=0; i<c; i++)		switch(com[i])	{

case 'a':	case 'x':	case 'y':
case 'z':	case 'w':	case 'h':	{	if((i+1)>c)	return;

		amorAppend(id, '_'+com[i],time, parseFloat(com[i+1]),0,0,0);
		i++;					break;	}

case 'c':	case 'p':	{			if((i+4)>c)	return;
		amorAppend(id, '_'+com[i],time, parseFloat(com[i+1]),parseFloat(com[i+2]),parseFloat(com[i+3]),parseFloat(com[i+4]));
		i += 4;					break;	}

default:	return;		}	}



function queryXY(id,x,y,time)	{
	if(id=='')		return;			if(time==undefined)		time = 500;
	amorAppend(id, 'x',time, x,0,0,0);		amorAppend(id, 'y',time, y,0,0,0);	}


//-A-m-o-r- -r-u-n-s- - - - - - - - - - - - - - - - - - - -


function IsCtrl()	{	return app.state & keyCtrl;	}
function IsShift()	{	return app.state & keyShift;	}

function FetchTime()	{	return new Date().getTime();	}

function FetchNumber()	{	return (new Date().getTime()) % 86400000;	}



function toURL(url,delay){	if(dTime('url')<5)	return;
	if(delay==undefined)	delay = 0;
if(delay==0)	{
if(url.indexOf('http://')!=-1)
	window.open(url,'_blank');
else	window.location.replace(url);			return;	}

	var s = 'window.location.replace(\''+url+'\')';	setTimeout(s,delay);	}





function blockRefresh(id){	wrapRequest('refresh', id, '?');	}
function blockReroute(id){	wrapRequest('reroute', id, '?');	}





function oMenuClear()	{	timer.clear('menu');	}



function areaOver(id)	{
	if(dTime('areaSelect')>10)			return false;
	oOver.area = id;				return true;	}





	var inAccCheck = 0;

function AccCheck()	{		inAccCheck = 1;

	var x = document.getElementsByName('acc[]');

for(var i=0; i<x.length; i++)	{
	setTimeout(x[i].onchange,1);	}

	setTimeout('inAccCheck = 0',50);	}



function AccCheck2(el,req)	{

	if(req=='')			return;

	var parent = document.getElementById(req);
	var child = document.getElementById(el);

if(parent==undefined)	{
	child.checked = 0;		return;	}

if(child.checked)
	if(parent.checked==0)	{

if(inAccCheck)
	child.checked = 0;	else	parent.checked = 1;

	setTimeout(parent.onchange,1);	}	}





function SetGroup(name,v,vv,vvv){	var x = document.getElementsByName(name);

if(vvv==undefined)
	for(var i=0; i<x.length; i++)	x[i][v] = vv;
else	for(var i=0; i<x.length; i++)	x[i][v][vv] = vvv;	}



function CustomHV(name,v,input,vv)	{

	SetGroup(name,'style','backgroundColor','#ffffff');
	v.style.backgroundColor = '#bfbfbf';

	var x = document.getElementsByName(input);
	x[0].value = vv;	}





function fixPos(name,win)	{	if(win==undefined)	win = '';

	o = byId(name);			if(o==null)		return false;
	o.style.visibility = 'visible';				var a = elemPos(o);


if((a[0]+a[2]) > app.sw)	{
if(a[2] > app.sw)
	a[0] = 0;
else	a[0] = app.sw - a[2];	}	else	if(a[0]<0)	a[0] = 0;

if((a[1]+a[3]) > app.sh)	{
if(a[3] > app.sh)
	a[1] = 0;
else	a[1] = app.sh - a[3];	}	else	if(a[1]<0)	a[1] = 0;

	o.style.left = a[0]+'px';	o.style.top = a[1]+'px';


if(win)	{				var w = aWin[win];	if(w==undefined)	return true;
	w.x = a[0];			w.y = a[1];		cookWin(win);	}	return true;	}



function fixWinPos(name)	{	return fixPos(name+'_top', name);	}





function PatchPosition(o)	{
if(app.mx<o.offsetLeft || app.mx>(o.offsetLeft+o.clientWidth))		o.style.left = app.mx-32 + 'px';
if(app.my<o.offsetTop || app.my>(o.offsetTop+o.clientHeight))		o.style.top = app.my-32 + 'px';	}



function InPosition(o)	{
if(app.mx<o.offsetLeft || app.mx>(o.offsetLeft+o.clientWidth) || app.my<o.offsetTop || app.my>(o.offsetTop+o.clientHeight))
	return false;				return true;	}





function UpdateXY(elem,aEvent)	{		var e = aEvent ? aEvent : window.event;

	aElem[0] = e.offsetX;			aElem[1] = e.offsetY;
	aElem[2] = elem.clientWidth;		aElem[3] = elem.clientHeight;		return false;	}





function Console(aEvent){	var e = aEvent ? aEvent : window.event;

	var xConsole = document.getElementById('console_input');		if(e.keyCode==96)	return false;
if(e.keyCode==13)	{
	wrapRequest('console','console_output','?com='+Base64.encode(xConsole.value));			xConsole.value = '';	}	}





function CreateDiv(x,y,w,h, text,parent){	var xDiv = document.createElement("DIV");

	parent = byId(parent);			if(parent==undefined)		parent = byId('core_point');

	xDiv.style.position = 'absolute';	xDiv.style.zIndex = app.GetZ();
	xDiv.style.left = x +'px';		xDiv.style.top = y +'px';
if(w)	xDiv.style.width = w+'px';	if(h)	xDiv.style.height = h+'px';

	xDiv.innerHTML = text;			parent.appendChild(xDiv);	return xDiv;	}



function FixRadialPos(a,r)	{}



function RadialPos(i,from, r)	{

	var xAngle = (i/from)*6.283152 - 3.14159, dx = 0, dy = 0;

	return {0:r*Math.cos(xAngle)+dx, 1:r*Math.sin(xAngle)+dy};	}



function PlanarPos(i,from, r)	{		var dx = from*r/2;		return {0:r*i-18, 1:0};	}



function KillNode(o)	{			o = byId(o);
if(o)	{					var xNode = byId('core_point');
	try{	xNode.removeChild(o);	}	catch(e)	{}

	delete o;	}	}

function delayedKill(o,time)	{		if(time==undefined)		time = 1000;	setTimeout('KillNode("'+ o +'")', time);	}



function explore(id,to)	{			winRQ('?route=route;test_conductor;oid;'+id, to);	}



function oEdit(oid,lang,win)	{
	if(lang==undefined)	lang = '';	if(win==undefined)		win = '?';
	var q = '?route=route;cp_edit;oid;'+ oid +';lang;'+ lang +';edge;'+ app.menu.edge;	winRQ(q,win);	}

function propEdit(oid,win)	{		var q = '?route=route;cp_edit2;oid;'+ oid;	winRQ(q,win);	}



function oParseCreate(win,oid,parent)	{	var a = fetchNodes('INPUT', win),		aCaps = '';
for(var i in a)
	if(a[i].checked)			aCaps += a[i].value+',';

	aCaps += 'node';			oOver.area = parent;

	winRQ('?route=route;cp_edit;oid;;refer;'+oid+';caps;'+ aCaps, '?', 462);	}



function oCreate(oid)	{

	var win = winCreate('?', 512,'', '','' ,1);

	var o = byId(win);

	var s = '', aType = Array('img','text','css','file','poll','user','group','domain','render','view','menu','php','js');

for(var i in aType)
//	s += '<label><img src="c/img/'+ aType[i] +'_mid" /><input type="checkbox" value="'+ aType[i] +'" /></label>';
	s += '<div style="float:left"><label><input type="checkbox" value="'+ aType[i] +'" /><img src="c/img/'+ aType[i] +'_mid" width="64" height="64" /></label></div>';

	s += '<div style="clear:both; border-bottom:1px solid #000"></div><div style="text-align:center">';

//	s += '<input type="button" value="Пакетная загрузка" onclick="xAlert(\'Ждем новой версии\')" style="width:254px; padding:10px" />';

	s += '<input type="button" value="Пакетная загрузка" onclick="winRQ(\'?route=route;batch_edit;refer;'+ oid +'\')" style="width:254px; padding:10px" />';
	s += '<input type="button" value="Создать" onclick="oParseCreate(\''+ win +'\',\''+ oid +'\',\''+ oOver.area +'\')" style="width:254px; padding:10px" />';

	s += '</div>';

	o.innerHTML = s;

}


function eRelease(eid)	{			callURL('?route=route;test_test;op;unref;edge;'+ eid);	}



function createFolder(oid)	{		winRQ('?route=route;cp_edit;caps;node;oid;;refer;'+oid+'_folder');	}



function oNew(edge,key,prop)	{

	if(edge==undefined)			return;
	if(key==undefined)			key = '';
	if(prop==undefined)			prop = '';

	var q = '?route=route;cp_edit;oid;0;edge;'+ edge +';key;'+ key;

	winRQ(q);	}



function oMenu(up)	{	//		if(checkAcc('menu')==0)		return;

	oOver.xarea = oOver.area;		xAction = '?route=route;test_test';

if(app.menu.oid)	{			var list = 'edit,new,folder,prop,copy,kill,conduct';

	var r = Math.abs(app.mx-app.down.mx) + Math.abs(app.my-app.down.my);
	if(up==0)	if(r>50)	{	oMenuClear();			return;	}

if(up==0)	{

	if(app.menu.edge)			list += ',cut,unref';

	if(list)	list += ',tag';		else	list = 'order,tag';

	if(app.buffer.op)			if(app.buffer.oid!=app.down.oid)	list += ',paste';

}	else	{	list = 'order';	}	}


	var xList = explode(',', list),		xR = 64+1*(xList.length-2),	xID = uniqid();

	if(xList.length==0)			return;


if(xList.length==1)	if(xList[0]!='paste')	{
	wrapRequest('cpx','?',xAction+';op;'+xList[0]+';oid;'+app.menu.oid+';edge;'+app.menu.edge+';oid2;'+app.menu2.oid+';edge2;'+app.menu2.edge);	return;	}


	var xMenu = CreateDiv(app.amx-xR, app.amy-xR, 2*xR,2*xR, '', 'core_point');

	xMenu.id = xID;				xMenu.onclick = 'return false';

for(var i=0; i<xList.length; i++)	{	if(xList[i]=='')		continue;

	var x = RadialPos(i,xList.length, xR),	xTitle = '';


	xText = '<img alt="" width="48" height="48" onmouseup="';		var iAction = 1;
switch(xList[i])	{
case 'copy':	case 'cut':
	xText += 'app.buffer.oid=\''+app.menu.oid+'\'; app.buffer.edge=\''+app.menu.edge+'\'; app.buffer.op=\''+xList[i]+'\'; app.buffer.area=\''+app.down.area+'\';';
if(xList[i]=='copy')
	xTitle = 'Копировать';		else	xTitle = 'Вырезать';		iAction = 0;		break;

case 'kill':
	xTitle = 'Удалить';
	xText += 'if(confirm(\'Удалить?\'))';					break;

case 'conduct':
	xTitle = 'Открыть';			$iAction = 0;
	xText += "winRQ('?route=route;test_conductor;key;;oid;'+app.menu.oid,'?',866,572, '','',7);";
	break;

case 'unref':
	xTitle = 'Удалить ссылку';						break;

case 'edit':
	xTitle = 'Редактировать';						iAction = 0;
	xText += 'oEdit(\''+app.menu.oid+'\');';				break;

case 'prop':
	xTitle = 'Редактировать';						iAction = 0;
	xText += 'propEdit(\''+app.menu.oid+'\');';				break;

case 'tag':
	xTitle = 'В избранное';							iAction = 0;
	xText += 'winRQ(\'?route=route;test_tag;oid;'+app.menu.oid+'\', \'tag\', 462);';			break;

case 'new':
	xTitle = 'Создать подчиненный объект';					iAction = 0;
	xText += 'oCreate(\''+app.menu.oid+'\')';				break;

case 'folder':
	xTitle = 'Создать папку';						iAction = 0;
	xText += 'createFolder(\''+app.menu.oid+'\')';				break;

case 'paste':
	xTitle = 'Вставить';							iAction = 0;
if(app.menu.oid!=app.buffer.oid)
	xText += 'wrapRequest(\'cpx\',\'?\',\''+xAction+';op;'+xList[i]+';area;'+app.down.area+';oid;'+app.menu.oid+';edge;'+app.menu.edge+';op2;'+app.buffer.op+';area2;'+app.buffer.area+';oid2;'+app.buffer.oid+';edge2;'+app.buffer.edge+'\')';
	break;	}

if(iAction)
	xText += 'wrapRequest(\'cpx\',\'?\',\''+xAction+';op;'+xList[i]+';area;'+app.down.area+';oid;'+app.menu.oid+';op2;'+app.buffer.op+';edge;'+app.menu.edge+';oid2;'+app.menu2.oid+';edge2;'+app.menu2.edge+'\')';

	xText += ';KillNode(\''+xID+'\')" src="c/img/'+xList[i]+'_48" title="'+ xTitle +'" />';

	var xDiv = CreateDiv(xR-24+x[0],xR-24+x[1], 0,0, xText,xMenu);

}	var xDiv = CreateDiv(xR-12,xR-12, 0,0, '<img src="c/img/nexus_48" width="24" onmouseup="KillNode(\''+xID+'\')" />',xMenu);



	oMenuClear();

}





function cpMenu()	{			if(checkAcc('duncan')==0)	return;

	var r = Math.abs(app.mx-app.down.mx) + Math.abs(app.my-app.down.my);
	if(r>50)	{	oMenuClear();	return;	}

	var list = 'conduct,exit';


	var xList = explode(',', list),		xR = 48+2*(xList.length-2),	xID = uniqid();
	if(xList.length==0)			return;


	var xMenu = CreateDiv(app.amx-xR, app.amy-xR, 2*xR,2*xR, '', byId('core_point'));

	xMenu.id = xID;				xMenu.onclick = 'return false';

for(var i=0; i<xList.length; i++)	{	if(xList[i]=='')		continue;

	var x = RadialPos(i,xList.length, xR),	xTitle = '';


	xText = '<img alt="" width="48" height="48" onmouseup="';		var iAction = 1;
switch(xList[i])	{
case 'conduct':
	xText += "winRQ('?route=route;test_conductor;key;','?',866,500);";
	break;

case 'hide':
	xText += "winHideAll();";
	break;

case 'exit':
	xText += "if(confirm('Закончить сессию?')) toURL('?&logout');";
	break;

case 'max':
	break;

case 'min':
	break;	}


	xText += ';KillNode(\''+xID+'\')" src="c/img/'+xList[i]+'" title="'+ xTitle +'" />';


	var xDiv = CreateDiv(xR-24+x[0],xR-24+x[1], 0,0, xText,xMenu);

}	var xDiv = CreateDiv(xR-12,xR-12, 0,0, '<img src="c/img/nexus_48" width="24" onmouseup="KillNode(\''+xID+'\')" />',xMenu);



	oMenuClear();

}





function CustomShow(show,hide,prefix)	{		var a = explode(',', hide),	c = a.length;
	if(prefix==undefined)				prefix = '';

	var o = document.getElementById(prefix+show);	if(o)	o.style.display = 'inline';
for(var i=0; i<c; i++)					if(a[i]!=show)	{
	o = document.getElementById(prefix+a[i]);	if(o)	o.style.display = 'none';	}	}



function procNames(id,op,val)	{	var a = document.getElementsByName(id);		var c = a.length;

for(var i=0; i<c; i++)	{

switch(op)	{
case 'hide':	a[i].style.visibility = 'hidden';	break;
case 'show':	a[i].style.visibility = 'visible';	break;
case 'check':	a[i].checked = 1;			break;
case 'uncheck':	a[i].checked = 0;			break;
case 'docheck':	a[i].checked = val;			break;

case 'smartcheck':
if(val)	{	if(i==from)		a[i].checked = val;	}
else		a[i].checked = val;	break;	}	}	}



function ProcGroup(id,from,to,op,val)	{

for(var i=from; i<=to; i++)	{

	var name = id + '_' + i,	oSrc = document.getElementById(name);

if(oSrc)	switch(op)	{
case 'hide':	oSrc.style.display = 'none';		break;
case 'show':	oSrc.style.display = 'inline';		break;
case 'check':	oSrc.checked = 1;			break;
case 'uncheck':	oSrc.checked = 0;			break;
case 'docheck':	oSrc.checked = val;			break;

case 'smartcheck':
if(val)	{	if(i==from)		oSrc.checked = val;	}
else		oSrc.checked = val;	break;	}	}	}



function xProcGroup(id,from,to,one,op,val)	{

switch(op)	{
case 'show':
//	alert(id+' '+from+' '+to+' '+one+' '+op);
	ProcGroup(id,from,to,'hide');
	ProcGroup(id,one,one,'show');			break;	}	}



function ShowOne(id,one,total)	{

	ProcGroup(id,0,total-1,'hide');	ProcGroup(id,one,one,'show');	}




function CheckParent(id,set)	{	var a = 0, b = 0, s, oSrc;

for(var i=0; i<9; i++)	{
	a = set.indexOf('.', a)+1;	if(a==0)	break;
	b = set.indexOf(',', a);	if(b==-1)	break;

	s = set.substring(a,b);
	var name = id + '_' + s;	oSrc = document.getElementById(name);
	if(oSrc)			oSrc.checked = 1;	}	}



function togglemenu(oUlId)	{
	var oUl=document.getElementById(oUlId);
	oUl.style.display=((oUl.style.display=="none") ? 'block' : 'none');	}

function vismenu(oUlId)	{
	var oUl=document.getElementById(oUlId);
	oUl.style.display='block';	}

function hidmenu(oUlId)	{
	var oUl=document.getElementById(oUlId);
	oUl.style.display='none';	}


function runMenu(id)	{
	s = "vismenu('" + id + "')";
	setTimeout(s,500);	}


function open_window(link,w,h)	{
	var xWin = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
	newWin = window.open(link,'order', xWin);	}



function miscop(src,dst)	{

	iD++;

	var oSrc = document.getElementById(src);
	var oDst = document.getElementById(dst);

	var xAct = 'var oSrc = document.getElementById(\'form_' + iD + '\');	oSrc.innerHTML = \'\';';

	oDst.innerHTML += '<span id="form_' + iD + '">' + oSrc.innerHTML + '<center class="link" align="right"><b style="cursor:pointer" onclick="' + xAct + '">Удалить</b></center></span>';	}



function doop(dst,check)	{
	var o = document.getElementById(dst);
if(check.checked==true)
	o.style.display = 'block';
else	o.style.display = 'none';	}





function asyncPage(s)	{			var xs = '', xPos=0, lPos = 0;

while(xPos=s.indexOf('href="?',xPos+6))	{	if(xPos==-1)	break;

	xs += s.substring(lPos,xPos+6);		lPos = s.indexOf('"', xPos+6);
	var link = 'javascript:LoadPage(\'' + s.substring(xPos+6,lPos) + '\')';

	xs += link;	}			xs += s.substring(lPos,s.length);	return xs;	}



function uPage()	{
	var oTodo = document.getElementById('todos');
	oTodo.innerHTML = asyncPage(oTodo.innerHTML);	}



function FetchReq()	{			var req;

if (window.XMLHttpRequest) {			req = new XMLHttpRequest();
	if (req.overrideMimeType)		req.overrideMimeType('text/xml');
} else if (window.ActiveXObject){
	try {   req = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	try {	req = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (e) {}	}	}

if (!req) {	alert('Giving up :( Cannot create an XMLHTTP instance');	return req;	}

	return req;	}





function patchString(s,a,b)	{		var xs = '', xPos=0, lPos = 0;

while(xPos=s.indexOf('href="?',xPos+6))	{	if(xPos==-1)	break;

	xs += s.substring(lPos,xPos+6);		lPos = s.indexOf('"', xPos+6);
if(s[xPos+7]=='&')
	xs += s.substring(xPos+6,lPos);
else	xs += a + s.substring(xPos+6,lPos) + b;	}

	xs += s.substring(lPos,s.length);	return xs;	}



function getCaps()	{
//	var s = '?java=1;sw=' + screen.width + ';sh=' + screen.height;
//	return s;
	return '';
}



function callURL(url)	{			var req = false;
	req = new FetchReq();			if (!req)	return;
	req.open('GET', url, true);		req.send(null);	}



function execURL(url)	{			var req = false;	//	alert(url);
	req = new FetchReq();			if (!req)	return;
	req.open('GET', url+'&async=31', true);	req.send(null);	}








function routeRQ(route,p,to)	{		var s = '?route=route;'+ route;
	if(p)	s += ';'+ p;			wrapRequest('route',to, s);	}



function winRQ(url,win, w,h,x,y, bits)	{	var O = document.getElementById(win);

if(!O)	{					if(win!='xalert')
	win = winCreate(win, w,h,x,y,bits);	wrapRequest('win',win, url);	}

else	wrapRequest('cpx',win, url);	}



function uRQ(url,win, theme, x,y)	{	var O = document.getElementById(win);

if(!O)	{					if(win!='xalert')
	win = createWinShell(win,theme, x,y);	wrapRequest('win',win, url);	}

else	wrapRequest('cpx',win, url);	}






function wrapFunc(id,id2,time)	{//		alert(id + ' x ' + id2);

	var elemA = document.getElementById(id);
	var elemB = document.getElementById(id2);

//	elemA.innerHTML = elemB.innerHTML;

	KillNode(elemB);

}



function animateX(o,x)	{

	var oElem = document.getElementById(o),			xElem = document.getElementById(x);

if(xElem!=undefined)
	KillNode(xElem);	}



function addEvent(o, eve, handler)	{	o = byId(o);
if(o.attachEvent)
	o.attachEvent('on'+eve, handler);
else	o.addEventListener(eve, handler, false);	}


function remEvent(o, eve, handler)	{
	if(typeof(o)=='string')			o = document.getElementById(o);
if(o.detachEvent)
	o.detachEvent('on'+eve, handler);
else	o.removeEventListener(eve, handler, false);	}






function stopBubble(event)	{		event = event || window.event;
	event.stopPropagation ? event.stopPropagation() : (event.cancelBubble=true);	}



function SetArea(o)	{	o = byId(o);	if(!o)			return;
if(!o.xmouseover)	{
	addEvent(o, 'mouseover', function () {if(dTime('area')>5)	oOver.area = o.id;	});
	o.xmouseover = 1;	}	}



function winTitle(id,s)	{	var oTitle = byId(id+'_title');
if(oTitle)	{
	aWin[id].title = s;	cookWin(id);
	refreshTaskbar();	oTitle.innerHTML = s;	}	}



function hexdec (hex_string) {
	hex_string = (hex_string + '').replace(/[^a-f0-9]/gi, '');	return parseInt(hex_string, 16);	}

function getText(node)	{	if(node.textContent==undefined)		return node.text;	else	return node.textContent;	}

function wrapJoint(req, inter)	{

if (req.readyState==4)	{
	if (req.status!=200)
		alert('There was a problem with the request.');	}	else	return;


	s = req.responseText;	//	alert(s);

if(window.DOMParser)	{
	parser = new DOMParser();	xmlDoc = parser.parseFromString(s, "text/xml");
}	else	{			xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	xmlDoc.async = "false";		xmlDoc.loadXML(s);	}


	var aWrap = xmlElements(xmlDoc, 'wrap'),		o, oTop, oTitle, sTitle;

for(i in aWrap)	{	var id = aWrap[i].getAttribute('id');	o = byId(id);

	var sText = aWrap[i].textContent;			if(sText==undefined)		sText = aWrap[i].text;

if(id=='xalert')	{
	xAlert(getText(aWrap[i]));	continue;	}

if(o==undefined)	{					var xElem = document.createElement("DIV");
	xElem.innerHTML = getText(aWrap[i]);			byId('core_point').appendChild(xElem);
	xElem.id = uniqid();					delayedKill(xElem.id);	}

	ExecScripts(getText(aWrap[i]));				if(o==undefined)	continue;

//	var qRoll = o.tagName=='DIV';
//	if(qRoll)	{	o.style.height = o.clientHeight+'px';		o.style.overflow = 'hidden';	}

	o.innerHTML = getText(aWrap[i]);			sTitle = xmlElements(xmlDoc, 'title','id',id);


//	if(qRoll)	{	unRoll(o.id);	}
//	if(o.id=='log')	{	setTimeout('xRoll("log")', 2500);	}


	if(sTitle)						winTitle(id, getText(sTitle[0]));
	fixWinPos(id);						SetArea(o);

	var v = o.getAttribute('_onwrap');		if(v)	eval(v);


	walkTag(id+'_top');	//walkTag(id+'_top');

	}


	xData = xmlElements(xmlDoc, 'xdata');			if(xData.length)
for(i in xData)	{
	var xRoute = xData[i].getAttribute('route');		window[xRoute](xData[i]);	}


	walkTags();

}





function wrapRequest(id,to,url,inter,a,b){	if(to=='')	to = id;	//	alert(to+' : '+url);

if(oOver.area)	{
	url = url.replace('route=', 'route=parent;'+oOver.area+';');	}	//	alert(to+' : '+url);

	var xList = explode(',', to);
for(var i=0; i<xList.length; i++)	{	var xID = document.getElementById(xList[i]);
	if(xID)					if(xID.innerHTML=='')		xID.innerHTML = '<div style="position:absolute"><img alt="" src="c/img/wait.gif" /></div>';	}

if(inter==undefined)
	inter = 0;
if(a==undefined || a=='')
	a = 'javascript:wrapRequest(\''+ id +'\',\''+ to +'\',\'';
if(b==undefined || b=='')
	b = '\','+ inter +')';					var req = false;


	req = new FetchReq();			if (!req)	return;
	req.onreadystatechange = function() {			wrapJoint(req,inter);	}
	req.open('GET', url+'&async=31&wrap='+id+'&wrapto='+to, true);		req.send(null);	}





function wrapiRequest(id,to,url,inter,a,b, time)	{
	var s = 'wrapRequest(\''+id+'\', \''+id+'\', \''+url+'\', '+inter+', \''+a+'\', \''+b+'\')';
	setInterval(s, time);	}





function eBehave(o)	{
if(app.kDown[0]==9)	{
	insertAtCursor(o,String.fromCharCode(9)); return false;	}

	return true;	}



function insertAtCursor(myField, myValue) {	if(typeof(myField)=='string')	myField = document.getElementById(myField);

//  Для MSIE   
if (document.selection)	{
	myField.focus();
	sel = document.selection.createRange();
	sel.text = myValue;	}

// Для нормальных браузеров   
else if (myField.selectionStart || myField.selectionStart == '0')	{
	var startPos = myField.selectionStart;
	var endPos = myField.selectionEnd;
	myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);

	myField.selectionStart = startPos + 1;
	myField.selectionEnd = endPos + 1;

}

// Для остальных
else	myField.value += myValue;	}  



function curStyle(el, cssprop){
if (el.currentStyle) //IE
	return el.currentStyle[cssprop]
else if (document.defaultView && document.defaultView.getComputedStyle) //Firefox
	return document.defaultView.getComputedStyle(el, "")[cssprop];
else	//try and get inline style
	return el.style[cssprop];	}





function getOpacity(o)	{		if(typeof(o)=='string')			o = document.getElementById(o);

	if(app.opaq=='')		fetchOpacity();

	if(curStyle(o,'visibility')=='hidden')					return 0;

if(app.opaq=="filter")	{		var oAlpha = o.filters['DXImageTransform.Microsoft.alpha'] || o.filters.alpha;
	if (oAlpha)			return oAlpha.opacity / 100;		return 1;	}

if(o.style[app.opaq]=='' && o.style[app.opaq]!='0')
	return 1;			return parseFloat(o.style[app.opaq]);	}



function setOpacity(o,alpha)	{	if(app.opaq=='')			fetchOpacity();

	if(typeof(o)=='string')		o = document.getElementById(o);		if(!o || !app.opaq)	return;

	if(alpha==0)		{	o.style.visibility = 'hidden';		return;	}

	if(curStyle(o,'visibility')=='hidden' && alpha!=0)			o.style.visibility = 'visible';

if (app.opaq=="filter")	{		alpha *= 100;
	var oAlpha = o.filters['DXImageTransform.Microsoft.alpha'] || o.filters.alpha;
	if (oAlpha)			oAlpha.opacity = alpha;
	else o.style.filter += "progid:DXImageTransform.Microsoft.Alpha(opacity="+alpha+")";  }

else	o.style[app.opaq] = alpha;	}





function miliTime()	{		var xTime = FetchTime();	return xTime;	}



function runFade(id,to, time)	{	if(!byId(id))			return;
	if(time==undefined)		time = 1000;			amorQuery(id, 'a,'+to, time);	}

function fadeIn(id, time)	{	runFade(id,1, time);	}
function fadeOut(id, time)	{	runFade(id,0, time);	}




function SlideRoutine(list,delay,period,index)	{			var xList = explode(',', list);

	var xIndex = index+1;		if(xIndex>=xList.length)	xIndex = 0;

	if(delay<=period)		delay = period;

	fadeOut(xList[index], period);					fadeIn(xList[xIndex], period);

	var s = 'SlideRoutine(\''+list+'\','+delay+','+period+','+xIndex+')';

	setTimeout(s, delay);	}


function SlideShow(list,delay,period)	{

	var s = 'SlideRoutine(\''+list+'\','+delay+','+period+',0)';

	setTimeout(s, delay);	}





function openView(oid,view)	{			var name = 'cat_'+oid;

	var o = document.getElementById(name),		oo = document.getElementById(name+'_x');

if(o.innerHTML!='')	{
	execURL('?op=cf='+ oid +','+view);		o.innerHTML = '';	o.style.height='';	}
else{	wrapRequest('mod',name, '?mod=of='+ oid +';vf='+ oid +','+ view);	}	}



function closeView(oid,view)	{			var name = 'cat_'+oid;	var o = document.getElementById(name);
if(o.innerHTML!='')	{
	execURL('?op=cf='+ oid +','+view);		o.innerHTML = '';	o.style.height='';	}	}





function FrameContent(id)	{			var x = document.getElementById(id);

if (x.contentDocument)
	var d = x.contentDocument;	else
if (x.contentWindow)
	var d = x.contentWindow.document;
else	var d = window.frames[id].document;		return d.body.innerHTML;	}




	var cpPanel = 'cp_x';

function asyncPatchString(s)	{	var a = 'javascript:wrapRequest(\'cpx\',\''+ cpPanel + '\',\'';
	ExecScripts(s);
	var b = '\')';			return patchString(s, a,b);	}



function submitClose(form)	{	app.submit = oOver.area;	app.form = form;
	var o = byId(form);
	if(o)	{	if(o.onsubmit)	if(o.onsubmit()==false)		return;
					winHide(oOver.area,0);		o.submit();	}	}


function submitApply(form)	{	app.submit = 'apply';		app.form = form;
	var o = byId(form);		if(o)				o.submit();	}


function submitUpdate(form)	{	app.submit = '';		app.form = form;	var o = byId(form);
if(o)	{
	if(o.onsubmit)	{
		if(o.onsubmit())	o.submit();	}	else	o.submit();	}	}



function LinkFrame(frame,out)	{
					var x = document.getElementById(out);
if(x)	{				var z = asyncPatchString(FrameContent(frame));

	if(app.submit=='apply')	{	app.submit = '';	return;	}
	if(app.submit)		{	winClear(app.submit);	app.submit = '';	return;	}

	if(z!='')			x.innerHTML = z;	}			app.submit = '';	}



function CloseFrame(id,win)	{	var s = FrameContent(id);
if(s!='')	{
	winClear(win);			ExecScripts(s);	}	}



function validateUser()	{		xForm = window.document.form;			var oPW = document.getElementById('opw');
	if(oPW)
	if(oPW.value=="")	{	window.alert("Вы не указали пароль");		oPW.focus();		return false; }

	return true;	}





function capsRequest(redraw)	{

	fetchWheel();		fetchOpacity();

	var caps = "?caps&body="+app.sw+'x'+app.sh+"&screen="+screen.width+'x'+screen.height+"&depth="+(((navigator.appName.substring(0,3)=="Mic"))?screen.colorDepth:screen.pixelDepth);

	caps += '&alpha='+app.opaq+'&wheel='+wheelType;

	req = new FetchReq();				if(req)	{
	req.open('GET', caps, true);			req.send(null);
if(redraw)
	setTimeout('window.location.replace(document.URL)', 500);	}	}





function Scroll(dx,dy, name,dt)	{	if(name==undefined)	name = scroll.name;	if(name==undefined)	return false;

	var xX = byId(name+'_bar');	var xH = byId(name+'_hbar');			var xV = byId(name+'_vbar');
	if(dt==undefined)								dt = 250;

	var xClip = name+'_clip';	var xAbs = inAbsolute(name);			var xBeacon = elemPos(name+'_beacon');


	var view = elemPos(name),	clip = elemPos(xClip);
//document.title = clip;
	var x = clip[0],		y = clip[1];		if(dy==undefined)	dy = 0;

	var vS = view[3],		hS = view[2];
	if(xV)				hS -= 16;
	if(xH)				vS -= 16;

	if(clip[3]<=view[3])	{	clip[3] = vS;		if(dy!=0 && dx==0){	dx = dy;	dy = 0;	}	}
	if(clip[2]<=view[2])	{	clip[2] = hS;	}

	x += dx/2;			y += dy/2;

	var minX = xBeacon[0] + hS - clip[2],			maxX = xBeacon[0];
	var minY = xBeacon[1] + vS - clip[3],			maxY = xBeacon[1];
//document.title = minX+' : '+maxX;
	if(x<minX)	x = minX;	if(x>maxX)		x = maxX;
	if(y<minY)	y = minY;	if(y>maxY)		y = maxY;


if(xH){	var partX = parseInt((hS-34)*hS / clip[2]);		part = parseInt(hS - partX - 34);
	var k;	if(clip[2]==hS)		k = 1;		else	var k = (clip[2] - hS - x + minX) / (clip[2] - hS);
	var p = parseInt(k*part);				amorQuery(xH.id, 'w,'+partX+',x,'+p, dt);	}

if(xV){	var partX = parseInt((vS-34)*vS / clip[3]);		var part = parseInt(vS - partX- 34);
	var k;	if(clip[3]==vS)		k = 1;		else	k = (clip[3] - vS - y + minY) / (clip[3] - vS);
	var p = parseInt(k*part);

	amorQuery(xV.id, 'h,'+partX+',y,'+p, dt);	}


	var q = 'x,'+ x +',y,'+ y +',c,'+ (xBeacon[1]-y) +','+ (xBeacon[0]+hS-x) +','+ (xBeacon[1]+vS-y) +','+ (xBeacon[0]-x);

	amorQuery(xClip, q, dt);

//	document.title = x+':'+minX+':'+maxX+' '+y+':'+minY+':'+maxY;
//	document.title = (x=minX || x==maxX)+' '+(y=minY || y==maxY);

	if((x==minX || x==maxX) && (y==minY || y==maxY))	return false;		return true;

}



function ScrollHome(name,dt)	{

	var oView = byId(name),		oClip = byId(name+'_clip');

if(oView)	if(oClip)	{
	if((oClip.clientWidth-16)<oView.clientWidth)
		oClip.style.width = (oView.clientWidth-16)+'px';	}

	Scroll(9999,9999, name,dt);	}



function SystemWheel(e)	{	var evt = window.event || e;

	var delta = evt.detail ? evt.detail*(-120) : evt.wheelDelta;

	if(Math.abs(delta)<360)	delta *= 3;

	if(scroll.over)		scroll.over(delta);

else{	if(scroll.name=='')	return true;

	Scroll(0,delta);	}

if(evt.preventDefault)
	evt.preventDefault();	else	return false;	}



function overrideScroll(func)	{			scroll.over = func;	}

function selectScroll(name)	{			scroll.name = name;	Scroll(0,0,name,250);	}

function clearScroll()	{	scroll.name = '';	scroll.over = '';	}





function wrapRoutine(from,to,bits,x)	{	//	if(to=='?')	return;

	if(bits==undefined)				bits = 0;
	var a = document.getElementById(from);		var b = document.getElementById(to);

	if(a==undefined || b==undefined)		return;

if(bits&1)	{

	sa = 'javascript:wrapRequest(\''+ x +'\',\''+ to +'\',\'';	sb = '\',0)';

	b.innerHTML = patchString(a.innerHTML, sa,sb);	}

else	b.innerHTML = a.innerHTML;	walkTag(b);	KillNode(a);	}



function placeRoutine(from,to,bits,x)	{

	setTimeout('wrapRoutine(\''+from+'\',\''+to+'\','+bits+',\''+x+'\')',0);	}



function placeInWin(from,to){	to = winCreate(to);

	var xWin = document.getElementById(to+'_top');
	xWin.style.visibility = 'visible';

	wrapRoutine(from,to);	fixWinPos(to);	}




function runAlpha0(id)	{	amorQuery(id,'a,0',500);	}
function runAlpha1(id)	{	amorQuery(id,'a,1',500);	}



function thinGroup(names,prefix)	{		if(prefix==undefined)	prefix = '';

	var xList = explode(',', names);		var c = xList.length;

	for(var i=0; i<c; i++)				amorQuery(prefix+xList[i], 'h,0',500);	}



function thinRoll(o)	{
	var o = byId(o);				amorQuery(o.id, 'h,0', 500);	}


function unRoll(o)	{				var o = byId(o), aXY = elemPos(o), hTo = 0, hFrom = o.clientHeight;
//	if(aXY[3]!=0)					return;

	o.style.height = '';				hTo = o.clientHeight;
	o.style.height = hFrom+'px';			amorQuery(o.id, 'h,'+hTo, 500);

	setTimeout('var o = byId(\''+ o.id +'\'); o.style.height="";', 600);	}


function xRoll(o)	{				var o = byId(o);
	if(o==null)			return;		amorQuery(o.id, 'h,0',500);	}



function rollnroll(o)	{				var o = byId(o);		if(o==null)	return;
	var aXY = elemPos(o),		hTo = 0,	hRes = 0;
	o.style.overflow = 'hidden';			if(dTime(o.id)<500)		return 0;

if(aXY[3]==0)	{					o.style.height = '';
	hTo = o.clientHeight;				o.style.height = '0px';
	setTimeout('var o = byId(\''+ o.id +'\'); o.style.height="";', 600);		hRes = 1;

}	else	{

}	amorQuery(o.id, 'h,'+hTo, 500);			return hRes;	}



function CountDown(id,time)	{			var s = 'var x = document.getElementById(\''+ id +'\'); if(x) x.innerHTML = x.innerHTML - 1;';
if(time)	{
	var xKill = setInterval(s,1000);		setTimeout('clearInterval(\''+ xKill +'\')', time*1000+500);	}	}





function xAlert(text,x,y)	{

	if(x==undefined)	x = (app.mx);
	if(y==undefined)	y = (app.my);

	var xDiv = CreateDiv(x,y,192,32, text);

	xDiv.id = uniqid();
	xDiv.className = "xalert";
	xDiv.style.border = '1px solid #000000';
	xDiv.style.backgroundColor = '#ffffff';
	xDiv.style.padding = '5px';
	xDiv.style.width = '';
	xDiv.style.height = '';
	xDiv.style.whiteSpace = 'nowrap';

//	amorQuery(xDiv.id, 'a,0,x,'+(x+100)+',y,'+(y-100), 7500);
	amorQuery(xDiv.id, 'a,0,x,'+(x+100)+',y,0', 7500);
//	amorQuery(xDiv.id, 'a,0,x,0,y,0', 7500);

	setTimeout('KillNode("'+ xDiv.id +'")', 8000);

}





function patchSelect(form)	{

	var aSelect = fetchNodes('SELECT', form);	var c = aSelect.length;

for(var i=0; i<c; i++)	{				var iSelect = aSelect[i];

	var to = iSelect.getAttribute('name2');		var aOption = fetchNodes('OPTION', iSelect);

if(to!=null)	{	var o = byId(to);
	if(o)	{	if(iSelect.selectedIndex==-1)	o.value = '';	else	o.value = aOption[iSelect.selectedIndex].innerHTML;	}	}

}	}



function findObject(a,attr,val)	{
for(var i in a)
	if(a[i].getAttribute(attr)==val)		return a[i];	return null;	}



	var gLenum	= Array(0x00000000,0x03ff4000, 0x87ffffff,0x07fffffe, 0x00000000,0x00000000, 0x00000000,0x00000000);
	var gNumbers	= Array(0x00000000,0x03ff0000, 0x00000000,0x00000000, 0x00000000,0x00000000, 0x00000000,0x00000000);
	var gLetters	= Array(0x00000000,0x00000000, 0x07fffffe,0x07fffffe, 0x00000000,0x00000000, 0x00000000,0x00000000);
	var gLower	= Array(0x00000000,0x00000000, 0x00000000,0x07fffffe, 0x00000000,0x00000000, 0x00000000,0x00000000);
	var gUpper	= Array(0x00000000,0x00000000, 0x07fffffe,0x00000000, 0x00000000,0x00000000, 0x00000000,0x00000000);

function checkSet(s,set)	{			var l = s.length;

for(var i=0; i<s.length; i++)	{			var v = s.charCodeAt(i);
	var a = v>>5,					b = v&31;
	if( (set[a] & (1<<b))==0 )			return false;	}

	return true;	}



function checkSets(v,set)	{			var aSet = explode(',', set),	xFail = 0;

for(var i in aSet)					switch(aSet[i])	{
case 'lenum':
	xFail += checkSet(v,gLenum)==false;		break;
case 'numbers':
	xFail += checkSet(v,gNumbers)==false;		break;
case 'letters':
	xFail += checkSet(v,gLetters)==false;		break;
case 'lower':
	xFail += checkSet(v,gLower)==false;		break;
case 'upper':
	xFail += checkSet(v,gUpper)==false;		break;	}

	return xFail!=aSet.length;	}



function procForm()	{				patchSelect(app.form);


	var a = fetchNodes('select,input,textarea', app.form);
	var xFail = '', v, o;

for(var i in a)	{	if(xFail)	break;		switch(a[i].tagName)	{

case 'SELECT':
//	alert('select');
	break;

case 'TEXTAREA':	case 'INPUT':

	v = a[i].getAttribute('required');
	if(v!=null)		if(a[i].value=='')	{	xFail = 'Поле незаполнено...';	a[i].focus();	break;	}

	v = a[i].getAttribute('equal');
	if(v!=null)	{	o = findObject(a, 'name',v);	if(o!=null)	if(a[i].value!=o.value)	xFail = 'Поля несовпадают...';	a[i].focus();	break;	}

	v = a[i].getAttribute('set');
	if(v!=null)	{	if(checkSets(a[i].value,v)==0){	xFail = 'Недопустимые символы...';	a[i].focus();	break;	}	}

	v = a[i].getAttribute('length');
	if(v!=null)	{	if(a[i].value.length!=v){	xFail = 'Недостаточное количество символов...';	a[i].focus();	}	break;	}
	

//	alert('ta');
	break;

//	a[i]

}	}

if(xFail)	{
	xAlert(xFail);		return false;	}



	return true;

}







function tuner(view,render,type)	{

	var query = '?route=route;view_tune;oid;'+view+';type;'+type;

	winRQ(query);	}





fetchWheel();

if (document.attachEvent)
	document.attachEvent("on"+wheelType, SystemWheel)
if (document.addEventListener)
	document.addEventListener(wheelType, SystemWheel, false);

//	alert(wheelType);


LoadTaskbar();

setTimeout('refreshTaskbar()', 1000);

uScreenWH();

//document.title = getCookie('');

//	alert(FetchNumber());
