
function flashObj(name,id,arg,w,h,align,classname,fvars,scale,salign)
{
this.id=id;
this.name=name;
this.src=arg;
if (scale)this.scale=scale;
else this.scale='';
if (document.getElementById(id)) this.elem=document.getElementById(id);
else this.elem=false;
if (w!='0') {this.width=' width="'+w+'"';}
else this.width='';
if (h!='0') {this.height=' height="'+h+'"';}
else this.height='';
if (classname.length>0)
this.classname=' class="'+classname+'"';
else this.classname='';
if (salign) this.salign=salign;
else this.salign='';

if (fvars.length>0)this.fvars='<PARAM NAME=FlashVars VALUE="'+fvars+'">';
else this.fvars='';
this.align=' align="'+align+'"';	
this.counter=0;
this.timeoutId;
this.writeFlash();}

flashObj.prototype.writeFlash=function()
{
var alterscale='';
var fl='<object '+this.classname+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id=fl'+this.id+' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"'+this.width+this.height+this.align+'>';
fl=fl+'<param name="allowScriptAccess" value="sameDomain" />';
fl=fl+'<param name="movie" value="'+this.src+'" /><param name="quality" value="autohigh" />';
fl=fl+'<param name="menu" value="false" /><param name="wmode" value="transparent" />';
if (this.scale.length>0)
	{
	fl=fl+'<param name="scale" value="'+this.scale+'" />';
	alterscale=' scale="'+this.scale+'" ';
	}
if (this.salign.length>0)
	{
	fl=fl+'<param name="salign" value="'+this.salign+'" />';
	alterscale=' salign="'+this.salign+'" ';
	}

fl=fl+this.fvars;
fl=fl+'<embed  '+this.classname+'" src="'+this.src+'" '+alterscale+' quality="autohigh" menu="false" wmode="transparent" id=ffl'+this.id+this.width+this.height+this.align+'  allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
fl=fl+'</embed></object>';
this.elem.innerHTML=fl;
if (parseInt(this.elem.offsetWidth)==0&&this.counter<5)
	{
	this.timeoutId = setTimeout(this.name+".writeFlash()", 30);
	}
else clearTimeout(this.timeoutId);

}

function movedDivs()
{
this.divs=new Array();
this.freedivs=new Array();
this.fl=this.freedivs.length;

}

movedDivs.prototype.addForm=function(id,url,cloned,nodeid)
{
var newid=this.divs.length;
if (this.fl>0)
	{
	newid=this.freedivs.shift();
	this.fl--;
	}
var object=new formObject(id,url,nodeid,newid);
this.divs[newid]=object;	
object.cloneMe(cloned);

}

movedDivs.prototype.removeDiv=function(id)
{
this.freedivs[this.fl]=id;
this.fl++;
this.divs[id]=null;

}

movedDivs.prototype.findMe=function(id)
{
var ret=false;
var l=this.divs.length-1;
for (i=l;i>=0;i--)
	{
	if (this.divs[i].domEl.id==id)
		{
		ret=this.divs[i].form;
		break;
		} 
	}
return ret;
}


function formObject(id,url,nodeid,arrid)
{
this.domEl=document.getElementById(id);
this.url=url;
this.arrid=arrid;
this.formid='';
this.form=null;
this.nodeid=parseInt(nodeid);
if (!isNaN(this.nodeid)&&this.nodeid>0&&this.url.length>0)this.url=this.url+'&id='+this.nodeid;
this.formobj=null;
this.parent=this.domEl.parentNode;

}

