var flashPlayer;
var SearchMode=0;
var boo=0;
var panel_history=[];
var panel_history_cur=0;
var mainpage_flag=0;
var clicked_id=[];
var current_selected;
var noflash=0;
var address_mode=0;
function ac_formatItem(_1,i,_3,_4){
var _5="<span><i>Возможно вы имели в виду: ";
var _6="</i></span>";
if(_1[1]==0){
if(_1[2]==1){
return _5+"<img src='/m/ac_road.png'/>"+_1[0]+_6;
}else{
return "<img src='/m/ac_road.png'/>"+_1[0];
}
}else{
if(_1[1]==1){
return "<img src='/m/ac_addr.png'/>"+_1[0];
}else{
if(_1[1]==2){
if(_1[2]==1){
return _5+"<img src='/m/ac_cmp.png'/>"+_1[0]+_6;
}else{
return "<img src='/m/ac_cmp.png'/>"+_1[0];
}
}else{
if(_1[1]==3){
return "<img src='/m/ac_bus.png'/>"+_1[0];
}else{
if(_1[1]==4){
return "<img src='/m/ac_dir.png'/>"+_1[0];
}else{
if(_1[1]==5){
return "<img src='/m/ac_busstop.png'/>"+_1[0];
}else{
if(_1[1]==6){
return "<img src='/m/ac_phone.png'/>"+_1[0];
}else{
if(_1[1]==7){
return "<img src='/m/ac_place.png'/>"+_1[0];
}else{
if(_1[1]==8){
return "<img src='/m/ac_subway.png'/>"+_1[0];
}else{
return _1[0];
}
}
}
}
}
}
}
}
}
};
function filldefault(v){
$("#inputString").val(v);
};
function setSearchMode(_8){
SearchMode=_8;
for(n=1;n<6;n++){
if((_8+1)==n){
$(".tab"+n).filter("#maintab").css("background","url('/m/i/bgm_1.gif')");
$(".tab"+n).filter("#rtab").css("background","url('/m/i/bgm_1_end.jpg')");
if(n==1){
$(".tab"+n).filter("#ltab").css("background","url('/m/i/bgm_1_l.gif') right no-repeat");
}
}else{
$(".tab"+n).filter("#maintab").css("background","url('/m/i/bgm_2.jpg')");
if(_8==n){
$(".tab"+n).filter("#rtab").css("background","url('/m/i/bgm_1_left.png') right no-repeat");
}else{
$(".tab"+n).filter("#rtab").css("background","url('/m/i/bgm_2_r.jpg')");
}
if(n==1){
$(".tab"+n).filter("#ltab").css("background","url('/m/i/bgm_2_end.jpg') right no-repeat");
}
if(n==5){
$(".tab"+n).filter("#rtab").css("background","url('/m/i/bgm_2_end.jpg') left no-repeat");
}
}
}
};
function moreexamples(){
if($("#moreexamples").css("display")=="none"){
$("#moreexamples").show("normal");
}else{
$("#moreexamples").hide("normal");
}
};
function return_SearchMode(){
return SearchMode;
};
function return_fcity_id(){
return fcity_id;
};
jQuery(document).ready(function(){
$("#addorg").hover(function(){
$(this).addClass("over");
},function(){
$(this).removeClass("over");
});
$("#inputString").focus();
$("#inputString").autocomplete("/complete/",{max:15,delay:400,minChars:2,matchContains:true,formatItem:ac_formatItem,selectFirst:false,scroll:true,scrollHeight:300,cacheLength:1,matchSubset:false,extraParams:{search_mode:return_SearchMode,"fcity_id":return_fcity_id}});
$("#inputString").result(function(_9,_a,_b){
if(_a){
}
});
});
function detectFlashPlayer(){
if(noflash){
return;
}
if(navigator.appName.indexOf("Microsoft")!=-1){
flashPlayer=EmoMap;
}else{
flashPlayer=window.document.embeds;
flashPlayer=flashPlayer[0];
}
finit();
};
function finit(){
if(boo){
if(check_tasks()){
}else{
flashPlayer.initMap(10338000,7525000,750,500,1.5,1.8);
}
}
boo=1;
};
function im_ready(){
resizefs();
finit();
};
function myTrace(_c){
};
function hidepanel(){
$("#fs1").hide();
$("#fs2").width("100%");
flashPlayer.show_minimize();
};
function show_minimize(){
$("#fs1").show();
$("#fs2").width("70%");
};
function history_manager(_d){
if(_d==1){
clicked_id=[];
panel_history_cur--;
window.frames["panel"].location.href=panel_history[panel_history_cur];
}else{
if(_d==2){
clicked_id=[];
panel_history_cur++;
window.frames["panel"].location.href=panel_history[panel_history_cur];
}else{
if(_d!=1&&_d!=2&&panel_history.length==0||panel_history[panel_history_cur]!=_d){
panel_history.push(_d);
if(panel_history.length>20){
panel_history.shift();
}
panel_history_cur=panel_history.length-1;
}
}
}
};
function do_some_search(){
if($("#inputString").val()){
if(mainpage_flag){
window.frames["panel"].location.href="/dosearch/"+$("#inputString").val()+"/?search_mode="+SearchMode+"&fcity_id="+fcity_id;
}else{
var _e=location.href.split("/");
location.href="http://"+_e[2]+"/q/"+$("#inputString").val();
}
}
};
function do_some_search(){
if($("#inputString").val()){
if(mainpage_flag){
window.frames["panel"].location.href="/dosearch/"+$("#inputString").val()+"/?search_mode="+SearchMode+"&fcity_id="+fcity_id;
}else{
var _f=location.href.split("/");
location.href="http://"+_f[2]+"/q/"+$("#inputString").val();
}
}
};
function do_re_search(){
var str=$("#re_frm").serialize();
$.post("/re/search/",str,function(_11){
window.frames["panel"].document.body.innerHTML=_11;
});
};
function other_city(){
if($("#headcitylinks").css("display")=="none"){
$("#headcitylinks").show("normal");
}else{
$("#headcitylinks").hide("normal");
}
};
function re_search_trigger(){
if($("#re_search_panel").css("display")=="none"){
$("#re_search_panel").show("normal");
}else{
$("#re_search_panel").hide("normal");
}
};
function get_crazy(){
flashPlayer.get_crazy();
};
function go_city(id,x,y,_15,_16){
$("#headcitylinks").hide("normal");
flashPlayer.goLocation(id,x,y);
obj_click(id);
$("#fcity").html(_15);
fcity_id=_16;
document.title="Карта "+_15;
};
function check_address(){
if($("#objs",paneldoc).val().split(",").length>1&&$("#id_house",paneldoc).val()!=""){
alert("Не могу изменить номер дома для нескольких домов");
}
if($("#objs",paneldoc).val().split(",").length<1){
alert("Не выбрано ни одного дома");
}
};
function obj_click(id){
current_selected=id;
clicked_id=[];
if(address_mode==1){
var _18=window.frames["panel"].document;
old=$("#objs",_18).val();
if(old==""){
$("#objs",_18).val(id);
}else{
$("#objs",_18).val(old+","+id);
}
count=$("#objs",_18).val().split(",").length;
$("#count",_18).val(count);
$.get("/addressator/"+id+"/",{},function(_19){
addr=_19.split(";");
$("#id_city",_18).val(addr[0]);
$("#id_street",_18).val(addr[1]);
$("#id_house",_18).val(addr[2]);
});
return;
}
var _1a=window.frames["panel"].location.href.split("/");
urlik2="/"+_1a.slice(3).join("/");
should_be="/info/"+id+"/";
if(urlik2!=should_be){
window.frames["panel"].location.href=should_be;
}
};
function picker_gotcoords(x,y){
var _1d=window.frames["panel"].document;
$("#coords",_1d).val(x+","+y);
var str=$("#frm",_1d).serialize();
$.post("/construct/",str,function(_1f){
alert("saved with id="+_1f);
});
};
function dir_company_click(id){
var _21=window.frames["panel"].document;
if(clicked_id[id]==1){
$("#cmp"+id,_21).hide("fast");
clicked_id[id]=2;
}else{
if(clicked_id[id]==2){
$("#cmp"+id,_21).show("normal");
clicked_id[id]=1;
}else{
$.get("/info_company/"+id+"/",{},function(_22){
$("#"+id,_21).append(_22);
$("#cmp"+id,_21).hide();
$("#cmp"+id,_21).show("normal");
clicked_id[id]=1;
});
}
}
};
function check_tasks(){
c=0;
while(task_list.length){
eval(task_list.shift());
c=c+1;
}
return c;
};
function got_location(str){
var _24=location.href.split("/");
_24=_24[2];
abc=str.split(",");
$("#permalink").attr("href","http://"+_24+"/?x="+abc[0]+"&y="+abc[1]+"&z="+Math.round(parseFloat(abc[2])*100)/100);
};
function layer_on(_25){
if(_25=="e"){
window.frames["panel"].location.href="/ecology/";
}else{
if(_25=="s"){
}else{
if(_25=="u"){
}else{
if(_25=="p"){
$.get("http://www.panoramio.com/map/get_panoramas.php?order=popularity&set=public&from=0&to=20&minx=92&miny=56&maxx=93&maxy=57&size=mini_square",{},function(_26){
alert(_26);
});
}
}
}
}
};
function layer_off(_27){
};
function photo_preview(_28,_29,_2a,_2b){
if(_2a){
newhtml="<a href=\""+_28+"\" class=\"lightbox\"><img src=\""+_29+"\" title=\""+_2b+"\"/></a>";
}else{
newhtml="<img src=\""+_29+"\" title=\""+_2b+"\"/>";
}
if(mainpage_flag){
var _2c=window.frames["panel"].document;
$("#photo_preview",_2c).html(newhtml);
}else{
$("#photo_preview").html(newhtml);
}
$(".lightbox").lightbox();
};
function resizefs(){
h=$(window).height();
h=h-160-10;
if(h<230){
h=230;
}
$("#fscont").height(h);
};

