var actSel=0;		
var active=Array();     // €ªâ¨¢­ë¥ § ª« ¤ª¨ à §¤¥«®¢ 
var ext_active;
var URL=new Array();
/**********************************************/
function $ (el) {return document.getElementById (el)}

/**********************************************/
function setS(ID,val)
{
$(ID).blur();
if (val=='' && $('mainQ').value=="") {document.location.href='http://meta.ua/';return false;}
if (val=='dir' &&  $('mainQ').value=="") {document.location.href="http://meta.ua/tree.asp"; return false;}
if ($('mainQ').value!="" && val!="") {document.location.href=URL[ID]+"?m="+val+"&q="+$('mainQ').value;return;}
if (s_name=='search.asp'){document.location.href=URL[ID]+"?m="+val+"&q="+$('mainQ').value;return;}
if (s_name=='adv_search.asp') {if (val!="dir" || $('mainQ').value!="") document.location.href=URL[ID]+"?m="+val+"&q="+$('mainQ').value;return;}
if ($('mainQ').value!="") {document.location.href=URL[ID]+"?m="+val+"&q="+$('mainQ').value;return;}
document.location.href=String(URL[ID]).replace(/\/[^\/]*$/,"/");
return;
/*
if (s_name=='search.asp' && val=='' && $('mainQ').value=="") {document.location.href='http://meta.ua/';return false;}
if (s_name=='default.asp' && val=='dir' &&  $('mainQ').value=="") {document.location.href="http://meta.ua/tree.asp"; return false;}
if (s_name=='default.asp' && $('mainQ').value!="" && val!="") {document.location.href=URL[ID]+"?m="+val+"&q="+$('mainQ').value;return;}
if (s_name=='search.asp'){document.location.href=URL[ID]+"?m="+val+"&q="+$('mainQ').value;return;}
if (s_name=='adv_search.asp') {if (val!="dir" || $('mainQ').value!="") document.location.href=URL[ID]+"?m="+val+"&q="+$('mainQ').value;return;}
if ($('mainQ').value!="") {document.location.href=URL[ID]+"?m="+val+"&q="+$('mainQ').value;return;}
*/
/*
if (QS==$('mainQ').value) 
	{
	document.location.href=URL[ID]+"?m="+val+"&q="+QS;
	return;
	}
*/	
//return;
	//alert($(ID).tabIndex+"=="+$("mainQ").tabIndex);
//return;
	razdel=ID.replace(/-.*$/, "") 
	if (ID!=ext_active) $('ext_dop').style.display="none"; else $('ext_dop').style.display="block";
/*	if (razdel=='sel')
		{
		if($("mainQ").tabIndex>=$(ID).tabIndex)
			{
			$("mainQ").tabIndex=$(ID).tabIndex-2;
			}
			else
			{$("mainQ").tabIndex=$(ID).tabIndex+1;
			}
		}
*/	
	//if((active[razdel]==ID)){
	//}

	$(ID).className='mC';
	$(active[razdel]).className='mCG';	
	active[razdel]=ID;
	document.forms['sForm'].m.value=val;
	if (!textSB && val!="")
		textSB=document.forms['sForm'].sb.value;
	try{check=$('rgnS').checked;}	catch(e){check=false}
	if ((val=="" || val=="dir")&&check)
	{
		if (val=="") document.forms['sForm'].sb.value=textSB+" â Óêðàèíå";
		if (val=="dir") document.forms['sForm'].sb.value=textSB+" â ðåãèîíå";
		return
	}
	if(val!="") 
		{
		text=String($("s-"+val).innerHTML);
		_match=text.match(/(.)$/);
		if (_match[1]!="")
		switch (_match[1])
			{ 
			case 'ð': text='â '+text+'å'; break;
			default:  break
			}
		if (lng!=1) text=text.toLowerCase();
		if (text=="ïîëüøà") {text="";}
		document.forms['sForm'].sb.value=textSB+" "+text;
		$('rp').style.visibility="hidden";
		}
		else
		{
		document.forms['sForm'].sb.value=textSB+" â Óêðàèíå";
		$('rp').style.visibility="visible";
		}

	if (s_name=='default.asp') $("mainQ").focus();
	$("sForm").setAttribute("action",URL[ID]);
	$("mainQ").focus();return;
}
/**********************************************/
function inSite(reverse)
	{
	check=$('siteS').checked;
	if(reverse) check=!$('siteS').checked;

	cap="íà ñàéòå";
	if (check==true)
	{
	document.forms['sForm'].sb.value=textSB+" "+cap;
	}
	else
	document.forms['sForm'].sb.value=textSB+" â Óêðàèíå";
}
/**********************************************/
function setSR(url)
	{
	try{
	_match=url.match(/.*rgn=(\d+)/);
	$('rgn_s').innerHTML="<input class=check id='rgnS' onchange='rgn_onload()' onmouseup='rgn_onload(true)' type=checkbox name='ctg"+reg2ctg[_match[1]]+"'>" + msg("Èñêàòü â ðåãèîíå") + " <span id=rn></span>";
	}catch(e){
	$('rgn_s').innerHTML="";
	}
	rgn_onload();
	}

//alert("Z is loaded!");