formObject.prototype.listNodes=function()
{
var list=new Array();
try
	{
	var treeWalker = document.createTreeWalker(
		   this.domEl,
		NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_COMMENT + NodeFilter.SHOW_TEXT,
		{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
		   false
		);
	while (treeWalker.nextNode())
		{
		list.push(treeWalker.currentNode)
		}
	}
catch (e)
	{
	if (document.all)
		{
		var cl=this.domEl.all.length;
		for (var i=0;i<cl;i++)
			{
			list.push(this.domEl.all[i]);
			}
		}
	}



return list}

formObject.prototype.cloneMe=function(cloned)
{
if (cloned)
	{
	this.domEl=this.domEl.cloneNode(true);
	if (this.domEl.id&&this.domEl.id.length>0)this.domEl.id=this.arrid+this.domEl.id;
	this.parent.appendChild(this.domEl);
	}
var nl=this.listNodes();	 

var cl=nl.length;

for (var i=0;i<cl;i++)
	{
	if (nl[i].id&&nl[i].id.length>0)nl[i].id=this.arrid+nl[i].id;
	if (nl[i].tagName&&nl[i].tagName.toLowerCase()=='form')
		{
		this.formid=nl[i].id;
		this.form=nl[i];
		}
	}
this.formobj=new chekf(this.form,'moved.divs['+this.arrid+'].formobj',this.nodeid);
if (this.url.length>0) this.formobj.url=this.url;
this.formobj.createForm();
this.domEl.style.display='block';

}

formObject.prototype.killMe=function()
{
this.formobj.deleteIt();
this.formobj=null;
var domEl=this.domEl.cloneNode(false);
this.parent.removeChild(this.domEl);
this.domEl=domEl;
this.parent.appendChild(this.domEl);
moved.removeDiv(this.arrid);

}

function ContentLoader(url,method,params,component)
{
	this.head=false;
	this.component=component;
	this.url=url;
	this.method=method;
	this.params=params;
	this.par='';

}

ContentLoader.prototype.getTransport=function()
{
var transport=null;
	try
		{
		   transport=new ActiveXObject('Msxml2.XMLHTTP');
		}
	catch (e)
		{
		try
			{
			transport=new ActiveXObject('Microsoft.XMLHTTP');
			}
		catch (e)
			{
			if(window.XMLHttpRequest)
				{
				transport=new XMLHttpRequest();
				}
			}
		}


return transport}

ContentLoader.prototype.setParams=function()
{
if (!this.method) this.method="GET";
	if (this.method=="POST")
		{
		this.head='application/x-www-form-urlencoded';
		var parL=this.params.length;
		if (parL>0)
			{
			this.par= this.params[0].name +'=' + encodeURIComponent(this.params[0].value);
			for (i=1;i<parL;i++)
				{
				this.par+='&' + this.params[i].name +'=' + encodeURIComponent( this.params[i].value);
				}
			}
		}}

ContentLoader.prototype.loadXMLDoc=function()
{
var request=this.getTransport();
		if (request)
			{
			this.setParams();
			if (request.overrideMimeType)
				{
				request.overrideMimeType('text/html');
				}
			var loader=this;
			request.onreadystatechange=function ()
				{
				loader.onReadyState(request);
				}
			request.open (this.method,this.url,true);
			if (this.head)
				{
				request.setRequestHeader("Content-Type",this.head);
				request.setRequestHeader("Content-length", this.params.length);
				  request.setRequestHeader("Connection", "close");
				}
			request.send (this.par);
			}

}

ContentLoader.prototype.onReadyState=function(request)
{
var ready=request.readyState;	
		if (ready==4)
			{
			var httpStatus=request.status;
			if (httpStatus==200||httpStatus==0)
				{
				if (this.component.ajaxUpdate) this.component.ajaxUpdate(request);
				else
					{
					this.component=new chekf(this.component,this.component.id)
					this.component.ajaxUpdate(request);
					}
				}
			}

}

function chekf(domEl,name,node_id)
{
this.name=name;
	this.node_id=node_id;
	this.sending=false;
	this.id=domEl.id;
	this.url='/index.'+'php?action=sendform&id='+this.node_id+'&formid='+this.id;
	this.domEl=domEl;
	this.childs=this.domEl.elements;
	this.elemNumb=this.childs.length;
	this.divid=this.domEl.parentNode.id;
	this.diverr=this.id+'err';
	this.childobjs=new Array();
	this.childNumb=this.childobjs.length;
	this.beginload=true;
	this.domEl.inpuObj=this;
	this.domEl.onsubmit=this.sendForm;
	this.error=false;
	this.wait=false;
	this.pars=new Array();
	this.timeout_id;
	this.sending=false;
	this.lowdiverr=this.id+'lowerr';}

chekf.prototype.ajaxUpdate=function(request)
{
var div=document.getElementById(this.diverr);
	var data=request.responseText;
	var arr = data.split('myperfectdevidehtml');
	var unchange=false;
	if (arr.length>1)
		{
		if (arr[1]=='myperfectsamehtml')
			{
			var testinner=new String(div.innerHTML);
			var testar=testinner.split('<script>');
			if (testar.length==1)testar=testinner.split('<SCRIPT>');
			arr[1]=testar[0];
			unchange=true;
			}
		div.innerHTML=arr[1];
		}
	arr = data.split('myperfectdevidejavascript');
	if (arr.length>1)
		{
		var theScript;
		if (unchange)
			{
			if (testar.length>1&&testar[1].length>0)
				{
				testinner=testar[1].split('<'+'/script>');
				if (testinner.length==1)testinner=testar[1].split('</'+'SCRIPT>');
				theScript= document.createElement('script');
				theScript.text=testinner[0];
				div.appendChild(theScript);
				} 
			}
		if (arr[1].length>0)
			{
			if (navigator.appVersion.indexOf('MSIE 6.0')>0)		eval (arr[1])
			else
				{
				theScript= document.createElement('script');
				theScript.text = arr[1];
				div.appendChild(theScript);
				}
			}
		}
	this.sending=false;
this.pars=new Array();

}

chekf.prototype.checkError=function()
{
this.error=false;
		document.getElementById(this.diverr).innerHTML='';
		if (this.beginload)
			{
			var inner='';
			for (var i=0;i<this.childNumb;i++)
				if (this.childobjs[i].error==true)
					{
					this.error=true;
					}
				else
					{
					if (!this.childobjs[i].beginload&&this.childobjs[i].requred)
						{
						if (this.childobjs[i].diverr)this.childobjs[i].diverr.innerHTML='Вы не заполнили обязательное поле ' + this.childobjs[i].defaultValue;	
						else
							{
							if (inner.length>0) inner=inner + '<br>';
							inner=inner+'Вы не заполнили обязательное поле ' + this.childobjs[i].defaultValue;
							}						
						this.error=true;
						}
					}
			if (inner.length>0) document.getElementById(this.diverr).innerHTML=inner;
			}
		else
			{
			this.error=true;
			document.getElementById(this.diverr).innerHTML='Вы не заполнили форму';
			}
	if (this.error&&this.lowdiverr&&document.getElementById(this.lowdiverr))document.getElementById(this.lowdiverr).innerHTML='При заполнении формы допущены ошибки';

}

chekf.prototype.deleteIt=function()
{
for (var i=0;i<this.childNumb;i++)
	{
	this.childobjs[i]=null;
	}

}

chekf.prototype.checkWait=function()
{
this.wait=false;
		for (var i=0;i<this.childNumb;i++)
			if (this.childobjs[i].wait)
				{
				this.wait=true;
				break;
				}

}

chekf.prototype.prepareForm=function()
{
	for (var i=0;i<this.elemNumb;i++)
		{
		if (this.childs[i].value==this.childs[i].defaultValue)this.childs[i].value='';
		}
this.pars=new Array();

}

chekf.prototype.createForm=function()
{
this.childobjs=new Array();
this.elemNumb=this.domEl.elements.length;
var vl;
var j=0;
	for (var i=0;i<this.elemNumb;i++)
		{
//		if (this.domEl.elements[i].type=='checkbox')this.domEl.elements[i].checked=false;
		this.childobjs[i]=new chekEl(this.childs[i]);
		if (this.domEl.elements[i].id)
			{
			this.childobjs[i].minvalue=parseInt(this.domEl.elements[i].getAttribute('minvalue'));	
			this.childobjs[i].defaultValue=this.domEl.elements[i].getAttribute('defaultValue');	
			if (this.childobjs[i].defaultValue=='')
				{
				vl=this.domEl.elements[i].attributes.length;
				for (j=0;j<vl;j++)
					{
					if (this.domEl.elements[i].attributes[j].name=='defaultValue')
						{
						this.childobjs[i].defaultValue=this.domEl.elements[i].attributes[j].value;
						}
					}
				}
			this.childobjs[i].requred=this.domEl.elements[i].getAttribute('requred').parseBoolean();	
			this.childobjs[i].ajax=this.domEl.elements[i].getAttribute('ajax').parseBoolean();	
			this.childobjs[i].linked=this.domEl.elements[i].getAttribute('linked').parseBoolean();	
			this.childobjs[i].defaultFill=this.domEl.elements[i].getAttribute('defaultFill').parseBoolean();	
			this.childobjs[i].testedTogether=this.domEl.elements[i].getAttribute('testedTogether').parseBoolean();	
			this.childobjs[i].beginload=this.domEl.elements[i].getAttribute('beginload').parseBoolean();	
			if (!this.childobjs[i].beginload)this.beginload=false;	
			this.childobjs[i].testedTogetherJsMet=this.domEl.elements[i].getAttribute('testedTogetherJsMet').parseBoolean();	
			if (this.childobjs[i].linked&&this.childobjs[i].domEl.type=='text')
				{
				var id1=this.childobjs[i].id+'1';
				this.childobjs[i].divid=id1+'err';
				if (document.getElementById(this.childobjs[i].divid))this.childobjs[i].diverr=document.getElementById(this.childobjs[i].divid);
				var passdefault=this.childobjs[i].defaultValue;
				}
			if (this.childobjs[i].linked&&this.childobjs[i].domEl.type=='password')
				{
				this.childobjs[i].defaultValue=passdefault;
				}
			}
		}
	this.childNumb=this.childobjs.length;

}

chekf.prototype.clearForm=function()
{
for (var i=0;i<this.elemNumb;i++)
		{
		this.childobjs[i].clearMe();
		}
		this.pars=new Array();
	
}

chekf.prototype.checkForm=function()
{
	for (var i=0;i<this.elemNumb;i++)
		{
		this.childobjs[i].CheckMe();
		}

}

chekf.prototype.sendForm=function()
{
if (!this.id)
		{
		var inpuObj=this.inpuObj.formEl.inpuObj;
		}
	else
		{
		var inpuObj=this;
		}
	var cmd=inpuObj.name+'.sendForm()';
	inpuObj.checkWait();
	if (!inpuObj.wait&&!inpuObj.sending)
		{
		if (inpuObj.timeout_id)clearTimeout(inpuObj.timeout_id);
		inpuObj.checkError();
		if (!inpuObj.error)
			{
			var par;
			var name;

			var name1;
			var name2;
			var arrmypar=''
			for (var i=0;i<inpuObj.elemNumb;i++)
				{
				if ((inpuObj.domEl.elements[i].type!='radio'&&inpuObj.domEl.elements[i].type!='checkbox')||(inpuObj.domEl.elements[i].checked))
					{
					inpuObj.pars[inpuObj.pars.length]=new inhtObject(inpuObj.domEl.elements[i].name,inpuObj.domEl.elements[i].value);
					}
				}
			inpuObj.pars[inpuObj.pars.length]=new inhtObject('myformname',inpuObj.name);
			var sender=new ContentLoader(inpuObj.url,'POST',inpuObj.pars,inpuObj);
			inpuObj.sending=true;
			sender.loadXMLDoc();
			}
		}
	else
		{
		inpuObj.timeout_id=setTimeout (cmd,50);
		}

}

function checkstatic(domEl,name,url)
{
	this.name=name;
	this.id=domEl.id;
	this.url=url;
	this.domEl=domEl;
	this.diverr=this.id;
	this.domEl.inpuObj=this;

}

checkstatic.prototype.ajaxUpdate=function(request)
{
	var div=document.getElementById(this.diverr);
	var data=request.responseText;
	var arr = data.split('myperfectdevidehtml');
	var unchange=false;
	if (arr.length>1)
		{
		if (arr[1]=='myperfectsamehtml')
			{
			var testinner=new String(div.innerHTML);
			var testar=testinner.split('<script>');
			if (testar.length==1)testar=testinner.split('<SCRIPT>');
			arr[1]=testar[0];
			unchange=true;
			}
		div.innerHTML=arr[1];
		}
	arr = data.split('myperfectdevidejavascript');
	if (arr.length>1)
		{
		var theScript;
		if (unchange)
			{
			if (testar.length>1&&testar[1].length>0)
				{
				testinner=testar[1].split('<'+'/script>');
				if (testinner.length==1)testinner=testar[1].split('</'+'SCRIPT>');
				theScript= document.createElement('script');
				theScript.text=testinner[0];
				div.appendChild(theScript);
				} 
			}
		if (arr[1].length>0)
			{
			if (navigator.appVersion.indexOf('MSIE 6.0')>0)		eval (arr[1])
			else
				{
				theScript= document.createElement('script');
				theScript.text = arr[1];
				div.appendChild(theScript);
				}
			}
		}

}

function chekEl(domEl)
{
this.domEl=domEl;
	this.defaultFill=true;
	this.linked=false;
	this.id=domEl.id;
	this.testedTogether=false;
	this.requred=false;
	this.formEl=this.domEl.form;
	this.divid=this.id+'err';
	this.beginload=false;
	this.name=this.domEl.name;
	this.oldname=this.domEl.name;
	this.testedTogetherJsMet=false;
	if (document.getElementById(this.divid))
	this.diverr=document.getElementById(this.divid);
	else this.diverr=null;
	this.value=this.domEl.value;
	this.defaultValue=this.domEl.defaultValue;
	this.color=colobj.color2;
	this.errorcolor=colobj.color1;
	this.minvalue=0;
	this.error=false;	
	this.wait=false;
	this.pars=new Array();
	this.nodeid=false;
	this.domEl.inpuObj=this;
	this.domEl.onfocus=this.prepareMe;
	this.domEl.onblur=this.tryMe;
	if (this.domEl.type=='button')
		{
		this.domEl.onclick=this.formEl.inpuObj.sendForm;
		this.domEl.onfocus=null;
		this.domEl.onblur=null;
		this.beginload=true;
		}

}

chekEl.prototype.clearPass=function()
{
var inpuObj=this;
var ind=inpuObj.id.length-1;
var id1=inpuObj.id.substring(0,ind);
var newdEl=document.getElementById(id1);
newdEl.style.visibility='visible';
newdEl.style.display='block';
inpuObj.domEl.style.visibility='hidden';
inpuObj.domEl.style.display='none';
if (inpuObj.defaultFill) newdEl.value=inpuObj.defaultValue;
inpuObj.domEl.value='';
inpuObj.beginload=false;

}

chekEl.prototype.clearMe=function()
{
this.pars=new Array();
if (this.domEl.type!='button')
	{
	if (this.diverr) this.diverr.innerHTML='';
	this.domEl.style.color=this.color;
	if (this.defaultFill)
		{
		this.value=this.defaultValue;
		this.domEl.value=this.defaultValue;
		}
	this.beginload=false;
	if (this.domEl.type=='password') this.clearPass();
	}
else
	{
	this.domEl.onclick=this.formEl.inpuObj.sendForm;
	this.domEl.onfocus=null;
	this.domEl.onblur=null;
	this.beginload=true;
	}

}

chekEl.prototype.ajaxUpdate=function(request)
{
var div=this.diverr;
	var data=request.responseText;
	var arr = data.split("myperfectdevidehtml");
	var unchange=false;
	if (arr.length>1)
		{
		if (arr[1]=="myperfectsamehtml")
			{
			var testinner=new String(div.innerHTML);
			var testar=testinner.split("<"+"script>");
			if (testar.length==1)testar=testinner.split("<"+"SCRIPT>");
			arr[1]=testar[0];
			unchange=true;
			div.innerHTML=arr[1];
			}
		else
			{
			if (arr[1].length==0)
				{
				this.error=false;
				this.domEl.style.color=this.color;
				div.innerHTML='';
				}
			else
				{
				this.error=true;
				this.domEl.style.color=this.errorcolor;
				div.innerHTML=arr[1];

				}
			}
		}
	arr = data.split("myperfectdevidejavascript");
	if (arr.length>1)
		{
		var theScript;
		if (unchange)
			{
			if (testar.length>1&&testar[1].length>0)
				{
				testinner=testar[1].split("</"+"script>");
				if (testinner.length==1)testinner=testar[1].split("</"+"SCRIPT>");
				theScript= document.createElement('script');
				theScript.text=testinner[0];
				div.appendChild(theScript);
				} 
			}
		if (arr[1].length>0)
			{
			if (navigator.appVersion.indexOf('MSIE 6.0')>0)		eval (arr[1])
			else
				{
				theScript=document.createElement('script');
				theScript.text = arr[1];
				div.appendChild(theScript);
				}
			}

		}
	this.pars=new Array();
	this.wait=false;}

chekEl.prototype.prepareMe=function()
{
var inpuObj;
if (this.parentNode)inpuObj=this.inpuObj;
else inpuObj=this;

if (this.type=='text'&inpuObj.linked) inpuObj.preparePass();
else
	{
	if (!inpuObj.beginload)
		{
		inpuObj.formEl.inpuObj.beginload=true;
		inpuObj.value='';
		inpuObj.beginload=true;
		inpuObj.domEl.value='';
		}
	}}

chekEl.prototype.preparePass=function()
{
var inpuObj=this;
var id1=inpuObj.id+'1';
var newdEl=document.getElementById(id1);
inpuObj.domEl.style.visibility='hidden';
inpuObj.domEl.style.display='none';
newdEl.style.visibility='visible';
newdEl.style.display='block';
newdEl.focus();

}

chekEl.prototype.tryMe=function()
{
var inpuObj=this.inpuObj;
if (this.type=='password'&inpuObj.linked) inpuObj.tryMePass();
else
	{
	if (inpuObj.beginload)
		{
		inpuObj.value=this.value;
		inpuObj.checkMe();	
		}
	}

}

chekEl.prototype.tryMePass=function()
{
var inpuObj=this;
inpuObj.value=inpuObj.domEl.value;
var str=new String(inpuObj.value);
inpuObj.value=str.trim();
if (inpuObj.beginload)
	{
	if (inpuObj.value.length<=inpuObj.minvalue)
		{
		var mess;
		inpuObj.error=true;
		if (inpuObj.minvalue==0)
			{
			mess='Вы не заполнили обязательное поле "'+inpuObj.defaultValue+ '"';
			inpuObj.clearPass();
			}
		else mess='Длина обязательного поля "'+inpuObj.defaultValue+ '" меньше '+inpuObj.minvalue;
		if (inpuObj.diverr)inpuObj.diverr.innerHTML=mess;
		var ind=inpuObj.id.length-1;
		var id1=inpuObj.id.substring(0,ind);
		var newdEl=document.getElementById(id1);
		newdEl.style.color=inpuObj.errorcolor;				 
		}
	else
		{
		inpuObj.error=false;
		var ind=inpuObj.id.length-1;
		var id1=inpuObj.id.substring(0,ind);
		var newdEl=document.getElementById(id1);
		newdEl.style.color=inpuObj.color;				 
		if (inpuObj.diverr)inpuObj.diverr.innerHTML='';
		}	
	}

}

chekEl.prototype.findOthers=function()
{
var res=new Array();
for(var i=0;i<this.formEl.inpuObj.childNumb;i++)
	{
	if (this.formEl.inpuObj.childobjs[i].testedTogetherJsMet.toString()==this.testedTogetherJsMet.toString()) res[res.length]=this.formEl.inpuObj.childobjs[i];
	}

return res}

chekEl.prototype.findElem=function(name)
{
for(var i=0;i<this.formEl.inpuObj.childNumb;i++)
	{
	if (this.formEl.inpuObj.childobjs[i].testedTogetherJsMet.toString()==this.testedTogetherJsMet.toString()&&this.formEl.inpuObj.childobjs[i].oldname.toString()==name) return this.formEl.inpuObj.childobjs[i];
	}

}

chekEl.prototype.riseIt=function(name)
{
this.requred=true;
if (this.domEl.type=='text'||this.domEl.type=='textarea')
		{
		this.beginload=false;
		}
else this.beginload=true;
this.error=false;
if (this.domEl.options)this.domEl.options[0].selected=true;
this.domEl.parentNode.parentNode.style.display='block';
this.domEl.name=name;

}

chekEl.prototype.hideIt=function(affected)
{
if (this.requred)
	{
	this.requred=false;
	this.beginload=true;
	this.domEl.parentNode.parentNode.style.display='none';
	this.domEl.value='';
	this.domEl.name=this.oldname;
	this.name=this.oldname;
	var elem;
	if (affected[this.oldname].length>0)
		{
		var toCheck=this.findOthers();
		elem=toCheck.shift();
		while(elem.domEl.name.toString()!=affected[this.oldname]&&toCheck.length>0)
			{
			elem=toCheck.shift();
			}
		elem.hideIt(affected);
		}
	}

}

chekEl.prototype.checkMe=function()
{
var inpuObj=this;
if (inpuObj.formEl.inpuObj.error&&inpuObj.formEl.inpuObj.lowdiverr&&document.getElementById(inpuObj.formEl.inpuObj.lowdiverr))document.getElementById(inpuObj.formEl.inpuObj.lowdiverr).innerHTML='';
	var mess;
	if (inpuObj.requred)
		{
		if (inpuObj.ajax)inpuObj.wait=true;
		var str=new String(inpuObj.value);
		inpuObj.value=str.trim();
		if (inpuObj.value.length<=inpuObj.minvalue)
			{
			inpuObj.error=true;
			if (inpuObj.minvalue==0)
				{
				mess='Вы не заполнили обязательное поле "'+inpuObj.defaultValue+ '"';
				inpuObj.clearMe();
				}
			else mess='Введенная длина обязательного поля "'+inpuObj.defaultValue+ '" меньше '+(inpuObj.minvalue+1);
			if (inpuObj.diverr)inpuObj.diverr.innerHTML=mess;
			inpuObj.domEl.style.color=inpuObj.errorcolor;				 
inpuObj.wait=false;			
}
		else
			{
			if (inpuObj.testedTogetherJsMet)
				{
				if (typeof inpuObj.testedTogetherJsMet=='function')inpuObj.testedTogetherJsMet.call(inpuObj);
				else Function[inpuObj.testedTogetherJsMet].call(inpuObj);
				}
			else inpuObj.error=false;
			if (!inpuObj.error)	
				{
				if (inpuObj.ajax)
					{
					var pars;
					inpuObj.wait=true;
					if (inpuObj.testedTogether)
						{
						var formob=inpuObj.formEl.inpuObj;
						var name;
						var name1;
						var name2;
						var arrmypar=''
						for (var k=0;k<formob.childNumb;k++)
							{
							if (formob.childobjs[k].beginload)
								{
								inpuObj.pars[inpuObj.pars.length]=new inhtObject(formob.childobjs[k].name,formob.childobjs[k].value);
								}
							}
						}
					else
						{
						inpuObj.pars[inpuObj.pars.length]=new inhtObject(inpuObj.name,inpuObj.value);
						}
					var url='/index.'+'php?action=check&what='+inpuObj.domEl.name;
					var sender= new ContentLoader(url,'POST',inpuObj.pars,inpuObj);
					sender.loadXMLDoc();
					}
				else
					{
					inpuObj.error=false;
					if (inpuObj.diverr&&inpuObj.diverr.innerHTML.length>0)inpuObj.diverr.innerHTML='';
					inpuObj.domEl.style.color=inpuObj.color;				 
					}	
				}
			}
		}}

function moveObject(id,name,elemwidth,tagname)
{
this.elem=document.getElementById(id);
this.parent=this.elem.parentNode;
this.name=name;
this.moving=false;
this.changing=false;
this.left=0;
this.top=0;
this.pausecounter=0;
this.timeoutId;
if (isNaN(elemwidth)) this.elemwidth=160;
else this.elemwidth=elemwidth;
if (!tagname) this.tagname='a';
else this.tagname=tagname;
this.myImg=false;
this.paused=false;
this.stopped=false;
var myImagesColl=this.elem.getElementsByTagName(this.tagname);
this.myImages=new Array()
for (i=myImagesColl.length-1;i>=0;i--)
	{
	myImagesColl[i].childNodes[0].inpuObj=this;
	myImagesColl[i].childNodes[0].onmouseover=this.stop;
	myImagesColl[i].childNodes[0].onmouseout=this.move;
	this.myImages.unshift(myImagesColl[i]);
	}
this.activeObject;
this.removedRight=false;
this.removedTop=false;
this.removedLeft=false;}

moveObject.prototype.swapFirst=function()
{
var temp=this.elem.removeChild(this.myImages[0]);
temp=this.elem.appendChild(temp);
temp.childNodes[0].inpuObj=this;
temp.childNodes[0].onmouseover=this.stop;
temp.childNodes[0].onmouseout=this.move;
this.elem.style.left=parseInt(this.elem.style.left)+this.elemwidth+'px';
this.myImages.push(temp);
temp=this.myImages.shift();
if (temp.inpuObj)temp.inpuObj=null;
temp.onmouseover=null;
temp.onmouseout=null;
temp=null;
this.moving=true;
this.changing=false;
this.moveLeft();

}

moveObject.prototype.swapLast=function()
{
var temp=this.elem.removeChild(this.myImages.pop());
temp=this.elem.insertBefore(temp,this.myImages[0]);
temp.childNodes[0].inpuObj=this;
temp.childNodes[0].onmouseover=this.stop;
temp.childNodes[0].onmouseout=this.move;
this.elem.style.left=parseInt(this.elem.style.left)-this.elemwidth+'px';
this.myImages.unshift(temp);
this.moving=true;
this.changing=false;
this.moveRight();

}

moveObject.prototype.stop=function()
{
var inpuObj;
if (!this.inpuObj)inpuObj=this;
else inpuObj=this.inpuObj;
if (!inpuObj.changing&&!inpuObj.paused)
	{
	inpuObj.activeObject=this;
	inpuObj.moving=false;
	clearTimeout(inpuObj.timeoutId);
	inpuObj.stopped=true;
	}}

moveObject.prototype.move=function()
{
var inpuObj;
if (!this.inpuObj)inpuObj=this;
else inpuObj=this.inpuObj;
if (inpuObj.stopped&&inpuObj.activeObject==this)
	{
	this.stopped=false;
	inpuObj.activeObject=false;

	if (inpuObj.removedTop)inpuObj.moveTop();
	else if (inpuObj.removedRight)inpuObj.moveRight();
		else inpuObj.moveLeft();	
	}}

moveObject.prototype.moveLeft=function()
{
if (this.removedRight)	clearTimeout(this.timeoutId);
this.removedRight=false;
this.removedTop=false;
this.removedLeft=true;
this.left=parseInt(this.elem.style.left);
if (isNaN(this.left))this.left=0;
if (this.left<(-(this.elemwidth*6)))
	{
	clearTimeout(this.timeoutId);
	this.moving=false;
	this.changing=true;
	this.swapFirst();	
	}
else
	{
	this.moving=true;
	this.elem.style.left=this.left-1+'px';
	this.timeoutId = setTimeout(this.name+".moveLeft()", 50);
	}}

moveObject.prototype.moveRight=function()
{
if (this.removedLeft)	clearTimeout(this.timeoutId);
this.removedRight=true;
this.removedTop=false;
this.removedLeft=false;
this.left=parseInt(this.elem.style.left);
if (this.left>(-(this.elemwidth*4)))
	{
	clearTimeout(this.timeoutId);
	this.moving=false;
	this.changing=true;
	this.swapLast();	
	}
else
	{
	this.elem.style.left=this.left+1+'px';
	this.timeoutId = setTimeout(this.name+".moveRight()", 50);
	}}

moveObject.prototype.moveTop=function()
{
this.removedRight=false;
this.removedTop=true;
this.removedLeft=false;
this.top=parseInt(this.elem.style.top);
if (isNaN(this.top))this.top=0;
if (this.top<(-(this.elemwidth)))
	{
	clearTimeout(this.timeoutId);
	this.moving=false;
	this.changing=true;
	this.swapTop();	
	}
else
	{
	this.moving=true;
	this.elem.style.top=this.top-1+'px';
	this.timeoutId = setTimeout(this.name+".moveTop()", 35);
	}}

moveObject.prototype.pauseMe=function()
{
if (this.pausecounter>60)
	{
	this.pausecounter=0;
	this.moved=true;
	this.paused=false;
	clearTimeout(this.timeoutId);
	this.moveTop();
	}
else
	{
	this.pausecounter++;
	this.moving=false;
	this.paused=true;
	this.timeoutId = setTimeout(this.name+".pauseMe()", 60);
	}}

moveObject.prototype.swapTop=function()
{
var temp=this.elem.removeChild(this.myImages[0]);
temp=this.elem.appendChild(temp);
temp.childNodes[0].inpuObj=this;
temp.childNodes[0].onmouseover=this.stop;
temp.childNodes[0].onmouseout=this.move;
this.elem.style.top=parseInt(this.elem.style.top)+this.elemwidth+'px';
this.myImages.push(temp);
temp=this.myImages.shift();
if (temp.inpuObj)temp.inpuObj=null;
temp.onmouseover=null;
temp.onmouseout=null;
temp=null;
this.moving=true;
this.changing=false;
this.pauseMe();}

function inhtObject(name,value)
{
this.name=name;
	this.value=value;

}

function colorObject()
{
	this.color1='#ff0000';
	this.color2='#9b9fa5';

}

var colobj=new colorObject();
var moved=new movedDivs(); 



Function.prototype.checkurl=function()
	{
	if (this.domEl.name!='email')
		{
		var toCheck=this.findOthers();
		
		var mail=toCheck.shift();
		while(mail.domEl.name.toString()!='email'&&toCheck.length>0)
			{
			mail=toCheck.shift();
			}
		mail.domEl.value=mail.domEl.value.trim().toLowerCase();
		this.domEl.value=this.domEl.value.trim().toLowerCase();
		var error=true;
		if (mail.beginload&&this.beginload)
			{
			var mval=email(mail.domEl.value);
			var uval=url(this.domEl.value);
			uval=uval.toLowerCase();
			mval=mval.toLowerCase();
			if (uval.substr(uval.lastIndexOf(mval))==mval)error=false;
			if (!error)
				{
				if (mail.diverr.innerHTML.length=='')
					{
					this.diverr.innerHTML='';
					this.error=false;
					this.domEl.style.color=this.color;	
					}
				else
					{
					this.error=true;
					this.domEl.style.color=this.errorcolor;	
					this.diverr.innerHTML='Вы неправильно заполнили поле URL официального сайта';
					}
				}
			else
				{
				this.error=true;
				this.domEl.style.color=this.errorcolor;	
				this.diverr.innerHTML='URL почтового домена должен совпадать с URL официального сайта компании';
				}
			}
		}
	else 
		{
					myurl=this.findElem('siteurl');
					this.diverr.innerHTML='';
					this.error=false;
					this.domEl.style.color=this.color;
					myurl.checkMe();	

		}	
	}

Function.prototype.testPhone=function()
{
var str='';
var val=this.value.trimPhone();
if (val.length>0)
	{
	str='Вы неправильно заполнили обязательное поле "'+this.defaultValue+'"';
	this.error=true;
	this.domEl.style.color=this.errorcolor;
	}
else
	{
	this.error=false;
	this.domEl.style.color=this.color;
	}
if (this.diverr)this.diverr.innerHTML=str;
}




function email(str)
{
var ind=str.lastIndexOf('@')+1;
if (ind>0)str=str.slice(ind);
else str='';
return str; 
}

function url(str)
{
	var regexp=/http:/gi;
	str=str.replace(regexp,'');
	var regexp=/:/gi;
	str=str.replace(regexp,'');
	var regexp=/\//gi;
	str=str.replace(regexp,'');
	var regexp=/^www\./gi;
	str=str.replace(regexp,'');
	return str;
}

function normalizeUrl(str)
{
	str='http://'+url(str);
	return str;
}



	
	
function worktask(action,nodeid)
{
var act='/index.'+'php?action='+action+'&id='+nodeid;
var pars=new Array();
var divid='addobject';
var stat=new checkstatic(document.getElementById(divid),divid,act);
sender= new ContentLoader(stat.url,'POST','',stat);
sender.loadXMLDoc();

}

function setRemember(nodeid)
{
var elem=document.getElementById('authcont');
var forms=elem.getElementsByTagName('form');
var cmd=forms[0].inpuObj.name.slice(0,-8)+'.killMe();';
eval(cmd);
var inner='<div id=remembererr class=error></div><form name=remember id="remember" method="POST" class="formrenew formauth formremember" ><h3>Вспомнить пароль</h3><div class=authfield><input type=text minvalue="0" requred=true ajax=false defaultValue="Логин" linked=false defaultFill=true testedTogether=false beginload=false testedTogetherJs=false testedTogetherJsMet=false id=email name=email class=areasmall value="Логин"></div><div class=butt><input type=button class=buttren value="ok"></div><p><a href=/registr.html>Регистрация</a>&nbsp;/&nbsp;<a href="javascript:setAuth(\'\','+nodeid+');">авторизация</a></p></form>';

//var inner='<form name=remember id="remember" method="POST"><div id=remembererr class=error ></div><h2>Вспомнить пароль</h2><div class=authfield><input type=text minvalue="0" requred=true ajax=false defaultValue="Логин" linked=false defaultFill=true testedTogether=false beginload=false testedTogetherJs=false testedTogetherJsMet=false id=email name=email class=areasmall value="Логин"></div><div class=butt><input type=button class=butt value="Выслать пароль" class=but></div></form><p><a href=/?action=show&id=360><strong>регистрация</strong></a>&nbsp;|&nbsp;<a href="javascript:setAuth(\'\','+nodeid+');">авторизация</a></p>';
elem=document.getElementById('authcont');
elem.innerHTML=inner;
moved.addForm('authcont','/index.'+'php?action=check&what=remember',false,nodeid);
}
function addObject(objecttype,nodeid,what)
{
var divid=what.divid;
var act='/index.'+'php?action=addobject&what='+objecttype+'&id='+nodeid+'&divid='+divid;
var pars=new Array();
var cmd=what.name.slice(0,-8)+'.killMe();';
eval(cmd);
var stat=new checkstatic(document.getElementById(divid),divid,act);
sender= new ContentLoader(stat.url,'POST','',stat);
sender.loadXMLDoc();
}


function logOut(some)
{
var act;
if (some.length>0) act='/index.'+'php?action=check&what=out&id='+some;
else act='/index.'+'php?action=check&what=out';
var pars=new Array();
var divid='authcont';
var stat=new checkstatic(document.getElementById('authcont'),'authcont','/index.php');
stat.url=act;
sender= new ContentLoader(stat.url,'POST','',stat);sender.loadXMLDoc();
}



function setAuth(txt,nodeid)
{
var elem=document.getElementById('authcont');
var forms=elem.getElementsByTagName('form');
if (forms[0])
	{
	var cmd=forms[0].inpuObj.name.slice(0,-8)+'.killMe();';
	eval(cmd);
	elem=document.getElementById('authcont');
	}
	
var inner='<div id=autherr class=error>'+txt+'</div><form name=auth id="auth" method="POST" class="formrenew formauth" ><h3>Добро пожаловать</h3><div class=authfield><input type=text minvalue="0" requred=true ajax=false defaultValue="Логин" linked=false defaultFill=true testedTogether=false beginload=false testedTogetherJs=false testedTogetherJsMet=false id=email name=email class=areasmall value="Логин"></div><div class=authfield><input type="text" id="pass" minvalue="0" requred=false ajax=false defaultValue="Пароль" linked=true defaultFill=true testedTogether=false beginload=false testedTogetherJs=false testedTogetherJsMet=false  class=areasmall1 value="Пароль"><input type="Password" name=password style="visibility:hidden;display:none;" id="pass1"  minvalue="0" requred=true ajax=false defaultValue="Пароль" linked=true defaultFill=true testedTogether=false beginload=false testedTogetherJs=false testedTogetherJsMet=false	class=areasmall1 value=""></div><div class=butt><input type=button class=buttren value="ok"></div><p><a href=/registr.html>Регистрация</a>&nbsp;/&nbsp;<a href="javascript:setRemember('+nodeid+');">забыли пароль?</a></p></form>';

elem.innerHTML=inner;
moved.addForm('authcont','/index.'+'php?action=auth',false,nodeid);
}

function setLogOut(uid,name,nodeid)
{
var elem=document.getElementById('authcont');
var forms=elem.getElementsByTagName('form');
if (forms[0])
	{
	var cmd=forms[0].inpuObj.name.slice(0,-8)+'.killMe();';
	eval(cmd);
	elem=document.getElementById('authcont');
	}
var inner='<div class="mylogname"><a href=/index.php?action=show&id='+uid+'>'+name+'</a> <span class=more>(<span class=symlink onClick="logOut(\''+nodeid+'\');">выйти</span>)</span></div>';
elem.innerHTML=inner;
}
		

var isIE4=(navigator.appName.indexOf("Microsoft")==0);
if (navigator.userAgent.indexOf("Opera")>-1)
	var isOpera=true;

String.prototype.trim=new Function("return this.replace(/^\\s+|\\s+$/g,'')");
String.prototype.trimPhone=new Function("return this.replace(/[0-9]*[()]{0,1}[-]*[+]{0,1}[ \t]*/g,'')");
String.prototype.trimDec=new Function("return this.replace(/[0-9]*/g,'')");




Array.prototype.indexOf=function(obj)
{
var result=-1;
for (var i=0;i<this.length;i++)
	{
	if(this[i]==obj)
		{
		result=i;
		break;
		}
	}
return result;
}

Array.prototype.contains=function (obj)
{
return(this.indexOf(obj)>=0);
}

Array.prototype.append=function (obj,nodup)
{
if (!(nodup&&this.contains(obj))) this[this.length]=obj;
}


if (window.Node && window.XMLSerializer)
{
  Node.prototype.__defineGetter__('outerHTML', function() {
	return new XMLSerializer().serializeToString(this);
  });
}

Object.prototype.parseBoolean=function()
{
if(this=='true') return true;
else if (this=='false') return false;
else return this; 
}



