function highlight(word)
		{
			var archname = "arch"+Math.round(Math.random()*1000);
			var str_loc = window.location.href;
			var cb = document.getElementById('text_content');
			if(cb)
			{
				var re = new RegExp(word, "gim");
				//var r =  new RegExp(word, "i");
				var wasHLighted=false;
				var tNodes=getChildNodes(cb,null,"#text")
				var repl=document.createElement("b");
				repl.style.color="black";
				repl.style.backgroundColor="#FF8E8E";
				repl.style.display="inline";
				repl.innerHTML=word;
				var anch=document.createElement("a");
				anch.style.display="inline";
				anch.name=archname;
				if(tNodes!=null)
				{
					for(var i=0;i<tNodes.length;i++)
					{
						var tnd		=	tNodes[i];
						var tText	=	tnd.nodeValue;
						var repNodes	=	new Array();
						var tmpNode=tnd.cloneNode(true);
						while(re.test(tmpNode.nodeValue))
						{
							var hRep=repl.cloneNode(true);
							var fOut=tmpNode.splitText(re.lastIndex-word.length);
							repNodes.push(tmpNode);
							if(!wasHLighted)
							{
								repNodes.push(anch);
								wasHLighted=true;
							}
							tmpNode=fOut.splitText(word.length);
							hRep.innerHTML=fOut.nodeValue;
							repNodes.push(hRep);
							//alert(newNode.nodeValue);
						}
						repNodes.push(tmpNode);
						if(repNodes.length>1)
						{
							for(var j=0; j<repNodes.length; j++)
							{
								tnd.parentNode.insertBefore(repNodes[j],tnd);
							}
							tnd.parentNode.removeChild(tnd);
						}
					//cb.innerHTML = cb.innerHTML.replace(r,"<a style='display:inline' name='" + archname + "'></a>"+word);
					//cb.innerHTML = cb.innerHTML.replace(re, "<b style='color:black;background-color:#FF8E8E;display:inline;'>"+word+"</b>");
					}
					window.location = str_loc.replace(/\#arch\d{3}/,"") + "#" + archname;
				}
			}
		}
function getChildNodes(obj,recDepth,chType)
{
	var childNodes = new Array();
	var subNodes = new Array();
	var i=0;
	if(!obj) return false;
	if(!chType) chType="all";
	if(recDepth==null) recDepth=-1;
	if(Math.abs(recDepth)>0)
	{
		if(obj.childNodes && obj.childNodes.length>0)
		{
			recDepth--;
			for(i=0;i<obj.childNodes.length;i++)
			{
				if(
						obj.childNodes[i]
					&&	(
						chType=="all" 
						|| 
						obj.childNodes[i].nodeName.toLowerCase()==chType.toLowerCase()
						)
					)
					{
						childNodes.push(obj.childNodes[i]);
					}
				childNodes=childNodes.concat(getChildNodes(obj.childNodes[i],recDepth,chType));
			}
		}
		//else childNodes=obj;
	}
	return childNodes;
}
function bodyresize()
{
	document.body.style.height=document.documentElement.scrollHeight-10+'px';
	if(document.getElementById('content_box'))
	{
		document.getElementById('content_box').style.height=(document.documentElement.scrollHeight-280)+'px';
	}
}
function wndopen(img,w,h)
{
//window.open(img, "","menubar=no,resizable=yes,width="+w+",height="+h+",toolbar=no,top=50,left=50,scrollbars=yes");
window.open(img, "","scrollbars=yes,width="+w+",height="+h+",resizable=yes");
}

function focus_img_menu(ob,t)
{
	obj=document.getElementById(ob);
	if(t==1)
	{
		obj.style.opacity="1";
		obj.style.filter="alpha(opacity=100)";
	}
	else
	{
		obj.style.opacity="0.8";
		obj.style.filter="alpha(opacity=80)";
	}
}

// Фича ещё пригодится, ибо заказчик не ведает, что творит!
window.onscroll = function()
{
look_at_fix('adm_place');
}
window.onresize = function()
{
look_at_fix('adm_place');
}
// Убираем каменты и превьюшка поползёт.

function look_at_fix(id)
{
	if(document.getElementById(id))
	{
		var p_img=document.getElementById(id);
		x=document.documentElement.scrollLeft;
		y=document.documentElement.scrollTop;
		x+=document.documentElement.clientWidth-p_img.clientWidth;
		//y+=Math.round(document.documentElement.clientHeight/2);
		p_img.style.left=x+'px';
		p_img.style.top=y+'px';
	}
}

function setCookie (name, value, expires, path, domain, secure)
{
      document.cookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name)
{
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = "";
	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 add_c_adm_pl(mode)
{
	var current_date = new Date;
	var cookie_year = current_date.getFullYear() + 1;
	var cookie_month = current_date.getMonth();
	var cookie_day = current_date.getDate();
	var the_exp = cookie_day+"/" + cookie_month + "/" + cookie_year + " 00:00:00";
	
	setCookie("adm_pl_op", mode, the_exp, "/");
}

function vis_adm_place(t)
{
	var vis_t={'hide':{0:'hidden',1:'visible',2:8},'show':{0:'visible',1:'hidden',2:36}};
	var pls=document.getElementById('adm_place').childNodes;
	var pl;
	for(i=0;i<pls.length;i++)
	{
		if(pls[i].nodeType!=3) 
			{
				pl=pls[i];
				break;
			}
	}
	var alements=pl.childNodes;

	for(ind in alements)
	{
		el = alements[ind];
		if(el.nodeType!=3 && !isNaN(ind)) el.style.visibility=vis_t[t][0];
	}
	arr=document.getElementById('a_show_lnk').style.visibility=vis_t[t][0];
	arr=document.getElementById('a_hide_lnk').style.visibility=vis_t[t][1];
	pl.style.height=vis_t[t][2]+'px';
	add_c_adm_pl(t);
	return false;
}
