var Show200Alert = 1;
function s(x,p) {
	dom='/cgi-bin/fs.cgi?mode=d&dom=';
	page='/cgi-bin/fs.cgi?mode=p&dom=';
	if(p==0)	x=dom+x;
	if(p==1)	x=page+x;
	open(x,null,"WIDTH=500,HEIGHT=400,toolbar=yes,menubar=no,resizable=yes,scrollbars=yes");
}

function st(id) {
	url='/cgi-bin/st_r.cgi?id='+id;
	open(url,null,"left=10,top=10,WIDTH=750,HEIGHT=450,toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes");
}

function checkempty() {
	if (document.searchform.query.value == "") {
		alert("Не могу выполнить пустой запрос!");
		return false;
	} else { return true; }
}

function check200() {
	if (Show200Alert && document.addform.descr.value.length >250) {
		alert('Превышен предел 250 символов! Вами введено '+document.addform.descr.value.length+' символов. Лишние символы будут удалены при внесении в базу!');
		Show200Alert = 0;
		setTimeout(function(){ Show200Alert = 1; }, 10000);
		return false;
	} else { return true; }
}

function checkempty1() {
	if (document.searchform1.query.value == '') {
		alert('Не могу выполнить пустой запрос!');
		return false;
	} else { return true; }
}

function checkempty2() {
	if (document.searchform2.query.value == '') {
		alert('Не могу выполнить пустой запрос!');
		return false;
	} else { return true; }
}
////////////// open
var current_id = 1;
var what_s = new Array();
what_s[1] = "http://all.by/cgi-bin/search?mode=news&find="; //новости
what_s[2] = "http://all.by/cgi-bin/search.cgi?mode=www&query="; //СНГ
what_s[3] = "http://all.by/cgi-bin/search.cgi?mode=by&query="; //Беларусь
what_s[4] = "http://all.by/cgi-bin/search?mode=shop&find="; //товары
what_s[5] = "http://all.by/cgi-bin/search?mode=work&find="; //Работа
what_s[6] = "http://all.by/cgi-bin/search?mode=imgby&find="; //Картинки
what_s[7] = "http://all.by/cgi-bin/stolica.cgi?mode=fullfind&query="; //Картинки

function del_select(id){
	if (id==0){return;}
		document.getElementById('tr_'+id+'_').style.backgroundImage="url(http://all.by/pics/open/pixel.gif)";
		document.getElementById('tr_d_'+id+'_').style.backgroundImage="url(http://all.by/pics/open/pixel.gif)";
		document.getElementById('tr_'+id+'_').style.backgroundImage="url(http://all.by/pics/open/pixel.gif)";
		document.getElementById('b_l_'+id+'_').src='http://all.by/pics/open/pixel.gif';
		document.getElementById('b_d_l_'+id+'_').src='http://all.by/pics/open/pixel.gif';
		document.getElementById('b_d_r_'+id+'_').src='http://all.by/pics/open/pixel.gif';
		document.getElementById('b_r_'+id+'_').src='http://all.by/pics/open/pixel.gif';
		document.getElementById('b_d_'+id+'_').src='http://all.by/pics/open/pixel.gif';
	return;
}
function set_select(id){
	if (document.findform.findtext){
		document.findform.findtext.focus();
	}
	if (current_id==id){return;}
	if (id==0){return;}
		del_select(current_id);
		document.getElementById('tr_d_'+id+'_').style.backgroundImage="url(http://all.by/pics/open/b_d_bg.gif)";
		document.getElementById('tr_'+id+'_').style.backgroundImage="url(http://all.by/pics/open/b_bg.gif)";
		document.getElementById('b_l_'+id+'_').src='http://all.by/pics/open/b_l.gif';
		document.getElementById('b_r_'+id+'_').src='http://all.by/pics/open/b_r.gif';
		document.getElementById('b_d_'+id+'_').src='http://all.by/pics/open/b_d.gif';
		document.getElementById('b_d_l_'+id+'_').src='http://all.by/pics/open/b_d_l.gif';
		document.getElementById('b_d_r_'+id+'_').src='http://all.by/pics/open/b_d_r.gif';
		current_id=id;
		document.findform.action.value=what_s[id];
	return;
}
function submit_form(){
	if(document.findform.findtext.value != ''){
		c = '';
		if(document.findform.chapter && document.findform.chapter.checked){
		   c = '&chapter=' + document.findform.chapter.value;
		}
		q = document.findform.findtext.value;
		reg = new RegExp("&", "g");
		q = q.replace(reg, "%26");
		reg = new RegExp(";", "g");
		q = q.replace(reg, "%3B");
		reg = new RegExp("\\+", "g");
		q = q.replace(reg, "%2B");
		reg = new RegExp("\\#", "g");
		q = q.replace(reg, "%23");
		document.location.href = document.findform.action.value + q + c;
	}
}
/////////// open menu
var top_position=155;
var left_position=5;
var nTimeOut = null;
var hideTime = 1500;
var showTime = 500;

