<div class="selections cf">
    <form method="get" class="m-all t-1of3 d-1of3" autocomplete="off">
        <select id="country" name="country" onchange="this.form.submit()">
            <option value="Deutschland">Deutschland</option><option value="Switzerland">Switzerland</option>        </select>
    </form>

    <div class="m-all t-1of3 d-1of3">
        <select id="region" name="region" onchange="getCities(this);" autocomplete="off">
                            <option value="Wählen Sie Ihre Provinz">Wählen Sie Ihre Provinz</option>
                            <option value="Aargau">Aargau</option>
                            <option value="Basel-Stadt">Basel-Stadt</option>
                            <option value="Bern">Bern</option>
                            <option value="St. Gallen">St. Gallen</option>
                            <option value="Tessin">Tessin</option>
                            <option value="Waadt">Waadt</option>
                            <option value="Zürich">Zürich</option>
                    </select>
    </div>

    <div class="m-all t-1of3 d-1of3">
        <select id="city" class="m-all t-1of3 d-1of3 last-col" name="city" onchange="getStreets(this);" autocomplete="off">
            <option>Wybierz miasto</option>
        </select>
    </div>
</div>

<div class="cf">
    <label class="checkbox-inline diy">
        <input id="market" type="checkbox" name="typ" value="3" checked="checked" onclick="Filter()">Market budowlany    </label>
    <label class="checkbox-inline magazine">
        <input id="sklad" type="checkbox" name="typ" value="2" checked="checked" onclick="Filter()">Skład magazynowy    </label>
    <label class="checkbox-inline distributor">
        <input id="dystrybutor" type="checkbox" name="typ" checked="checked" value="1" onclick="Filter()">Dystrybutor    </label>
    <label class="checkbox-inline partner">
        <input id="partner" type="checkbox" name="typ" checked="checked" value="1" onclick="Filter()">Partner    </label>
