function MyAlert(str){
	alert(str);
}

function CheckIfEmpty(field, message)
{
	//alert("field="+field);
	//alert("CheckIfEmpty, value="+field.value);
	if(field.value == '')
	{
		MyAlert(message);
		field.focus();
		return false; 
	}
	return true;
}

function confirmChecked(frm)
{
   	var isChecked = false;
    var msg;

    radioGrp = frm.art;
    
    if(frm.art == null)
    {
		msg= "Выберите хотя бы один из вариантов ответа.";
      	//Это не радиокнопки, а чекбоксы
      	for(var i=0; i<frm.length; i++)
      	{
         	if(frm.elements[i].type == "checkbox")
            if(frm.elements[i].checked)
               	isChecked = true;
      	}     
    }
   	else
   	{
       	msg= "Выберите один из вариантов ответа.";
      	//РАДИОкнопки
        for(var i=0; i<radioGrp.length; i++)
         	if(radioGrp[i].checked)
            	isChecked = true;
    }

    if(isChecked)
      	return true;
    else
      	alert(msg);

   	return false;
}

function CheckSearchForm(f)
{
	if(f.like.value=='')
    {
          alert('Введите строку поиска!');
          f.like.focus();
          return false; 
    }
       
    return true;
}
            
var invisible= "none";
var visible= "block";

function HideSearchForm()
{
	var div= document.getElementById("search-form");
	div.style.display= invisible;
}

function ShowSearchForm()
{
	var div= document.getElementById("search-form");
	div.style.display= visible;
}

function SwitchSearchForm()
{
	//alert("SwitchSearchForm()");
	var div= document.getElementById("search-form");
	//var div_href= document.getElementById("href_search");	

	/*if(div == null)
	{
		alert("div == null");
	}*/
	/*if(div_href == null)
	{
		alert("div_href == null");
	}*/

   	/*newWindow= window.open("","subWind",
   			"status,menubar,height=400,width=300,resizable,scrollbars");
   			newWindow.focus( );
	for(i in div_href)
	{
		newWindow.document.write(i +"="+ eval("div_href."+i) + "<br/>");
	}*/

	//top= div_href.style.top;
	//left= div_href.style.left;
	//alert("div_href.style.left="+ div_href.style.left);
	//**div.style.left= div_href.offsetLeft - 212;
	//**div.style.top= div_href.offsetTop + 15;

	/*div.style.top= top;
	div.style.left= left;
    */

	if(div.style.display == invisible || div.style.display == "")
		div.style.display= visible;
	else
		div.style.display= invisible;
}