var nForOpen = null;

document.write('<div style="position: absolute; top: '+top_position+'px; left: '+left_position+'px; display: none; z-index: 10000;" id="open_menu_table" onMouseOver="clearTimeout(nTimeOut);" onmouseout="setHide();">');
document.write('<table border="0" cellpadding="1" cellspacing="0" width="440" bgcolor="#4D8DD5" onMouseOver="clearTimeout(nTimeOut);">');
document.write('<tr><td>');
document.write('   <table border="0" cellpadding="2" cellspacing="0" width="100%">');
document.write('     <tr>');
document.write('       <td>&nbsp;&nbsp;<a href="http://open.by/" style="font-weight: normal;font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;font-variant: small-caps;font-size: 12px;text-decoration: underline; color:#ffffff;">WWW.OPEN.BY</a></td>');
document.write('       <td align="right"><img src="http://news.by/pics/om_close.gif" border="0" style="cursor: pointer;" onClick="open_menu();"/></td>');
document.write('     </tr>');
document.write('   </table>');
document.write('</td></tr>');
document.write('<tr><td style="border: 1px solid #4D8DD5; background-color: #f6f8fc;">');
document.write('<iframe width="440" height="412" src="http://help.open.by/menu.html" framespacing="0" frameborder="no" scrolling="no" allowtransparency="true"></iframe>');
document.write('</td></tr></table>');
document.write('</div>');

function setHide()	{
	clearTimeout(nTimeOut);
	nTimeOut = null;
	nTimeOut=window.setTimeout("closeMenu()",hideTime);
}

function setShow() 
{
	if (!nForOpen)
	{
		nForOpen=window.setTimeout("openMenu()",showTime);
	}
}

function clearShow()
{
	clearTimeout(nForOpen);
	nForOpen = null;
}

function clearHide() {
	clearTimeout(nTimeOut);
	nTimeOut = null;
}

function open_menu(){
	clearTimeout(nTimeOut);

	if(document.getElementById('open_menu_table').style.display=='none')
	{
		openMenu();
	}
	else
	{
		closeMenu();
	}

	return false;
}


function closeMenu() {
	if (nTimeOut)
	{
		clearTimeout(nTimeOut);
		nTimeOut = null;
	}
	
	if (document.getElementById('regionsel'))
	{
		document.getElementById('regionsel').style.display = 'block';
	}

	if(document.getElementById('open_menu_table').style.display!='none')
	{
		document.getElementById('open_menu_table').style.display='none';
		if (document.getElementById('guest_div')){
			document.getElementById('guest_div').style.display='block';
		}
		if (document.getElementById('ban_1')){
			document.getElementById('ban_1').style.display='block';
		}
		if (document.getElementById('ftohide1')){
			document.getElementById('ftohide1').style.visibility = 'visible';
		}
		if (document.getElementById('ftohide2')){
			document.getElementById('ftohide2').style.visibility = 'visible';
		}
	}
}

function openMenu() {
	if (nTimeOut)
	{
		clearTimeout(nTimeOut);
		nTimeOut = null;
	}
	if (nForOpen)
	{
		clearTimeout(nForOpen);
		nForOpen = null;
	}
	if (document.getElementById('regionsel'))
	{
		document.getElementById('regionsel').style.display = 'none';
	}
	if(document.getElementById('open_menu_table').style.display=='none')
	{
		document.getElementById('open_menu_table').style.display='block';
		if (document.getElementById('guest_div'))
		{
			document.getElementById('guest_div').style.display='none';
		}
		if (document.getElementById('ban_1'))
		{
			document.getElementById('ban_1').style.display='none';
		}
		if (document.getElementById('ftohide1')){
			document.getElementById('ftohide1').style.visibility = 'hidden';
		}
		if (document.getElementById('ftohide2')){
			document.getElementById('ftohide2').style.visibility = 'hidden';
		}
	}
}
function stolica_print_bn(){
	if(stolica_try){
		stolica_try --;
		stolica_print_bn1();
	}
}

function stolica_print_bn1(){
	if(stolica_show && stolica_data){
		try{
			document.getElementById("stolica_bnr").innerHTML = stolica_data;
			stolica_show = 0;
		} catch(exeption){
			null;
		}
		stolica_try --;
	}
	setTimeout('stolica_print_bn()',1000);
}