</div>
<script type="text/javascript">

    //jQuery('#country').selectpicker();
    //jQuery('#region').selectpicker();
    //jQuery('#city').selectpicker();

    var countries = '{"1388":"Deutschland","1389":"Deutschland","1390":"Deutschland","1391":"Deutschland","1392":"Deutschland","1393":"Deutschland","1394":"Deutschland","1395":"Deutschland","1396":"Deutschland","1397":"Deutschland","1398":"Deutschland","1399":"Deutschland","1400":"Deutschland","1401":"Deutschland","1402":"Deutschland","1403":"Deutschland","1404":"Deutschland","1405":"Deutschland","1406":"Deutschland","1407":"Deutschland","1408":"Deutschland","1409":"Deutschland","1410":"Deutschland","1411":"Deutschland","1412":"Deutschland","1413":"Deutschland","1414":"Deutschland","1415":"Deutschland","1416":"Deutschland","1417":"Deutschland","1418":"Deutschland","1419":"Deutschland","1420":"Deutschland","1421":"Deutschland","1422":"Deutschland","1423":"Deutschland","1424":"Deutschland","1425":"Deutschland","1426":"Deutschland","1427":"Deutschland","1428":"Deutschland","1429":"Deutschland","1430":"Deutschland","1431":"Deutschland","1432":"Deutschland","1433":"Deutschland","1434":"Deutschland","1435":"Deutschland","1436":"Deutschland","1437":"Deutschland","1438":"Deutschland","1439":"Deutschland","1440":"Deutschland","1441":"Deutschland","1442":"Deutschland","1443":"Deutschland","1444":"Deutschland","1445":"Deutschland","1446":"Deutschland","1447":"Deutschland","1448":"Deutschland","1449":"Deutschland","1450":"Deutschland","1451":"Deutschland","1452":"Deutschland","1453":"Deutschland","1454":"Deutschland","1455":"Deutschland","1456":"Deutschland","1457":"Deutschland","1458":"Deutschland","1459":"Deutschland","1460":"Deutschland","1461":"Deutschland","1462":"Deutschland","1463":"Deutschland","1464":"Deutschland","1465":"Deutschland","1466":"Deutschland","1467":"Deutschland","1468":"Deutschland","1469":"Deutschland","1470":"Deutschland","1471":"Deutschland","1472":"Deutschland","1473":"Deutschland","1474":"Deutschland","1475":"Deutschland","1476":"Deutschland","1516":"Switzerland","1517":"Switzerland","1518":"Switzerland","1519":"Switzerland","1520":"Switzerland","1521":"Switzerland","1522":"Switzerland","1523":"Switzerland","1524":"Switzerland"}';
    var cities = '{"de":{"1388":"Dresden","1389":"Hoyerswerda","1390":"Markkleeberg","1391":"Landsberg \/ OT Braschwitz","1392":"Bennstedt","1393":"Wei\u00dfenfels OT Lei\u00dfling","1394":"Dessau","1395":"Hermsdorf","1396":"Jena-Isserstedt","1397":"Weischlitz-Plauen","1398":"Berlin-Lichtenberg","1399":"Berlin-Treptow","1400":"Ahrensfelde","1401":"Oranienburg","1402":"Rostock-Roggentin","1403":"Wendorf","1404":"Oststeinbek","1405":"Kaltenkirchen","1406":"Oldenburg","1407":"Peine","1408":"Wetzlar","1409":"Petersberg","1410":"G\u00f6ttingen","1411":"Braunschweig","1412":"Salzgitter","1413":"Wolfsburg","1414":"Goslar","1415":"Magdeburg","1416":"Meerbusch-Osterath","1417":"Marl","1418":"Br\u00fchl","1419":"Trier","1420":"Hermeskeil","1421":"Wittlich","1422":"Bitburg","1423":"Gensingen","1424":"Simmern","1425":"Bad Kreuznach","1426":"Idar-Oberstein","1427":"Lahnstein","1428":"Zell\/Mosel","1429":"Bergkamen","1430":"Unna","1431":"Lippstadt","1432":"Friedberg","1433":"Dietzenbach","1434":"W\u00e4chtersbach","1435":"H\u00f6sbach","1436":"R\u00fcsselsheim","1437":"Hofheim","1438":"Saarbruecken","1439":"Heusweiler","1440":"Homburg","1441":"V\u00f6lklingen","1442":"Zweibr\u00fccken","1443":"St Wendel","1444":"Merzig","1445":"Losheim am See","1446":"Saarlouis","1447":"Kusel","1448":"Gr\u00fcnstadt","1449":"Neustadt a.d. W.","1450":"Neustadt a.d. W.(Hela)","1451":"Wagh\u00e4usel","1452":"Weinheim","1453":"Kornwestheim","1454":"Weinstadt-Endersbach","1455":"Vaihingen an der Enz","1456":"Rottenburg","1457":"Horb a. Neckar","1458":"Schw\u00e4bisch-Hall","1459":"K\u00fcnzelsau","1460":"Germersheim","1461":"W\u00f6rth am Rhein","1462":"Hela Achern","1463":"Herbolzheim","1464":"M\u00fcllheim","1465":"M\u00fchldorf\u00a0a. Inn","1466":"Ingolstadt","1467":"K\u00f6nigsbrunn","1468":"Laupheim","1469":"Forchheim","1470":"Regensburg","1471":"Plattling","1472":"Kulmbach","1473":"Kitzingen","1474":"Schweinfurt","1475":"Suhl","1476":"Ilmenau","1516":"Basel","1517":"Volketswil","1518":"Renens","1519":"Oftringen","1520":"San Antonino","1521":"Moosseedorf\/Sch\u00f6nb\u00fchl","1522":"Winterthur","1523":"St. Gallen","1524":"Thun"}}';
    var streets = '{"Dresden":{"1388":"R\u00e4hnitzer Allee 10"},"Hoyerswerda":{"1389":"Kamenzer Bogen 3"},"Markkleeberg":{"1390":"Nordstra\u00dfe 1"},"Landsberg \/ OT Braschwitz":{"1391":"M\u00e4gdeberge 1"},"Bennstedt":{"1392":"Eisdorfer Str. 31"},"Wei\u00dfenfels OT Lei\u00dfling":{"1393":"Am Marktwege 2"},"Dessau":{"1394":"Weststr. 7 - 8"},"Hermsdorf":{"1395":"Rodaer Stra\u00dfe 72"},"Jena-Isserstedt":{"1396":"Weimarische Str. 3"},"Weischlitz-Plauen":{"1397":"Taltitzerstr. 80"},"Berlin-Lichtenberg":{"1398":"Landsberger Allee 360-362"},"Berlin-Treptow":{"1399":"Eisenhutweg 2"},"Ahrensfelde":{"1400":"Rudolf Diesel Str"},"Oranienburg":{"1401":"Stra\u00dfe am Globus 1"},"Rostock-Roggentin":{"1402":"Globusring 1"},"Wendorf":{"1403":"Albert-Schweitzer-Stra\u00dfe"},"Oststeinbek":{"1404":"Willinghusener Weg"},"Kaltenkirchen":{"1405":"Kisdorfer Weg 11"},"Oldenburg":{"1406":"Ammerl\u00e4nder Heerstrasse 303"},"Peine":{"1407":"Caroline-Herschel-Stra\u00dfe 7"},"Wetzlar":{"1408":"Altenberger Strasse 24"},"Petersberg":{"1409":"Justus Liebig Str. 9"},"G\u00f6ttingen":{"1410":"Lutteranger 7"},"Braunschweig":{"1411":"Hansestra\u00dfe 25"},"Salzgitter":{"1412":"Konrad-Adenauer-Strasse 98"},"Wolfsburg":{"1413":"Wolfsburger Landstr.\u00a07"},"Goslar":{"1414":"Carl-Zeiss-Strasse 7"},"Magdeburg":{"1415":"Salbker Chaussee 93"},"Meerbusch-Osterath":{"1416":"Gewerb. Mollsfeld Krefelder Str. 84"},"Marl":{"1417":"Karl-Breuing-Stra\u00dfe 15"},"Br\u00fchl":{"1418":"Lise-Meitner-Stra\u00dfe 3"},"Trier":{"1419":"Castelforte-Stra\u00dfe 1"},"Hermeskeil":{"1420":"An der R\u00f6merstrasse"},"Wittlich":{"1421":"R\u00f6merstra\u00dfe 53"},"Bitburg":{"1422":"Industriestrasse"},"Gensingen":{"1423":"Binger Strasse"},"Simmern":{"1424":"R\u00f6delbachstr. 3"},"Bad Kreuznach":{"1425":"Bosenheimer Str. 214"},"Idar-Oberstein":{"1426":"John F. Kennedy-Str. 3"},"Lahnstein":{"1427":"Koblenzer Str. 38"},"Zell\/Mosel":{"1428":"Auf dem Barl 1"},"Bergkamen":{"1429":"Geschwister Scholl Str. 1"},"Unna":{"1430":"Hans-B\u00f6ckler-Stra\u00dfe 3"},"Lippstadt":{"1431":"Am Mondschein 24"},"Friedberg":{"1432":"Stra\u00dfheimer Strasse 24"},"Dietzenbach":{"1433":"Albert-Einstein-Str. 3"},"W\u00e4chtersbach":{"1434":"Industriestra\u00dfe 50"},"H\u00f6sbach":{"1435":"Siemensstr. 23"},"R\u00fcsselsheim":{"1436":"Am Steinmarkt"},"Hofheim":{"1437":"Nordring 5-9"},"Saarbruecken":{"1438":"K\u00e4the Kollwitz Str."},"Heusweiler":{"1439":"Am Bahnhof 13"},"Homburg":{"1440":"Am Forum 6"},"V\u00f6lklingen":{"1441":"Zechenstr. 8"},"Zweibr\u00fccken":{"1442":"Wilkstra\u00dfe 2"},"St Wendel":{"1443":"Linxweilerstra\u00dfe 20"},"Merzig":{"1444":"Zum Wiesenhof 80"},"Losheim am See":{"1445":"Saarbr\u00fccker Strasse 207\/Industr. S\u00fcd"},"Saarlouis":{"1446":"Schanzenstrasse 18"},"Kusel":{"1447":"Industriesrasse 9"},"Gr\u00fcnstadt":{"1448":"Gewe. Im Hahnental Daimlerstr. 23"},"Neustadt a.d. W.":{"1449":"Adolf-Kolping-Strasse 130"},"Neustadt a.d. W.(Hela)":{"1450":"Chemnitzer Strasse 40"},"Wagh\u00e4usel":{"1451":"Hambr\u00fccker Landstr. 4"},"Weinheim":{"1452":"Viernheimer Strasse 59"},"Kornwestheim":{"1453":"Leibnizstrasse 10"},"Weinstadt-Endersbach":{"1454":"Kalkofenstra\u00dfe 14"},"Vaihingen an der Enz":{"1455":"Stuttgarter Strasse 121 "},"Rottenburg":{"1456":"Felix-Wankel-Str. 22"},"Horb a. Neckar":{"1457":"Kirschb\u00e4umle 1"},"Schw\u00e4bisch-Hall":{"1458":"Raiffeisenstrasse 22"},"K\u00fcnzelsau":{"1459":"W\u00fcrzburger Strasse 26"},"Germersheim":{"1460":"Mainzer Strasse 4"},"W\u00f6rth am Rhein":{"1461":"Maximilianstrasse 11"},"Hela Achern":{"1462":"Severinstr. "},"Herbolzheim":{"1463":"Konrad-Adenauer Ring 5"},"M\u00fcllheim":{"1464":"L\u00f6rracher Strasse 30"},"M\u00fchldorf\u00a0a. Inn":{"1465":"Siemensstra\u00dfe 18"},"Ingolstadt":{"1466":"Am Hochfeldweg 4"},"K\u00f6nigsbrunn":{"1467":"Messerschmittring 22"},"Laupheim":{"1468":"Neue Welt Str. 24"},"Forchheim":{"1469":"Willy-Brandt-Allee 1  "},"Regensburg":{"1470":"Sulzfeldstr. 3"},"Plattling":{"1471":"Dr. Walter Bruch Str."},"Kulmbach":{"1472":"Lichtenfelser Strasse 53"},"Kitzingen":{"1473":"August-Gauer-Str. 2    "},"Schweinfurt":{"1474":"Rudolf Diesel Str. 24"},"Suhl":{"1475":"Am Steinsfelder Wasser 13"},"Ilmenau":{"1476":"B\u00fccheloher Str. 31"},"Basel":{"1516":"Reinacherstrasse 29"},"Volketswil":{"1517":"Industriestrasse 20"},"Renens":{"1518":"Avenue Du Silo 11"},"Oftringen":{"1519":"Ackerweg 2"},"San Antonino":{"1520":"Via Serrai 3"},"Moosseedorf\/Sch\u00f6nb\u00fchl":{"1521":"Gewerbestrasse 11"},"Winterthur":{"1522":"Industriestrasse 44"},"St. Gallen":{"1523":"Gaiserwaldstrasse 3"},"Thun":{"1524":"Weststrasse 14"}}';
    var lats = '{"1388":"51.1255834","1389":"51.4285756","1390":"51.2840492","1391":"51.5164369","1392":"51.4744019","1393":"51.1844533","1394":"51.8224813","1395":"50.8863256","1396":"50.9577255","1397":"50.4382153","1398":"52.5331647","1399":"52.4340243","1400":"52.6080776","1401":"52.7465077","1402":"54.0753068","1403":"54.2816414","1404":"53.5458676","1405":"53.8308028","1406":"53.158479","1407":"52.3382765","1408":"50.5606793","1409":"50.5528197","1410":"51.5563434","1411":"52.3071713","1412":"52.1521878","1413":"52.4229527","1414":"51.9336397","1415":"52.0815454","1416":"51.279292","1417":"51.639938","1418":"50.8340667","1419":"49.7718473","1420":"49.6771446","1421":"49.9770797","1422":"49.9599126","1423":"49.9007708","1424":"49.982927","1425":"49.8464722","1426":"49.7107411","1427":"50.3224522","1428":"50.0280372","1429":"51.6150602","1430":"51.5319697","1431":"51.6755578","1432":"50.3227011","1433":"50.0143461","1434":"50.2467795","1435":"50.0068841","1436":"49.9675208","1437":"50.0927011","1438":"49.2380084","1439":"49.3337724","1440":"49.3150441","1441":"49.2480598","1442":"49.2504816","1443":"49.4628849","1444":"49.4578581","1445":"49.502785","1446":"49.3243199","1447":"49.541402","1448":"49.5576988","1449":"49.3408445","1450":"49.3393466","1451":"49.2132114","1452":"49.5562088","1453":"48.8679066","1454":"48.8148481","1455":"48.9251855","1456":"48.4819527","1457":"48.45925","1458":"49.1092594","1459":"49.2867492","1460":"49.2278286","1461":"49.0393466","1462":"48.63414","1463":"48.2180458","1464":"47.8057737","1465":"48.2501969","1466":"48.703724","1467":"48.2562119","1468":"48.2413208","1469":"49.706573","1470":"49.0025853","1471":"48.788909","1472":"50.10421","1473":"49.72524","1474":"50.0334063","1475":"50.6356563","1476":"50.6913181","1516":"47.540570","1517":"47.380020","1518":"46.533160","1519":"47.308920","1520":"46.155100","1521":"47.015750","1522":"47.497510","1523":"47.415070","1524":"46.743900"}';
    var lngs = '{"1388":"13.7425915","1389":"14.2363624","1390":"12.4262438","1391":"12.0607215","1392":"11.8186221","1393":"11.9243126","1394":"12.2192522","1395":"11.8443105","1396":"11.5069079","1397":"12.0885386","1398":"13.5072189","1399":"13.4991272","1400":"13.5229106","1401":"13.1882797","1402":"12.1992939","1403":"13.0551729","1404":"10.1524932","1405":"9.9753146","1406":"8.1652702","1407":"10.2558254","1408":"8.4842096","1409":"9.7249949","1410":"9.9272742","1411":"10.5044018","1412":"10.342164","1413":"10.7228562","1414":"10.4083801","1415":"11.6069071","1416":"6.6145803","1417":"7.1007637","1418":"6.9209715","1419":"6.6595273","1420":"6.9499813","1421":"6.8891902","1422":"6.5191923","1423":"7.9200106","1424":"7.5485527","1425":"7.8842277","1426":"7.3550452","1427":"7.5957662","1428":"7.1547553","1429":"7.6552344","1430":"7.6685396","1431":"8.3683408","1432":"8.7440406","1433":"8.7890322","1434":"9.2883794","1435":"9.2227742","1436":"8.3854063","1437":"8.4566362","1438":"6.9585832","1439":"6.9246105","1440":"7.3311763","1441":"6.8685878","1442":"7.3439018","1443":"7.1573618","1444":"6.6211512","1445":"6.7570785","1446":"6.7476936","1447":"7.4198169","1448":"8.1802152","1449":"8.1578406","1450":"8.155575","1451":"8.5209721","1452":"8.6488143","1453":"9.1990435","1454":"9.3616366","1455":"8.9686082","1456":"8.9532636","1457":"8.693016","1458":"9.7905529","1459":"9.6783812","1460":"8.3677861","1461":"8.2948162","1462":"8.0566259","1463":"7.7602172","1464":"7.603369","1465":"12.4929347","1466":"11.422371","1467":"10.8685165","1468":"9.8640724","1469":"11.069122","1470":"12.1740808","1471":"12.8958696","1472":"11.431666","1473":"10.155226","1474":"10.2379657","1475":"10.7068373","1476":"10.944991","1516":"7.603490","1517":"8.675260","1518":"6.585870","1519":"7.928470","1520":"8.961660","1521":"7.490380","1522":"8.761380","1523":"9.312180","1524":"7.605360"}';
    var addresses = '{"1388":"1109 Dresden, R\u00e4hnitzer Allee 10","1389":"2977 Hoyerswerda, Kamenzer Bogen 3","1390":"04416 Markkleeberg, Nordstra\u00dfe 1","1391":"06188 Landsberg \/ OT Braschwitz, M\u00e4gdeberge 1","1392":"06198 Bennstedt, Eisdorfer Str. 31","1393":"06667 Wei\u00dfenfels OT Lei\u00dfling, Am Marktwege 2","1394":"06847 Dessau, Weststr. 7 - 8","1395":"07629 Hermsdorf, Rodaer Stra\u00dfe 72","1396":"07751 Jena-Isserstedt, Weimarische Str. 3","1397":"08538 Weischlitz-Plauen, Taltitzerstr. 80","1398":"10365 Berlin-Lichtenberg, Landsberger Allee 360-362","1399":"12487 Berlin-Treptow, Eisenhutweg 2","1400":"16356 Ahrensfelde, Rudolf Diesel Str","1401":"16515 Oranienburg, Stra\u00dfe am Globus 1","1402":"18184 Rostock-Roggentin, Globusring 1","1403":"18442 Wendorf, Albert-Schweitzer-Stra\u00dfe","1404":"22113 Oststeinbek, Willinghusener Weg","1405":"24568 Kaltenkirchen, Kisdorfer Weg 11","1406":"26129 Oldenburg, Ammerl\u00e4nder Heerstrasse 303","1407":"31228 Peine, Caroline-Herschel-Stra\u00dfe 7","1408":"35576 Wetzlar, Altenberger Strasse 24","1409":"36100  Petersberg, Justus Liebig Str. 9","1410":"37075 G\u00f6ttingen, Lutteranger 7","1411":"38112 Braunschweig, Hansestra\u00dfe 25","1412":"38226 Salzgitter, Konrad-Adenauer-Strasse 98","1413":"38442 Wolfsburg, Wolfsburger Landstr.\u00a07","1414":"38644 Goslar, Carl-Zeiss-Strasse 7","1415":"39118 Magdeburg, Salbker Chaussee 93","1416":"40670 Meerbusch-Osterath, Gewerb. Mollsfeld Krefelder Str. 84","1417":"45770 Marl, Karl-Breuing-Stra\u00dfe 15","1418":"50321 Br\u00fchl, Lise-Meitner-Stra\u00dfe 3","1419":"54292 Trier, Castelforte-Stra\u00dfe 1","1420":"54411 Hermeskeil, An der R\u00f6merstrasse","1421":"54516 Wittlich, R\u00f6merstra\u00dfe 53","1422":"54634 Bitburg, Industriestrasse","1423":"55457 Gensingen, Binger Strasse","1424":"55469 Simmern, R\u00f6delbachstr. 3","1425":"55543 Bad Kreuznach, Bosenheimer Str. 214","1426":"55743 Idar-Oberstein, John F. Kennedy-Str. 3","1427":"56112 Lahnstein, Koblenzer Str. 38","1428":"56856 Zell\/Mosel, Auf dem Barl 1","1429":"59192 Bergkamen, Geschwister Scholl Str. 1","1430":"59423 Unna, Hans-B\u00f6ckler-Stra\u00dfe 3","1431":"59557 Lippstadt, Am Mondschein 24","1432":"61169 Friedberg, Stra\u00dfheimer Strasse 24","1433":"63128 Dietzenbach, Albert-Einstein-Str. 3","1434":"63607 W\u00e4chtersbach, Industriestra\u00dfe 50","1435":"63768 H\u00f6sbach, Siemensstr. 23","1436":"65428 R\u00fcsselsheim, Am Steinmarkt","1437":"65719 Hofheim, Nordring 5-9","1438":"66115 Saarbruecken, K\u00e4the Kollwitz Str.","1439":"66265 Heusweiler, Am Bahnhof 13","1440":"66424 Homburg, Am Forum 6","1441":"66333 V\u00f6lklingen, Zechenstr. 8","1442":"66482 Zweibr\u00fccken, Wilkstra\u00dfe 2","1443":"66606 St Wendel, Linxweilerstra\u00dfe 20","1444":"66663 Merzig, Zum Wiesenhof 80","1445":"66679 Losheim am See, Saarbr\u00fccker Strasse 207\/Industr. S\u00fcd","1446":"66740 Saarlouis, Schanzenstrasse 18","1447":"66869 Kusel, Industriesrasse 9","1448":"67269 Gr\u00fcnstadt, Gewe. Im Hahnental Daimlerstr. 23","1449":"67433 Neustadt a.d. W., Adolf-Kolping-Strasse 130","1450":"67433 Neustadt a.d. W.(Hela), Chemnitzer Strasse 40","1451":"68753 Wagh\u00e4usel, Hambr\u00fccker Landstr. 4","1452":"69469 Weinheim, Viernheimer Strasse 59","1453":"70806 Kornwestheim, Leibnizstrasse 10","1454":"71384 Weinstadt-Endersbach, Kalkofenstra\u00dfe 14","1455":"71665 Vaihingen an der Enz, Stuttgarter Strasse 121","1456":"72108 Rottenburg, Felix-Wankel-Str. 22","1457":"72160 Horb a. Neckar, Kirschb\u00e4umle 1","1458":"74523 Schw\u00e4bisch-Hall, Raiffeisenstrasse 22","1459":"74653 K\u00fcnzelsau, W\u00fcrzburger Strasse 26","1460":"76726 Germersheim, Mainzer Strasse 4","1461":"76744 W\u00f6rth am Rhein, Maximilianstrasse 11","1462":"77855 Hela Achern, Severinstr. ","1463":"79336 Herbolzheim, Konrad-Adenauer Ring 5","1464":"79379 M\u00fcllheim, L\u00f6rracher Strasse 30","1465":"84453 M\u00fchldorf\u00a0a. Inn, Siemensstra\u00dfe 18","1466":"85051 Ingolstadt, Am Hochfeldweg 4","1467":"86343 K\u00f6nigsbrunn, Messerschmittring 22","1468":"88471 Laupheim, Neue Welt Str. 24","1469":"91301 Forchheim, Willy-Brandt-Allee 1  ","1470":"93055 Regensburg, Sulzfeldstr. 3","1471":"94447 Plattling, Dr. Walter Bruch Str.","1472":"95326 Kulmbach, Lichtenfelser Strasse 53","1473":"97318 Kitzingen, August-Gauer-Str. 2","1474":"97424 Schweinfurt, Rudolf Diesel Str. 24","1475":"98528 Suhl, Am Steinsfelder Wasser 13","1476":"98693 Ilmenau, B\u00fccheloher Str. 31","1516":"Reinacherstrasse 29 4053 Basel ","1517":"Industriestrasse 20 8604 Volketswil","1518":"Avenue Du Silo 11 1020 Renens","1519":"Ackerweg 2, 4665 Oftringen","1520":"Via Serrai 3 6592 San Antonino","1521":"Gewerbestrasse 11 3302 Moosseedorf","1522":"Industriestrasse 44 8404 Winterthur","1523":"Gaiserwaldstrasse 3 9015 St. Gallen","1524":"Weststrasse 14 3604 Thun"}';
    var types = '{"1388":"3","1389":"3","1390":"3","1391":"3","1392":"3","1393":"3","1394":"3","1395":"3","1396":"3","1397":"3","1398":"3","1399":"3","1400":"3","1401":"3","1402":"3","1403":"3","1404":"3","1405":"3","1406":"3","1407":"3","1408":"3","1409":"3","1410":"3","1411":"3","1412":"3","1413":"3","1414":"3","1415":"3","1416":"3","1417":"3","1418":"3","1419":"3","1420":"3","1421":"3","1422":"3","1423":"3","1424":"3","1425":"3","1426":"3","1427":"3","1428":"3","1429":"3","1430":"3","1431":"3","1432":"3","1433":"3","1434":"3","1435":"3","1436":"3","1437":"3","1438":"3","1439":"3","1440":"3","1441":"3","1442":"3","1443":"3","1444":"3","1445":"3","1446":"3","1447":"3","1448":"3","1449":"3","1450":"3","1451":"3","1452":"3","1453":"3","1454":"3","1455":"3","1456":"3","1457":"3","1458":"3","1459":"3","1460":"3","1461":"3","1462":"3","1463":"3","1464":"3","1465":"3","1466":"3","1467":"3","1468":"3","1469":"3","1470":"3","1471":"3","1472":"3","1473":"3","1474":"3","1475":"3","1476":"3","1516":"3","1517":"3","1518":"3","1519":"3","1520":"3","1521":"3","1522":"3","1523":"3","1524":"3"}';
    var names = '{"1388":"Globus","1389":"Globus","1390":"Globus","1391":"Globus","1392":"Globus","1393":"Globus","1394":"Globus","1395":"Globus","1396":"Globus","1397":"Globus","1398":"Globus","1399":"Globus","1400":"Globus","1401":"Globus","1402":"Globus","1403":"Globus","1404":"Globus","1405":"Globus","1406":"Globus","1407":"Globus","1408":"Globus","1409":"Globus","1410":"Globus","1411":"Globus","1412":"Globus","1413":"Globus","1414":"Globus","1415":"Globus","1416":"Globus","1417":"Globus","1418":"Globus","1419":"Globus","1420":"Globus","1421":"Globus","1422":"Globus","1423":"Globus","1424":"Globus","1425":"Globus","1426":"Globus","1427":"Globus","1428":"Globus","1429":"Globus","1430":"Globus","1431":"Globus","1432":"Globus","1433":"Globus","1434":"Globus","1435":"Globus","1436":"Globus","1437":"Globus","1438":"Globus","1439":"Globus","1440":"Globus","1441":"Globus","1442":"Globus","1443":"Globus","1444":"Globus","1445":"Globus","1446":"Globus","1447":"Globus","1448":"Globus","1449":"Globus","1450":"Globus","1451":"Globus","1452":"Globus","1453":"Globus","1454":"Globus","1455":"Globus","1456":"Globus","1457":"Globus","1458":"Globus","1459":"Globus","1460":"Globus","1461":"Globus","1462":"Globus","1463":"Globus","1464":"Globus","1465":"Globus","1466":"Globus","1467":"Globus","1468":"Globus","1469":"Globus","1470":"Globus","1471":"Globus","1472":"Globus","1473":"Globus","1474":"Globus","1475":"Globus","1476":"Globus","1516":"Obi","1517":"Obi","1518":"Obi","1519":"Obi","1520":"Obi","1521":"Obi","1522":"Obi","1523":"Obi","1524":"Obi"}';
    var phones = '{"1388":"","1389":"","1390":"","1391":"","1392":"","1393":"","1394":"","1395":"","1396":"","1397":"","1398":"","1399":"","1400":"","1401":"","1402":"","1403":"","1404":"","1405":"","1406":"","1407":"","1408":"","1409":"","1410":"","1411":"","1412":"","1413":"","1414":"","1415":"","1416":"","1417":"","1418":"","1419":"","1420":"","1421":"","1422":"","1423":"","1424":"","1425":"","1426":"","1427":"","1428":"","1429":"","1430":"","1431":"","1432":"","1433":"","1434":"","1435":"","1436":"","1437":"","1438":"","1439":"","1440":"","1441":"","1442":"","1443":"","1444":"","1445":"","1446":"","1447":"","1448":"","1449":"","1450":"","1451":"","1452":"","1453":"","1454":"","1455":"","1456":"","1457":"","1458":"","1459":"","1460":"","1461":"","1462":"","1463":"","1464":"","1465":"","1466":"","1467":"","1468":"","1469":"","1470":"","1471":"","1472":"","1473":"","1474":"","1475":"","1476":"","1516":"41585758200","1517":"41 58 563 44 30","1518":"+41 58 573 53 00","1519":"+41 58 567 43 00","1520":"+41 91 850 88 37","1521":"+41 58 567 41 11","1522":"+41 58 712 05 00","1523":"+41 58 712 86 00","1524":"+41 58 567 28 28"}';
    var wwws = '{"1388":"","1389":"","1390":"","1391":"","1392":"","1393":"","1394":"","1395":"","1396":"","1397":"","1398":"","1399":"","1400":"","1401":"","1402":"","1403":"","1404":"","1405":"","1406":"","1407":"","1408":"","1409":"","1410":"","1411":"","1412":"","1413":"","1414":"","1415":"","1416":"","1417":"","1418":"","1419":"","1420":"","1421":"","1422":"","1423":"","1424":"","1425":"","1426":"","1427":"","1428":"","1429":"","1430":"","1431":"","1432":"","1433":"","1434":"","1435":"","1436":"","1437":"","1438":"","1439":"","1440":"","1441":"","1442":"","1443":"","1444":"","1445":"","1446":"","1447":"","1448":"","1449":"","1450":"","1451":"","1452":"","1453":"","1454":"","1455":"","1456":"","1457":"","1458":"","1459":"","1460":"","1461":"","1462":"","1463":"","1464":"","1465":"","1466":"","1467":"","1468":"","1469":"","1470":"","1471":"","1472":"","1473":"","1474":"","1475":"","1476":"","1516":"www.obi.ch","1517":"www.obi.ch","1518":"www.obi.ch","1519":"www.obi.ch","1520":"www.obi.ch","1521":"www.obi.ch","1522":"www.obi.ch","1523":"www.obi.ch","1524":"www.obi.ch"}';

    zoom = 7;

    var allowedtypes = [];
    
    function getAllowedTypes() {
        allowedtypes = [];
        if (jQuery('#market').prop('checked')) {
            allowedtypes.push(3);
        }
        if (jQuery('#sklad').prop('checked')) {
            allowedtypes.push(2);
        }
        if (jQuery('#dystrybutor').prop('checked')) {
            allowedtypes.push(1);
        }
        if (jQuery('#partner').prop('checked')) {
            allowedtypes.push(4);
        }
        return allowedtypes;
    }

    var addressHtml = [];

    // function paginateTable() {
    //     jQuery('.table-pagination').remove();
    //     if(jQuery('#results table tr').length > 20){
    //         jQuery('#results table').tablePaginate({navigateType:'navigator',recordPerPage:10});
    //     } else {
    //         jQuery('#results table').tablePaginate({navigateType:'full',recordPerPage:10});
    //     }
    // }

    sortSelectOptions('#region', true);
    function getAll() {
        clearMarkers();

        getAllowedTypes();

        obj = jQuery.parseJSON(streets);

        addressHtml = [];
        jQuery.each(obj, function(key, value) {
            jQuery.each(value, function(id, street, type) {
                SetPoint(id);
            });
        });

        map.setZoom(zoom);
                var latlng = new google.maps.LatLng(51.165691, 10.451526);

        center = new google.maps.LatLng(51.165691,10.451526);
        map.panTo(center);
        
                jQuery('#results table tbody').append(addressHtml.join(''));
             var table = jQuery('#results table').DataTable({
                "destroy": true,
                "order": [[ 0, 'asc' ], [ 1, 'asc' ]],
                "pageLength": 20,
                "searching": false,
                "language": {
                    "paginate": {
                      "previous": "&larr;",
                      "next": "&rarr;"
                    }
                }
            } );
    }

    function getCities(element) {
        var selected = element.value;
        if (selected == "Wählen Sie Ihre Provinz") {
            jQuery('#cities').empty();
            getAll();
            return;
        } else {
            obj = jQuery.parseJSON(cities);
            options = obj[selected];
            appendCities(options);
            zoomIt();
        }
    }
    
    function loadCities(value){
        if (value == "Wählen Sie Ihre Provinz") {
            getAll();
            return;
        }
        
        obj = jQuery.parseJSON(cities);
        if(obj){
            options = obj[value];
            appendCities(options);
            console.log('oi')
            jQuery("select[name=region] option[value='"+value+"']").attr('selected', 'selected');
            //jQuery('#region').selectpicker('refresh');
            jQuery('#results table tbody').append(addressHtml.join(''));
                var table = jQuery('#results table').DataTable({
                "destroy": true,
                "order": [[ 0, 'asc' ], [ 1, 'asc' ]],
                "pageLength": 20,
                "searching": false,
                "language": {
                    "paginate": {
                      "previous": "&larr;",
                      "next": "&rarr;"
                    }
                }
            } );
        }else{
            getAll();
        }  
    }

    function appendCities(options) {
        olats = jQuery.parseJSON(lats);
        olngs = jQuery.parseJSON(lngs);
        oaddresses = jQuery.parseJSON(addresses);
        var $el = jQuery("#city");
        $el.empty(); // remove old options
        
        $el.append(jQuery("<option></option>").attr("value", 0).text('Wybierz miasto'));
        
        clearMarkers();
            
        var usedNames = {};
        addressHtml = [];
        jQuery.each(options, function(id, key) {
            if(!usedNames[key]){
                $el.append(jQuery("<option></option>")
                    .attr("value", id).text(key));
            }
            lat = olats[id];
            lng = olngs[id];
            address = oaddresses[id];
            SetPoint(id);
            usedNames[key] = key;
        });
		sortSelectOptions('#city', true);
        if (jQuery.fn.DataTable.isDataTable('#results table')) {
          jQuery('#results table').DataTable().clear().destroy();
        }
        jQuery('#results table tbody').append(addressHtml.join(''));
        var table = jQuery('#results table').DataTable({
            "destroy": true,
            "order": [[ 0, 'asc' ], [ 1, 'asc' ]],
            "pageLength": 20,
            "searching": false,
            "language": {
                "paginate": {
                  "previous": "&larr;",
                  "next": "&rarr;"
                }
            }
        } );
        //paginateTable();
        zoomIt();
        //Filter();
    }

    function sortSelectOptions(selector, skip_first) {
        var options = (skip_first) ? jQuery(selector + ' option:not(:first)') : jQuery(selector + ' option');
        var arr = options.map(function(_, o) { return { t: jQuery(o).text(), v: o.value, s: jQuery(o).prop('selected') }; }).get();
        arr.sort(function(o1, o2) {
          var t1 = o1.t.toLowerCase(), t2 = o2.t.toLowerCase();
          return t1.localeCompare(t2);
        }); 
        options.each(function(i, o) {
            o.value = arr[i].v;
            jQuery(o).text(arr[i].t);
            if (arr[i].s) {
                jQuery(o).attr('selected', 'selected').prop('selected', true);
            } else {
                jQuery(o).removeAttr('selected');
                jQuery(o).prop('selected', false);
            }
        }); 
    }

    function getStreets(element) {
        var id = element.value;
        if (id == '0') {

            selected = jQuery("#region option:selected").val();

            obj = jQuery.parseJSON(cities);
            options = obj[selected];
            appendCities(options);
        } else {
            clearMarkers();

            selected = jQuery("#region option:selected").val();
            obj = jQuery.parseJSON(cities);
            options = obj[selected];

            addressHtml = [];
            jQuery.each(options, function(id, key) {
                if(key == jQuery("#city option:selected").text()){
                    lat = olats[id];
                    lng = olngs[id];
                    address = oaddresses[id];
                    SetPoint(id);
                }
            });
			if (jQuery.fn.DataTable.isDataTable('#results table')) {
              jQuery('#results table').DataTable().clear().destroy();
            }
            console.log('here')
            jQuery('#results table tbody').append(addressHtml.join(''));
            zoomIt();
        }
        var table = jQuery('#results table').DataTable({
            "destroy": true,
            "order": [[ 0, 'asc' ], [ 1, 'asc' ]],
            "pageLength": 20,
            "searching": false,
            "language": {
                "paginate": {
                    "previous": "&larr;",
                    "next": "&rarr;"
                }
            }
        } );
        //paginateTable();
    }

    function zoomIt(){
        if(markers.length > 0){
            var bounds = markers.reduce(function(bounds, marker) {
                return bounds.extend(marker.getPosition());
            }, new google.maps.LatLngBounds());

            map.setCenter(bounds.getCenter());
            map.fitBounds(bounds);
        }
    }

