function write_image(str,title) {
   var wd = hg = 0;
   //alert(title);
   if (document.images && !(/\.swf$/gi.test(str))) {
       var tmp = new Image();
       tmp.src = str;
       wd = tmp.width + 20;
       hg = tmp.height + 20;
   }

   var par = 'location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no' +
             ',width=' + Math.min(Math.max(Math.floor(screen.width/2),wd),screen.width-50) +
             ',height='+Math.min(Math.max(Math.floor(screen.height/2),hg),screen.height-50);
	
   var wind = window.open('', 'UpbImage', par);
   wind.document.open();
   wind.document.write('<head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>\r\n');
   wind.document.write('<body bgcolor=#FFFFFF topmargin=0 leftmargin=0 marginwight=0 marginheight=0>');
   wind.document.write('<table border=0 cellpadding=0 cellspacing=0 width=100% height=100%><tr valign="top"><td valign=middle align=center>');
   wind.document.write('<img src="'+str+'" border="1" align="center" class="img1">');
   wind.document.write('</td></tr></table></body>');
   wind.document.close();
   wind.document.title = title;
   wind.focus();
}
function write_image1(str,title,info) {
   var wd = hg = 0;
   //alert(title);
   if (document.images && !(/\.swf$/gi.test(str))) {
       var tmp = new Image();
       tmp.src = str;
       wd = tmp.width + 20;
       hg = tmp.height + 20;
   }
   var par = 'location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no' +
             ',width=' + Math.min(Math.max(Math.floor(screen.width/2),wd),screen.width-50) +
             ',height='+Math.min(Math.max(Math.floor(screen.height/2),hg),screen.height-50);
   var wind = window.open('', 'UpbImage', par);
   wind.document.open();
   wind.document.write('<head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>\r\n');
   wind.document.write('<body bgcolor=#FFFFFF topmargin=0 leftmargin=0 marginwight=0 marginheight=0>');
   wind.document.write('<table border=0 cellpadding=0 cellspacing=0 width=100% height=100%><tr valign="top"><td valign=middle align=center>');
   wind.document.write('<img src="'+str+'" border="1" align="center" class="img1">');
   wind.document.write('<p style="font-family:Arial; font-size:12px; font-weight:normal; color:#696969;">'+info+'</p>');
   wind.document.write('</td></tr></table></body>');
   wind.document.close();
   wind.document.title = title;
   wind.focus();
}


function oncheck(radio) {
	var checker=true;
	var ok=false;
	for (checker=0; checker<radio.length; checker++) {
		if (radio[checker].checked) {
			//alert(radio[checker].value);
			//radio[checker].focus();
			ok=true;
			
		}
	}
	
	if (!ok) alert('Вы не выбрали ответ!');
		return ok;
	
}


function popupwin(str) {
   var par = 'location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no' +
             ',width=' + 600 +
             ',height='+ 300;

   var wind = window.open(str, 'popup_win', par);
//   wind.document.title = 'Український Професійний Банк';
   wind.focus();
}
		function OnSearch(form) {
			var ok;  
			ok = true; 
			//alert('sdfdf');
			if(form.s.value.length == 0) {
				alert('Введите текст для поиска!'); 
				form.s.focus(); 
				ok = false;
			} else if(form.s.value.search(/\*/) != -1 && form.s.value.search(/\s/) != -1) {
				alert('Если Вы используете * для расширения поиска, вы можете ввести только одно слово за раз!'); 
				form.s.focus(); 
				ok = false;
			} else if(form.s.value.search(/^\S+\*\S+$/) != -1) { 
				alert('Вы можете использовать * только в начали или конце поискового условия'); 
				form.s.focus(); 
				ok = false; 
			} else if(form.s.value == '*') {
				alert('Вы не можете искать * в качестве символа!\nСмотрите Помощь'); 
				form.s.focus(); 
				ok = false;
			} if(ok){
				//alert('<%=C_DocRoot & "search/"%>' + form.s.value + '.html');
				ok=false;
				//location.href = '<%=C_DocRoot & "search/"%>' + form.s.value + '.html'; 
				form.action = site_url+g_result; 
				form.submit();
			} 
			//alert(ok);
			return ok;
		}
	function addbookmark()
    {
            if (document.all)
            window.external.AddFavorite(bookmarkurl,bookmarktitle)
    }
function hideLogin() {
	document.getElementById('login-form').style.display = "none";
	document.getElementById('login-form-shadow').style.display = "none";
	return false;
}



	
		function m_over(obj) {
		//alert(obj);
			obj.src = mon.src;
		}
		function m_out(obj) {
			obj.src = moff.src;
		}

function show(idx)
	{
	//alert(idx);
	elem=document.getElementById(idx);
	//alert(elem.style.display);
	elem.style.display="block";
	//alert(document.getElementById('id1'));
	}
function hide(idx)
	{
	elem=document.getElementById(idx);
	elem.style.display="none";
	}
	
function load_book_img()
{
	k = book_img_src.length;
	for (i=0; i<k; i++)
	{
		//alert('!!!'+document.images['book_img_'+i].src);
		document.images['book_img_'+i].src = book_img_src[i];
	}
}
function itemOver(img) {
	td = document.getElementById(img);
	td.style.backgroundColor = "#BABABA";
}

function itemOut(img) {
	//document.images['i'+img].src = out_state['arr'].src;
	td = document.getElementById(img);
	td.style.backgroundColor = "#F2F2F2";
}