isDOM=document.getElementById; isOpera=isOpera5=window.opera && isDOM; isOpera6=isOpera && window.print; isOpera7=isOpera && document.readyState; isMSIE=document.all && document.all.item && !isOpera; isMSIE5=isDOM && isMSIE; isNetscape4=document.layers; isMozilla=isDOM && navigator.appName=="Netscape"; isSAFARI = (navigator.userAgent.toLowerCase().indexOf('safari') != -1) || (navigator.userAgent.toLowerCase().indexOf('konqueror') != -1); RMAP_VERSION = '19.07.2007г.'; TILE_SIZE = 256; TILE_CACHE_SIZE = .1; MAP_MAX_STEP = 20; MAP_INC_STEP = 2; IMAGE_SERVER = 'in/'; FINDER_SERVER = ''; globalsettings = {}; globalsettings.virtualmaps = {/*list*/list_1:{status:true,description:'3-го Интернационала ул.',defaultcenter:{x:'roads',y:'3internacionala_i',z:1},path:'no'},list_2:{status:true,description:'Гайдамацкая ул.',defaultcenter:{x:'roads',y:'Gaidamackay_i',z:1},path:'no'},list_3:{status:true,description:'Малиновского ул.',defaultcenter:{x:'roads',y:'Malinovskogo_b',z:1},path:'no'},list_4:{status:true,description:'Гайдамацкий пер.',defaultcenter:{x:'roads',y:'Gaidamackiyper_i',z:1},path:'no'},list_5:{status:true,description:'Некрасова ул.',defaultcenter:{x:'roads',y:'Nekrasova_i',z:1},path:'no'},list_6:{status:true,description:'Гоголя ул.',defaultcenter:{x:'roads',y:'Gogoly_i',z:1},path:'no'},list_7:{status:true,description:'Киевская ул.',defaultcenter:{x:'roads',y:'Kievskay_i',z:1},path:'no'},list_8:{status:true,description:'Коминтерна ул.',defaultcenter:{x:'roads',y:'Kominterna_i',z:1},path:'no'},list_9:{status:true,description:'Курская ул.',defaultcenter:{x:'roads',y:'Kurskay_i',z:1},path:'no'},list_10:{status:true,description:'Новооскольская ул.',defaultcenter:{x:'roads',y:'Novooskolskay_i',z:1},path:'no'},list_11:{status:true,description:'Глинки ул.',defaultcenter:{x:'roads',y:'Glinki_i',z:1},path:'no'},list_12:{status:true,description:'Мечникова ул.',defaultcenter:{x:'roads',y:'Mechnikova_i',z:1},path:'no'},list_13:{status:true,description:'Надсона ул.',defaultcenter:{x:'roads',y:'Nadsona_i',z:1},path:'no'},list_14:{status:true,description:'Лермонтова ул.',defaultcenter:{x:'roads',y:'Lermontova_i',z:1},path:'no'},list_15:{status:true,description:'Толстого ул.',defaultcenter:{x:'roads',y:'Tolstogo_i',z:1},path:'no'},list_16:{status:true,description:'Лермонтова пер.',defaultcenter:{x:'roads',y:'Lermontovaper_i',z:1},path:'no'},list_17:{status:true,description:'Высокая ул.',defaultcenter:{x:'roads',y:'Visokay_i',z:1},path:'no'},list_18:{status:true,description:'Суворова ул.',defaultcenter:{x:'roads',y:'Suvorova_i',z:1},path:'no'},list_19:{status:true,description:'Пушкинская ул.',defaultcenter:{x:'roads',y:'Pushkinskay_i',z:1},path:'no'},list_20:{status:true,description:'Карла Маркса ул.',defaultcenter:{x:'roads',y:'Karlamarksa_i',z:1},path:'no'},list_21:{status:true,description:'Парижской Коммуны ул.',defaultcenter:{x:'roads',y:'Parigskoykommuni_i',z:1},path:'no'},list_22:{status:true,description:'Тищенко ул.',defaultcenter:{x:'roads',y:'Tischenko_i',z:1},path:'no'},list_23:{status:true,description:'Киевский пер.',defaultcenter:{x:'roads',y:'Kievskipereulok_i',z:1},path:'no'},list_24:{status:true,description:'2-й Украинский пер.',defaultcenter:{x:'roads',y:'Vtoroiukrainskiipereulok_i',z:1},path:'no'},list_25:{status:true,description:'Чехова ул.',defaultcenter:{x:'roads',y:'Chehova_i',z:1},path:'no'},list_26:{status:true,description:'Лесная ул.',defaultcenter:{x:'roads',y:'Lesnay_i',z:1},path:'no'},list_27:{status:true,description:'Украинская ул.',defaultcenter:{x:'roads',y:'Ukrainskayulica_i',z:1},path:'no'},list_28:{status:true,description:'Ватутина ул.',defaultcenter:{x:'roads',y:'Vatutina_i',z:1},path:'no'},list_29:{status:true,description:'Гагарина ул.',defaultcenter:{x:'roads',y:'Gagarina_i',z:1},path:'no'},list_30:{status:true,description:'Пионерская ул.',defaultcenter:{x:'roads',y:'Pionerskay_i',z:1},path:'no'},list_31:{status:true,description:'Рыльского ул.',defaultcenter:{x:'roads',y:'Rilskogo_i',z:1},path:'no'},list_32:{status:true,description:'1 Мая ул.',defaultcenter:{x:'roads',y:'1may_i',z:1},path:'no'},list_33:{status:true,description:'Федорова ул.',defaultcenter:{x:'roads',y:'Fedorova_i',z:1},path:'no'},list_34:{status:true,description:'Матросова ул.',defaultcenter:{x:'roads',y:'Matrosova_i',z:1},path:'no'},list_35:{status:true,description:'Гайдара ул.',defaultcenter:{x:'roads',y:'Gaidara_i',z:1},path:'no'},list_36:{status:true,description:'Гайдара пер.',defaultcenter:{x:'roads',y:'Gaidarapereulok_i',z:1},path:'no'},list_37:{status:true,description:'Южная ул.',defaultcenter:{x:'roads',y:'Ugnay_i',z:1},path:'no'},list_38:{status:true,description:'Островского ул.',defaultcenter:{x:'roads',y:'Ostrovskogo_i',z:1},path:'no'},list_39:{status:true,description:'Достоевского ул.',defaultcenter:{x:'roads',y:'Dostoevskogo_i',z:1},path:'no'},list_40:{status:true,description:'Михайловская ул.',defaultcenter:{x:'roads',y:'Mihailovskay_i',z:1},path:'no'},list_41:{status:true,description:'Михайловский пер.',defaultcenter:{x:'roads',y:'Mihailovskiypereulok_i',z:1},path:'no'},list_42:{status:true,description:'Гражданская ул.',defaultcenter:{x:'roads',y:'Grazgdanskay_i',z:1},path:'no'},list_43:{status:true,description:'Гражданский пер.',defaultcenter:{x:'roads',y:'Grazdanskipereulok_i',z:1},path:'no'},list_44:{status:true,description:'Гутенберга ул.',defaultcenter:{x:'roads',y:'Gutenberga_i',z:1},path:'no'},list_45:{status:true,description:'Озерная ул.',defaultcenter:{x:'roads',y:'Ozernay_i',z:1},path:'no'},list_46:{status:true,description:'Озерный пер.',defaultcenter:{x:'roads',y:'Ozernipereulok_i',z:1},path:'no'},list_47:{status:true,description:'Кочура ул.',defaultcenter:{x:'roads',y:'Kochura_i',z:1},path:'no'},list_48:{status:true,description:'Щорса ул.',defaultcenter:{x:'roads',y:'Schersa_i',z:1},path:'no'},list_49:{status:true,description:'Розы Люксембург ул.',defaultcenter:{x:'roads',y:'Roziluksemburg_i',z:1},path:'no'},list_50:{status:true,description:'Маяковского ул.',defaultcenter:{x:'roads',y:'Maykovskogo_i',z:1},path:'no'},list_51:{status:true,description:'Комсомольская ул.',defaultcenter:{x:'roads',y:'Komsomolskay_i',z:1},path:'no'},list_52:{status:true,description:'Шевченко ул.',defaultcenter:{x:'roads',y:'Shevchenko_i',z:1},path:'no'},list_53:{status:true,description:'З. Алиевой ул.',defaultcenter:{x:'roads',y:'Alievoy_i',z:1},path:'no'},list_54:{status:true,description:'Восточная ул.',defaultcenter:{x:'roads',y:'Vostochnay_i',z:1},path:'no'},list_55:{status:true,description:'Грибоедова ул.',defaultcenter:{x:'roads',y:'Griboedova_i',z:1},path:'no'},list_56:{status:true,description:'Д. Попова ул.',defaultcenter:{x:'roads',y:'Dpopova_i',z:1},path:'no'},list_57:{status:true,description:'Нахимова пер.',defaultcenter:{x:'roads',y:'Nahimovapereulok_i',z:1},path:'no'},list_58:{status:true,description:'Центральная ул.',defaultcenter:{x:'roads',y:'Centralnay_i',z:1},path:'no'},list_59:{status:true,description:'Садовая ул.',defaultcenter:{x:'roads',y:'Sadovay_i',z:1},path:'no'},list_60:{status:true,description:'Павленко ул.',defaultcenter:{x:'roads',y:'Pavlenko_i',z:1},path:'no'},list_61:{status:true,description:'Революции пер.',defaultcenter:{x:'roads',y:'Revolucii_i',z:1},path:'no'},list_62:{status:true,description:'1-й Украинский пер.',defaultcenter:{x:'roads',y:'Perviiukrainskiipereulok_i',z:1},path:'no'},list_63:{status:true,description:'Тургеневская ул.',defaultcenter:{x:'roads',y:'Turgenevskay_i',z:1},path:'no'},list_64:{status:true,description:'Кутузова ул.',defaultcenter:{x:'roads',y:'Kutuzova_i',z:1},path:'no'},list_65:{status:true,description:'Степановская ул.',defaultcenter:{x:'roads',y:'Stepanovskay_i',z:1},path:'no'},list_66:{status:true,description:'Фрунзе ул.',defaultcenter:{x:'roads',y:'Frunze_i',z:1},path:'no'},list_67:{status:true,description:'Северная ул.',defaultcenter:{x:'roads',y:'Severnay_i',z:1},path:'no'},list_68:{status:true,description:'Северный пер.',defaultcenter:{x:'roads',y:'Severniypereulok_i',z:1},path:'no'},list_69:{status:true,description:'1-й Северный тупик',defaultcenter:{x:'roads',y:'Pervisevernitupik_i',z:1},path:'no'},list_70:{status:true,description:'2-й Северный тупик',defaultcenter:{x:'roads',y:'Vtoroisevernitupik_i',z:1},path:'no'},list_71:{status:true,description:'Московская ул.',defaultcenter:{x:'roads',y:'Moskovskay_i',z:1},path:'no'},list_72:{status:true,description:'Курортная ул.',defaultcenter:{x:'roads',y:'Kurortnay_i',z:1},path:'no'},list_73:{status:true,description:'8-го Марта ул.',defaultcenter:{x:'roads',y:'Vosmogomarta_i',z:1},path:'no'},list_74:{status:true,description:'Минеральная ул.',defaultcenter:{x:'roads',y:'Mineralnay_i',z:1},path:'no'},list_75:{status:true,description:'Нежинская ул.',defaultcenter:{x:'roads',y:'Neginskay_i',z:1},path:'no'},list_76:{status:true,description:'Мира ул.',defaultcenter:{x:'roads',y:'Mira_i',z:1},path:'no'},list_77:{status:true,description:'Подгорная ул.',defaultcenter:{x:'roads',y:'Podgornay_i',z:1},path:'no'},list_78:{status:true,description:'Песочная ул.',defaultcenter:{x:'roads',y:'Pesochnay_i',z:1},path:'no'},list_79:{status:true,description:'Стельмаха ул.',defaultcenter:{x:'roads',y:'Stelmaha_i',z:1},path:'no'},list_80:{status:true,description:'Цветочная ул.',defaultcenter:{x:'roads',y:'Cvetochnay_i',z:1},path:'no'},list_81:{status:true,description:'2-я Линия ул.',defaultcenter:{x:'roads',y:'Vtorayliniy_i',z:1},path:'no'},list_82:{status:true,description:'Сосниных ул.',defaultcenter:{x:'roads',y:'Sosninih_i',z:1},path:'no'},list_83:{status:true,description:'Дачная ул.',defaultcenter:{x:'roads',y:'Dachnay_i',z:1},path:'no'},list_84:{status:true,description:'Капитана Зайцева ул.',defaultcenter:{x:'roads',y:'Kapitanazaiceva_i',z:1},path:'no'},list_85:{status:true,description:'74-ой Стрелецкой Дивизии ул.',defaultcenter:{x:'roads',y:'74streleckoydivizi_i',z:1},path:'no'},list_86:{status:true,description:'Горького ул.',defaultcenter:{x:'roads',y:'Gorkogo_i',z:1},path:'no'},list_87:{status:true,description:'Калинина ул.',defaultcenter:{x:'roads',y:'Kalinina_i',z:1},path:'no'},list_88:{status:true,description:'Спартака ул.',defaultcenter:{x:'roads',y:'Spartaka_i',z:1},path:'no'},list_89:{status:true,description:'Ленинградская ул.',defaultcenter:{x:'roads',y:'Leningradskay_i',z:1},path:'no'},list_90:{status:true,description:'Нахимова ул.',defaultcenter:{x:'roads',y:'Nahimova_i',z:1},path:'no'},list_91:{status:true,description:'Б. Хмельницкого ул.',defaultcenter:{x:'roads',y:'Bhmelnickogo_i',z:1},path:'no'},list_92:{status:true,description:'Советская ул.',defaultcenter:{x:'roads',y:'Sovetskay_i',z:1},path:'no'},list_93:{status:true,description:'Героев ул.',defaultcenter:{x:'roads',y:'Geroevulica_i',z:1},path:'no'},list_94:{status:true,description:'6-я Линия ул.',defaultcenter:{x:'roads',y:'Shestayliniy_i',z:1},path:'no'},list_95:{status:true,description:'Котляревского ул.',defaultcenter:{x:'roads',y:'Kotlyrevskogo_i',z:1},path:'no'},list_96:{status:true,description:'Героев пер.',defaultcenter:{x:'roads',y:'Geroevpereulok_i',z:1},path:'no'},list_97:{status:true,description:'Полтавская ул.',defaultcenter:{x:'roads',y:'Poltavskay_i',z:1},path:'no'},list_98:{status:true,description:'Леси Украинки ул.',defaultcenter:{x:'roads',y:'Lesiukrainki_i',z:1},path:'no'},list_99:{status:true,description:'Рыбака ул.',defaultcenter:{x:'roads',y:'Ribaka_i',z:1},path:'no'},list_100:{status:true,description:'Ломоносова ул.',defaultcenter:{x:'roads',y:'Lomonosova_i',z:1},path:'no'},list_101:{status:true,description:'Ломоносова пер.',defaultcenter:{x:'roads',y:'Lomonosovapepeulok_i',z:1},path:'no'},list_102:{status:true,description:'Октябрьская ул.',defaultcenter:{x:'roads',y:'Oktybrskay_i',z:1},path:'no'},list_103:{status:true,description:'Дзержинского ул.',defaultcenter:{x:'roads',y:'Dzerginskogo_i',z:1},path:'no'},list_104:{status:true,description:'9-я Линия ул.',defaultcenter:{x:'roads',y:'Devytayliniy_i',z:1},path:'no'},list_105:{status:true,description:'Речной пер.',defaultcenter:{x:'roads',y:'Rechnoypereulok_i',z:1},path:'no'},list_106:{status:true,description:'Львовская ул.',defaultcenter:{x:'roads',y:'Lvovskay_i',z:1},path:'no'},list_107:{status:true,description:'Луговая ул.',defaultcenter:{x:'roads',y:'Lugovay_i',z:1},path:'no'},list_108:{status:true,description:'10-я Линия ул.',defaultcenter:{x:'roads',y:'Desytayliniy_i',z:1},path:'no'},list_109:{status:true,description:'Гостомельское шоссе',defaultcenter:{x:'roads',y:'Gostomelskoeshose_i',z:1},path:'no'},list_110:{status:true,description:'Чапаева ул.',defaultcenter:{x:'roads',y:'Chapaeva_i',z:1},path:'no'},list_111:{status:true,description:'11-я Линия ул.',defaultcenter:{x:'roads',y:'Odinadcatayliniy_i',z:1},path:'no'},list_112:{status:true,description:'Привокзальная пл.',defaultcenter:{x:'roads',y:'Privokzalnay_i',z:1},path:'no'},/*list_501:{status:true,description:' Ваша визитка',defaultcenter:{x:'busineskatalog',y:'Vashavizitka_i',z:1},path:'no'},*/list_502:{status:true,description:' Бухгалтерское агентство Цифра',defaultcenter:{x:'busineskatalog',y:'Zcifra_i',z:1},path:'no'},list_503:{status:true,description:' Компания BEST',defaultcenter:{x:'busineskatalog',y:'ProvaiderBest_i',z:1},path:'no'},list_504:{status:true,description:' Дом Декор',defaultcenter:{x:'busineskatalog',y:'DimDekor_i',z:1},path:'no'},list_505:{status:true,description:' Фирма Prof-IT',defaultcenter:{x:'busineskatalog',y:'KompProfit_i',z:1},path:'no'},list_701:{status:true,description:' Храм Свято-Никольский',defaultcenter:{x:'topo',y:'SvytoNikolskiyhram_i',z:1},path:'no'},list_:{status:false,description:' #',defaultcenter:{x:'roads',y:'#',z:1},path:'no'}/*end list*/}; globalsettings.datums = { datum1: { Semimajor : 6378135.0, Semiminor : 0.0, Flattering : 298.257223563, InversFlattering : 1.0/298.257223563, MetersPerUnit : 1, base: { esq : 0.00669342, e1sq : 0.00673853, e1 : 0.00167898, A0 : 0.998325, A2 : 0.00251425, A4 : 2.63822e-06, A6 : 3.38728e-09, A8 : -4.82385e-12, a : 6378245, x0 : 0, y0 : -6.1716e+06, k0 : 1, lon0 : 37.5 } } }; globalsettings.maps = { ua: { makeobjurl : function (id, agent) { switch (agent) { case 'busineskatalog' : return 'http://www.irpen.in.ua/component/option,com_sobi2/sobi2Task,sobi2Details/catid,0/sobi2Id,'+id+'/Itemid,228/lang,/'; break; } return ''; }, lastupdate: '23.05.2008г. (v2.1.4)', author: 'Бизнес-каталог', authorhref: 'http://www.karta.irpin.in.ua/', authortitle: 'Поиск по серверу визиток фирм, организаций, государственных учреждений с уточнением на карте, внесенных в раздел БИЗНЕС КАТАЛОГ Ирпенского независимого сервера', author2: 'связь с администрацией.', author2href: 'http://www.irpin.in.ua/contact.html', author2title: 'Обратная связь', status: true, description: '', extent: { x1:-161294.640636731, y1:-185458.562477162, x2:225789.623006343, y2:186546.195520016 }, defaultcenter: { x: 70502.29, y: -49888.56, z: 0 }, scalelist: [64000, 128000, 256000, 512000], defaultscalenum : 3, path: '', datum: 'datum1', isgeo : true }}; globalsettings.object_types = { theatre : 'Театры', intown : 'В городе', child : 'Детям', cinema : 'Кинотеатры', club : 'Клубы', hall : 'Концертные залы', shop : 'Магазины', museum : 'Музеи', cafe : 'Рестораны', sport : 'Спорт', establish : 'Учреждения', firm : 'Организации' };function encode_utf8( s ) { return unescape( encodeURIComponent( s ) ); } function encode_utf8( s ) { return decodeURIComponent( escape( s ) ); } function addhandler(element, event_type, func) { if (event_type == 'dblclick') { element.ondblclick = func; return; } if (element.attachEvent) { element.attachEvent('on' + event_type, func); } else if (element.addEventListener) { element.addEventListener(event_type, func, false); } else { element['on' + event_type] = func; } } function addhandlerCont(element, event_type, func) { if (event_type == 'dblclick') { element.ondblclick = func; return; } if (element.attachEvent) { element.attachEvent('on' + event_type, func); } else if (element.addEventListener) { element.addEventListener(event_type, func, true); } else { element['on' + event_type] = func; } } function removehandler(element, func, event_type) { if (element.attachEvent) { element.detachEvent('on' + event_type, func); } else if (element.addEventListener) { element.removeEventListener(event_type, func, false); } else { delete element['on' + event_type]; } } function cancelevent(e) { if (isMSIE) { e = event; } e.returnValue = false; e.cancelBubble = true; if (e.preventDefault) { e.preventDefault(); } if (e.stopPropagation) { e.stopPropagation(); } } function BoxInBox(box1, box2) { if( (box1.x2 <  box2.x1) || (box1.x1 >  box2.x2) || (box1.y2 <  box2.y1) || (box1.y1 >  box2.y2) ) { return false; } if( (box1.x1 >= box2.x1) && (box1.x2 <= box2.x2) && (box1.y1 >= box2.y1) && (box1.y2 <= box2.y2) ) { return 'in'; } if( (box1.x1 <  box2.x1) && (box1.x2 >  box2.x2) && (box1.y1 <  box2.y1) && (box1.y2 >  box2.y2) ) { return 'over'; } return 'cross'; } function Geo2Pix(geocoords, extent, scale, datum) { var geo_width, geo_height, pix_width, pix_height, pix_center_left, pix_center_top; geo_width = extent.x2-extent.x1; geo_height = extent.y2-extent.y1; pix_width = Math.round(geo_width*(28.346472)/(scale/(datum.MetersPerUnit*100))); pix_height = Math.round((geo_height * pix_width) / geo_width); pix_center_left = Math.round((geocoords.x - extent.x1) * (pix_width/geo_width)); pix_center_top = Math.round((extent.y2 - geocoords.y) * (pix_height/geo_height)); return { x: Math.floor(pix_center_left/TILE_SIZE), y: Math.floor(pix_center_top/TILE_SIZE), left: pix_center_left % TILE_SIZE, top: pix_center_top % TILE_SIZE } } function Pix2Geo(tileinfo, extent, scale, datum) { var geo_width, geo_height, pix_width, pix_height, pixx, pixy; geo_width = extent.x2-extent.x1; geo_height = extent.y2-extent.y1; pix_width = Math.round(geo_width*(28.346472)/(scale/(datum.MetersPerUnit*100))); pix_height = Math.round((geo_height * pix_width) / geo_width); pixx = (tileinfo.x)*TILE_SIZE+tileinfo.left; pixy = (tileinfo.y)*TILE_SIZE+tileinfo.top; return { x: extent.x1 + (pixx * (geo_width/pix_width)), y: extent.y2 - (pixy * (geo_height/pix_height)) } } function ComprehensiveScale(r, viewbounds, datum) { r.width = Math.abs(r.x2-r.x1); r.height = Math.abs(r.y2-r.y1); if(r.width > r.height) { return (r.width*datum.MetersPerUnit*100)/(viewbounds.width/28.346472); } else { return (r.height*datum.MetersPerUnit*100)/(viewbounds.height/28.346472); } } function NearestScale(scale) { for(var i in control.map.scalelist) { if (control.map.scalelist[i] > scale) { return i; } } return 0; } function FromLonLat(lon, lat, base) { lon = lon * (Math.PI/180); lat = lat * (Math.PI/180); lon0 = base.lon0 * (Math.PI/180); var sinlat = Math.sin(lat); var coslat = Math.cos(lat); var tanlat = sinlat / coslat; var sinsqlat = sinlat*sinlat; var cossqlat = coslat*coslat; var T = tanlat*tanlat; var N = base.a/Math.sqrt(1-base.esq*sinsqlat); var C = base.e1sq*cossqlat; var Q = coslat*(lon-lon0); var Q2 = Q * Q; var Q3 = Q2 * Q; var Q4 = Q3 * Q; var Q5 = Q4 * Q; var Q6 = Q5 * Q; var M = base.a*(base.A0*lat-base.A2*Math.sin(2*lat)+base.A4*Math.sin(4*lat)-base.A6*Math.sin(6*lat)+base.A8*Math.sin(8*lat)); var x = (base.k0*N*(Q+(1-T+C)*Q3/6+ (5-18*T+T*T+72*C-58*base.e1sq)*Q5/120) + base.x0); var y = (base.k0*(M+N*tanlat*(Q*Q/2+(5-T+9*C+4*C*C)*Q4/24 + (61-58*T+T*T+600*C-330*base.e1sq)*Q6/720))+ base.y0); return {x:x,y:y}; } function ToLonLat(x, y, base) { var epsilon = 2.0E-12; var highPrecision = false; var errmax = highPrecision ? epsilon / 100000 : epsilon; var maxiter = highPrecision ? 1000 : 100; var lon0 = base.lon0 * (Math.PI/180); x = x - base.x0; y = y - base.y0; M = y / base.k0; mu = M/(base.a*base.A0); phi1 = mu + (3*base.e1/2-27*base.e1*base.e1*base.e1/32)*Math.sin(2*mu)+ (21*base.e1*base.e1/16-55*base.e1*base.e1*base.e1*base.e1/32)*Math.sin(4*mu)+(151*base.e1*base.e1*base.e1/96)*Math.sin(6*mu); var iter = 0; var sinphi1, cosphi1, eff, eff1, delta; do { sinphi1 = Math.sin(2*phi1); cosphi1 = Math.cos(2*phi1); eff = base.A0*phi1 - base.A2 * sinphi1 - M/base.a; eff1 = base.A0 - 2*base.A2*cosphi1; sinphi1 = Math.sin(4*phi1); cosphi1 = Math.cos(4*phi1); eff += base.A4*sinphi1; eff1 += 4*base.A4*cosphi1; sinphi1 = Math.sin(6*phi1); cosphi1 = Math.cos(6*phi1); eff -= base.A6*sinphi1; eff1 -= 6*base.A6*cosphi1; sinphi1 = Math.sin(8*phi1); cosphi1 = Math.cos(8*phi1); eff += base.A8*sinphi1; eff1 -= 8*base.A8*cosphi1; delta = eff/eff1; phi1 -= delta; } while ((Math.abs(delta) > errmax) && (++iter < maxiter)); sinphi1 = Math.sin(phi1); cosphi1 = Math.cos(phi1); var tanphi1 = sinphi1 / cosphi1; var sinsqphi1 = sinphi1 * sinphi1; var cossqphi1 = cosphi1 * cosphi1; var tansqphi1 = tanphi1 * tanphi1; var N1 = base.a/Math.sqrt(1-base.esq*sinsqphi1); var T1 = tansqphi1; var C1 = base.e1sq*cossqphi1; var R1 = base.a*(1-base.esq)/Math.pow(1-base.esq*sinsqphi1, 1.5); var D = x/(N1*base.k0); var lon = (D-(1+2*T1+C1)*D*D*D/6+ (5-2*C1+28*T1-3*C1*C1+8*base.e1sq+24*T1*T1)*D*D*D*D*D/120) / cosphi1; lon = (lon + lon0) * (180/Math.PI); var lat = (phi1 - (N1*tanphi1/R1) * (D*D/2- (5+3*T1+10*C1-4*C1*C1-9*base.e1sq)*D*D*D*D/24+ (61+90*T1+298*C1+45*T1*T1-252*base.e1sq-3*C1*C1)*D*D*D*D*D*D/720)); lat = lat * (180/Math.PI); return {lon: lon, lat: lat}; } function Max(arr) { ret = arr[0]; for(var i in arr) {if (arr[i] > ret) ret = arr[i]} return ret; } function Min(arr) { ret = arr[0]; for(var i in arr) {if (arr[i] < ret) ret = arr[i]} return ret; } function URL2Array() { var vars, str, query, keypairs, numKP, keyName, keyValue; vars = new Object(); str = window.location + ''; query = str.substring((str.indexOf('#')) + 1); keypairs = new Object(); numKP = 1; while (query.indexOf('&') > -1) { keypairs[numKP] = query.substring(0,query.indexOf('&')); query = query.substring((query.indexOf('&')) + 1); numKP++; } keypairs[numKP] = query; for (var i in keypairs) { keyName = keypairs[i].substring(0,keypairs[i].indexOf('=')); keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1); while (keyValue.indexOf('+') > -1) { keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1); } keyValue = unescape(keyValue); vars[keyName] = keyValue; } delete vars['']; for (var key in vars) { if (key.indexOf('.') > -1) { keyName = key.substring(0,key.indexOf('.')); subkeyName = key.substring((key.indexOf('.')) + 1); if (!vars[keyName]) { vars[keyName] = {}; } vars[keyName][subkeyName] = vars[key]; delete vars[key]; } } vars['hostname'] = window.location.hostname; vars['pathname'] = window.location.pathname; return vars; } function GetMouse(e) { if (isMSIE) { e = window.event; } return {x:e.clientX, y:e.clientY} } function GetMouseWheel(e) { if (isMSIE) { e = window.event; } return {x:e.screenX, y:e.screenY} } function GetMouseButton(e) { if (isMSIE) { return window.event.button; } return e.which; } function GetKeyboardCode(e) { if (isMSIE) { e = window.event; } if (e.keyCode) { return e.keyCode; } else { return e; } } function GetAltKey(e) { if (isMSIE) { e = window.event; } return e.altKey; } function GetShiftKey(e) { if (isMSIE) { e = window.event; } return e.shiftKey; } function GetTarget(e) { if (isMSIE) { return window.event.srcElement; } return e.target; } function Count(data){ var c = 0; for(var i in data) { c++; } return c; } function GetFirst(data){ for(var i in data) { return data[i]; } return false; } function cleanUpText(text) { if (text != undefined) { text = text.replace('&#8470;', '№'); } return text; } function Tile(tileinfo, tileborder) { this.image = document.createElement('IMG'); this.Show(false); this.image.ondragstart="return false"; this.image.ondrag="return false"; this.image.style.cursor = 'move'; this.image.style.position = 'absolute'; this.image.style.zIndex = '500'; this.tileborder = tileborder; if (tileborder) { this.image.style.border = '1px solid #FF0000'; };this.image.width = TILE_SIZE; this.image.height = TILE_SIZE; this.image.id = tileinfo.x+'x'+tileinfo.y; this.image.drag = true; this.x = tileinfo.x; this.y = tileinfo.y; this.left = tileinfo.left; this.top = tileinfo.top; this.markers = {}; for(var i in control.matrix.markers) { k = control.matrix.markers[i]; if (k.tiles[control.currentscalenum] && k.tiles[control.currentscalenum].x == this.x && k.tiles[control.currentscalenum].y == this.y) { this.markers[i] = k; k.Show(true); } } };Tile.prototype.Show = function(state) { this.image.style.visibility = (state) ? 'visible' : 'hidden'; };Tile.prototype.SetPosition = function(to) { this.image.style.left = to.x; this.image.style.top = to.y; for(var i in this.markers) { this.markers[i].SetPosition({ x: this.image.offsetLeft+this.markers[i].tiles[control.currentscalenum].left, y: this.image.offsetTop+this.markers[i].tiles[control.currentscalenum].top }); } };function Matrix(divid, currentscale, mapid, params) { this.params = params; this.div = document.getElementById(divid); this.div.style.overflow = 'hidden'; this.mapid = mapid; this.currentscale = currentscale; this.MakeBox(); this.tiles = new Object(); this.divs = new Object(); this.keyboardflags = { left : false, up : false, right : false, down : false, plus : false, minus : false, esc : false };this.keyboardmovingstep = 1; this.needupdate = false; this.moving = false; this.stopnow = false; this.markers = {}; this.selection = {}; this.selection.process = false; };Matrix.prototype.AddInterface = function(object, state) { this.div.appendChild(object.div); if (state != undefined && state == false) { object.div.style.display = 'none'; } };Matrix.prototype.MakeBox = function() { this.box = { x1: this.div.offsetLeft, y1: this.div.offsetTop, x2: this.div.offsetLeft+this.div.offsetWidth, y2: this.div.offsetTop+this.div.offsetHeight, width: this.div.offsetWidth, height: this.div.offsetHeight, center : { x : Math.round(this.div.offsetWidth/2), y : Math.round(this.div.offsetHeight/2) } };this.bigbox = { x1 : -TILE_CACHE_SIZE*this.box.width, y1 : -TILE_CACHE_SIZE*this.box.height, x2 : this.box.width+TILE_CACHE_SIZE*this.box.width, y2 : this.box.height+TILE_CACHE_SIZE*this.box.height, width : this.box.width*(1+TILE_CACHE_SIZE*2), height : this.box.height*(1+TILE_CACHE_SIZE*2) };this.matrixsize = {x: Math.ceil(this.bigbox.width / TILE_SIZE), y: Math.ceil(this.bigbox.height / TILE_SIZE)};if (this.params.showcenter) { var t; t = document.getElementById('showcenter1'); if (t) { this.div.removeChild(t); } t = document.getElementById('showcenter2'); if (t) { this.div.removeChild(t); } t = document.createElement('IMG'); t.style.width = 1; t.style.zIndex = '1005'; t.style.height = this.box.height; t.style.background = '#FF00FF'; t.style.position = 'absolute'; this.div.appendChild(t); t.style.left = this.box.width / 2; t.id = 'showcenter1'; t.style.top = 0; t = document.createElement('IMG'); t.style.height = 1; t.style.zIndex = '1006'; t.style.width = this.box.width; t.style.background = '#FF00FF'; t.style.position = 'absolute'; this.div.appendChild(t); t.id = 'showcenter2'; t.style.left = 0; t.style.top = this.box.height / 2; } };Matrix.prototype.SwitchGrid = function() { for(var i in this.tiles) { if(this.params.tileborders) { this.tiles[i].tileborder = false; this.tiles[i].image.style.border = 'none'; } else { this.tiles[i].tileborder = true; this.tiles[i].image.style.border = '1px solid #FF0000'; } } this.params.tileborders = !this.params.tileborders; };Matrix.prototype.CreateMatrix = function(centertile) { tile = new Tile({ x: centertile.x, y: centertile.y, left: Math.round(this.box.width/2)-centertile.left, top: Math.round(this.box.height/2)-centertile.top }, this.params.tileborders); this.AppendTile(tile); this.needupdate = true; this.AddTiles(); this.stopnow = false; };function FillByZero(str, count) { var newstr = ''; str = str+''; count = count-str.length; for(var i=1;i<=count;i++){ newstr += '0'; } return newstr+str; };Matrix.prototype.AppendTile = function(tile) { var x, y; if (this.tiles[tile.image.id]) return false; this.tiles[tile.image.id] = tile; this.div.appendChild(tile.image); tile.SetPosition({x:tile.left, y:tile.top}); if (tile.x < 0 || tile.y < 0 || tile.x > control.mosttile.x || tile.y > control.mosttile.y) { tile.image.src = 'i/nodata.png'; } else { tile.image.src = IMAGE_SERVER + this.mapid + '/' + FillByZero(this.currentscale, 11) + '/' + FillByZero(tile.y, 6) + '/' + FillByZero(tile.x, 6) + FillByZero(tile.y, 6) + '.gif'; } tile.Show(true); };Matrix.prototype.ReanimateMarkers = function() { for (var i in this.markers) { this.markers[i].Show(true); } };Matrix.prototype.RemoveAllTiles = function() { this.stopnow = true; for(var i in this.tiles) { this.RemoveTile(this.tiles[i]); } };Matrix.prototype.RemoveTile = function(tile) { for(var i in this.tiles[tile.image.id].markers) { this.tiles[tile.image.id].markers[i].Show(false); } this.div.removeChild(tile.image); this.tiles[tile.image.id] = null; delete this.tiles[tile.image.id]; this.changed = true; };Matrix.prototype.StartSelection = function(e) { this.selection = {}; this.selection.process = true; this.selection.position = GetMouse(e); this.selection.div = document.createElement('DIV'); this.selection.div.style.position = 'absolute'; this.selection.div.style.zIndex = '1000'; this.selection.div.style.left = this.selection.position.x; this.selection.div.style.top = this.selection.position.y; this.selection.div.style.width = 0; this.selection.div.style.height = 0; this.selection.div.style.border = '3px dotted #FF0000'; this.selection.div.style.cursor = 'move'; this.div.appendChild(this.selection.div); return false; };Matrix.prototype.DoSelection = function(e) { if (!this.selection.process) { return true; } var mouse = GetMouse(e); if (mouse.x > this.selection.position.x && mouse.y > this.selection.position.y) { this.selection.div.style.width = mouse.x-this.selection.position.x; this.selection.div.style.height = mouse.y-this.selection.position.y; } return false; };Matrix.prototype.EndSelection = function(e) { if (!this.selection.process) { return true; } var mouse = GetMouse(e); var width = mouse.x-this.selection.position.x; var height = mouse.y-this.selection.position.y; if (width != 0 && height != 0) { var tile = control.matrix.GetTileAtPix({left: Math.round(this.selection.position.x+width/2),top: Math.round(this.selection.position.y+height/2)}); var center = Pix2Geo(tile, control.map.extent, control.currentscale, control.map.datum); var zdiff = Math.round(Min([this.box.width / width, this.box.height / height])-1); var z = (control.currentscalenum-zdiff); if (z < 0) { z = 0; } if (z >= control.maxscalenum) { z = control.maxscalenum; } control.Goto(center.x, center.y, z); } this.div.removeChild(this.selection.div); return false; };Matrix.prototype.StartDrag = function(e) { var mouse; if (this.disablehandmove || (GetMouseButton(e) != 1)) { return true; } this.leader = GetTarget(e); if (!this.leader.drag) return true; this.needupdate = true; this.moving = true; mouse = GetMouse(e); this.dx = mouse.x-this.tiles[this.leader.id].image.offsetLeft; this.dy = mouse.y-this.tiles[this.leader.id].image.offsetTop; return false; };Matrix.prototype.Drag = function(e) { var mouse, x_add, y_add, to; if (this.disablehandmove || !this.moving) { return true; } mouse = GetMouse(e); for(i in this.tiles) { x_add = (this.tiles[i].x-this.tiles[this.leader.id].x)*TILE_SIZE; y_add = (this.tiles[i].y-this.tiles[this.leader.id].y)*TILE_SIZE; to = {x: (mouse.x-this.dx+x_add), y: (mouse.y-this.dy+y_add)};this.tiles[i].SetPosition(to); } return false; };Matrix.prototype.EndDrag = function(e) { if (this.disablehandmove || !this.moving) { return true; };this.moving = false;this.needupdate = true; control.UpdateLocation(); return false; };Matrix.prototype.GetTileIdAtPix = function(pix) {  var tile; tile = this.GetTileAtPix(pix); if (tile) { return tile.x+'x'+tile.y; } return false; };Matrix.prototype.SlideFromTo = function(from, to, finishfunc) { if (!finishfunc) { finishfunc = function() {}; };control.SmoothExec(
function() {control.matrix.PrepareSlideMoving(from, to)},
function() {control.matrix.doSlideMoving()},
function() {return control.matrix.checkEndSlideMoving()},
function() {control.matrix.EndSlideMoving(); finishfunc()}, 1 ); };Matrix.prototype.PrepareSlideMoving = function(from, to) {this.slide = {};this.slide.worktileid = this.GetTileIdAtPix({left:from.x, top:from.y}); if (!this.slide.worktileid) { return false; };this.stopnow = false;this.disablehandmove = true;this.moving = true;this.slide.bre = {};this.slide.bre.xn = this.tiles[this.slide.worktileid].image.offsetLeft;this.slide.bre.yn = this.tiles[this.slide.worktileid].image.offsetTop;this.slide.bre.addX = from.x-this.slide.bre.xn;this.slide.bre.addY = from.y-this.slide.bre.yn;this.slide.bre.xk = to.x-this.slide.bre.addX;this.slide.bre.yk = to.y-this.slide.bre.addY;this.slide.bre.sx = 0; if ((this.slide.bre.dx = (this.slide.bre.xk-this.slide.bre.xn)) < 0) {this.slide.bre.dx = -this.slide.bre.dx; --this.slide.bre.sx; } else if (this.slide.bre.dx>0) { ++this.slide.bre.sx; };this.slide.bre.sy = 0; if ((this.slide.bre.dy = this.slide.bre.yk-this.slide.bre.yn) < 0) {this.slide.bre.dy = -this.slide.bre.dy; --this.slide.bre.sy; } else if (this.slide.bre.dy>0) { ++this.slide.bre.sy; };this.slide.bre.swap = 0; if ((this.slide.bre.kl = this.slide.bre.dx) < (this.slide.bre.s = this.slide.bre.dy)) {this.slide.bre.dx = this.slide.bre.s;this.slide.bre.dy = this.slide.bre.kl;this.slide.bre.kl = this.slide.bre.s; ++this.slide.bre.swap; };this.slide.bre.s = (this.slide.bre.incr1 = 2*this.slide.bre.dy)-this.slide.bre.dx;this.slide.bre.incr2 = 2*this.slide.bre.dx;this.slide.bre.npos = 0;this.slide.bre.mass = new Array(); while (--this.slide.bre.kl >= 0) { if (this.slide.bre.s >= 0) { if (this.slide.bre.swap) {this.slide.bre.xn += this.slide.bre.sx; } else {this.slide.bre.yn += this.slide.bre.sy; };this.slide.bre.s -= this.slide.bre.incr2; } if (this.slide.bre.swap) {this.slide.bre.yn += this.slide.bre.sy; } else {this.slide.bre.xn += this.slide.bre.sx; };this.slide.bre.s += this.slide.bre.incr1;this.slide.bre.mass[this.slide.bre.npos] = { x : this.slide.bre.xn, y : this.slide.bre.yn };this.slide.bre.npos++; };this.slide.bre.npos = 0;this.slide.bre.diff = 0;this.slide.bre.speedup = 4;this.slide.newarr = [];this.slide.slist = [Math.round(this.slide.bre.mass.length/5), 0, Math.round(this.slide.bre.mass.length/5)];this.slide.slist[1] = this.slide.bre.mass.length-(this.slide.slist[0]+this.slide.slist[2]); for(i=0;i<this.slide.bre.mass.length;i++){ if (i < this.slide.slist[0]) {this.slide.newarr.push(this.slide.bre.mass[i]); i += this.slide.bre.diff;this.slide.bre.diff += this.slide.bre.speedup; } if (i>= this.slide.slist[0] && i < this.slide.slist[0]+this.slide.slist[1]) {this.slide.newarr.push(this.slide.bre.mass[i]); i += this.slide.bre.diff; } if (i>= this.slide.slist[0]+this.slide.slist[1] && i < this.slide.slist[0]+this.slide.slist[1]+this.slide.slist[2]) {this.slide.newarr.push(this.slide.bre.mass[i]); i += this.slide.bre.diff;this.slide.bre.diff -= this.slide.bre.speedup; if (i < 1) i = 1; } } if (this.slide.newarr[this.slide.newarr.length-1] != this.slide.bre.mass[this.slide.bre.mass.length-1]) {this.slide.newarr.push(this.slide.bre.mass[this.slide.bre.mass.length-1]); } this.slide.bre.mass = this.slide.newarr; };Matrix.prototype.doSlideMoving = function() { var to; if (!this.moving) { return false; } if (!this.tiles[this.slide.worktileid]) { this.stopnow = true; } if (this.stopnow) { return; };this.slide.bre.xn = this.slide.bre.mass[this.slide.bre.npos].x; this.slide.bre.yn = this.slide.bre.mass[this.slide.bre.npos].y;for(var i in this.tiles) { to = { x: (this.slide.bre.xn+((this.tiles[i].x-this.tiles[this.slide.worktileid].x)*TILE_SIZE)), y: (this.slide.bre.yn+((this.tiles[i].y-this.tiles[this.slide.worktileid].y)*TILE_SIZE)) };this.tiles[i].SetPosition(to); } };Matrix.prototype.checkEndSlideMoving = function() {if (!this.moving) {return false;}if (this.slide.bre.npos >= (this.slide.bre.mass.length-1)) {return true;}if (this.stopnow) {return true;};this.slide.bre.npos++;return false;};Matrix.prototype.EndSlideMoving = function() {var to;if (!this.moving) {return false;}if (!this.tiles[this.slide.worktileid]) {this.stopnow = true;} else {for(var i in this.tiles) {to = {x: (this.slide.bre.xk+((this.tiles[i].x-this.tiles[this.slide.worktileid].x)*TILE_SIZE)),y: (this.slide.bre.yk+((this.tiles[i].y-this.tiles[this.slide.worktileid].y)*TILE_SIZE))};this.tiles[i].SetPosition(to);}};this.needupdate = true;this.moving = false;this.disablehandmove = false;};Matrix.prototype.CheckKeyboard = function() {var shiftx, shifty;if (control.stopmatrix) return;if (this.keyboardflags.esc) {control.Finder.Abort();return;}if (this.keyboardflags.plus) {control.ChangeZoom(-1);this.keyboardflags.plus = false;return;}if (this.keyboardflags.minus) {control.ChangeZoom(1);this.keyboardflags.minus = false;return;}if (!this.keyboardflags.left && !this.keyboardflags.up && !this.keyboardflags.right && !this.keyboardflags.down) {this.keyboardmovingstep = 1;this.stopnow = false;return;};this.stopnow = true;if (this.keyboardmovingstep <= MAP_MAX_STEP) {this.keyboardmovingstep += MAP_INC_STEP;}shiftx = 0;shifty = 0;if (this.keyboardflags.left) {shiftx = this.keyboardmovingstep;}if (this.keyboardflags.up) {shifty = this.keyboardmovingstep;}if (this.keyboardflags.right) {shiftx = -this.keyboardmovingstep;}if (this.keyboardflags.down) {shifty = -this.keyboardmovingstep;}for(var i in this.tiles) {this.tiles[i].SetPosition({x: this.tiles[i].image.offsetLeft+shiftx, y: this.tiles[i].image.offsetTop+shifty});};this.needupdate = true;control.UpdateLocation();};Matrix.prototype.PressKeyboard = function(e) {keycode = GetKeyboardCode(e);switch (keycode) {case 27:if (control.rWindow.state) {control.rWindow.Show(false);};this.keyboardflags.esc = true;break;case 37:this.keyboardflags.left = true;break;case 38:this.keyboardflags.up = true;break;case 39:this.keyboardflags.right = true; break;case 40:this.keyboardflags.down = true; break;case 187 :case 61 :this.keyboardflags.plus = true;break;case 189 :case 109 :this.keyboardflags.minus = true;break;}};Matrix.prototype.UnPressKeyboard = function(e) {keycode = GetKeyboardCode(e);switch (keycode) {case 90:if (GetAltKey(e)) {this.RemoveAllMarkers();};break;case 71:if (GetAltKey(e)) {this.SwitchGrid();}break;case 76:if (GetAltKey(e)) {currentcentertile = control.matrix.GetTileAtPix({left: control.matrix.box.center.x,top: control.matrix.box.center.y});alert('bin/rasterizer --verbose=debug1 --map='+control.vars.mapid+' --outpath=/spool/atlas/tiles/ --scale='+(control.maxscalenum-control.currentscalenum)+' --left='+(currentcentertile.x-5)+' --top='+(currentcentertile.y-5)+' --right='+(currentcentertile.x+5)+' --bottom='+(currentcentertile.y+5)+' etc/build.iac');}break;case 27: this.keyboardflags.esc = false; break;case 37:this.keyboardflags.left = false; break;case 38:this.keyboardflags.up = false; break;case 39:this.keyboardflags.right = false; break;case 40:this.keyboardflags.down = false; break;case 187 : this.keyboardflags.plus = false; break;case 189 : this.keyboardflags.minus = false; break;}};Matrix.prototype.AddTiles = function() {var end, result;if (!this.needupdate) return;end = false;while(!end) {result = false;for(var i in this.tiles) {result |= this.AddNear(this.tiles[i]);}end = !result;};this.needupdate = true;};Matrix.prototype.RemoveTiles = function() {if (!this.needupdate) return;for(var i in this.tiles) {if (this.moving) {return;};this.ConditionRemove(this.tiles[i]);};this.needupdate = false;};Matrix.prototype.ConditionRemove = function(tile) {var tilebox;tilebox = {x1: tile.image.offsetLeft,
y1: tile.image.offsetTop,
x2: tile.image.offsetLeft+TILE_SIZE,
y2: tile.image.offsetTop+TILE_SIZE};if (!this.isVisible(tilebox)) {this.RemoveTile(tile)}};Matrix.prototype.AddNear = function (tile) {var tilebox, r, newtilebox;tilebox = {x1 : tile.image.offsetLeft,y1 : tile.image.offsetTop,x2 : (tile.image.offsetLeft+TILE_SIZE),y2 : (tile.image.offsetTop+TILE_SIZE)};r = false;newtilebox = {x1: tilebox.x1-TILE_SIZE, y1: tilebox.y1, x2: tilebox.x1, y2: tilebox.y2};if (!this.tiles[(tile.x-1)+'x'+(tile.y)] && this.isVisible(newtilebox)) {newtile = new Tile({x: (tile.x-1), y: tile.y, left: newtilebox.x1, top: newtilebox.y1}, this.params.tileborders);this.AppendTile(newtile);r = true;}newtilebox = {x1: tilebox.x1, y1: tilebox.y1-TILE_SIZE, x2: tilebox.x2, y2: tilebox.y1};if (!this.tiles[(tile.x)+'x'+(tile.y-1)] && this.isVisible(newtilebox)) {newtile = new Tile({x: (tile.x), y: (tile.y-1), left: newtilebox.x1, top: newtilebox.y1}, this.params.tileborders);this.AppendTile(newtile);r = true;}newtilebox = {x1:tilebox.x2, y1: tilebox.y1, x2: tilebox.x2+TILE_SIZE, y2: tilebox.y2};if (!this.tiles[(tile.x+1)+'x'+(tile.y)] && this.isVisible(newtilebox)) {newtile = new Tile({x: (tile.x+1), y: (tile.y), left: newtilebox.x1, top: newtilebox.y1}, this.params.tileborders);this.AppendTile(newtile);r = true;}newtilebox = {x1: tilebox.x1, y1: tilebox.y2, x2: tilebox.x2, y2: tilebox.y2+TILE_SIZE};if (!this.tiles[(tile.x)+'x'+(tile.y+1)] && this.isVisible(newtilebox)) {newtile = new Tile({x: (tile.x), y: (tile.y+1), left: newtilebox.x1, top: newtilebox.y1}, this.params.tileborders);this.AppendTile(newtile);r = true;}return r;};Matrix.prototype.isVisible = function(tile) {if ((tile.x2 < this.bigbox.x1) || (tile.x1 > this.bigbox.x2) || (tile.y2 < this.bigbox.y1) || (tile.y1 > this.bigbox.y2)) {return false;}return true;};Matrix.prototype.GetTileAtPix = function(pix) {var tile, tilebox;for(var i in this.tiles) {tile = this.tiles[i];tilebox = {x1: tile.image.offsetLeft,y1: tile.image.offsetTop,x2: tile.image.offsetLeft+TILE_SIZE,y2: tile.image.offsetTop+TILE_SIZE};if (pix.left >= tilebox.x1 && pix.left <= tilebox.x2 && pix.top >= tilebox.y1 && pix.top <= tilebox.y2) {return {x: tile.x,y: tile.y,left: pix.left-tile.image.offsetLeft,top: pix.top-tile.image.offsetTop}}}return false;};Matrix.prototype.GetTileMinMax = function() {minX = Infinity;maxX = -Infinity;minY = Infinity;maxY = -Infinity;for(var i in this.tiles) {if (this.tiles[i].x < minX) {minX = this.tiles[i].x;}if (this.tiles[i].x >= maxX) {maxX = this.tiles[i].x;}if (this.tiles[i].y < minY) {minY = this.tiles[i].y;}if (this.tiles[i].y >= maxY) {maxY = this.tiles[i].y;}}return {minx: minX, miny: minY, maxx: maxX, maxy: maxY};};Matrix.prototype.Info = function() {};Matrix.prototype.HideAllMarkers = function() {for(var i in this.markers) {this.markers[i].Show(false);}};Matrix.prototype.RemoveAllMarkers = function() {for(var i in this.markers) {this.RemoveMarker(i);}};Matrix.prototype.RemoveMarker = function(markerid) {for (var i in this.markers[markerid].tiles) {tileid = this.markers[markerid].tiles[i].x+'x'+this.markers[markerid].tiles[i].y;if (this.tiles[tileid] && this.tiles[tileid].markers[markerid]) {delete this.tiles[tileid].markers[markerid];}};this.div.removeChild(this.markers[markerid].div);delete this.markers[markerid];};Matrix.prototype.SetMarker = function(marker) {this.RemoveAllMarkers();this.AddMarker(marker);};Matrix.prototype.AddMarker = function(marker) {if (!this.markers[marker.id]) {this.markers[marker.id] = marker;this.div.appendChild(marker.div);}};function MarkerTemplate(data) {if (!data.name) return false;this.currentstate = false;this.tiles = {};this.x = data.x;this.y = data.y;this.div = document.createElement('DIV');this.div.style.position = 'absolute';this.div.style.zIndex = '10000';this.hintdiv = document.createElement('DIV');this.hintdiv.id = 'hint';this.hintdiv.style.zIndex = '10000';var tmp_content = document.createElement('DIV');tmp_content.className = 'hintcontent';if (data.image) {var tmp_img = document.createElement('IMG');tmp_img.src = data.image;tmp_img.width = 98;tmp_img.height = 73;tmp_content.appendChild(tmp_img);};var tmp_h1 = document.createElement('H1');tmp_h1.innerText = data.name;tmp_content.appendChild(tmp_h1);var tmp_text = document.createElement('SPAN');tmp_text.innerHTML = data.address+'<BR>';tmp_content.appendChild(tmp_text);var tmp_text = document.createElement('SPAN');if (data.metro) {tmp_text.innerHTML = 'Метро: '+data.metro+'<BR>';} else {tmp_text.innerHTML = '<BR>';}tmp_content.appendChild(tmp_text);var tmp_text = document.createElement('SPAN');if (data.phone) {tmp_text.innerHTML = 'т. '+data.phone+'<BR>';} else {tmp_text.innerHTML = '<BR>';};tmp_content.appendChild(tmp_text);var tmp_text = document.createElement('SPAN');if (data.url) {tmp_text.innerHTML = '<a href="'+data.url+'" target="_blank">'+data.url+'</a>';} else {tmp_text.innerHTML = '<BR>';};tmp_content.appendChild(tmp_text);var empty_div = document.createElement('DIV');tmp_content.appendChild(empty_div);this.hintdiv.appendChild(tmp_content);var tmp_content = document.createElement('DIV');tmp_content.className = 'arrow';tmp_content.appendChild(empty_div);this.hintdiv.appendChild(tmp_content);this.div.appendChild(this.hintdiv);for(var i in control.map.scalelist) {this.tiles[i] = Geo2Pix({x:this.x, y:this.y}, control.map.extent, control.map.scalelist[i], control.map.datum);};this.ok = true;this.FixPosition = function() {this.hintdiv.style.left = -this.hintdiv.offsetWidth+27;this.hintdiv.style.top = -this.hintdiv.offsetHeight;};this.SetPosition = function(to) {this.div.style.left = to.x;this.div.style.top = to.y;};this.Show = function(state) {if (state) {if (this.tiles[control.currentscalenum] == undefined) {this.tiles[control.currentscalenum] = Geo2Pix({x:this.x, y:this.y}, control.map.extent, control.currentscale, control.map.datum);};tileid = this.tiles[control.currentscalenum].x+'x'+this.tiles[control.currentscalenum].y;if (control.matrix.tiles[tileid] != undefined) {this.SetPosition({x: control.matrix.tiles[tileid].image.offsetLeft+this.tiles[control.currentscalenum].left, y: control.matrix.tiles[tileid].image.offsetTop+this.tiles[control.currentscalenum].top});if (!control.matrix.tiles[tileid].markers[this.id]) {control.matrix.tiles[tileid].markers[this.id] = this;}}};this.div.style.display = (state) ? 'block' : 'none';this.currentstate = state;}};function Marker(id, x, y, customimage) {this.id = id;this.x = x;this.y = y;this.text = '';this.customimage = customimage;this.tiles = {};this.currentstate = false;this.labelcurrentstate = false;this.havecontent = false;this.div = document.createElement('DIV');this.div.style.position = 'absolute';this.div.style.zIndex = '1000';this.image = document.createElement('IMG');if (customimage) {this.image.src = customimage;this.image.style.left = 0;this.image.style.bottom = 0;} else {this.image.src = 'i/bluepoint.gif';this.image.style.left = -12;this.image.style.bottom = 0;}this.image.style.position = 'absolute';this.image.style.cursor = 'pointer';this.image.style.zIndex = '1000';this.div.appendChild(this.image);this.label = document.createElement('DIV');this.label.style.position = 'absolute';this.label.style.left = 2;this.label.style.bottom = 100;this.label.style.width = 'auto';this.label.style.height = 'auto';this.label.style.zIndex = '999';this.label.style.background = '#ffffff';this.label.style.border = '2px solid #2828FF';this.label.style.padding = '15px';this.label.style.display = 'none';this.div.appendChild(this.label);this.iw_tapimage = document.createElement('IMG');this.iw_tapimage.src = 'i/iw_tap.gif';this.iw_tapimage.style.position = 'absolute';this.iw_tapimage.style.left = 0;this.iw_tapimage.style.bottom = -70;this.iw_tapimage.style.zIndex = '1000';this.label.appendChild(this.iw_tapimage);this.closeimage = document.createElement('IMG');this.closeimage.src = 'i/close.gif';this.closeimage.style.position = 'absolute';this.closeimage.style.cursor = 'pointer';this.closeimage.style.right = 2;this.closeimage.style.top = 2;this.closeimage.style.zIndex = '1000';this.label.appendChild(this.closeimage);var self = this;addhandler(this.image, 'click', function(e) {self.ShowLabel(!self.labelcurrentstate)});addhandler(this.closeimage, 'click', function(e) {control.matrix.RemoveMarker(self.id)});for(var i in control.map.scalelist) {this.tiles[i] = Geo2Pix({x:this.x, y:this.y}, control.map.extent, control.map.scalelist[i], control.map.datum);}};Marker.prototype.Show = function(state) {if (state) {if (this.tiles[control.currentscalenum] == undefined) {this.tiles[control.currentscalenum] = Geo2Pix({x:this.x, y:this.y}, control.map.extent, control.currentscale, control.map.datum);};tileid = this.tiles[control.currentscalenum].x+'x'+this.tiles[control.currentscalenum].y;if (control.matrix.tiles[tileid] != undefined) {this.SetPosition({x: control.matrix.tiles[tileid].image.offsetLeft+this.tiles[control.currentscalenum].left, y: control.matrix.tiles[tileid].image.offsetTop+this.tiles[control.currentscalenum].top});if (!control.matrix.tiles[tileid].markers[this.id]) {control.matrix.tiles[tileid].markers[this.id] = this;}}};this.div.style.display = (state) ? 'block' : 'none';this.currentstate = state;};Marker.prototype.FixPosition = function(x, y) {x = x*1;y = y*1;var labelH = this.label.offsetHeight + this.image.offsetHeight;var labelW = this.label.offsetWidth + this.image.offsetWidth;return {x:x+Math.round(labelW/2), y:y+Math.round(labelH/2)};};Marker.prototype.ShowLabel = function(state) {if (!this.havecontent) return;this.label.style.display = (state) ? 'block' : 'none';this.labelcurrentstate = state;};Marker.prototype.SetPosition = function(to) {this.div.style.left = to.x;this.div.style.top = to.y;};Marker.prototype.AddURL = function(url, content, prefix) {if (url == undefined || url == '') {return false;}if (content == undefined) {content = url;};D = document.createElement('DIV');D.className = 'markerlabel';Anode = document.createElement('A');url=url.replace('http://', '', 'gi');Anode.setAttribute('href', 'http://'+url);Anode.setAttribute('target', '_blank');Anode.setAttribute('title', 'Открыть в новом окне.');textnode = document.createTextNode(content);Anode.appendChild(textnode);Anode.className = 'markerlabelweb';D.appendChild(Anode);this.label.appendChild(D);this.havecontent = true;};Marker.prototype.AddToLabel = function(content, small, gray, wrap) {this.text += content;labeldiv = document.createElement('DIV');labeldiv.className = 'markerlabel';if (small) {labeldiv.className = 'markerlabelsmall';}if (gray) {labeldiv.className = 'markerlabelgray';}if (!wrap) {labeldiv.style.whiteSpace  = 'nowrap';}node = document.createTextNode(content);labeldiv.appendChild(node);this.label.appendChild(labeldiv);this.havecontent = true;};function Zoomer(zoomcount, initzoom) {var temp, slider;this.initzoom = initzoom;this.zoomcount = zoomcount;this.div = document.createElement('DIV');this.div.style.position = 'absolute';this.div.style.overflow = 'hidden';this.div.style.zIndex = '1000';this.div.style.height = 25*2+13*zoomcount;this.div.style.width = 28;this.div.style.left = '2px';this.div.style.top = document.getElementById('head').offsetHeight+30;this.div.id = 'zoomer';temp = document.createElement('IMG');temp.src = 'i/slider_top.png';temp.className='fixpng';temp.style.position = 'absolute';temp.style.left = 0;temp.style.top = 0;temp.width = 28;temp.height = 25;temp.id = 'zoomin';temp.style.cursor = 'pointer';this.div.appendChild(temp);for(var i=0;i<zoomcount;i++){temp = document.createElement('IMG');temp.src = 'i/slider_step.png';temp.style.position = 'absolute';temp.style.left = 0;temp.style.top = 25+i*13;temp.width = 28;temp.height = 13;temp.style.cursor = 'pointer';temp.id = "zoom_step_"+i;temp.cnt = i;temp.title = control.map.scalelist[i];this.div.appendChild(temp);addhandler(temp, 'click', function(e) {control.ChangeZoom(GetTarget(e).cnt-control.currentscalenum);control.zoomer.initzoom = GetTarget(e).cnt}); };temp = document.createElement('IMG');temp.src = 'i/slider_bottom.png';temp.className='fixpng';temp.style.position = 'absolute';temp.style.left = 0;temp.style.bottom = 0;temp.width = 28;temp.height = 25;temp.id = 'zoomout';temp.style.cursor = 'pointer';this.div.appendChild(temp);this.slider = document.createElement('IMG');this.slider.src = 'i/slider_slider.png';this.slider.style.position = 'absolute';this.slider.style.left = 5;this.slider.style.top = initzoom*13+25+3;this.slider.width = 18;this.slider.height = 5;this.slider.style.cursor = 'pointer';this.slider.id = 'slider';this.div.appendChild(this.slider);slider = new Object();slider.control = this;slider.moving = false;slider.obj = this.slider;slider.dy = 0;slider.obj.miny = 22;slider.obj.maxy = (zoomcount-1)*13+25+10;slider.obj.onmousedown = function(e) {cancelevent(e); return slider.control.StartDrag(e)};addhandler(document, 'mousemove', function(e) { return slider.control.Drag(e) });addhandler(document, 'mouseup', function(e) { slider.control.EndDrag(e) }); };Zoomer.prototype.ShiftToZoom = function(zoom) {this.slider.style.top = zoom*13+25+3; };Zoomer.prototype.StartDrag = function(e) {this.moving = true;this.dy = GetMouse(e).y-this.slider.offsetTop;return false; };Zoomer.prototype.EndDrag = function(e) {var newzoom;if (!this.moving) return false;this.moving = false;newzoom = Math.round((this.slider.offsetTop-28)/13);if (newzoom < 0) newzoom = 0;if (newzoom > this.zoomcount-1) newzoom = this.zoomcount-1;this.slider.style.top = newzoom*13+25+3;control.ChangeZoom(newzoom-this.initzoom);this.initzoom = newzoom; };Zoomer.prototype.Drag = function(e) {var newy;if (!this.moving) return true;newy = e.clientY-this.dy;if (newy >= this.slider.miny && newy <= this.slider.maxy) this.slider.style.top = newy;return false; };Zoomer.prototype.Show = function(state) {this.div.style.visibility = (state) ? 'visible' : 'hidden'; };function Finder(mapid) {this.base = FINDER_SERVER;this.offset = 0;this.limit = 0;this.mapid = mapid;this.types = false;this.callback = false; };Finder.prototype.SelectBy = function(to, where, what, parent, context) { if (where == 'buildings') { this.url = this.base + 'finder/index.php?option=com_sobi2&sobi2Task=search&Itemid=34&sobi2Search='+where+'&search=Поиск&searchphrase=all'; } else { this.url = this.base + 'finder/index.php?option=com_sobi2&sobi2Task=search&Itemid=34&sobi2Search='+what+'&search=Поиск&searchphrase=all'; };replyfunc = function () {var search_objects=[];eval(this.request.responseText);if (search_objects[0].params.error != undefined) {control.SearchResults.ClearSubResults();control.SearchResults.JumpToObject(context);} else {control.SearchResults.ClearSubResults();control.SearchResults.AppendSubResults(parent, search_objects);} };document.getElementById('searchbutton').src = 'i/progress.gif';this.MakeRequest(function () {replyfunc() }); };Finder.prototype.SearchByAgent = function(agent, oid, z) { this.url = this.base + 'finder/index.php?option=com_sobi2&sobi2Task=search&Itemid=34&sobi2Search='+oid+'&search=Поиск&searchphrase=all';replyfunc = function () {var search_objects=[];eval(control.Finder.request.responseText);if (search_objects[0].params.error != undefined) {} else { control.SearchResults.JumpToObject(search_objects[0].params, z); } };document.getElementById('searchbutton').src = 'i/progress.gif';this.MakeRequest(function () {replyfunc() }); };Finder.prototype.SearchByKeyword = function(keyword) { if (keyword == '' || keyword == '<' || keyword == '<<' || keyword == '<<<' || keyword == '<<<<' || keyword == undefined) { return; } keyword = keyword.replace(/\"/g, '\\"'); this.url = this.base + 'finder/index.php?option=com_sobi2&sobi2Task=search&Itemid=34&sobi2Search='+keyword+'&search=Поиск&searchphrase=all';subrequestfunc = function(parent) { if (this.typeid == 'metrostat') { where = 'metro'; };if (this.typeid == 'roads') {where = 'buildings'; }what = this.obj_cod;control.Finder.SelectBy(this.id, where, what, parent, this); };replyfunc = function () {var search_objects=[];eval(control.Finder.request.responseText);if (search_objects && search_objects[0] && search_objects[0].params && search_objects[0].params.error != undefined) {keyword = keyword.replace(/\\"/g, '"');control.rWindow.Generate('','Ничего не найдено по запросу:&nbsp;<b>'+keyword+'</b></br>Возможно, искомый объект ещё не внесен в базу.');control.rWindow.Show(true);} else {control.SearchResults.ClearSubResults();control.SearchResults.Clear(true);for(i in search_objects) {search_objects[i].params.subrequest = subrequestfunc;control.SearchResults.AddObject(search_objects[i].params); };control.SearchResults.Show(true); } };document.getElementById('searchbutton').src = 'i/progress.gif';this.MakeRequest(function() {replyfunc() }); };function SimpleObject(params) {this.params = params;};Finder.prototype.MakeRequest = function(callback) {try {request = new XMLHttpRequest();} catch (e) {request = new ActiveXObject("Microsoft.XMLHTTP");};request.onreadystatechange = function() {if (request.readyState == 4) {if (request.status == 200) {callback();document.getElementById('searchbutton').src = 'i/search.gif';} else if (request.status == undefined) {} else {document.getElementById('searchbutton').src = 'i/search.gif';control.rWindow.Generate('Ошибка '+request.status, 'Введите точный запрос!');control.rWindow.Show(true); } } };this.request = request;request.open("GET", this.url);request.send(null); };Finder.prototype.Abort = function() {if (this.request != undefined) {this.request.abort(); };document.getElementById('searchbutton').src = 'i/search.gif'; };function ControlPanel() {var temp, temp2;this.div = document.createElement('DIV');this.div.style.position = 'absolute';this.div.style.overflow = 'hidden';this.div.style.right = 33;this.div.style.top = document.getElementById('head').offsetHeight+2;this.div.style.width = 102;this.div.style.height = 25;this.div.style.zIndex = '1000';this.div.id = 'controlpanel';temp = document.createElement('IMG');temp.src = 'i/hs-1.gif';temp.style.position = 'absolute';temp.style.left = 0;temp.style.top = 0;temp.width = 7;temp.height = 25;this.div.appendChild(temp);temp = document.createElement('DIV');temp.style.backgroundImage = "url(i/hs-2.gif)";temp.style.backgroundPosition = 'center center';temp.style.backgroundRepeat = 'repeat-x';temp.style.position = 'absolute';temp.style.left = 7;temp.style.top = 0;temp.style.width = 90;temp.style.height = 25;this.div.appendChild(temp);temp2 = document.createElement('IMG');temp2.src = 'i/hs-star.gif';temp2.style.position = 'absolute';temp2.style.left = 0;temp2.style.top = 2;temp2.width = 26;temp2.height = 19;temp2.id = "favorite";temp2.style.cursor = "pointer";temp.appendChild(temp2);temp2 = document.createElement('IMG');temp2.src = 'i/hs-url.gif';temp2.style.position = 'absolute';temp2.style.left = 30;temp2.style.top = 2;temp2.width = 26;temp2.height = 19;temp2.id = "geturl";temp2.style.cursor = "pointer";temp.appendChild(temp2);temp2 = document.createElement('IMG');temp2.src = 'i/hs-print.gif';temp2.style.position = 'absolute';temp2.style.left = 60;temp2.style.top = 2;temp2.width = 26;temp2.height = 19;temp2.id = "print";temp2.style.cursor = "pointer";temp.appendChild(temp2);temp = document.createElement('IMG');temp.src = 'i/hs-3.gif';temp.style.position = 'absolute';temp.style.right = 0;temp.style.top = 0;temp.width = 7;temp.height = 25;this.div.appendChild(temp); };ControlPanel.prototype.Show = function(state) { this.div.style.visibility = (state) ? 'visible' : 'hidden'; };function MapSelector() {this.div = document.createElement('DIV');this.div.style.position = 'absolute';this.div.style.overflow = 'hidden';this.div.id = 'mapselector';this.div.style.left = 0;this.div.style.top = document.getElementById('head').offsetHeight;this.div.style.width = 'auto';this.div.style.height = 'auto';this.div.style.zIndex = '1000';this.div.style.padding = '20px';this.div.style.backgroundImage = "url(i/box2.png)";this.div.style.background = "#FFFFFF";this.div.style.border = "#FF0000";this.div.style.visibility = 'hidden';var dumplist = [];for(mapid in control.maps) {firstletter = control.maps[mapid].description.charAt(0);dumplist.push({firstletter : firstletter,
id : mapid,vid: mapid,
status: control.maps[mapid].status,
description : control.maps[mapid].description,
path: control.maps[mapid].path,
type : 'real'});};for(mapid in control.virtualmaps) {firstletter = control.virtualmaps[mapid].description.charAt(0);dumplist.push({firstletter : firstletter,
id : control.virtualmaps[mapid].linkto,
vid: mapid,
x : control.virtualmaps[mapid].defaultcenter.x,
y : control.virtualmaps[mapid].defaultcenter.y,
z : control.virtualmaps[mapid].defaultcenter.z,
description : control.virtualmaps[mapid].description,
status: control.virtualmaps[mapid].status,
path: control.virtualmaps[mapid].path,
type : 'virtual'});};dumplist.sort(this.compare);this.html = '<TABLE cellpadding="5" cellspacing="0" border="0"><TR valign="top">';var lfl,cur=0;for(var column=0;column<4;column++) {this.html += '<TD width="10">';this.html += '<TABLE cellpadding="0" cellspacing="0" border="0">';lfl = dumplist[cur].firstletter;this.html += '<TR><TD align="center" width="5" class="mapselector_firstletter">'+dumplist[cur].firstletter+'</TD><TD></TD></TR>';for(elem=0;elem<Math.round(dumplist.length/4);elem++){if (lfl != dumplist[cur].firstletter) {this.html += '<TR><TD height="1" colspan="2"></TD></TR>';this.html += '<TR><TD align="center" width="5" class="mapselector_firstletter">'+dumplist[cur].firstletter+'</TD><TD></TD></TR>';}if (dumplist[cur].status) {this.html += '<TR><TD colspan="2" nowrap><A target="_blank" title="Открыть в новом окне: '+dumplist[cur].description+'" href="'+window.location.protocol+'//'+window.location.host+'/';if (dumplist[cur].x != undefined && dumplist[cur].y != undefined && dumplist[cur].z != undefined) {this.html += '#agent='+dumplist[cur].x+'&oid='+dumplist[cur].y+'&z='+dumplist[cur].z+'&embed='+dumplist[cur].path;}this.html += '"class="llist">';} else {this.html += '<TR><TD colspan="2" nowrap><A title="'+dumplist[cur].description+' - cсылка неактивна." href="#" onclick="return false" class="disabled">';}this.html += dumplist[cur].description;this.html += '</A></TD></TR>';lfl = dumplist[cur].firstletter;cur++;if (cur>=dumplist.length) {break; } }this.html += '</TABLE>';this.html += '</TD>'; }this.html += '</TR></TABLE>'; };MapSelector.prototype.compare = function(a, b) {if (a.description < b.description) {return -1; } if (a.description > b.description) { return 1; } return 0; };MapSelector.prototype.PopUp = function() {control.rWindow.Generate('Выберите улицу или организацию:', this.html);control.rWindow.Show(true); };MapSelector.prototype.Show = function(state) {control.rWindow.Show(state); };function rWindow() {this.div = document.createElement('DIV');this.div.style.position = 'absolute';this.div.style.zIndex = '30000';this.div.style.borderRight = '3px solid #999999';this.div.style.borderBottom = '3px solid #999999';this.div.style.width = 'auto';this.div.style.height = 'auto';this.contentdiv = document.createElement('DIV');this.contentdiv.style.margin = '30px';this.contentdiv.style.paddingBottom = '20px';this.div.style.background = "url(i/box2.png)";this.state = false;this.div.appendChild(this.contentdiv); };rWindow.prototype.Generate = function(header, content) {if (this.headernode) {this.contentdiv.removeChild(this.headernode); };if (this.contentnode) {this.contentdiv.removeChild(this.contentnode); };this.headernode = document.createTextNode(header);this.contentdiv.appendChild(this.headernode);this.contentnode = document.createElement('DIV');this.contentnode.innerHTML = content;this.contentdiv.appendChild(this.contentnode);this.closebutton = document.createElement('IMG');this.closebutton.src = 'i/cancel.png';this.closebutton.style.position = 'absolute';this.closebutton.style.bottom = 2;this.closebutton.style.right = 2;this.closebutton.width = 32;this.closebutton.height = 32;this.closebutton.style.cursor = "pointer";var self = this;addhandler(this.closebutton, 'click', function(e) {self.Show(false)});this.div.appendChild(this.closebutton);this.div.style.top = control.matrix.box.center.y - Math.round(this.div.offsetHeight / 2);this.div.style.left = control.matrix.box.center.x - Math.round(this.div.offsetWidth / 2); };rWindow.prototype.Show = function(state) {var prevstate = (this.div.style.visibility == 'visible');this.div.style.visibility = (state) ? 'visible' : 'hidden';this.state = state;return prevstate; };Show = function(state) {var prevstate = (this.div.style.display == 'block');this.div.style.display = (state) ? 'block' : 'none';return prevstate; };function SearchSubResults(left, top) {this.div = document.createElement('DIV');this.div.style.top =  document.getElementById('head').offsetHeight+2;this.div.style.backgroundImage = 'url("i/box2.png")';this.div.style.border = '1px solid #639ADC';this.div.style.position = 'absolute';this.div.style.font = 'normal 12px arial,sans-serif';this.div.style.overflow = 'scroll';this.div.style.zIndex = '300000';this.div.style.width = '300px';this.div.style.padding = '5px';this.div.style.height = '300px'; };SearchSubResults.prototype.Show = function(state) {var prevstate = (this.div.style.display == 'block');if (!state) {this.div.style.display = 'none';} else {this.div.style.left = control.SearchResults.div.offsetWidth+4;this.div.style.display = 'block'; } return prevstate; };function SearchResults() {this.div = document.createElement('DIV');this.div.style.left = '32px';this.div.className = "clientfix";this.div.style.top = document.getElementById('head').offsetHeight+2;this.div.style.backgroundImage = 'url("i/box2.png")';this.div.style.border = '1px solid #639ADC';this.div.style.position = 'absolute';this.div.style.font = 'normal 12px arial,sans-serif';this.div.style.overflow = 'scroll';this.div.style.zIndex = '300000';this.div.style.width = '350px';this.div.style.height = '150px';this.groups = {};closebutton = document.createElement('IMG');closebutton.src = 'i/close.png';closebutton.width = '12';closebutton.height = '12';closebutton.align = 'right';closebutton.style.cursor = "pointer";addhandler(closebutton, 'click', function(e) {control.SearchSubResults.Show(false);control.SearchResults.Show(false); });this.div.appendChild(closebutton); };SearchResults.prototype.ClearSubResults = function() {control.SearchSubResults.Show(false);while(control.SearchSubResults.div.firstChild) {control.SearchSubResults.div.removeChild(control.SearchSubResults.div.firstChild); } };SearchResults.prototype.AppendSubResults = function(fortype, objects) {var objdiv;var textnode;var object;closebutton = document.createElement('IMG');closebutton.src = 'i/close.png';closebutton.width = '12';closebutton.height = '12';closebutton.align = 'right';closebutton.style.cursor = "pointer";addhandler(closebutton, 'click', function(e) {control.SearchSubResults.Show(false); });control.SearchSubResults.div.appendChild(closebutton);if (fortype.typeid == 'roads') {objdiv = document.createElement('DIV');objdiv.className = 'searchsubresultsitem';objdiv.data = fortype;textnode = document.createTextNode(fortype.text+': ');objdiv.appendChild(textnode);control.SearchSubResults.div.appendChild(objdiv);addhandler(objdiv, 'click', function(e) {target = GetTarget(e);control.SearchResults.JumpToObject(target.data);control.SearchSubResults.Show(false);control.SearchResults.Show(false); }); };for(var i in objects) {object = objects[i].params;objdiv = document.createElement('DIV');if (object.adres) { text = object.adres; } else if (object.name) { text = object.name; } else { text = object.text; };textnode = document.createTextNode(text);objdiv.appendChild(textnode);objdiv.className = 'searchsubresultsitem';objdiv.style.cursor = 'pointer';objdiv.data = object;addhandler(objdiv, 'click', function(e) {target = GetTarget(e);control.SearchSubResults.Show(false);control.SearchResults.Show(false);control.SearchResults.JumpToObject(target.data); });control.SearchSubResults.div.appendChild(objdiv);if (object.exit) {subobjdiv = document.createElement('DIV');subobjdiv.className = 'search_results_object_subinfo';textnode = document.createTextNode(object.exit);subobjdiv.appendChild(textnode);control.SearchSubResults.div.appendChild(subobjdiv); } } control.SearchSubResults.Show(true); };SearchResults.prototype.AddObject = function(object) {if (!this.groups[object.typeid]) {this.groups[object.typeid] = new SearchResultGroup(object.typeid, (object.typename != '' ? object.typename : control.object_types[object.typeid]));this.div.appendChild(this.groups[object.typeid].div); };this.groups[object.typeid].AddItem(object); };SearchResults.prototype.Clear = function(removegroups) {for(var i in this.groups) {this.groups[i].Clear();if (removegroups) {this.div.removeChild(this.groups[i].div);delete this.groups[i]; } } };SearchResults.prototype.Generate = function() { };SearchResults.prototype.Show = function(state) {var prevstate = (this.div.style.display == 'block');this.div.style.display = (state) ? 'block' : 'none';if (state) {if (Count(this.groups) == 1) {var firstgroup = GetFirst(this.groups);this.groups[firstgroup.id].ShowContent(true);}}return prevstate;};SearchResults.prototype.JumpToObject = function(object, z) {var s1 = ComprehensiveScale({x1:object.min_x, y1:object.min_y, x2:object.max_x, y2:object.max_y}, {width: control.matrix.box.width, height: control.matrix.box.height}, control.map.datum);var obj;if (object.text == undefined) {object.text = object.streetadr;};if (object.text == undefined) {object.text = object.name;}var workid = object.rowid||object.id;if (!object.x) {object.x = object.min_x*1;object.y = object.min_y*1;};if (!control.matrix.markers[workid]) {obj = new Marker(object.rowid||object.id, object.x, object.y);obj.AddToLabel(object.text);if (object.exit) {obj.AddToLabel(object.line1, true, false);obj.AddToLabel(object.exit, true, true, true);}if (object.groupname) { obj.AddToLabel(object.groupname, true, true); }if (object.address) { obj.AddToLabel(object.address, true, false); }if (object.adm1) { obj.AddToLabel(object.adm1, true, true); }if (object.adm3) { obj.AddToLabel(object.adm3, true, true); }if (object.adm2) { obj.AddToLabel(object.adm2, true, true); }if (object.adm) { obj.AddToLabel(object.adm, true, true); }if (object.phone) { obj.AddToLabel(object.phone, true, true); }if (object.fax) { obj.AddToLabel(object.fax, true, true); }if (object.website) { obj.AddURL(object.website); }if (control.vars.makeobjurl) { obj.AddURL(control.vars.makeobjurl(object.id, object.typeid), 'Подробнее...'); };control.matrix.AddMarker(obj);obj.Show(true);obj.ShowLabel(true);scale = z || NearestScale(s1+1);var newpos = obj.FixPosition(object.x, object.y);control.Goto(newpos.x, newpos.y, scale);} else {newpos = {x:object.x, y:object.y};control.Goto(newpos.x, newpos.y, scale);}};SearchResults.prototype.HighlightItem = function(id) {for(var i in this.groups) {for(var j in this.groups[i].items) {if (this.groups[i].items[j].data.id == id) {this.groups[i].items[j].textdiv.style.backgroundColor = '#3370CE';this.groups[i].items[j].textdiv.style.color = '#FFFFFF';} else {this.groups[i].items[j].textdiv.style.backgroundColor = 'transparent';this.groups[i].items[j].textdiv.style.color = '#000000';}}}};function SearchResultGroup(id, name) {this.id = id;this.name = name;this.items = {};this.contentstate = false;this.div = document.createElement('DIV');this.headerdiv = document.createElement('DIV');this.headerdiv.className = 'searchresultsgroup';this.headerdiv.containdivid = id;this.contentdiv = document.createElement('DIV');this.contentdiv.style.paddingLeft = '10px';this.contentdiv.style.display = 'none';this.contentdiv.id = this.headerdiv.containdivid;this.headerdiv.appendChild(document.createTextNode(name));this.div.appendChild(this.headerdiv);this.div.appendChild(this.contentdiv);addhandler(this.headerdiv, 'click', function(e) {var target = GetTarget(e);control.SearchResults.ClearSubResults();var prevstate = control.SearchResults.groups[target.containdivid].contentstate;for(var i in control.SearchResults.groups) {control.SearchResults.groups[i].ShowContent(false);};control.SearchResults.groups[target.containdivid].ShowContent(!prevstate);});};SearchResultGroup.prototype.FindExistObjCod = function(obj_cod) {for(var i in this.items) {if (this.items[i].data.obj_cod == obj_cod) {return true;}}return false;};SearchResultGroup.prototype.AddItem = function(object) {if (!this.items[object.id]) {this.items[object.id] = new SearchResultsItem(object);this.contentdiv.appendChild(this.items[object.id].div);}};SearchResultGroup.prototype.Clear = function() {for(var i in this.items) {delete this.items[i];}};SearchResultGroup.prototype.Show = Show;SearchResultGroup.prototype.ShowContent = function(state) {this.contentstate = state;var prevstate = (this.contentdiv.style.display == 'block');this.contentdiv.style.display = (state) ? 'block' : 'none';return prevstate;};function SearchResultsItem(object) {this.data = object;this.div = document.createElement('DIV');this.textdiv = document.createElement('DIV');this.textdiv.className = 'searchresultsitem';var text;if (object.streetadr) {text = object.streetadr;} else if (object.text) {text = object.text;} else if (object.name) {text = object.name;} else {text = 'Неизвестный объект';};if (object.typeid == 'roads'||(object.typeid == 'metrostat' && object.leg_num == '1')) {this.textdiv.havesub = true;} else {this.textdiv.havesub = false;};text = cleanUpText(text);this.textdiv.appendChild(document.createTextNode(text));this.textdiv.data = object;this.textdiv.id = object.id;this.div.appendChild(this.textdiv);if (object.adm1 || object.adm || object.line1) {var subinfo = object.adm1 || object.adm || object.line1;if (object.adm2) {subinfo = object.adm2;};subobjdiv = document.createElement('DIV');subobjdiv.className = 'search_results_object_subinfo_main';textnode = document.createTextNode('('+subinfo+')');subobjdiv.appendChild(textnode);this.div.appendChild(subobjdiv);};addhandler(this.textdiv, 'click', function(e) {target = GetTarget(e);control.SearchResults.HighlightItem(target.id);if (!target.havesub) {control.SearchResults.JumpToObject(target.data);control.SearchSubResults.Show(false);control.SearchResults.Show(false);} else {object.subrequest(target.data);}});};function rMap(vars) { this.LoadTop100 = function() {var top100image = new Image();top100image.src = 'http://www.irpin.in.ua/modules/counter/counter.php';};this.Goto = function(x, y, z) {var centertile;this.currentcenter = {x: x,y: y};z = 1;oldcenter = this.matrix.GetTileAtPix({left: this.matrix.box.center.x, top: this.matrix.box.center.y});newcenter = Geo2Pix(this.currentcenter, this.map.extent, this.currentscale, this.map.datum);distance = this.CalcPixDistance(oldcenter, newcenter);if (z == this.currentscalenum && distance.distance < 1000) {oldcenter = control.matrix.box.center;newcenter = {x: oldcenter.x+distance.xdiff, y: oldcenter.y+distance.ydiff};control.matrix.SlideFromTo(
oldcenter,newcenter);} else {this.currentscale = this.map.scalelist[z];this.currentscalenum = z;centertile = Geo2Pix(this.currentcenter, this.map.extent, this.currentscale, this.map.datum);this.recalcMostTile();this.matrix.HideAllMarkers();this.matrix.RemoveAllTiles();this.matrix.currentscale = this.currentscale;this.matrix.CreateMatrix(centertile);this.zoomer.ShiftToZoom(z);};this.UpdateLocation();};this.CalcPixDistance = function(from, to) {from_pix_x = from.x*TILE_SIZE+from.left;from_pix_y = from.y*TILE_SIZE+from.top;to_pix_x = to.x*TILE_SIZE+to.left;to_pix_y = to.y*TILE_SIZE+to.top;distance = Math.round(Math.sqrt((from_pix_x-to_pix_x)*(from_pix_x-to_pix_x) + (from_pix_y-to_pix_y)*(from_pix_y-to_pix_y)));return {distance: distance, xdiff: (from_pix_x-to_pix_x), ydiff: (from_pix_y-to_pix_y)};};this.ChangeZoom = function(shift) {var currentcentertile, currentcenter;if ((shift == 0 ) || (this.currentscalenum+shift < 0) || (this.currentscalenum+shift > this.maxscalenum)) {return;};currentcentertile = control.matrix.GetTileAtPix({left: control.matrix.box.center.x,
top: control.matrix.box.center.y});currentcenter = Pix2Geo(currentcentertile, control.map.extent, control.currentscale, control.map.datum);changezoomprocess = function() {control.currentscalenum += shift;control.currentscale = control.map.scalelist[control.currentscalenum];control.recalcMostTile();control.matrix.RemoveAllTiles();control.matrix.currentscale = control.currentscale;centertile = Geo2Pix(currentcenter, control.map.extent, control.currentscale, control.map.datum);control.matrix.CreateMatrix(centertile);control.zoomer.ShiftToZoom(control.currentscalenum);control.UpdateLocation();};control.matrix.HideAllMarkers();if (Math.abs(shift) != 1) {changezoomprocess();} else {control.SmoothExec(
function() {control.smoothresize = {};control.matrix.needupdate = false;control.smoothresize.image_size_from = TILE_SIZE;if (shift < 0) {control.smoothresize.image_size_to = TILE_SIZE*(-shift*2);} else {control.smoothresize.image_size_to = TILE_SIZE/(shift*2);}control.smoothresize.imagechanger = -Math.ceil((control.smoothresize.image_size_from - control.smoothresize.image_size_to) / 5);control.smoothresize.iterator = 0;control.smoothresize.centertile = control.matrix.GetTileAtPix({left: control.matrix.box.center.x, top: control.matrix.box.center.y});control.smoothresize.minmax = control.matrix.GetTileMinMax();control.smoothresize.tiles = {};for(var i in control.matrix.tiles) {control.smoothresize.tiles[i] = document.createElement('IMG');control.smoothresize.tiles[i].src = control.matrix.tiles[i].image.src;control.smoothresize.tiles[i].style.position = 'absolute';control.smoothresize.tiles[i].style.zIndex = '600';control.smoothresize.tiles[i].width = TILE_SIZE;control.smoothresize.tiles[i].height = TILE_SIZE;control.smoothresize.tiles[i].style.left = control.matrix.tiles[i].image.offsetLeft;control.smoothresize.tiles[i].style.top = control.matrix.tiles[i].image.offsetTop;control.matrix.div.appendChild(control.smoothresize.tiles[i]);}},
function() {for(x=control.smoothresize.minmax.minx;x<=control.smoothresize.minmax.maxx;x++) {for(y=control.smoothresize.minmax.miny;y<=control.smoothresize.minmax.maxy;y++) {tileid = x+'x'+y;xdiff = control.smoothresize.centertile.x-x;ydiff = control.smoothresize.centertile.y-y;if (control.smoothresize.tiles[tileid]) {control.smoothresize.tiles[tileid].width += control.smoothresize.imagechanger;control.smoothresize.tiles[tileid].height += control.smoothresize.imagechanger;control.smoothresize.tiles[tileid].style.left = control.smoothresize.tiles[tileid].offsetLeft-(control.smoothresize.imagechanger/2)-xdiff*control.smoothresize.imagechanger;control.smoothresize.tiles[tileid].style.top = control.smoothresize.tiles[tileid].offsetTop-(control.smoothresize.imagechanger/2)-ydiff*control.smoothresize.imagechanger;}}}},
function() {control.smoothresize.iterator++;return (control.smoothresize.iterator == 5);},
function() {for(var i in control.smoothresize.tiles) {control.smoothresize.tiles[i].style.zIndex = '400';};changezoomprocess();if (control.smoothresize && control.smoothresize.tiles) {for(var i in control.smoothresize.tiles) {control.matrix.div.removeChild(control.smoothresize.tiles[i]);delete control.smoothresize.tiles[i];}control.smoothresize.tiles = {};}},1);}};this.wheel = function(event) {var delta;if (!GetTarget(event).drag) return true;delta = 0;if (!event) {event = window.event;};if (event.wheelDelta) {delta = event.wheelDelta/120;if (window.opera) {delta = -delta;}} else if (event.detail) {delta = -event.detail/3;};if (delta > 0) {delta = -1;} else {delta = 1;};if ((delta == -1 &&  (control.currentscalenum == 0)) || (delta == 1 &&  (control.currentscalenum == control.maxscalenum))) {return;};from = GetMouseWheel(event);half_x = Math.round((control.matrix.box.center.x-from.x)/2);half_y = Math.round((control.matrix.box.center.y-from.y)/2);to = {x:control.matrix.box.center.x-half_x, y:control.matrix.box.center.y-half_y};control.ChangeZoom(delta);cancelevent(event);return false;};this.SmoothExec = function(startfunc, periodicalfunc, checkendfunc, endfunc, speed) {this.smoothstartfunc = startfunc;this.smoothperiodicalfunc = periodicalfunc;this.smoothcheckendfunc = checkendfunc;this.smoothendfunc = endfunc;startfunc();this.smoothinterval = window.setInterval("control.SmoothExecDo()", speed);};this.SmoothExecDo = function() {if (this.smoothcheckendfunc()) {window.clearInterval(this.smoothinterval);this.smoothendfunc();} else {this.smoothperiodicalfunc();}};this.State2Url = function(fullpath) {var currentcentertile, currentcenter, result = '', str, query, d;currentcentertile = control.matrix.GetTileAtPix({left: control.matrix.box.center.x,top: control.matrix.box.center.y});currentcenter = Pix2Geo(currentcentertile, this.map.extent, this.currentscale, this.map.datum);if (fullpath) {result = window.location.protocol+'//'+window.location.host+window.location.pathname;};if (this.map.isgeo) {var cr = ToLonLat(currentcenter.x, currentcenter.y, this.map.datum.base);cr.lon = Math.round(cr.lon*1000000)/1000000;cr.lat = Math.round(cr.lat*1000000)/1000000;result += '#gx='+cr.lon+'&gy='+cr.lat+'&z='+this.currentscalenum;} else {currentcenter.x = Math.round(currentcenter.x*1000000)/1000000;currentcenter.y = Math.round(currentcenter.y*1000000)/1000000;result += '#x='+currentcenter.x+'&y='+currentcenter.y+'&z='+this.currentscalenum;};if (this.matrix.markers['user'] != undefined) {result += '&utext='+this.matrix.markers['user'].text+'&ux='+this.matrix.markers['user'].x+'&uy='+this.matrix.markers['user'].y;}if (this.matrix.markers['usericon'] != undefined) {result += '&uicon='+this.matrix.markers['usericon'].customimage+'&ux='+this.matrix.markers['usericon'].x+'&uy='+this.matrix.markers['usericon'].y;}if (this.userurl != undefined) {result += '&userurl='+this.userurl;}if (this.userdata != undefined) {for(var i in this.userdata) {result += '&data.'+i+'='+this.userdata[i];}}return result;};this.recalcMostTile = function() {this.mosttile = Geo2Pix({x:this.map.extent.x2, y:this.map.extent.y1}, this.map.extent, this.currentscale, this.map.datum);if (this.mosttile.left > 0){this.mosttile.x++;};if (this.mosttile.top > 0) {this.mosttile.y++;}};this.calcCoords = function() {var tile1, tile2;tile1 = Pix2Geo(control.matrix.GetTileAtPix({left: this.matrix.box.x1, top: this.matrix.box.y1}),  this.map.extent, this.currentscale, this.map.datum);tile2 = Pix2Geo(control.matrix.GetTileAtPix({left: this.matrix.box.x2, top: this.matrix.box.y2}),  this.map.extent, this.currentscale, this.map.datum);this.coords.x1 = tile1.x;this.coords.y1 = tile1.y;this.coords.x2 = tile2.x;this.coords.y2 = tile2.y;};this.UpdateLocation = function() {state = this.State2Url(false);if (this.embed) {state = state + '&embed=yes';};location.href = window.location.protocol+'//'+window.location.host+window.location.pathname + state;};this.ProcessExternalXML = function(xmldata) {s = '';var marker;var objects = xmldata.getElementsByTagName("object");for(var i=0;i<objects.length;i++) {object = objects[i];marker = {};for (var j=0; j < object.childNodes.length; j++) {line = object.childNodes[j];tagname = line.tagName;if (tagname) {value = line.firstChild.nodeValue;switch (tagname) {case 'id' : marker.id = value; break;case 'x' : marker.x = value; break;case 'y' : marker.y = value; break;case 'name' : marker.name = value; break;case 'email' : marker.email = value; break;case 'url' : marker.url = value; break;case 'text' : marker.text = value; break;case 'address' : marker.address = value; break;case 'img' : case 'image' : marker.image = value; break;case 'mapid' : marker.mapid = value; break;case 'labelstyle' : marker.labelstyle = value; break;}}};if (marker.id && marker.x && marker.y && marker.mapid == this.vars.mapid) {userpoint = new Marker(marker.id, marker.x, marker.y);this.matrix.AddMarker(userpoint);if (marker.name) userpoint.AddToLabel(marker.name);if (marker.address) userpoint.AddToLabel(marker.address, true, true);if (marker.url) userpoint.AddURL(marker.url);userpoint.Show(true);if (marker.labelstyle == 'show') userpoint.ShowLabel(true);}}};this.SelectMapid = function(pathname) {if (pathname == undefined) {return false;};for(var i in this.virtualmaps) {if (pathname.indexOf(this.virtualmaps[i].path) != -1) {return {mapid: this.virtualmaps[i].linkto, vmapid: i};}};for(var i in this.maps) {if (pathname.indexOf(this.maps[i].path) != -1) {return {mapid: i};}}return false;};var urlvalues, currentcenter, d, centertile;this.maps = globalsettings.maps;this.virtualmaps = globalsettings.virtualmaps;this.object_types = globalsettings.object_types;this.defaultdocumenttitle = document.title;this.vars = vars;this.coords = {};urlvalues = URL2Array();if (urlvalues.embed == 'yes' || urlvalues.header == 'no') {this.embed = true;};if (this.vars.staticmap == undefined) {var rvalue = this.SelectMapid(window.location.pathname);} else {if (vars.vmapid != undefined) {var rvalue = {mapid: this.virtualmaps[vars.vmapid].linkto, vmapid: vars.vmapid};} else if (vars.mapid != undefined) {var rvalue = {mapid: vars.mapid};}};	if (rvalue == false || (this.maps[rvalue.mapid] == undefined && this.virtualmaps[rvalue.vmapid] == undefined) ) {window.location = '/';};this.vars.mapid = rvalue.mapid;if (rvalue.vmapid != undefined) {this.map = this.maps[rvalue.mapid];this.vars.search_mapid = this.virtualmaps[rvalue.vmapid].search_mapid;this.vars.makeobjurl = this.virtualmaps[rvalue.vmapid].makeobjurl;this.map.defaultcenter = this.virtualmaps[rvalue.vmapid].defaultcenter;this.currentscalenum = this.virtualmaps[rvalue.vmapid].defaultcenter.z;} else {this.map = this.maps[rvalue.mapid];this.vars.makeobjurl = this.maps[rvalue.mapid].makeobjurl;this.vars.search_mapid = rvalue.mapid;this.map.defaultcenter = this.maps[rvalue.mapid].defaultcenter;this.currentscalenum = this.maps[rvalue.mapid].defaultscalenum;};this.map.datum = globalsettings.datums[this.maps[this.vars.mapid].datum];this.map.isgeo = this.maps[this.vars.mapid].isgeo;this.maxscalenum = this.map.scalelist.length-1;currentcenter = this.map.defaultcenter;document.title =  this.map.description + ' ' + this.defaultdocumenttitle;if (document.getElementById('mapname') != null) {document.getElementById('mapname').innerHTML = this.map.description;};control = this;control.rWindow = new rWindow();if (urlvalues.gx != undefined && urlvalues.gy != undefined && urlvalues.z != undefined && this.map.isgeo) {this.currentscalenum = (urlvalues.z*1);var tmp = FromLonLat(urlvalues.gx, urlvalues.gy, this.map.datum.base);currentcenter = {x: tmp.x, y:tmp.y};};if (urlvalues.x != undefined && urlvalues.y != undefined && urlvalues.z != undefined) {this.currentscalenum = (urlvalues.z*1);currentcenter = {x: urlvalues.x*1, y:urlvalues.y*1};};control.rnd = (Math.round(Math.random()*1000000000));this.currentscale = this.map.scalelist[this.currentscalenum];this.recalcMostTile();centertile = Geo2Pix(currentcenter, this.map.extent, this.currentscale, this.map.datum);control.matrix = new Matrix(this.vars.maindivid, this.currentscale, this.vars.mapid, {showcenter:false, tileborders: false});control.matrix.CreateMatrix(centertile);control.zoomer = new Zoomer(this.maxscalenum+1, this.currentscalenum);control.MapSelector = new MapSelector();control.SearchResults = new SearchResults();control.Finder = new Finder(this.vars.search_mapid);control.matrix.AddInterface(control.zoomer);control.matrix.AddInterface(control.rWindow);control.rWindow.Show(false);control.matrix.AddInterface(control.SearchResults, false);control.SearchSubResults = new SearchSubResults();control.matrix.AddInterface(control.SearchSubResults, false);if (urlvalues.q) {d = document.getElementById('query');d.value = unescape(urlvalues.q);control.Finder.SearchByKeyword(document.getElementById('query').value);};if (urlvalues.utext) {userpoint = new Marker('user', urlvalues.ux, urlvalues.uy);this.matrix.AddMarker(userpoint);userpoint.AddToLabel(unescape(urlvalues.utext));userpoint.Show(true);userpoint.ShowLabel(true);};if (urlvalues.uicon) {userpoint = new Marker('usericon', urlvalues.ux, urlvalues.uy, urlvalues.uicon);this.matrix.AddMarker(userpoint);userpoint.Show(true);};if (urlvalues.userurl) {this.userurl = urlvalues.userurl;userurl_requester = new Finder(this.vars.mapid);userurl_requester.url = '/showrml/?'+this.userurl;callback_func = function() {control.ProcessExternalXML(userurl_requester.request.responseXML);};userurl_requester.MakeRequest(callback_func);};if (urlvalues.agent && urlvalues.oid) {var z = false;if (urlvalues.z != undefined) {z=urlvalues.z;};control.Finder.SearchByAgent(urlvalues.agent, urlvalues.oid, z);};if (urlvalues.data) {templatepoint = new MarkerTemplate(urlvalues.data);if (templatepoint.ok)  {this.userdata = urlvalues.data;this.matrix.AddMarker(templatepoint);templatepoint.FixPosition();templatepoint.Show(true);}};addhandler(document.getElementById('searchform'), 'submit', function(e) {control.Finder.SearchByKeyword(document.getElementById('query').value);});addhandler(document.getElementById('zoomin'), 'click', function(e) { control.ChangeZoom(-1) });addhandler(document.getElementById('zoomout'), 'click', function(e) { control.ChangeZoom(1) });addhandler(control.matrix.div, 'mousedown', function(e) {var v;if (GetShiftKey(e)) {v = control.matrix.StartSelection(e);} else {v = control.matrix.StartDrag(e);}if (!v) {cancelevent(e);}return v;});addhandler(document, 'mouseup', function(e) {var v;if (GetShiftKey(e)) {v = control.matrix.EndSelection(e);} else {v = control.matrix.EndDrag(e);}if (!v) {cancelevent(e);}return v;});addhandler(control.matrix.div, 'mousemove', function(e) {var v;if (GetShiftKey(e)) {v = control.matrix.DoSelection(e);} else {v = control.matrix.Drag(e);}if (!v) {cancelevent(e);}return v;});addhandler(document, 'keydown', function(e) { control.matrix.PressKeyboard(e) });addhandler(document, 'keyup', function(e) { control.matrix.UnPressKeyboard(e) });addhandler(control.matrix.div, 'dblclick', function(e) {control.e = e;if (GetTarget(control.e).drag == undefined) {return false;};control.matrix.SlideFromTo(
{x: GetMouse(control.e).x, y: GetMouse(control.e).y},
{x: control.matrix.box.center.x, y: control.matrix.box.center.y},
function() {control.ChangeZoom(-1)});});this.hsize = control.matrix.box.width;this.vsize = control.matrix.box.height;this.underresize = false;this.CheckChangeSize = function() {if (this.underresize) {return false;}if (control.matrix.div.offsetWidth != this.hsize || control.matrix.div.offsetHeight != this.vsize) {this.underresize = true;oldcenter = control.matrix.box.center;control.matrix.MakeBox();control.matrix.needupdate = true;control.matrix.SlideFromTo(
oldcenter,control.matrix.box.center,
function() {control.underresize = false});this.hsize = control.matrix.box.width;this.vsize = control.matrix.box.height;}};window.setInterval("control.CheckChangeSize()", 1*1000);window.setInterval("control.matrix.CheckKeyboard()", .01*1000);window.setInterval("control.matrix.AddTiles()", .01*1000);window.setInterval("control.matrix.RemoveTiles()", 3*1000);buttonspri_div = document.getElementById('buttonspri');temp = document.createElement('IMG');temp.id = 'iconprint';temp.src = 'i/icon_print.png';temp.className='fixpng';temp.width = 28;temp.height = 25;temp.style.cursor = 'pointer';temp.style.margin = '15px';temp.style.zIndex = 1000;buttonspri_div.appendChild(temp);addhandler(document.getElementById('iconprint'), 'mouseover', function(e) {document.getElementById('iconprint').src = 'i/icon_print_active.png';});addhandler(document.getElementById('iconprint'), 'mouseout', function(e) {document.getElementById('iconprint').src = 'i/icon_print.png';});addhandler(document.getElementById('iconprint'), 'click', function(e) {document.getElementById('head').style.visibility = 'hidden';document.getElementById('zoomer').style.visibility = 'hidden';control.zoomer.Show(false);var sr_state = control.SearchResults.Show(false);var sur_state = control.SearchSubResults.Show(false);if (confirm('Вывести на печать?')) {window.print();};control.SearchResults.Show(sr_state);control.SearchSubResults.Show(sur_state);control.zoomer.Show(true);document.getElementById('zoomer').style.visibility = 'visible';document.getElementById('head').style.visibility = 'visible';});buttonslist_div = document.getElementById('buttonslist');temp = document.createElement('IMG');temp.id = 'iconlist';temp.src = 'i/icon_list.gif';temp.className='fixpng';temp.width = 28;temp.height = 25;temp.style.cursor = 'pointer';temp.style.margin = '15px';temp.style.zIndex = 1000;buttonslist_div.appendChild(temp);addhandler(document.getElementById('iconlist'), 'mouseover', function(e) {document.getElementById('iconlist').src = 'i/icon_list_active.gif';});addhandler(document.getElementById('iconlist'), 'mouseout', function(e) {document.getElementById('iconlist').src = 'i/icon_list.gif';});if (document.getElementById('buttonslist') != null) {addhandler(document.getElementById('buttonslist'), 'click', function(e) {control.SearchSubResults.Show(false);control.SearchResults.Show(false);control.MapSelector.PopUp();});};buttonsurl_div = document.getElementById('buttonsurl');temp = document.createElement('IMG');temp.id = 'iconurl';temp.src = 'i/icon_url.png';temp.className='fixpng';temp.width = 28;temp.height = 25;temp.style.cursor = 'pointer';temp.style.margin = '15px';temp.style.zIndex = 1000;buttonsurl_div.appendChild(temp);addhandler(document.getElementById('iconurl'), 'mouseover', function(e) {document.getElementById('iconurl').src = 'i/icon_url_active.png';});addhandler(document.getElementById('iconurl'), 'mouseout', function(e) {document.getElementById('iconurl').src = 'i/icon_url.png';});addhandler(document.getElementById('iconurl'), 'click', function(e) {var url = control.State2Url(true);control.SearchSubResults.Show(false);control.SearchResults.Show(false);control.rWindow.Generate('','<div class="buttonsurl"><br>Ссылка на этот фрагмента карты mapa.irpin.in.ua:<h5>(cкопируйте и вставьте ссылку</br> в сообщение электронной почты или чата)</br><p></p></div><b><a title="Открыть в новом окне." target="_blank" href="'+url+'">'+url+'</a></b>');control.rWindow.Show(true);});buttonsfaq_div = document.getElementById('buttonsfaq');temp = document.createElement('IMG');temp.id = 'iconfaq';temp.src = 'i/icon_faq.gif';temp.className='fixpng';temp.width = 28;temp.height = 25;temp.style.cursor = 'pointer';temp.style.margin = '15px';temp.style.zIndex = 1000;buttonsfaq_div.appendChild(temp);addhandler(document.getElementById('iconfaq'), 'mouseover', function(e) {document.getElementById('iconfaq').src = 'i/icon_faq_active.gif';});addhandler(document.getElementById('iconfaq'), 'mouseout', function(e) {document.getElementById('iconfaq').src = 'i/icon_faq.gif';});addhandler(document.getElementById('iconfaq'), 'click', function(e) {var url = control.State2Url(true);control.SearchSubResults.Show(false);control.SearchResults.Show(false);control.rWindow.Generate('','<div class="buttonsfaq">Инструкция пользования интерактивной картой:<br></br>	Поиск:<br>&raquo;&nbsp;&nbsp;Для поиска улицы или организации впишите ключевое слово в искомое поле и нажмите &quot;Найти&quot;<br>или на клавиатуре &quot;Enter&quot;. Например: &quot;улица Малиновского&quot;, &quot;Малиновского 10&quot; или &quot;ул малиновского&quot;.<br>&raquo;&nbsp;&nbsp;При положительном поиске, появится меню. Выберите/нажмите в меню требуемый искомый объект.<br>&raquo;&nbsp;&nbsp;Результат поиска помечается капелеобразным маркером.<br>&raquo;&nbsp;&nbsp;Над маркером находится ярлык, на котором указывается информация о выбранном объекте.<br>&raquo;&nbsp;&nbsp;При нажатии на маркер - ярлык отключается.<br>&raquo;&nbsp;&nbsp;&quot;Крестиком&quot; в верхнем правом углу ярлыка, можно убрать маркер и ярлык одновременно.<br><br>	Перемещение:<br>&raquo;&nbsp;&nbsp;При максимальном масштабе, двойным кликом по карте вы быстро переместите в центр то место,<br>где дважды кликнули.<br>&raquo;&nbsp;&nbsp;Если масштаб не максимальный, то двойной клик одновременно перемещает в центр выбранное<br>место на карте и увеличивает её.<br>&raquo;&nbsp;&nbsp;Управление кнопками на клавиатуре: кнопка &quot;вверх&quot; - перемещает карту на север, кнопка &quot;вниз&quot; -<br>перемещает карту на юг, кнопка &quot;влево&quot; - перемещает карту на запад, кнопка &quot;вправо&quot; -<br>перемещает карту на восток.<br><br>	Масштаб:<br>&raquo;&nbsp;&nbsp;Слева вверху находится панель увеличения в виде вертикальной полосы.<br>&raquo;&nbsp;&nbsp;Передвиньте полоску/ползунок на нужный масштаб или кликните на нужную шкалу увеличения,<br>либо нажмите на &quot;-&quot; или &quot;+&quot; для изменения масштаба.<br>&raquo;&nbsp;&nbsp;С клавиатуры кнопка &quot;-&quot; или &quot;=&quot; ( она же &quot;+&quot; ) - отдалить или приблизить.<br>&raquo;&nbsp;&nbsp;Использования колёсика мыши - можно увеличивать/уменьшать карту.<br><br>	Важно !<br>&raquo;&nbsp;&nbsp;Во избежания &quot;зависания&quot; карты не кликайте на &quot;-&quot; или &quot;+&quot; по несколько раз до полного<br> отображения/загрузки всей карты. Если такое случилось, просто обновите вэбстраничку (кнопка &quot;F5&quot;).<br></br>	Примечание:<br>&raquo;&nbsp;&nbsp;Открытые окна закрывются по нажатии клавиши &quot;ESC&quot;.<br>&raquo;&nbsp;&nbsp;Все вопросы, замечания и пожелания пишите на E-mail: &nbsp;&nbsp; v@irpin.in.ua &nbsp;&nbsp; или на icq: &nbsp;&nbsp; 455400744 <br><p></p><center>Удачного вам поиска!</center></div>');control.rWindow.Show(true);});if (!this.embed && window.addEventListener) {window.addEventListener('DOMMouseScroll', control.wheel, false);}if (!this.embed) {window.onmousewheel = document.onmousewheel = control.wheel;};addhandlerCont(document.getElementById('query'), 'focus', function(e) {control.stopmatrix = true;});addhandlerCont(document.getElementById('query'), 'blur', function(e) {control.stopmatrix = false});addhandlerCont(document.getElementById('searchform'), 'submit', function(e) {control.SearchSubResults.Show(false);control.SearchResults.Show(false);control.rWindow.Show(false);document.getElementById('query').blur();control.UpdateLocation();});if (!this.embed) { var lastupdate = this.maps[this.vars.mapid]['lastupdate']; if (lastupdate) { document.getElementById('version').innerHTML = 'Обновление от: '+lastupdate + ' / '+RMAP_VERSION; } if (this.maps[this.vars.mapid]['author2date']) { document.getElementById('version').innerHTML += ' [DB: '+this.maps[this.vars.mapid]['author2date']+']'; } var author = this.maps[this.vars.mapid]['author']; var authortitle; if (author) { document.getElementById('copyright').innerHTML += ', '; if (this.maps[this.vars.mapid]['authorhref']) { if (this.maps[this.vars.mapid]['authortitle']) { authortitle = 'title="'+this.maps[this.vars.mapid]['authortitle']+'"'; } document.getElementById('copyright').innerHTML += '<a href="'+this.maps[this.vars.mapid]['authorhref']+'" class="miniblue" target="_blank" '+authortitle+'>'+author+'</a>'; } else { document.getElementById('copyright').innerHTML += author; } if (this.maps[this.vars.mapid]['author2'] != undefined) { document.getElementById('copyright').innerHTML += ', '; var author2 = this.maps[this.vars.mapid]['author2']; if (this.maps[this.vars.mapid]['author2href']) { if (this.maps[this.vars.mapid]['author2title']) { author2title = 'title="'+this.maps[this.vars.mapid]['author2title']+'"'; };document.getElementById('copyright').innerHTML += '<a href="'+this.maps[this.vars.mapid]['author2href']+'" class="miniblue" target="_blank" '+author2title+'>'+author2+'</a>'; } else { document.getElementById('copyright').innerHTML += author2; } } } } else { document.getElementById('version').innerHTML = '';document.getElementById('copyright').innerHTML = ''; };this.LoadTop100();document.getElementById('wait').style.visibility='visible';document.getElementById('wait').style.visibility='hidden';if (!this.embed) { document.getElementById('head').style.display = 'block'; } else { document.getElementById('head').style.visibility = 'hidden'; document.getElementById('zoomer').style.top = '2px';}}