</script>

    <style>
      #map-canvas {
        margin: 25px auto;
        height: 620px;
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCzqwV2COu61ASo1ahiR0Ju8bzQOaE695E&v=3.exp"></script>
    <script>
      var geocoder;
      var map;
      var markers = [];

      function initialize() {
        geocoder = new google.maps.Geocoder();
        var latlng = new google.maps.LatLng(51.165691, 10.451526);
        var mapOptions = {
          zoom: 7,
          center: latlng
        }
        map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

                  getAll();
          //jQuery('#results').before('<span>Wybierz region</span>');
        
      }

      var olats = jQuery.parseJSON(lats);
      var olngs = jQuery.parseJSON(lngs);
      var ocountries = jQuery.parseJSON(countries);
      var oaddresses = jQuery.parseJSON(addresses);
      var otypes = jQuery.parseJSON(types);
      var onames = jQuery.parseJSON(names);
      var ophones = jQuery.parseJSON(phones);
      var owwws = jQuery.parseJSON(wwws);

      function SetPoint(id) {

        lat = olats[id];
        lng = olngs[id];
        land = ocountries[id];
        address = oaddresses[id];
        type = otypes[id];
        name = onames[id];
        phone = ophones[id];
        if (phone == 'null' || phone == null) {
          phone = '';
        }
        www = owwws[id];
        if (www == 'null' || www == null) {
          www = '';
        }

        var location = new google.maps.LatLng(lat, lng);

                  if(type==='4'){
            var point = 'https://stones.com.pl/wp-content/themes/stones/library/images/icons/wheretobuy-purple.png';
          } else if(type==='5') {
            var point = 'https://stones.com.pl/wp-content/themes/stones/library/images/icons/wheretobuy-green.png';
          } else if(type==='6') {
            var point = 'https://stones.com.pl/wp-content/themes/stones/library/images/icons/wheretobuy-orange.png';
          } else if(type==='3') {
            var point = 'https://stones.com.pl/wp-content/themes/stones/library/images/icons/wheretobuy-red.png';
          } else if(type==='2') {
            var point = 'https://stones.com.pl/wp-content/themes/stones/library/images/icons/wheretobuy-black.png';
          } else if(type==='7') {
            var point = 'https://stones.com.pl/wp-content/themes/stones/library/images/icons/wheretobuy-blue.png';
          } else {
            var point = 'https://stones.com.pl/wp-content/themes/stones/library/images/icons/wheretobuy-gray.png';
          }
        
        selectedtype = parseInt(type);
        typesOrder = ["7","4","2","1","3","5","6"];
        countries = {Poland:'http://stones.com.pl/gdzie-kupic/', Detschland:'http://de.stones.com.pl/gdzie-kupic/', France:'http://stegu.fr/ou-acheter/', Ireland:'http://ie.stones.com.pl/where-to-buy/'};

        if (allowedtypes.indexOf(selectedtype) > -1) {
          if ( type==='7' ) {
              var zindex = 999;
            }
            else {
              var zindex = "";
            }
          var marker = new google.maps.Marker({
            id: id,
            position: location,
            map: map,
            icon: point,
            zIndex: zindex
          });

          var infowindow = new google.maps.InfoWindow({
            content: ''
          });

          var countryLink = '';

          
          var infoHtml = "<p class='address-map-popup'>"
              + "<strong>" + name + "</strong><br/>"
              + address + "<br/><br/><br/>"
              + phone + "<br/>"
              + www + "<br/><br/>"
              + countryLink
              + "</p>";

          if (address) {
            var addressSplited = address.split(', ');
            address = addressSplited.shift() + "<br>" + addressSplited.join(', ');
            addressHtml.push(
                "<tr>");
            if(jQuery('.language-list .dropdown-toggle').text().trim() !== 'pl'){
              addressHtml.push('<td class="country">'
                  + land
                + '</td>');
            }
            addressHtml.push('<td style="display:none">' + typesOrder[type-1] + '</td>');
            addressHtml.push( "<td>"
                  + "<img class='point-icon' src='" + point + "'/>"
                  + name
                + "</td>"
                + "<td>"
                  + address
                + "</td>"
                + "<td>"
                  + phone + "<br/>"
                  + www
                + "</td>"
                + "<td>"
                  + "<a class='generate-marker-link' onclick='generateMarker(" + markers.length + "); '>Pokaż na mapie</a>"
                + "</td>"
                + "</tr>");
            // jQuery('#results table tbody').append(addressHtml.join(''));
          }

          bindInfoWindow(marker, map, infowindow, infoHtml);
          markers.push(marker);
        }
      }

      function generateMarker(markerPos){
        for (var i = 0; i < markers.length; i++) {
          if(i != markerPos){
            markers[i].setMap(null);
          }else{
            markers[i].setMap(map);
            map.setCenter(markers[i].position);
          }
        }
        jQuery('html, body').animate({scrollTop : jQuery('.header').height()},500);
      }

      function Filter() {
        getAllowedTypes();
        getAll();
      }

      /* deprecated, changed to setPoint method for google request balance*/

              function bindInfoWindow(marker, map, infowindow, html) {
          google.maps.event.addListener(marker, 'mouseover', function() {
            infowindow.setContent(html);
            infowindow.open(map, marker);
          });
          google.maps.event.addListener(marker, 'mouseout', function() {
            infowindow.close();
          });
        }
      
      // Sets the map on all markers in the array.
      function setAllMap(map) {
        for (var i = 0; i < markers.length; i++) {
          markers[i].setMap(map);
        }
      }

      // Removes the markers from the map, but keeps them in the array.
      function clearMarkers() {
        setAllMap(null);
        jQuery('#results table tbody').html('');
        markers = [];
      }

      function adjustZoom(results) {
        count = results.length;
        if (count == 1) {
          zoom = 12;
        } else {
          zoom = 6;
        }
        map.setZoom(zoom);
      }

      jQuery(window).load(function(){
        initialize()
        //google.maps.event.addDomListener(window, 'load', initialize);
      });

    </script>

    <div id="map-canvas"></div>

    
