var search_url="http://www.1189.lv/ru/info/otrasl:330-sud/"; var map; var locate; var locate_x; var locate_y; var distances = []; var waiting = false; var array = []; var min_level = 10; var offset = parseInt('1')-1; var addressPoints = []; addressPoints[1993]="Strēlnieku iela 9, RĪGA, LV-1010"; addressPoints[112480]="Atmodas iela 19, JELGAVA, LV-3007"; addressPoints[112492]="Lielā iela 4, LIEPĀJA, LV-3401"; addressPoints[113021]="Atbrīvošanas aleja 88, RĒZEKNE, LV-4601"; addressPoints[113131]="Voldemāra Baloža iela 13A, VALMIERA, LV-4201"; addressPoints[56158]=""; addressPoints[56097]="Lāčplēša iela 1, AIZKRAUKLE, LV-5101"; addressPoints[47064]=""; addressPoints[47985]="Jūras iela 13, ALOJA, LV-4064"; addressPoints[117403]="Pils iela 1, ALSUNGA, ALSUNGAS PAG., ALSUNGAS NOV., LV-3306"; addressPoints[47081]="Dārza iela 11, ALŪKSNE, LV-4301"; addressPoints[56099]="Stacijas iela 2, APE, LV-4337"; addressPoints[31036]="Jelgavas iela 1, AUCE, LV-3708"; addressPoints[114057]="Grēcinieku iela 8, RĪGA, LV-1050"; addressPoints[3898]="Blaumaņa iela 29, RĪGA, LV-1011"; addressPoints[1143]="Centra iela 4, PIŅĶI, BABĪTES PAG., BABĪTES NOV., LV-2107"; addressPoints[56100]=""; addressPoints[2108]="Ģertrūdes iela 7, RĪGA, LV-1010"; addressPoints[59416]="Elizabetes iela 18, RĪGA, LV-1050"; addressPoints[106708]="Krišjāņa Valdemāra iela 17A, RĪGA, LV-1010"; // Show user geo location on map function showMapCallback(position) { var lat = position.coords.latitude; var lon = position.coords.longitude; var lks = Kijs_LatLon_2_Lks(lat, lon); //map.SetCenter(lks.x, lks.y); locate = map.image_layer.Add("http://www.1189.lv/images/design/user.png", lks.x, lks.y, 16, 39); locate_x = lks.x; locate_y = lks.y; array[array.length] = {x:locate_x,y:locate_y}; map.ShowPoints(array, min_level); calculateDistances(); $('#distanceDropdown').show(); $.post('/ajax/companyedit.php',{action:'setLocationSession', x:locate_x, y:locate_y}); } // Change user location on map function saveLocation() { waiting=true; $("#changeMarker").hide(); $("#changeInfo").show(); document.getElementById('viewableMap0').style.cursor="url(http://www.1189.lv/images/design/mapcursor.cur),move"; map.event_click.AddCallback(function(args){ var coords = map.svg.LayerCoords(args.pointer_x, args.pointer_y); if (waiting) { $("#changeInfo").hide(); $("#changeMarker").show(); map.image_layer.Remove(locate); locate = map.image_layer.Add("http://www.1189.lv/images/design/user.png", coords.x_meter, coords.y_meter, 16, 38); $.cookie('locate', coords.x_meter+'|'+coords.y_meter, {path: '/', domain: '.1189.lv'}); locate_x = coords.x_meter; locate_y = coords.y_meter; //alert('X: ' + locate_x + ', Y: ' + locate_y); calculateDistances(); waiting=false; document.getElementById('viewableMap0').style.cursor="url(http://www.1189.lv/images/design/move_map.cur),move"; window.location.reload(); } }); } // Initialize map var oArray = new Array(); function pageInit() { var center_x = 506387; var center_y = 6311419; var actual_level; map = new JanaSetaMap('viewableMap0'); array[array.length] = {x:11241, y:11241}; array[array.length] = {x:481016, y:6278551}; array[array.length] = {x:316226, y:6266941}; array[array.length] = {x:704953, y:6267141}; array[array.length] = {x:583499, y:6376826}; array[array.length] = {x:521074, y:6401164}; array[array.length] = {x:576956, y:6273727}; array[array.length] = {x:608104, y:6225466}; array[array.length] = {x:552306, y:6403144}; array[array.length] = {x:352141, y:6317960}; array[array.length] = {x:683199, y:6368231}; array[array.length] = {x:661326, y:6380519}; array[array.length] = {x:431837, y:6258523}; array[array.length] = {x:506666, y:6311483}; array[array.length] = {x:507690, y:6312026}; array[array.length] = {x:494321, y:6311064}; array[array.length] = {x:523867, y:6288433}; array[array.length] = {x:507352, y:6312779}; array[array.length] = {x:507383, y:6311854}; array[array.length] = {x:508467, y:6313120}; // load map in best possible view if (array.length) { var view = map.BestView(array); map.Load(view.level-1, view.center_x, view.center_y); actual_level = view.level-1; } else { map.Load(min_level-1, center_x, center_y); map.SetCenter(center_x, center_y); actual_level = min_level-1; } // hide,show map controls map.navigation_controls.HideZoomRegion(); map.navigation_controls.HidePanningButton(); map.ruler.Hide(); //map.ShowSabTransp(); //map.EnableRoadWorkLayer(); map.zoom_tool.Hide(); // var offset_x_pix = 12; var offset_y_pix = 12; // show companies on map by list number var image_id0 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/0.png", 11241, 11241, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id0, "id", "pointer0"); array[0] = {x:11241, y:11241}; oArray[image_id0] = new Object(); oArray[image_id0].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/0.png']"); map.image_layer.EventMouseOverCallback(image_id0, function(id){ var id = image_id0; var el = document.getElementById('listItem0'); if ($(el).prev()) { oArray[image_id0]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/0_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id0, function(id){ showPOIinfobox(909635, 11241, 11241); //showInfoBox('some text goes here from: showInfoBox()', 11241, 11241); });*/ map.image_layer.EventClickCallback(image_id0, function(id){ showHTMLinfobox(1993,11241, 11241); }); map.image_layer.EventMouseOutCallback(image_id0, function(id){ var el = document.getElementById('listItem0'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/0.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id0]['previous']){ $(el).insertAfter(oArray[image_id0]['previous']); } }); distances[0] = [11241, 11241]; var image_id1 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/1.png", 481016, 6278551, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id1, "id", "pointer1"); array[1] = {x:481016, y:6278551}; oArray[image_id1] = new Object(); oArray[image_id1].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/1.png']"); map.image_layer.EventMouseOverCallback(image_id1, function(id){ var id = image_id1; var el = document.getElementById('listItem1'); if ($(el).prev()) { oArray[image_id1]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/1_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id1, function(id){ showPOIinfobox(140234, 481016, 6278551); //showInfoBox('some text goes here from: showInfoBox()', 481016, 6278551); });*/ map.image_layer.EventClickCallback(image_id1, function(id){ showHTMLinfobox(112480,481016, 6278551); }); map.image_layer.EventMouseOutCallback(image_id1, function(id){ var el = document.getElementById('listItem1'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/1.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id1]['previous']){ $(el).insertAfter(oArray[image_id1]['previous']); } }); distances[1] = [481016, 6278551]; var image_id2 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/2.png", 316226, 6266941, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id2, "id", "pointer2"); array[2] = {x:316226, y:6266941}; oArray[image_id2] = new Object(); oArray[image_id2].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/2.png']"); map.image_layer.EventMouseOverCallback(image_id2, function(id){ var id = image_id2; var el = document.getElementById('listItem2'); if ($(el).prev()) { oArray[image_id2]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/2_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id2, function(id){ showPOIinfobox(140246, 316226, 6266941); //showInfoBox('some text goes here from: showInfoBox()', 316226, 6266941); });*/ map.image_layer.EventClickCallback(image_id2, function(id){ showHTMLinfobox(112492,316226, 6266941); }); map.image_layer.EventMouseOutCallback(image_id2, function(id){ var el = document.getElementById('listItem2'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/2.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id2]['previous']){ $(el).insertAfter(oArray[image_id2]['previous']); } }); distances[2] = [316226, 6266941]; var image_id3 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/3.png", 704953, 6267141, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id3, "id", "pointer3"); array[3] = {x:704953, y:6267141}; oArray[image_id3] = new Object(); oArray[image_id3].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/3.png']"); map.image_layer.EventMouseOverCallback(image_id3, function(id){ var id = image_id3; var el = document.getElementById('listItem3'); if ($(el).prev()) { oArray[image_id3]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/3_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id3, function(id){ showPOIinfobox(140775, 704953, 6267141); //showInfoBox('some text goes here from: showInfoBox()', 704953, 6267141); });*/ map.image_layer.EventClickCallback(image_id3, function(id){ showHTMLinfobox(113021,704953, 6267141); }); map.image_layer.EventMouseOutCallback(image_id3, function(id){ var el = document.getElementById('listItem3'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/3.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id3]['previous']){ $(el).insertAfter(oArray[image_id3]['previous']); } }); distances[3] = [704953, 6267141]; var image_id4 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/4.png", 583499, 6376826, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id4, "id", "pointer4"); array[4] = {x:583499, y:6376826}; oArray[image_id4] = new Object(); oArray[image_id4].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/4.png']"); map.image_layer.EventMouseOverCallback(image_id4, function(id){ var id = image_id4; var el = document.getElementById('listItem4'); if ($(el).prev()) { oArray[image_id4]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/4_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id4, function(id){ showPOIinfobox(140885, 583499, 6376826); //showInfoBox('some text goes here from: showInfoBox()', 583499, 6376826); });*/ map.image_layer.EventClickCallback(image_id4, function(id){ showHTMLinfobox(113131,583499, 6376826); }); map.image_layer.EventMouseOutCallback(image_id4, function(id){ var el = document.getElementById('listItem4'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/4.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id4]['previous']){ $(el).insertAfter(oArray[image_id4]['previous']); } }); distances[4] = [583499, 6376826]; var image_id5 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/5.png", 521074, 6401164, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id5, "id", "pointer5"); array[5] = {x:521074, y:6401164}; oArray[image_id5] = new Object(); oArray[image_id5].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/5.png']"); map.image_layer.EventMouseOverCallback(image_id5, function(id){ var id = image_id5; var el = document.getElementById('listItem5'); if ($(el).prev()) { oArray[image_id5]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/5_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id5, function(id){ showPOIinfobox(907529, 521074, 6401164); //showInfoBox('some text goes here from: showInfoBox()', 521074, 6401164); });*/ map.image_layer.EventClickCallback(image_id5, function(id){ showHTMLinfobox(56158,521074, 6401164); }); map.image_layer.EventMouseOutCallback(image_id5, function(id){ var el = document.getElementById('listItem5'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/5.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id5]['previous']){ $(el).insertAfter(oArray[image_id5]['previous']); } }); distances[5] = [521074, 6401164]; var image_id6 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/6.png", 576956, 6273727, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id6, "id", "pointer6"); array[6] = {x:576956, y:6273727}; oArray[image_id6] = new Object(); oArray[image_id6].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/6.png']"); map.image_layer.EventMouseOverCallback(image_id6, function(id){ var id = image_id6; var el = document.getElementById('listItem6'); if ($(el).prev()) { oArray[image_id6]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/6_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id6, function(id){ showPOIinfobox(57219, 576956, 6273727); //showInfoBox('some text goes here from: showInfoBox()', 576956, 6273727); });*/ map.image_layer.EventClickCallback(image_id6, function(id){ showHTMLinfobox(56097,576956, 6273727); }); map.image_layer.EventMouseOutCallback(image_id6, function(id){ var el = document.getElementById('listItem6'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/6.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id6]['previous']){ $(el).insertAfter(oArray[image_id6]['previous']); } }); distances[6] = [576956, 6273727]; var image_id7 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/7.png", 608104, 6225466, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id7, "id", "pointer7"); array[7] = {x:608104, y:6225466}; oArray[image_id7] = new Object(); oArray[image_id7].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/7.png']"); map.image_layer.EventMouseOverCallback(image_id7, function(id){ var id = image_id7; var el = document.getElementById('listItem7'); if ($(el).prev()) { oArray[image_id7]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/7_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id7, function(id){ showPOIinfobox(392359, 608104, 6225466); //showInfoBox('some text goes here from: showInfoBox()', 608104, 6225466); });*/ map.image_layer.EventClickCallback(image_id7, function(id){ showHTMLinfobox(47064,608104, 6225466); }); map.image_layer.EventMouseOutCallback(image_id7, function(id){ var el = document.getElementById('listItem7'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/7.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id7]['previous']){ $(el).insertAfter(oArray[image_id7]['previous']); } }); distances[7] = [608104, 6225466]; var image_id8 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/8.png", 552306, 6403144, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id8, "id", "pointer8"); array[8] = {x:552306, y:6403144}; oArray[image_id8] = new Object(); oArray[image_id8].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/8.png']"); map.image_layer.EventMouseOverCallback(image_id8, function(id){ var id = image_id8; var el = document.getElementById('listItem8'); if ($(el).prev()) { oArray[image_id8]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/8_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id8, function(id){ showPOIinfobox(49107, 552306, 6403144); //showInfoBox('some text goes here from: showInfoBox()', 552306, 6403144); });*/ map.image_layer.EventClickCallback(image_id8, function(id){ showHTMLinfobox(47985,552306, 6403144); }); map.image_layer.EventMouseOutCallback(image_id8, function(id){ var el = document.getElementById('listItem8'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/8.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id8]['previous']){ $(el).insertAfter(oArray[image_id8]['previous']); } }); distances[8] = [552306, 6403144]; var image_id9 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/9.png", 352141, 6317960, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id9, "id", "pointer9"); array[9] = {x:352141, y:6317960}; oArray[image_id9] = new Object(); oArray[image_id9].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/9.png']"); map.image_layer.EventMouseOverCallback(image_id9, function(id){ var id = image_id9; var el = document.getElementById('listItem9'); if ($(el).prev()) { oArray[image_id9]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/9_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id9, function(id){ showPOIinfobox(199422, 352141, 6317960); //showInfoBox('some text goes here from: showInfoBox()', 352141, 6317960); });*/ map.image_layer.EventClickCallback(image_id9, function(id){ showHTMLinfobox(117403,352141, 6317960); }); map.image_layer.EventMouseOutCallback(image_id9, function(id){ var el = document.getElementById('listItem9'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/9.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id9]['previous']){ $(el).insertAfter(oArray[image_id9]['previous']); } }); distances[9] = [352141, 6317960]; var image_id10 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/10.png", 683199, 6368231, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id10, "id", "pointer10"); array[10] = {x:683199, y:6368231}; oArray[image_id10] = new Object(); oArray[image_id10].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/10.png']"); map.image_layer.EventMouseOverCallback(image_id10, function(id){ var id = image_id10; var el = document.getElementById('listItem10'); if ($(el).prev()) { oArray[image_id10]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/10_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id10, function(id){ showPOIinfobox(48203, 683199, 6368231); //showInfoBox('some text goes here from: showInfoBox()', 683199, 6368231); });*/ map.image_layer.EventClickCallback(image_id10, function(id){ showHTMLinfobox(47081,683199, 6368231); }); map.image_layer.EventMouseOutCallback(image_id10, function(id){ var el = document.getElementById('listItem10'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/10.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id10]['previous']){ $(el).insertAfter(oArray[image_id10]['previous']); } }); distances[10] = [683199, 6368231]; var image_id11 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/11.png", 661326, 6380519, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id11, "id", "pointer11"); array[11] = {x:661326, y:6380519}; oArray[image_id11] = new Object(); oArray[image_id11].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/11.png']"); map.image_layer.EventMouseOverCallback(image_id11, function(id){ var id = image_id11; var el = document.getElementById('listItem11'); if ($(el).prev()) { oArray[image_id11]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/11_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id11, function(id){ showPOIinfobox(57221, 661326, 6380519); //showInfoBox('some text goes here from: showInfoBox()', 661326, 6380519); });*/ map.image_layer.EventClickCallback(image_id11, function(id){ showHTMLinfobox(56099,661326, 6380519); }); map.image_layer.EventMouseOutCallback(image_id11, function(id){ var el = document.getElementById('listItem11'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/11.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id11]['previous']){ $(el).insertAfter(oArray[image_id11]['previous']); } }); distances[11] = [661326, 6380519]; var image_id12 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/12.png", 431837, 6258523, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id12, "id", "pointer12"); array[12] = {x:431837, y:6258523}; oArray[image_id12] = new Object(); oArray[image_id12].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/12.png']"); map.image_layer.EventMouseOverCallback(image_id12, function(id){ var id = image_id12; var el = document.getElementById('listItem12'); if ($(el).prev()) { oArray[image_id12]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/12_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id12, function(id){ showPOIinfobox(234598, 431837, 6258523); //showInfoBox('some text goes here from: showInfoBox()', 431837, 6258523); });*/ map.image_layer.EventClickCallback(image_id12, function(id){ showHTMLinfobox(31036,431837, 6258523); }); map.image_layer.EventMouseOutCallback(image_id12, function(id){ var el = document.getElementById('listItem12'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/12.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id12]['previous']){ $(el).insertAfter(oArray[image_id12]['previous']); } }); distances[12] = [431837, 6258523]; var image_id13 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/13.png", 506666, 6311483, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id13, "id", "pointer13"); array[13] = {x:506666, y:6311483}; oArray[image_id13] = new Object(); oArray[image_id13].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/13.png']"); map.image_layer.EventMouseOverCallback(image_id13, function(id){ var id = image_id13; var el = document.getElementById('listItem13'); if ($(el).prev()) { oArray[image_id13]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/13_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id13, function(id){ showPOIinfobox(169297, 506666, 6311483); //showInfoBox('some text goes here from: showInfoBox()', 506666, 6311483); });*/ map.image_layer.EventClickCallback(image_id13, function(id){ showHTMLinfobox(114057,506666, 6311483); }); map.image_layer.EventMouseOutCallback(image_id13, function(id){ var el = document.getElementById('listItem13'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/13.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id13]['previous']){ $(el).insertAfter(oArray[image_id13]['previous']); } }); distances[13] = [506666, 6311483]; var image_id14 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/14.png", 507690, 6312026, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id14, "id", "pointer14"); array[14] = {x:507690, y:6312026}; oArray[image_id14] = new Object(); oArray[image_id14].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/14.png']"); map.image_layer.EventMouseOverCallback(image_id14, function(id){ var id = image_id14; var el = document.getElementById('listItem14'); if ($(el).prev()) { oArray[image_id14]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/14_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id14, function(id){ showPOIinfobox(906204, 507690, 6312026); //showInfoBox('some text goes here from: showInfoBox()', 507690, 6312026); });*/ map.image_layer.EventClickCallback(image_id14, function(id){ showHTMLinfobox(3898,507690, 6312026); }); map.image_layer.EventMouseOutCallback(image_id14, function(id){ var el = document.getElementById('listItem14'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/14.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id14]['previous']){ $(el).insertAfter(oArray[image_id14]['previous']); } }); distances[14] = [507690, 6312026]; var image_id15 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/15.png", 494321, 6311064, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id15, "id", "pointer15"); array[15] = {x:494321, y:6311064}; oArray[image_id15] = new Object(); oArray[image_id15].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/15.png']"); map.image_layer.EventMouseOverCallback(image_id15, function(id){ var id = image_id15; var el = document.getElementById('listItem15'); if ($(el).prev()) { oArray[image_id15]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/15_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id15, function(id){ showPOIinfobox(234600, 494321, 6311064); //showInfoBox('some text goes here from: showInfoBox()', 494321, 6311064); });*/ map.image_layer.EventClickCallback(image_id15, function(id){ showHTMLinfobox(1143,494321, 6311064); }); map.image_layer.EventMouseOutCallback(image_id15, function(id){ var el = document.getElementById('listItem15'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/15.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id15]['previous']){ $(el).insertAfter(oArray[image_id15]['previous']); } }); distances[15] = [494321, 6311064]; var image_id16 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/16.png", 523867, 6288433, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id16, "id", "pointer16"); array[16] = {x:523867, y:6288433}; oArray[image_id16] = new Object(); oArray[image_id16].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/16.png']"); map.image_layer.EventMouseOverCallback(image_id16, function(id){ var id = image_id16; var el = document.getElementById('listItem16'); if ($(el).prev()) { oArray[image_id16]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/16_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id16, function(id){ showPOIinfobox(234601, 523867, 6288433); //showInfoBox('some text goes here from: showInfoBox()', 523867, 6288433); });*/ map.image_layer.EventClickCallback(image_id16, function(id){ showHTMLinfobox(56100,523867, 6288433); }); map.image_layer.EventMouseOutCallback(image_id16, function(id){ var el = document.getElementById('listItem16'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/16.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id16]['previous']){ $(el).insertAfter(oArray[image_id16]['previous']); } }); distances[16] = [523867, 6288433]; var image_id17 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/17.png", 507352, 6312779, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id17, "id", "pointer17"); array[17] = {x:507352, y:6312779}; oArray[image_id17] = new Object(); oArray[image_id17].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/17.png']"); map.image_layer.EventMouseOverCallback(image_id17, function(id){ var id = image_id17; var el = document.getElementById('listItem17'); if ($(el).prev()) { oArray[image_id17]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/17_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id17, function(id){ showPOIinfobox(313710, 507352, 6312779); //showInfoBox('some text goes here from: showInfoBox()', 507352, 6312779); });*/ map.image_layer.EventClickCallback(image_id17, function(id){ showHTMLinfobox(2108,507352, 6312779); }); map.image_layer.EventMouseOutCallback(image_id17, function(id){ var el = document.getElementById('listItem17'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/17.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id17]['previous']){ $(el).insertAfter(oArray[image_id17]['previous']); } }); distances[17] = [507352, 6312779]; var image_id18 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/18.png", 507383, 6311854, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id18, "id", "pointer18"); array[18] = {x:507383, y:6311854}; oArray[image_id18] = new Object(); oArray[image_id18].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/18.png']"); map.image_layer.EventMouseOverCallback(image_id18, function(id){ var id = image_id18; var el = document.getElementById('listItem18'); if ($(el).prev()) { oArray[image_id18]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/18_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id18, function(id){ showPOIinfobox(231360, 507383, 6311854); //showInfoBox('some text goes here from: showInfoBox()', 507383, 6311854); });*/ map.image_layer.EventClickCallback(image_id18, function(id){ showHTMLinfobox(59416,507383, 6311854); }); map.image_layer.EventMouseOutCallback(image_id18, function(id){ var el = document.getElementById('listItem18'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/18.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id18]['previous']){ $(el).insertAfter(oArray[image_id18]['previous']); } }); distances[18] = [507383, 6311854]; var image_id19 = map.image_layer.Add("http://www.1189.lv/images/nummuri/small/19.png", 508467, 6313120, offset_x_pix, offset_y_pix); map.image_layer.SetCustomParameter(image_id19, "id", "pointer19"); array[19] = {x:508467, y:6313120}; oArray[image_id19] = new Object(); oArray[image_id19].obj = $("#themap img[src='http://www.1189.lv/images/nummuri/small/19.png']"); map.image_layer.EventMouseOverCallback(image_id19, function(id){ var id = image_id19; var el = document.getElementById('listItem19'); if ($(el).prev()) { oArray[image_id19]['previous'] = $(el).prev(); } $(el).addClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/19_hover.png"); var z = parseInt(oArray[id].obj.css("z-index"))+100; oArray[id].obj.css("z-index",z); var par = $(el).parent(); $(el).prependTo(par); }); /*map.image_layer.EventClickCallback(image_id19, function(id){ showPOIinfobox(134462, 508467, 6313120); //showInfoBox('some text goes here from: showInfoBox()', 508467, 6313120); });*/ map.image_layer.EventClickCallback(image_id19, function(id){ showHTMLinfobox(106708,508467, 6313120); }); map.image_layer.EventMouseOutCallback(image_id19, function(id){ var el = document.getElementById('listItem19'); $(el).removeClass('hover'); oArray[id].obj.attr("src","http://www.1189.lv/images/nummuri/small/19.png"); var z = parseInt(oArray[id].obj.css("z-index"))-99; oArray[id].obj.css("z-index",z); if(oArray[image_id19]['previous']){ $(el).insertAfter(oArray[image_id19]['previous']); } }); distances[19] = [508467, 6313120]; if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showMapCallback); } else { if (array.length > 0) { map.ShowPoints(array, actual_level); } } var boxElement = map.info_box.get_box_element(); boxElement.style.border = "none"; boxElement.style.backgroundColor = "transparent"; boxElement.style.zIndex = 500; map.info_box.context.style.border = "none"; map.info_box.context.style.backgroundColor = "transparent"; map.info_box.context.style.zIndex = 500; } var opositePoints= new Array(); opositePoints["A"]="B"; opositePoints["B"]="A"; function routeSetup(point, compid) { $("#point"+point).val(addressPoints[compid].replace(/"/g, "").replace(/'/g, "")); $("#point"+opositePoints[point]).val(""); $('#route-popup').show(); } function showHTMLinfobox(cid,x,y) { $.get("/ru/karta/",{action:"getinfobox",compid:cid},function (data){ if (data!=0) { map.info_box.context.innerHTML = ""; boxElement = map.info_box.get_box_element(); boxElement.style.zIndex = "10"; //map.SetCenter(x, y); var boxElement = map.info_box.get_box_element(); boxElement.style.border = "none"; boxElement.style.backgroundColor = "transparent"; boxElement.style.marginLeft = "-120"; boxElement.style.marginTop = "-150"; map.info_box.context.style.border = "none"; map.info_box.context.style.backgroundColor = "transparent"; map.info_box.context.innerHTML = data; map.info_box.ShowNoContextChange(x, y, 0, 0); var pLeft = $('.map-block .map-popup').parent().parent().parent().css('left'); var bLeft = -1 * parseInt(pLeft) + 13; var pTop = $('.map-block .map-popup').parent().parent().parent().css('top'); var bTop = -1 * parseInt(pTop) + 66; if (navigator.appVersion.match(/MSIE 7\.0/) || navigator.appVersion.match(/MSIE 8\.0/)) { bTop = bTop+148; bLeft = bLeft+118; } $('.map-block .map-popup').parent().parent().css({'z-index': '500'}); $('.map-block .map-popup').parent().parent().css({'top': bTop}); $('.map-block .map-popup').parent().parent().css({'left': bLeft}); } }); } // Show popup for map marker. customized function showPOIinfobox(point_id,x,y) { map.info_box.Hide(); $.get( "/ru/karta/", { action : "get_poi_box", point_id : point_id }, function(data){ if (checkPoiHtmlData(data)) { map.info_box.context.innerHTML = ""; boxElement = map.info_box.get_box_element(); boxElement.style.zIndex = "10"; map.info_box.context.innerHTML = data; map.info_box.ShowNoContextChange(x, y, 0, 0); } } ); } // Show popup for map marker. standart function showInfoBox(text,x,y) { var offset_x_pix = 10; var offset_y_pix = 10; map.info_box.Show(x, y, text, offset_x_pix, offset_y_pix); } // Calculate new distances from user geo location function calculateDistances() { showDistanceNumbers(distances, locate_x, locate_y); } // Do companies list filtering/searching function doExtraSearch(setofPage){ remslash=new RegExp('/'); $('input[name="orderby_old"]').val($('input[name="orderby_old"]').val().replace(remslash,'')); $('input[name="cityby_old"]').val($('input[name="cityby_old"]').val().replace(remslash,'')); $('input[name="orderby"]').val($('input[name="orderby"]').val().replace(remslash,'')); $('input[name="cityby"]').val($('input[name="cityby"]').val().replace(remslash,'')); var order = $('#orderby').val(); var city = $('#cityby').val(); var distance = $('#distanceby').val(); var order_val = ''; var city_val = ''; var distance_var = ''; if (order.length >=1 && order != 'default'){ order_val = order+"/"; } if (city.length >=1 && city != '0'){ city_val = city+"/"; } if (distance.length >=1 && distance != '0'){ if (order_val=='izvietojums/' || order_val=='rastojanije/' || order_val=='distance/'){ distance_var = distance+'/'; } } url=window.location.href; if ($('input[name="cityby_old"]').val()!='' && $('input[name="cityby_old"]').val()!='0'){ reg=new RegExp($('input[name="cityby_old"]').val()+'/'); url=url.replace(reg,''); alert(url); } if ($('input[name="orderby_old"]').val()!=''){ reg=new RegExp($('input[name="orderby_old"]').val()+'/'); url=url.replace(reg,''); } if ($('input[name="distanceby_old"]').val()!=''){ reg=new RegExp($('input[name="distanceby_old"]').val()+'/'); url=url.replace(reg,''); } var action_url = url+city_val+order_val+distance_var; $("#dropdown_order").attr("action", action_url); $("#dropdown_order").submit(); return false; } function saveCompany(objId,compid){ res = false; $.get( "/ru/", { action : 'savecomp', compid : compid }, function (data){ if(data[0]==1){ $('#saveButton'+objId).replaceWith('Сохранить'); res= true; } } ); return res; } function prepareShowWin(obj, ev, msg, compid){ $.post('/ajax/companyedit.php',{action:'setCompSave', compid: compid},function (data){ if(checkWinData(data)){ var win = showWin(obj, ev, msg); cd(win); $("#actionClose",$(win)).bind("mousedown",function(){ $.post('/ajax/companyedit.php',{action:'unsetCompSave', compid: compid}); }); } }, "json"); } // Map control f-tions function moveUp() { var center = map.GetCenter(); var center_x = center.x; var center_y = center.y+(map.zoom_level*200); map.SetCenter(center_x, center_y); } function moveDown() { var center = map.GetCenter(); var center_x = center.x; var center_y = center.y-(map.zoom_level*200); map.SetCenter(center_x, center_y); } function moveLeft() { var center = map.GetCenter(); var center_x = center.x-(map.zoom_level*200); var center_y = center.y; map.SetCenter(center_x, center_y); } function moveRight() { var center = map.GetCenter(); var center_x = center.x+(map.zoom_level*200); var center_y = center.y; map.SetCenter(center_x, center_y); } function zoomIn() { var current_level = map.zoom_level; var new_level = current_level-1; map.ChangeLevel(new_level); } function zoomOut() { var current_level = map.zoom_level; var new_level = current_level+1; map.ChangeLevel(new_level); } function zoomLatvia() { map.ChangeLevel(11); var center_x = 527061; var center_y = 6306150; map.SetCenter(center_x, center_y); } function zoomRiga() { map.ChangeLevel(7); var center_x = 505378; var center_y = 6313472; map.SetCenter(center_x, center_y); } // function changeClose(){ //return; $("#window").hide(); $("#window-text").html("Невозможно сохранить компанию в Вашем профиле!"); $("#actionSocials").hide(); $("#actionClose").hide(); $("#simpleClose").show(); $("#window").show(); } function finishClose(){ $.post('/ajax/companyedit.php',{action:'unsetCompSave'},function (data){ $("#window").hide(); $("#actionSocials").show(); $("#window-text").html("Чтобы сохранить компанию в списке “Мои компании”, Вы должны зарегистрироваться или подключиться к системе, используя один из паспортов, предлагаемых социальными сетями"); $("#actionClose").show(); $("#simpleClose").hide(); }, "json"); } $(document).ready(function() { if(0){ showWin($("#savePlace0"), null, "Невозможно сохранить компанию в Вашем профиле!"); changeClose(); var opos=$("#savePlace0").position(); $('#wrapper').scrollTo( { top: opos.top, left:opos.left }, { axis:'xy', offset:-20 } ); } }); $(function(){ $("#compList div.dlist.hasCoords").each(function(k){ $(this) .bind("mouseover focus",function(){ var idNum = k; var img = parseInt($(this).attr("id").substring(8)); if(typeof(oArray[idNum]) == "undefined"){return;} oArray[idNum].obj.attr("src","http://www.1189.lv/images/nummuri/small/"+(img+offset)+"_hover.png"); var z = parseInt(oArray[idNum].obj.css("z-index"))+100; oArray[idNum].obj.css("z-index",z); }) .bind("mouseout focusout",function(){ var idNum = k; var img = parseInt($(this).attr("id").substring(8)); if(typeof(oArray[idNum]) == "undefined"){return;} oArray[idNum].obj.attr("src","http://www.1189.lv/images/nummuri/small/"+(img+offset)+".png"); var z = parseInt(oArray[idNum].obj.css("z-index"))-99; oArray[idNum].obj.css("z-index",z); }); }); });