var global_city_list,Monthes=["\u042f\u043d\u0432\u0430\u0440\u044c","\u0424\u0435\u0432\u0440\u0430\u043b\u044c","\u041c\u0430\u0440\u0442","\u0410\u043f\u0440\u0435\u043b\u044c","\u041c\u0430\u0439","\u0418\u044e\u043d\u044c","\u0418\u044e\u043b\u044c","\u0410\u0432\u0433\u0443\u0441\u0442","\u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c","\u041e\u043a\u0442\u044f\u0431\u0440\u044c","\u041d\u043e\u044f\u0431\u0440\u044c","\u0414\u0435\u043a\u0430\u0431\u0440\u044c"]; Ajax.Responders.register({onCreate:function(){show_wait()},onComplete:function(){hide_wait()}});function go_city2area(a){a=$F(a.id);if(a>0)new Ajax.Request("/return_city.php",{method:"post",asynchronous:true,parameters:"id_area="+a,onComplete:show_city2area});else if($("step2")){$("step2").hide();$("buy_sell_data").hide()}} function show_city2area(a){global_city_list=a.responseText;var b=a.responseText.split(",");if(!a.responseText.blank()){for(a=0;a<b.length;a+=2){var c=document.createElement("option");$("iid_city").options.add(c);c.value=b[a];c.text=b[a+1]}$("step2")&&$("step2").show()}}function clear_city2area(){$("iid_city").innerHTML=""} function go_aldermanry2area(a){new Ajax.Request("/return_aldermanry_area.php",{method:"post",asynchronous:true,parameters:"id_area="+a.options[a.selectedIndex].value,onComplete:show_aldermanry2area})} function show_aldermanry2area(a){var b=a.responseText.split(",");if(!a.responseText.blank()){var c;if($("album")){var d=$("tab_aldermanry");a=$("tab_street");var e=$("iid_aldermanry");if(a)a.innerHTML="";if(d)d.innerHTML=""}for(a=0;a<b.length;a+=2){c=document.createElement("option");e.options.add(c);c.value=b[a];c.text=b[a+1];if(d){c=document.createElement("option");d.options.add(c);c.value=b[a];c.text=b[a+1]}}}}function clear_aldermanry2area(){$("iid_aldermanry").innerHTML=""} function go_aldermanry2city(a){new Ajax.Request("/return_aldermanry.php",{method:"post",asynchronous:true,parameters:"id_city="+a.options[a.selectedIndex].value,onComplete:show_aldermanry2city})}function save_aldermanry2city(a){new Ajax.Request("/save_aldermanry.php",{method:"post",asynchronous:true,parameters:"id_aldermanry="+a.options[a.selectedIndex].value,onComplete:void 0});$("buy_sell_data").hide()} function show_aldermanry2city(a){var b=a.responseText.split(",");if(!a.responseText.blank())for(a=0;a<b.length;a+=2){var c=document.createElement("option");$("iid_aldermanry").options.add(c);c.value=b[a];c.text=b[a+1]}}function clear_aldermanry2city(){$("iid_aldermanry").innerHTML=""} function buy_sell_form(a){var b=$F("id_area"),c=$F("id_city"),d=$F("id_aldermanry");new Ajax.Request("/inc/main_menu/"+a,{method:"post",asynchronous:true,parameters:"id_area="+b+"&id_city="+c+"&id_aldermanry="+d,onComplete:show_buy_sell_form})} function load_sell_form(a,b){var c=$F("id_area"),d=$F("id_city"),e=$F("id_aldermanry");d||(d=-1);e||(e=-1);c>0&&d>0&&new Ajax.Request("/inc/main_menu/load_sell_form.php",{method:"post",asynchronous:true,parameters:"id_area="+c+"&id_city="+d+"&id_aldermanry="+e+"&obj_for_sale="+a+"&op_type="+b,onComplete:show_buy_sell_form})} function load_buy_form(a,b,c){var d=$F("id_area"),e=$F("id_city"),f=$F("id_aldermanry");e||(e=-1);f||(f=-1);new Ajax.Request("/inc/main_menu/load_buy_form.php",{method:"post",asynchronous:true,parameters:"id_area="+d+"&id_city="+e+"&id_aldermanry="+f+"&obj_for_sale="+a+"&new_search="+b+"&op_type="+c,onComplete:show_buy_sell_form})} function search_obj_form(a){var b=$F("id_area"),c=$F("id_city"),d=$F("id_aldermanry"),e=$F("op_type");new Ajax.Request("/inc/main_menu/load_buy_form.php",{method:"post",asynchronous:true,parameters:"id_area="+b+"&id_city="+c+"&id_aldermanry="+d+"&obj_for_sale="+a+"&op_type="+e+"&distributions=1",onComplete:show_buy_sell_form})}function show_buy_sell_form(a){var b=$("buy_sell_data");b.innerHTML="";b.style.display="block";new Insertion.Bottom(b,a.responseText);b.scrollTo()} function sell_flat(){var a=$("isell_flat");check_form(a.id)&&a.submit()}function sell_obj(a,b){var c=$(b+a+"_form");if(c){var d=$("sb-body-inner").down("#preview_buttons");if(d)d.innerHTML="<b>\u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435, \u0438\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0434\u0430\u043d\u043d\u044b\u0445...</b>";c.action="/add_object.php";c.submit()}}function buy_flat(a,b){var c=$(b+a);check_form(c.id)&&c.submit()} function page_init(){Shadowbox.init({handleOversize:"resize",handleUnsupported:"remove"})} function setup(a){var b;if(a){var c=Math.floor(a/20)+1,d=a%20;switch(d){case 1:b="flat";break;case 2:b="room";break;case 3:b="house";break;case 4:b="share_flat";break;case 5:b="share_house";break;case 6:b="garden";break;case 7:b="land";break;case 8:b="garage";break;case 9:b="officeroom";break;case 10:b="officebuilding";break;case 11:b="salesroom";break;case 12:b="salesbuilding";break;case 13:b="kiosk";break;case 14:b="warehouseroom";break;case 15:b="warehouse";break;case 16:b="factoryroom";break; case 17:b="factory";break}var e="1";if(c==2)e="3";if(c==3)e="6";if(d>8){step2(2);e=e*1+6}else step2(1);menuselect(e);check_link(b,a,c)}}function add_to_saved(a){new Ajax.Request("/save_object.php",{method:"post",asynchronous:true,parameters:"id_object="+a,onComplete:on_object_saved})} function on_object_saved(a){a=a.responseText;if(a=="error"||!a)messageBox(8);else $("save"+a).innerHTML='<img src="/images/pics/btn_saved.gif" width="18" height="18" title="\u041e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d">'}function add_flash(a,b,c,d,e){var f="f"+b;e||(e="#5282BA");f=new SWFObject(a,f,c,d,"8",e);for(var h=arguments,g=5;g<h.length-1;g+=2)f.addVariable(""+h[g],""+h[g+1]);f.addParam("wmode","opaque");f.addParam("scale","exactfit");f.write(b)} function add_to_favorites(a){new Ajax.Request("/add_object_to_favorite.php",{method:"post",asynchronous:true,parameters:"id_object="+a,onComplete:on_object_fav})}function on_object_fav(a){a=a.responseText;if(a=="error"||!a)messageBox(4);else{$("fav"+a).innerHTML="";messageBox(14)}}function load_change_form(a,b){a>0&&new Ajax.Request("/inc/main_menu/load_change_form.php",{method:"post",asynchronous:true,parameters:"obj_type="+a+"&num="+b,onComplete:show_change_form})} function show_change_form(a){a=a.responseText;if(a=="error"||!a)$("chg"+a).innerHTML="error";else{var b=$("chg"+a.substring(0,1));if(b)b.innerHTML=a.substring(1)}} function change_area(a,b){if(a){if(a=="chk_fed")a=""}else a="";$("id_city"+a).innerHTML="";var c=$("id_aldermanry"+a);if(c)c.innerHTML="";c=$F("id_area"+a);a||(a="-1");var d="id_area="+c+"&num="+a;if(b>0)d+="&cnt=1";new Ajax.Request("/return_city.php",{method:"post",asynchronous:true,parameters:d,onComplete:set_city2area});if(a<1)if(c>0){$("flashmap")&&$("flashmap").hide();if($("areamap")){$("areamap").style.backgroundImage='url("/images/maps/'+c+'.gif")';$("areamap").show()}$("buy_sell_data")&&$("buy_sell_data").hide()}else{$("areamap")&& $("areamap").hide();$("flashmap")&&$("flashmap").show();if($("mapimg"))$("mapimg").src="";if(a)if($("step2")){$("step2").hide();$("buy_sell_data").hide()}}}function change_city(a,b){a||(a="");$("id_aldermanry"+a).innerHTML="";var c=$F("id_city"+a);a||(a="-1");c="id_city="+c+"&num="+a;if(b)for(var d in b)c+="&"+d+"="+b[d];new Ajax.Request("/return_aldermanry.php",{method:"post",asynchronous:true,parameters:c,onComplete:set_aldermanry2area});a<1&&$("buy_sell_data")&&$("buy_sell_data").hide()} function get_street_list(){$("alb_street_list").innerHTML="";var a="id_aldermanry="+$F("alb_ald_list");new Ajax.Request("/return_street.php",{method:"post",asynchronous:true,parameters:a,onComplete:set_street})}function set_city2area(a){a=a.responseText.split(",");var b=$("id_city"+(a[1]==-1?"":a[1]));b.innerHTML="";for(var c=2;c<a.length;c+=2){var d=document.createElement("option");d.text=a[c+1];d.value=a[c];b.options.add(d)}a[2]&&$("step2")&&$("step2").show()} function set_street(a){var b=a.responseText.split(","),c=$("alb_street_list");c.innerHTML="";if(a.responseText!="")for(a=0;a<b.length;a+=2){var d=document.createElement("option");d.text=b[a+1];d.value=b[a];c.options.add(d);alb_pg(1)}} function set_aldermanry2area(a){a=a.responseText.split(",");var b=a[1]==-1?"":a[1],c=a[3],d=$("id_aldermanry"+b),e,f=$("aldblock");d.innerHTML="";if(!b){var h=$("alb_ald_list");b=$("alb_street_list");if(h)h.innerHTML="";if(b)b.innerHTML=""}if(a.length>4){for(var g=4;g<a.length;g+=2){b=document.createElement("option");b.text=a[g+1];b.value=a[g];if(a[g]==c)e=(g-4)/2;d.options.add(b);if(h){b=document.createElement("option");b.text=a[g+1];b.value=a[g];h.options.add(b)}}f&&f.show()}else f&&f.hide();if(c)d.selectedIndex= e}function get_agency(){var a=a|0,b=$("id_area").getAttribute("value"),c=$("id_city").getAttribute("value"),d=$("id_aldermanry").getAttribute("value");d=d||0;b>0&&new Ajax.Request("/return_agency_html.php",{method:"post",asynchronous:true,parameters:"id_area="+b+"&id_city="+c+"&id_aldermanry="+d+"&show_rows="+a,onComplete:set_agency})} function set_agency(a){var b="";if(a){a=a.responseText.split("*#*");if(a.length>1){var c=a[0].split(",");if(c.length>1){if(b=$("ar"))b.value=c[0];if(b=$("cit"))b.value=c[1];if(b=$("ald"))b.value=c[2];b=a[1]}}}$("aglist").innerHTML=b}function sub_login(){var a=$("iloginform"),b=$("ilogin"),c=$("ipassword");if(b.value.length==0){messageBox(1);b.focus()}else if(c.value.length==0){messageBox(10);c.focus()}else a.submit()}function newcaptcha(){var a=new Date;$("cpch").src="/captcha.php?"+a.getTime()} function search_photo(a,b,c){if($("alb_ald_list")&&$("alb_street_list")&&$("alb_house_num")){if(!(a&&b&&c)){a=$F("alb_ald_list");b=$F("alb_street_list");c=$F("alb_house_num")}c=encodeURIComponent(urlencode(c.toUpperCase()));a&&b&&c&&new Ajax.Request("/return_photo.php",{method:"post",asynchronous:true,parameters:"id_aldermanry="+a+"&id_street="+b+"&house="+c,onComplete:set_photo})}} function urlencode(a){for(var b=0,c="",d="",e="%C0-%C1-%C2-%C3-%C4-%C5-%A8-%C6-%C7-%C8-%C9-%CA-%CB-%CC-%CD-%CE-%CF-%D0-%D1-%D2-%D3-%D4-%D5-%D6-%D7-%D8-%D9-%DC-%DB-%DA-%DD-%DE-%DF".split("-"),f=0;f<a.length;f++){c=a.charAt(f);b="\u0410\u0411\u0412\u0413\u0414\u0415\u0401\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042c\u042b\u042a\u042d\u042e\u042f".indexOf(c);d+=b>=0?e[b]:c}return d} function set_photo(a){if(a){a=a.responseText;if(a!="error"){a=a.split(",");if(a.length==12){var b=$("album_img"),c=$("album_link"),d=$("album_address"),e=$("albumrealty");if(b&&c&&d){b.src=decodeURIComponent(a[11])+urlencode(a[8])+"_tn90.jpg";c.href=decodeURIComponent(a[11])+urlencode(a[8])+".jpg";c.title=a[1]+", "+a[3]+", "+a[5]+" "+a[7];d.innerHTML=a[1]+", "+a[3]+", "+a[5]+" "+a[7];Shadowbox.setup(c);if(e&&a[9]>0){b='<a href="/result/?obj[id_area]='+a[0]+"&obj[id_city]="+a[2]+"&obj[id_aldermanry]="+ a[4]+"&obj[id_street]="+a[6]+'" title="\u043e\u0431\u044c\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u0434\u0432\u0438\u0436\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443: '+a[1]+", "+a[3]+", "+a[5]+'">\u043d\u0435\u0434\u0432\u0438\u0436\u0438\u043c\u043e\u0441\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u0439 \u0443\u043b\u0438\u0446\u0435</a>';if(a[10]>0)b+='<br><a href="/result/?obj[id_area]='+a[0]+"&obj[id_city]="+a[2]+"&obj[id_aldermanry]="+ a[4]+"&obj[id_street]="+a[6]+"&obj[v9]="+a[7]+'" title="\u043e\u0431\u044c\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u0434\u0432\u0438\u0436\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443: '+a[1]+", "+a[3]+", "+a[5]+", \u0434\u043e\u043c "+a[7]+'">\u043d\u0435\u0434\u0432\u0438\u0436\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u0434\u043e\u043c\u0435</a>';e.innerHTML=b}(a=$("album"))&&!a.visible()&&a.show()}}}}};
