var timer;

function StartTimeOut() {
	timer = setTimeout('reset_menu()', 1000);
	
}

function reset_menu() {
	SM=document.getElementById("sm1");
	SM.innerHTML='';
	clearTimeout(timer);
}

function swap_menu(submenu) {
	clearTimeout(timer);
	reset_menu()
	SM=document.getElementById("sm1");
	if (submenu=="commerc"){
	 SM.innerHTML='<img src="http://office.realtor.ru/images/sp.gif" width="171" height="10"><a href="http://office.realtor.ru" class="gg11n" onMouseOver="clearTimeout(timer)" onMouseOut="StartTimeOut()">Аренда офисов</a><img src="http://office.realtor.ru/images/sp_gr.gif" width="1" height="10" hspace="10"><a href="http://sale.realtor.ru" class="gg11n" onMouseOver="clearTimeout(timer)" onMouseOut="StartTimeOut()">Продажа офисов</a><img src="http://office.realtor.ru/images/sp_gr.gif" width="1" height="10" hspace="10"><a href="http://retail.realtor.ru" class="gg11n" onMouseOver="clearTimeout(timer)" onMouseOut="StartTimeOut()">Торговые помещения</a><img src="http://office.realtor.ru/images/sp_gr.gif" width="1" height="10" hspace="10"><a href="http://commercial.realtor.ru/special/" class="gg11n" onMouseOver="clearTimeout(timer)" onMouseOut="StartTimeOut()">Специальные предложения</a>';
	}
	if (submenu=="country"){
	 SM.innerHTML='<img src="http://office.realtor.ru/images/sp.gif" width="397" height="10"><a href="http://country.realtor.ru/rent.php" class="gg11n" onMouseOver="clearTimeout(timer)" onMouseOut="StartTimeOut()">Аренда домов</a><img src="http://office.realtor.ru/images/sp_gr.gif" width="1" height="10" hspace="10"><a href="http://country.realtor.ru/sale.php" class="gg11n" onMouseOver="clearTimeout(timer)" onMouseOut="StartTimeOut()">Продажа домов</a><img src="http://office.realtor.ru/images/sp_gr.gif" width="1" height="10" hspace="10"><a href="http://country.realtor.ru/land.php" class="gg11n" onMouseOver="clearTimeout(timer)" onMouseOut="StartTimeOut()">Земельные участки</a>';
	}
	if (submenu=="ware"){
	 SM.innerHTML='<img src="http://office.realtor.ru/images/sp.gif" width="270" height="10"><a href="http://industry.realtor.ru" class="gg11n" onMouseOver="clearTimeout(timer)" onMouseOut="StartTimeOut()">Аренда склада</a><img src="http://office.realtor.ru/images/sp_gr.gif" width="1" height="10" hspace="10"><a href="http://industry.realtor.ru/sklad_sale.php" class="gg11n" onMouseOver="clearTimeout(timer)" onMouseOut="StartTimeOut()">Продажа склада</a><img src="http://office.realtor.ru/images/sp_gr.gif" width="1" height="10" hspace="10"><a href="http://industry.realtor.ru/industry_rent.php" class="gg11n" onMouseOver="clearTimeout(timer)" onMouseOut="StartTimeOut()">Производственная недвижимость</a><img src="http://office.realtor.ru/images/sp_gr.gif" width="1" height="10" hspace="10"><a href="http://industry.realtor.ru/land.php" class="gg11n" onMouseOver="clearTimeout(timer)" onMouseOut="StartTimeOut()">Земли промышленности</a>';
	}
}

function set(w,k)
{
	if (w.checked == true)
	{
		document.cookie = "ch["+k+"]="+k+"; path=/" ;
	}
	else
	{
		document.cookie = "ch["+k+"]=; path=/" ;
	}
}

function MM_jumpMenu(targ,selObj,restore)
{ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function img(lid, fid)
{
  bigimg.src = '/lib/merge.php?t=img&lid='+lid+'&fid='+fid;
}

//MAIN
var defimg=0;

function clearform(val) {
window.document.fastsearch.selall.value=val;
defimg=0;
change("reset");

window.document.fh.reset();
window.document.fastsearch.reset();
}

function swapimg(val1, val2) {
if (defimg==0){
document.fastsearch.selall.value=val1;
change("set");
defimg=1;
} else {
document.fastsearch.selall.value=val2;
defimg=0;
change("reset");
}
}

function change(n) {
if ((n=="set")||(n=="reset"))
{
  if (n=="set")
  {
      val=true;
  }

  if (n=="reset")
  {
     val=0;
  }
    window.document.fastsearch.distr1.checked=val;
    window.document.fastsearch.distr2.checked=val;
    window.document.fastsearch.distr3.checked=val;
    window.document.fastsearch.distr4.checked=val;
    window.document.fastsearch.distr5.checked=val;
    window.document.fastsearch.distr6.checked=val;
    window.document.fastsearch.distr7.checked=val;
    window.document.fastsearch.distr8.checked=val;
    window.document.fastsearch.distr9.checked=val;
    window.document.fastsearch.distr10.checked=val;
    window.document.fastsearch.distr11.checked=val;
    window.document.fastsearch.distr12.checked=val;
    //window.document.fastsearch.distr13.checked=val;
    //window.document.fastsearch.distr14.checked=val;
}
//посылаем значение чекбокса флэшке.
window.document.map.SetVariable ("_root.flg", n);
}

//функции передачи значений из флэшки чекбоксам.
function setDistr(n) {
eval("document.fastsearch.distr"+n+".checked=1");
}
function resetDistr(n) {
eval("document.fastsearch.distr"+n+".checked=0");
}

function clear_pricemkv(){
document.fastsearch.pricemkv1.checked=fastsearch.pricemkv2.checked=fastsearch.pricemkv3.checked=fastsearch.pricemkv4.checked=fastsearch.pricemkvall.checked=0;
}

function clear_price(){
document.fastsearch.price1.checked=fastsearch.price2.checked=fastsearch.price3.checked=fastsearch.price4.checked=fastsearch.priceall.checked=0;
}