<div class="clearfix"></div>

<div id="results">
    <table class="table table-hover">
        <thead style="display: none;">
            <tr>
                <th>Type</th>
                <th>Name</th>
                <th>Address</th>
                <th>Contact</th>
                <th>Find</th>
            </tr>
        </thead>
        <tbody>
            
        </tbody>
    </table>
</div>
{"id":185,"date":"2016-02-03T12:20:55","date_gmt":"2016-02-03T11:20:55","guid":{"rendered":"http:\/\/stegu.pl\/?page_id=185"},"modified":"2016-07-28T09:49:06","modified_gmt":"2016-07-28T07:49:06","slug":"where-to-buy","status":"publish","type":"page","link":"https:\/\/stones.com.pl\/de\/gdzie-kupic\/","title":{"rendered":"Gdzie kupi\u0107"},"content":{"rendered":"\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":11,"featured_media":4384,"parent":0,"menu_order":6,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"acf":[],"_links":{"self":[{"href":"https:\/\/stones.com.pl\/de\/wp-json\/wp\/v2\/pages\/185"}],"collection":[{"href":"https:\/\/stones.com.pl\/de\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/stones.com.pl\/de\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/stones.com.pl\/de\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/stones.com.pl\/de\/wp-json\/wp\/v2\/comments?post=185"}],"version-history":[{"count":4,"href":"https:\/\/stones.com.pl\/de\/wp-json\/wp\/v2\/pages\/185\/revisions"}],"predecessor-version":[{"id":4386,"href":"https:\/\/stones.com.pl\/de\/wp-json\/wp\/v2\/pages\/185\/revisions\/4386"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/stones.com.pl\/de\/wp-json\/wp\/v2\/media\/4384"}],"wp:attachment":[{"href":"https:\/\/stones.com.pl\/de\/wp-json\/wp\/v2\/media?parent=185"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}