var foo;
var timer;
var timer_ajax_field;
var coordinates = -2620;
function close_list(){
         $('#ajax_search').fadeOut(500);
         setTimeout(function(){
         $('#ajax_search').html(' ');
         },500);
}
function boo(a){
//$('#ajax_search').mouseover(function(){ start_waiting(); });
$.post("/maps/main/ajax/", { data: a },
  function(){
    $('#ajax_search').load('/maps/main/ajax/').fadeIn('slow');
  });

}
function scroll_right(){
    coordinates_new = coordinates - 333;
    if (coordinates_new < -8725){
        coordinates_new  = -8725;
    }
    coordinates = coordinates_new;
   $('#scroller_block').animate({left: coordinates_new+'px' }, 1000 ); 
}
function scroll_left(){

    coordinates_new = coordinates + 333;
    if (coordinates_new > 377){
        coordinates_new  = 377;
    }
    coordinates = coordinates_new;
   $('#scroller_block').animate({left: coordinates_new+'px' }, 1000 ); 
}
function start_waiting(){
    if (timer_ajax_field){
        clearTimeout(timer_ajax_field);
        
        $('#ajax_search').mouseout(function(){
            stop_waiting();
        });
    }else{
        $('#ajax_search').mouseout(function(){
            stop_waiting();
        });
    }
}

function stop_waiting(){

                timer_ajax_field = setTimeout(function(){
         $('#ajax_search').fadeOut(500);
         setTimeout(function(){
         $('#ajax_search').html(' ');
         },500);
                }, 500);
}

$(document).ready(
    function (){
        $('#search_field').keyup(function(){
            if (timer){
                clearTimeout(timer);
                timer = setTimeout(function(){
                    boo($('#search_field').attr('value'));
                }, 500);
            }else{
                timer = setTimeout(function(){
                    boo($('#search_field').attr('value'));
                }, 500);
            
            }
        });
    
    }
);

var mapper = new Array();
mapper[22]=1;
mapper[28]=2;
mapper[29]=3;
mapper[30]=4;
mapper[31]=5;
mapper[32]=6;
mapper[33]=7;
mapper[34]=8;
mapper[35]=9;
mapper[36]=10;
mapper[79]=11;
mapper[75]=12;
mapper[37]=13;
mapper[38]=14;
mapper[39]=15;
mapper[40]=16;
mapper[41]=17;
mapper[42]=18;
mapper[43]=19;
mapper[44]=20;
mapper[23]=21;
mapper[24]=22;
mapper[45]=23;
mapper[46]=24;
mapper[47]=25;
mapper[48]=26;
mapper[49]=27;
mapper[77]=28;
mapper[50]=29;
mapper[51]=30;
mapper[83]=31;
mapper[52]=32;
mapper[53]=33;
mapper[54]=34;
mapper[55]=35;
mapper[56]=36;
mapper[57]=37;
mapper[58]=38;
mapper[59]=39;
mapper[25]=40;
mapper[60]=41;
mapper[01]=42;
mapper[04]=43;
mapper[02]=44;
mapper[03]=45;
mapper[05]=46;
mapper[06]=47;
mapper[07]=48;
mapper[08]=49;
mapper[09]=50;
mapper[10]=51;
mapper[11]=52;
mapper[12]=53;
mapper[13]=54;
mapper[14]=55;
mapper[15]=56;
mapper[16]=57;
mapper[17]=58;
mapper[19]=59;
mapper[61]=60;
mapper[62]=61;
mapper[63]=62;
mapper[78]=63;
mapper[64]=64;
mapper[65]=65;
mapper[66]=66;
mapper[67]=67;
mapper[26]=68;
mapper[68]=69;
mapper[69]=70;
mapper[70]=71;
mapper[71]=72;
mapper[72]=73;
mapper[18]=74;
mapper[73]=75;
mapper[27]=76;
mapper[86]=77;
mapper[74]=78;
mapper[20]=79;
mapper[21]=80;
mapper[87]=81;
mapper[89]=82;
mapper[76]=83;













