        function CheckForm(form)
        {   
                if ((form.region_spb.value=='') && (form.region_lo.value==''))
                {
                        alert("Пожалуйста, выберите район Лениградской области или Санкт-Петербурга");
                        form.focus();
                        return false;
                }
				ret=false;
				for (i=1; i<=15; i++)
					if (eval("document.all.p"+i).checked) ret=true;
				if (ret==false)
                {
                        alert("Выбирете интересующий Вас объект.");
                        return false;
                }
     			return true;
        }
        
        function CheckBoth(ss)
        {
                if ((document.form1.region_spb.value!='') && (document.form1.region_lo.value!=''))
                {
                        alert("Пожалуйста, выберите район только Лениградской области или Санкт-Петербурга\nПользуйтесь кнопкой \"Очистить\"");
                       // ss.value = '';
                       ss.selectedIndex=-1;
                return false;
                }
                if (document.form1.region_spb.value == 'ВСЕ РАЙОНЫ СПб')
                {
                        form1.whattbl.value = '1';
                }else{
                        if (document.form1.region_spb.value != '')
                        {
                        form1.whattbl.value = '0';
                        }
                }
                if (document.form1.region_lo.value == 'ВСЕ РАЙОНЫ ЛО')
                {
                        form1.whattbl.value = '3';
                }else{
                        if (document.form1.region_lo.value != '')
                        {
                        form1.whattbl.value = '2';
                        }
                }
                document.form1.district.value = ss.value;
                return true;
        }

//ie = ((navigator.appName == 'Microsoft Internet Explorer') && (parseInt(navigator.appVersion)>=4));
  if (typeof document.body.style.opacity == 'string') // CSS3 compliant (Moz 1.7+, Safari 1.2+, Opera 9, IE7)
    ie = true;
  else if (typeof document.body.style.MozOpacity == 'string') // Mozilla 1.6 и младше, Firefox 0.8 
    ie = true;
  else if (typeof document.body.style.KhtmlOpacity == 'string') // Konqueror 3.1, Safari 1.1
    ie = true;
  else if (document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5) // Internet Exploder 5.5+
    ie = true;
  else ie = false;


var lighting,
	highlighting;

function high(which2){
  theobject=which2;
  highlighting=setInterval("highlightit(theobject)",25);
}
function low(which2){
  clearInterval(highlighting);
  if (eval("document.all.pic" + which2)) eval("document.all.pic" + which2).filters.alpha.opacity=0
}
function highlightit(cur2){
if (eval("document.all.pic" + cur2).filters.alpha.opacity<100)
  eval("document.all.pic" + cur2).filters.alpha.opacity+=10
  else if (window.highlighting)
    clearInterval(highlighting)
}

function SetItem(n){
  if(ie)
  {
	  document.form1.region_lo.selectedIndex=n;
	  //alert(document.form1.region_lo.selectedIndex + ' ' + CheckBoth(document.form1.region_lo))
	  if (CheckBoth(document.form1.region_lo) && document.form1.region_lo.selectedIndex <= 16)
	    img_on(n,true);
  }
  else
  {
  document.form1.region_lo.selectedIndex=n;
  CheckBoth(document.form1.region_lo);
  }
}
function SetItem_spb(n){
  if(ie)
  {
	  document.form1.region_spb.selectedIndex=n;
	  if (document.form1.region_spb.selectedIndex <= 20 && CheckBoth(document.form1.region_spb))
	  	img_on(n,true); 
  }
  else
  {
		document.form1.region_spb.selectedIndex=n;
		CheckBoth(document.form1.region_spb);
  }
}

function reset_img()
{
  for (i=0;i<=22;i++)
  {
      if (eval("document.all.id" + i))
      {
       	eval("document.all.id" + i).style.visibility = 'hidden'; 
      	low(i);
      }
      else
      	continue;
  }
  //return true;
}


function img_off(id,reset)
{
  if ((document.form1.region_lo.selectedIndex<0 && document.form1.region_spb.selectedIndex<0) || reset == true)
  {
    if (eval("document.all.id" + id)) eval("document.all.id" + id).style.visibility = 'hidden';
    low(id);
  }
  return true;
}

function img_on(id,reset)
{
  if (document.form1.region_lo.selectedIndex<0 && document.form1.region_spb.selectedIndex<0)
  {
         lighting = id;
         eval("document.all.id" + id).style.visibility = 'visible';
         high(id);
  }
  if (reset == true && id != lighting)
  {
         img_off(lighting, true);
         eval("document.all.id" + id).style.visibility = 'visible';
         lighting = id;
         high(id);
  }
  return true;
}
