var pois = null; var poisall = null; var drawingManager = null; var activePoly = null; var markers = Array(); var filterCategory = ''; var isScrollEnabled = true; var itemHTML = ''; var allShapes = []; var disableLazyLoad = false; function showLocationSearchLayer(obj) { $('.location-search-layer').show(); } function hideLocationSearchLayer(obj) { if (filterCategory==='') { //$('.location-search-layer').hide(); } else { return false; } } function searchSuggession(obj) { var act = $(obj).val(); var lastKeyword = ''; var kws = []; if (act.length>2) { kws = act.split(","); lastKeyword = kws[kws.length-1]; $.get('/main/suggession/'+lastKeyword,function(resp) { $('.suggession').html(resp); }); if (!$('.suggession').is(':visible')) { $('.suggession').show(); } } else { $('.suggession').html(''); $('.suggession').hide(); return false; } } function set_suggess_item(key) { if (key!=='') { var act = $('#search_location').val(); var kws = []; var fill = ''; kws = act.split(","); kws[kws.length-1]=key; fill = kws.join(','); $('#search_location').val(fill+','); } else { return false; } } var fsMode = false; function switchFullScreen(obj) { if (fsMode==false) { fsMode = true; $('.results-block').toggle(); $('.filter-bar').toggle(); $('#headline').toggle(); $('#menu').toggle(); $('.map-block').css('margin-top','0px'); $('#circleButton').css('top','0px'); $('#fullButton').css('top','0px'); $('#dsBtn').toggle(); $('#fsBtnLabel').html('Normál nézet'); } else { fsMode = false; $('.results-block').toggle(); $('.filter-bar').toggle(); $('#headline').toggle(); $('#menu').toggle(); $('.map-block').css('margin-top','162px'); $('#fullButton').css('top','162px'); $('#circleButton').css('top','162px'); $('#dsBtn').toggle(); $('#fsBtnLabel').html('Teljes képernyő'); } } function post(path, params, method='post') { const form = document.createElement('form'); form.method = method; form.action = path; for (const key in params) { if (params.hasOwnProperty(key)) { const hiddenField = document.createElement('input'); hiddenField.type = 'hidden'; hiddenField.name = key; hiddenField.value = params[key]; form.appendChild(hiddenField); } } document.body.appendChild(form); form.submit(); } function search_from_main() { var keyw = new Array(); var ertekesites = $('#ertekesites').val(); $('.sugessionTags').children('.sugessionTag').each(function() { keyw.push($(this).attr('data-value')); }); //filterCategory = '/'+ertekesites+'/'+$('#tipus').val(); filterCategory = '/map/search/filter'; filterCategory+= '/?from=/&city='+keyw+'&ertekesites='+ertekesites+'&jelleg='+$('#tipus').val()+'&iranyar_min='+$('#armin').val()+'&iranyar_max='+$('#armax').val()+'&meret_netto_min='+$('#sizemin').val()+'&meret_netto_max='+$('#sizemax').val()+'&szoba_min='+$('#szoba_min').val()+'&szoba_max='+$('#szoba_max').val(); window.location.href = filterCategory; /*if (keyw.length>0) { window.location = filterCategory+'filter/?from=/&city='+keyw+'&ertekesites='+$('#ertekesites').val()+'&jelleg='+$('#tipus').val()+'&iranyar_min='+$('#armin').val()+'&iranyar_max='+$('#armax').val()+'&meret_netto_min='+$('#sizemin').val()+'&meret_netto_max='+$('#sizemax').val()+'&szoba_min='+$('#szoba_min').val()+'&szoba_max='+$('#szoba_max').val(); } else { return false; }*/ } function search_from_main_mobil() { var keyw = new Array(); $('.sugessionTagsMobile').children('.sugessionTag').each(function() { keyw.push($(this).attr('data-value')); }); filterCategory = '/map/search/'; window.location = filterCategory+'filter/?from=/&city='+keyw+'&ertekesites='+$('#ertekesites_mobil').val()+'&jelleg='+$('#tipus_mobil').val()+'&iranyar_min='+$('#armin_mobil').val()+'&iranyar_max='+$('#armax_mobil').val()+'&meret_netto_min='+$('#sizemin_mobil').val()+'&meret_netto_max='+$('#sizemax_mobil').val()+'&szoba_min='+$('#szoba_min_mobil').val()+'&szoba_max='+$('#szoba_max_mobil').val(); } function save_search() { $.get('/profile/favorites/addsearch/',function(resp) { if (resp==='ok') { $('.success-bar').html(' A keresést sikeresen mentette...'); $('.success-bar').toggle(); var shtimer = setInterval(function() { $('.success-bar').toggle(); clearInterval(shtimer); },3000); } else if (resp==='login') { login_modal(); $('.error-bar').html(' A keresés mentéséhez be kell lépnie...'); $('.error-bar').toggle(); var shtimer = setInterval(function() { $('.error-bar').toggle(); clearInterval(shtimer); },3000); } else { $('.error-bar').html(' Keresés hozzáadása nem lehetséges...'); $('.error-bar').toggle(); var shtimer = setInterval(function() { $('.error-bar').toggle(); clearInterval(shtimer); },3000); } }); } function account_modal() { $('#accountbox').toggle(); } function show_authed_modal() { uglipop({ class: 'register-popup', source: 'html', content: '\n\ ' }); } function register_modal() { $('#accountbox').hide(); uglipop({ class: 'register-popup', source: 'html', content: '\n\ ' }); } function login_modal() { $('#accountbox').hide(); uglipop({ class: 'login-popup', source: 'html', content: '\n\ ' }); } function reminder_modal() { $('#accountbox').hide(); uglipop({ class: 'login-popup', source: 'html', content: '\n\ ' }); } function close_modal() { document.getElementById('uglipop_overlay_wrapper').style.display = 'none'; document.getElementById('uglipop_overlay').style.display = 'none'; document.getElementById('uglipop_content_fixed').style.display = 'none'; } function show_filter_modal(obj) { $(obj).show(); } function hide_filter_modal(obj) { $(obj).hide(); } function apply_map_filter(obj) { $(obj).hide(); } function initPropMap() { var lat = $('#propmap').attr('data-lat'); var lon = $('#propmap').attr('data-lon'); var zoom = $('#propmap').attr('data-zoom'); var noise = $('#propmap').attr('data-noise'); var map = new google.maps.Map(document.getElementById('propmap'),{ zoom: 14, center: new google.maps.LatLng(lat,lon) }); if (noise!='y') { var marker = new google.maps.Marker({ position: new google.maps.LatLng(lat,lon), icon: '/uix/images/marker.png', map: map }); } else { var myCircle = new google.maps.Circle({ strokeColor: '#2eac59', strokeOpacity: 0.8, strokeWeight: 2, fillColor: '#2eac59', fillOpacity: 0.35, map: map, center: new google.maps.LatLng(lat,lon), radius: 700 }); } } //Sample constant JSON resultset var data = { "pois": [ {"name":"Teszt 01", "desc":"(1) Sed sodales quis eros in feugiat. Maecenas eu luctus eros. Pellentesque interdum libero non luctus bibendum. Integer in nunc pharetra, hendrerit urna vel, viverra massa. Fusce quis sapien ex.", "URL":"http://www.index.hu", "lat":"47.539950", "lng":"19.140520"}, {"name":"Teszt 02", "desc":"(2) Sed sodales quis eros in feugiat. Maecenas eu luctus eros. Pellentesque interdum libero non luctus bibendum. Integer in nunc pharetra, hendrerit urna vel, viverra massa. Fusce quis sapien ex.", "URL":"http://www.origo.hu", "lat":"47.539450", "lng":"19.143663"}, {"name":"Teszt 03", "desc":"(3) Sed sodales quis eros in feugiat. Maecenas eu luctus eros. Pellentesque interdum libero non luctus bibendum. Integer in nunc pharetra, hendrerit urna vel, viverra massa. Fusce quis sapien ex.", "URL":"http://www.sg.hu", "lat":"47.538458", "lng":"19.143084"}, {"name":"Teszt 04", "desc":"(4) Sed sodales quis eros in feugiat. Maecenas eu luctus eros. Pellentesque interdum libero non luctus bibendum. Integer in nunc pharetra, hendrerit urna vel, viverra massa. Fusce quis sapien ex.", "URL":"http://www.google.com", "lat":"47.542927", "lng":"19.141732"}, {"name":"Teszt 05", "desc":"(5) Sed sodales quis eros in feugiat. Maecenas eu luctus eros. Pellentesque interdum libero non luctus bibendum. Integer in nunc pharetra, hendrerit urna vel, viverra massa. Fusce quis sapien ex.", "URL":"http://www.amazon.com", "lat":"47.540906", "lng":"19.134211"}, {"name":"Teszt 06", "desc":"(6) Sed sodales quis eros in feugiat. Maecenas eu luctus eros. Pellentesque interdum libero non luctus bibendum. Integer in nunc pharetra, hendrerit urna vel, viverra massa. Fusce quis sapien ex.", "URL":"http://www.prog.hu", "lat":"47.546142", "lng":"19.134973"}, {"name":"Teszt 07", "desc":"(7) Sed sodales quis eros in feugiat. Maecenas eu luctus eros. Pellentesque interdum libero non luctus bibendum. Integer in nunc pharetra, hendrerit urna vel, viverra massa. Fusce quis sapien ex.", "URL":"http://www.youtube.com", "lat":"47.548748", "lng":"19.127635"}, {"name":"Teszt 08", "desc":"(8) Sed sodales quis eros in feugiat. Maecenas eu luctus eros. Pellentesque interdum libero non luctus bibendum. Integer in nunc pharetra, hendrerit urna vel, viverra massa. Fusce quis sapien ex.", "URL":"http://www.ingatlan.com", "lat":"47.553846", "lng":"19.130081"} ] }; function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, "."); } function setListOrderReloader(order) { if (order!=='') { $.get('/property/search/reorder/',{order: order},function(resp) { window.location.reload(); }); } else { return false; } } function setAgentListOrderReloader(order) { if (order!=='') { $.get('/rockhome-tanacsadok/reorder/change/',{order: order},function(resp) { window.location.reload(); }); } else { return false; } } function setOfficeListOrderReloader(order) { if (order!=='') { $.get('/rockhome-irodak/reorder/change/',{order: order},function(resp) { window.location.reload(); }); } else { return false; } } function generateSlug(text) { if (text!='') { text = text.toLowerCase(); text = text.replace(/ /g,'-'); text = text.replace(/á/g,'a'); text = text.replace(/é/g,'e'); text = text.replace(/í/g,'i'); text = text.replace(/ó/g,'o'); text = text.replace(/ö/g,'o'); text = text.replace(/ő/g,'o'); text = text.replace(/ú/g,'u'); text = text.replace(/ü/g,'u'); text = text.replace(/ű/g,'u'); text = text.replace('budapest-01','budapest-i-kerulet'); text = text.replace('budapest-02','budapest-ii-kerulet'); text = text.replace('budapest-03','budapest-iii-kerulet'); text = text.replace('budapest-04','budapest-iv-kerulet'); text = text.replace('budapest-05','budapest-v-kerulet'); text = text.replace('budapest-06','budapest-vi-kerulet'); text = text.replace('budapest-07','budapest-vii-kerulet'); text = text.replace('budapest-08','budapest-viii-kerulet'); text = text.replace('budapest-09','budapest-ix-kerulet'); text = text.replace('budapest-10','budapest-x-kerulet'); text = text.replace('budapest-11','budapest-xi-kerulet'); text = text.replace('budapest-12','budapest-xii-kerulet'); text = text.replace('budapest-13','budapest-xiii-kerulet'); text = text.replace('budapest-14','budapest-xiv-kerulet'); text = text.replace('budapest-15','budapest-xv-kerulet'); text = text.replace('budapest-16','budapest-xvi-kerulet'); text = text.replace('budapest-17','budapest-xvii-kerulet'); text = text.replace('budapest-18','budapest-xviii-kerulet'); text = text.replace('budapest-19','budapest-xix-kerulet'); text = text.replace('budapest-20','budapest-xx-kerulet'); text = text.replace('budapest-21','budapest-xxi-kerulet'); text = text.replace('budapest-22','budapest-xxii-kerulet'); text = text.replace('budapest-23','budapest-xxiii-kerulet'); return text; } else { return false; } } function setListOrder(order) { if (order!=='') { var itemHTML = ''; var szobak = 0; $.getJSON('/map/search/reorder/',{order: order},function(resp) { if (resp.code=='01') { pois = resp.pois; } $.each(pois,function(key,poi) { szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } itemHTML += '
'; itemHTML += '
'; itemHTML += '
'; itemHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; itemHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { itemHTML += ''+poi.meret_telek+' m2
'; } itemHTML += ''+szobak.toString()+' szoba
'; itemHTML += ''+poi.name+''; //itemHTML += ' Contact'; //itemHTML += ' Favorite'; itemHTML += '
'; itemHTML += '
'; }); itemHTML += '
'; $.get('/map/lazy/check/',function(resp) { itemHTML += resp; $('.result-list-thin').html(itemHTML); }); }); } else { return false; } } function addClearButton(controlDiv,map) { var controlUI = document.getElementById('trashButton'); controlDiv.appendChild(controlUI); controlUI.addEventListener('click', function() { $.post('/map/clearpolygon/',function(resp) { window.location.reload(); }); }); } function addDrawButton(controlDiv,map) { var controlUI = document.getElementById('polyButton'); controlDiv.appendChild(controlUI); controlUI.addEventListener('click', function() { for (var i=0; i < allShapes.length; i++) { allShapes[i].setMap(null); } allShapes = []; if (activePoly!==null) { activePoly.setMap(null); while (markers.length) { markers.pop().setMap(null); } } drawingManager.setDrawingMode(google.maps.drawing.OverlayType.POLYGON); }); } function addCircleButton(controlDiv,map) { var controlUI = document.getElementById('circleButton'); controlDiv.appendChild(controlUI); controlUI.addEventListener('click', function() { for (var i=0; i < allShapes.length; i++) { allShapes[i].setMap(null); } allShapes = []; activePoly = null; while (markers.length) { markers.pop().setMap(null); } drawingManager.setDrawingMode(google.maps.drawing.OverlayType.CIRCLE); }); } function addMoveButton(controlDiv,map) { var controlUI = document.getElementById('moveButton'); controlDiv.appendChild(controlUI); controlUI.addEventListener('click', function() { drawingManager.setDrawingMode(null); }); } function getDefaultPropertyList(origin) { var itemHTML = ''; var szobak = 0; $.getJSON('/map/search/all/',{},function(resp) { if (resp.code=='01') { pois = resp.pois; } $.each(pois,function(key,poi) { szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } itemHTML += '
'; itemHTML += '
'; itemHTML += '
'; itemHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; itemHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { itemHTML += ''+poi.meret_telek+' m2
'; } itemHTML += ''+szobak.toString()+' szoba
'; itemHTML += ''+poi.name+''; //itemHTML += ' Contact'; //itemHTML += ' Favorite'; itemHTML += '
'; itemHTML += '
'; }); itemHTML += '
'; $('#properties_count').html(resp.count.toString()); $.get('/map/lazy/check/',function(resp) { itemHTML += resp; $('.result-list-thin').html(itemHTML); }); }); } function lazyShowMore(obj) { if (disableLazyLoad==false) { isScrollEnabled = false; $(obj).remove(); var itemHTML = $('.result-list-thin').html(); var szobak = 0; var ujak = null; $.getJSON('/map/lazy/load/',function(resp) { if (resp.code=='01') { ujak = resp.pois; } $.each(ujak,function(key,poi) { szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } itemHTML += '
'; itemHTML += '
'; itemHTML += '
'; itemHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; itemHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { itemHTML += ''+poi.meret_telek+' m2
'; } itemHTML += ''+szobak.toString()+' szoba
'; itemHTML += ''+poi.name+''; //itemHTML += ' Contact'; //itemHTML += ' Favorite'; itemHTML += '
'; itemHTML += '
'; }); itemHTML += '
'; $.get('/map/lazy/check/',function(resp) { itemHTML += resp; isScrollEnabled = true; $('.result-list-thin').html(itemHTML); if ($(window).width()>500) { $('#content').css('height',$('.result-list-thin').height()+360); $('#map').css('height',$('.result-list-thin').height()+160); } else { $('#content').css('height',$('.result-list-thin').height()+145); $('#map').css('height',$('.result-list-thin').height()+160); } }); }); } } function lazyShowMoreGrid() { var acturl = window.location.href; if (acturl.indexOf("://rockhome.hu/rockhome-irodak/")==-1) { isScrollEnabled = false; if (screen.width>1000) { $.get('/property/lazyLoad/',function(resp) { $('.showmore').remove(); $('.result-list').append(resp); isScrollEnabled = true; }); } else { $.get('/property/lazyLoad/justmobile',function(resp) { $('.showmore').remove(); $('.result-list-thin').append(resp); isScrollEnabled = true; }); } } } function showGridView() { window.location='/property/search'; } function showMapView() { window.location='/map'; } function sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if ((new Date().getTime() - start) > milliseconds){ break; } } } //Google maps initialization function initMapStored() { //getDefaultPropertyList('stored'); var geocoder = new google.maps.Geocoder(); //Init map div var map = new google.maps.Map(document.getElementById('map'),{ zoom: 8, disableDefaultUI: true, zoomControl: true, zoomControlOptions: { position: google.maps.ControlPosition.LEFT_TOP }, center: {lat: 46.897913, lng: 20.540236} }); /*geocoder.geocode({'address': "Paris"}, function(results, status) { if (status === 'OK') { map.setCenter(results[0].geometry.location); } });*/ var centerControlDiv = document.createElement('div'); var centerControl3 = new addMoveButton(centerControlDiv, map); if (storedLats==='' && storedLngs==='') { var centerControl2 = new addDrawButton(centerControlDiv, map); } var centerControl1 = new addClearButton(centerControlDiv, map); centerControlDiv.index = 1; map.controls[google.maps.ControlPosition.TOP_CENTER].push(centerControlDiv); var counter = 0; if (storedLats!=='' && storedLngs!=='') { var coords = []; var pointObject = {}; var myLats = JSON.parse(storedLats); var myLngs = JSON.parse(storedLngs); for (var i=0;i'; popHTML += '
'; popHTML += '
'; popHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; popHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { popHTML += ''+poi.meret_telek+' m2
'; } popHTML += ''+szobak.toString()+' szoba
'; popHTML += ''+poi.name+''; //popHTML += ' Contact'; //popHTML += ' Favorite'; popHTML += '
'; popHTML += ''; var infowindow = new google.maps.InfoWindow({ content: popHTML }); //Add marker var marker = new google.maps.Marker({ position: cord, map: map, title: poi.name, icon: '/uix/images/marker.png' }); //Bind click event to marker to open modal marker.addListener('click',function() { infowindow.open(map,marker); }); markers.push(marker); }); $('#properties_count').html(counter); if (counter>0) { $('.error-message').hide(); } else { $('.error-message').show(); } $.each(pois,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon //isInside = google.maps.geometry.poly.containsLocation(cord,poly); //if (isInside) { //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } itemHTML += '
'; itemHTML += '
'; itemHTML += '
'; itemHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; itemHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { itemHTML += ''+poi.meret_telek+' m2
'; } itemHTML += ''+szobak.toString()+' szoba
'; itemHTML += ''+poi.name+''; //itemHTML += ' Contact'; //itemHTML += ' Favorite'; itemHTML += '
'; itemHTML += '
'; //} }); itemHTML += '
'; $.get('/map/lazy/check/',function(resp) { itemHTML += resp; $('.result-list-thin').html(itemHTML); if ($(window).width()>500) { $('#content').css('height',$('.result-list-thin').height()+360); $('#map').css('height',$('.result-list-thin').height()+160); } else { $('#content').css('height',$('.result-list-thin').height()+145); $('#map').css('height',$('.result-list-thin').height()+160); } }); }); //Draw initialized map poly.setMap(map); } function initOfficeMap() { var map = new google.maps.Map(document.getElementById('map'),{ zoom: 7, disableDefaultUI: true, zoomControl: true, zoomControlOptions: { position: google.maps.ControlPosition.LEFT_TOP }, center: {lat: 47.200013, lng: 19.740236}, styles: [ { "featureType": "administrative", "elementType": "labels.text.fill", "stylers": [ { "color": "#444444" } ] }, { "featureType": "administrative.country", "elementType": "geometry", "stylers": [ { "visibility": "on" } ] }, { "featureType": "administrative.province", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative.province", "elementType": "labels.text", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative.locality", "elementType": "geometry", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative.locality", "elementType": "geometry.fill", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative.locality", "elementType": "geometry.stroke", "stylers": [ { "visibility": "off" } ] }, { "featureType": "administrative.locality", "elementType": "labels.text", "stylers": [ { "visibility": "on" } ] }, { "featureType": "landscape", "elementType": "all", "stylers": [ { "color": "#f2f2f2" } ] }, { "featureType": "poi", "elementType": "all", "stylers": [ { "visibility": "off" } ] }, { "featureType": "road", "elementType": "all", "stylers": [ { "saturation": -100 }, { "lightness": 45 } ] }, { "featureType": "road.highway", "elementType": "all", "stylers": [ { "visibility": "simplified" } ] }, { "featureType": "road.arterial", "elementType": "labels.icon", "stylers": [ { "visibility": "off" } ] }, { "featureType": "transit", "elementType": "all", "stylers": [ { "visibility": "off" } ] }, { "featureType": "water", "elementType": "all", "stylers": [ { "color": "#d1d7d9" }, { "visibility": "on" } ] } ] }); $.getJSON('/rockhome-irodak/getrawlist',function(resp) { var items = resp.list; items.forEach(function(row) { var popHTML = ''; popHTML+= '
'; popHTML+= '
'; popHTML+= '
'; popHTML+= '

'+row['nev']+'

'; popHTML+= ''+row['iranyitoszam']+'. '+row['varos']+', '+row['utca_hazszam']+''; popHTML+= ''+row['telefon']+''; popHTML+= ''+row['email']+''; popHTML+= '
'; popHTML+= '
'; var infowindow = new google.maps.InfoWindow({ content: popHTML }); cord = new google.maps.LatLng(row['latitude'],row['longitude']); var marker = new google.maps.Marker({ position: cord, map: map, title: row['nev'], icon: '/uix/images/marker.png' }); marker.addListener('click',function() { infowindow.open(map,marker); }); markers.push(marker); }); }); } //Google maps initialization function initMap(viewchage) { getDefaultPropertyList('first'); var geocoder = new google.maps.Geocoder(); //Init map div var map = new google.maps.Map(document.getElementById('map'),{ zoom: 8, disableDefaultUI: true, zoomControl: true, zoomControlOptions: { position: google.maps.ControlPosition.LEFT_TOP }, center: {lat: 46.897913, lng: 20.540236} }); /*geocoder.geocode({'address': "Paris"}, function(results, status) { if (status === 'OK') { map.setCenter(results[0].geometry.location); } });*/ var centerControlDiv = document.createElement('div'); var centerControl3 = new addMoveButton(centerControlDiv, map); var centerControl2 = new addDrawButton(centerControlDiv, map); var centerControl4 = new addCircleButton(centerControlDiv, map); var centerControl1 = new addClearButton(centerControlDiv, map); centerControlDiv.index = 1; map.controls[google.maps.ControlPosition.TOP_CENTER].push(centerControlDiv); var counter = 0; //Init drawing tools and polygon properties drawingManager = new google.maps.drawing.DrawingManager({ drawingMode: null, drawingControl: false, drawingControlOptions: { position: google.maps.ControlPosition.TOP_CENTER, drawingModes: ['polygon','circle'] }, polygonOptions: { fillColor: '#ff0000', fillOpacity: 0.5, strokeWeight: 2, clickable: false, editable: true, zIndex: 1 } }); //Add default result list $.getJSON('/map/search/reload/',function(resp) { if (resp.pois!=null) { pois = resp.pois; poisall = resp.poisall; $('#properties_count').html(poisall.length); if (pois.length>0) { $('.error-message').hide(); } else { $('.error-message').show(); } counter = 0; } //Roll all JSON data to check POIs $.each(poisall,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon //isInside = google.maps.geometry.poly.containsLocation(cord,activePoly); //if (isInside) { counter++; //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } popHTML = '
'; popHTML += '
'; popHTML += '
'; popHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; popHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { popHTML += ''+poi.meret_telek+' m2
'; } popHTML += ''+szobak.toString()+' szoba
'; popHTML += ''+poi.name+''; //popHTML += ' Contact'; //popHTML += ' Favorite'; popHTML += '
'; popHTML += '
'; var infowindow = new google.maps.InfoWindow({ content: popHTML }); //Add marker var marker = new google.maps.Marker({ position: cord, map: map, title: poi.name, icon: '/uix/images/marker.png' }); //Bind click event to marker to open modal marker.addListener('click',function() { infowindow.open(map,marker); }); markers.push(marker); //} }); $('#properties_count').html(counter); if (counter==0) { $('#properties_count').parent('h3').html('

Nincs találat : (

Jelenleg nincs a megadott keresési feltételeknek megfelelő ingatlan az adatbázisunkban. Kérjük adjon meg más keresési paramétereket!
'); } if (counter>0) { if (counter>0) { $('.error-message').hide(); } else { $('.error-message').show(); } $.each(pois,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon //isInside = google.maps.geometry.poly.containsLocation(cord,activePoly); //if (isInside) { //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } itemHTML += '
'; itemHTML += '
'; itemHTML += '
'; itemHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; itemHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { itemHTML += ''+poi.meret_telek+' m2
'; } itemHTML += ''+szobak.toString()+' szoba
'; itemHTML += ''+poi.name+''; //itemHTML += ' Contact'; //itemHTML += ' Favorite'; itemHTML += '
'; itemHTML += '
'; //} }); } itemHTML += '
'; $.get('/map/lazy/check/',function(resp) { if (counter>5) { itemHTML += resp; } $('.result-list-thin').html(itemHTML); if ($(window).width()>500) { $('#content').css('height',$('.result-list-thin').height()+360); $('#map').css('height',$('.result-list-thin').height()+160); } else { $('#content').css('height',$('.result-list-thin').height()+145); $('#map').css('height',$('.result-list-thin').height()+160); } }); }); //End on default result list //Add event listener for drawing complete signal google.maps.event.addListener(drawingManager,'polygoncomplete',function(poly) { activePoly = poly; allShapes.push(poly); for (var i = 0; i < markers.length; i++) { markers[i].setMap(null); } markers = []; google.maps.event.addListener(activePoly.getPath(),'insert_at',function() { //Get polygon path var points = activePoly.getPath(); var lats = []; var lngs = []; var cord = null; var isInside = false; //Get polygon points points.b.forEach(function(row,i) { lats.push(row.lat()); lngs.push(row.lng()); }); //Set max and min points to build rectangle var LATmin = Math.min.apply(Math,lats); var LATmax = Math.max.apply(Math,lats); var LNGmin = Math.min.apply(Math,lngs); var LNGmax = Math.max.apply(Math,lngs); var popHTML = ''; var szobak = 0; $.getJSON('/map/search/polygon/',{lat_min: LATmin, lat_max: LATmax, lon_min: LNGmin, lon_max: LNGmax},function(resp) { if (resp.code=='01') { pois = resp.pois; poisall = resp.poisall; $('#properties_count').html(poisall.length); counter = 0; } //Roll all JSON data to check POIs $.each(poisall,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon isInside = google.maps.geometry.poly.containsLocation(cord,activePoly); if (isInside) { counter++; //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } popHTML = '
'; popHTML += '
'; popHTML += '
'; popHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; popHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { popHTML += ''+poi.meret_telek+' m2
'; } popHTML += ''+szobak.toString()+' szoba
'; popHTML += ''+poi.name+''; //popHTML += ' Contact'; //popHTML += ' Favorite'; popHTML += '
'; popHTML += '
'; var infowindow = new google.maps.InfoWindow({ content: popHTML }); //Add marker var marker = new google.maps.Marker({ position: cord, map: map, title: poi.name, icon: '/uix/images/marker.png' }); //Bind click event to marker to open modal marker.addListener('click',function() { infowindow.open(map,marker); }); markers.push(marker); } }); $('#properties_count').html(counter); if (counter>0) { $('.error-message').hide(); } else { $('.error-message').show(); } $.each(pois,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon isInside = google.maps.geometry.poly.containsLocation(cord,activePoly); if (isInside) { //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } itemHTML += '
'; itemHTML += '
'; itemHTML += '
'; itemHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; itemHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { itemHTML += ''+poi.meret_telek+' m2
'; } itemHTML += ''+szobak.toString()+' szoba
'; itemHTML += ''+poi.name+''; //itemHTML += ' Contact'; //itemHTML += ' Favorite'; itemHTML += '
'; itemHTML += '
'; } }); itemHTML += '
'; $.get('/map/lazy/check/',function(resp) { itemHTML += resp; $('.result-list-thin').html(itemHTML); if ($(window).width()>500) { $('#content').css('height',$('.result-list-thin').height()+360); $('#map').css('height',$('.result-list-thin').height()+160); } else { $('#content').css('height',$('.result-list-thin').height()+145); $('#map').css('height',$('.result-list-thin').height()+160); } }); }); }); drawingManager.setDrawingMode(null); drawingManager.setOptions({ drawingControl: false }); //Get polygon path var points = poly.getPath(); var lats = []; var lngs = []; var cord = null; var isInside = false; //Get polygon points //console.log(points.j); points.j.forEach(function(row,i) { lats.push(row.lat()); lngs.push(row.lng()); }); $.post('/map/storepolygon/',{lats: lats, lngs: lngs},function() { console.log('Polygon stored'); storedLats = lats; storedLngs = lngs; }); //Set max and min points to build rectangle var LATmin = Math.min.apply(Math,lats); var LATmax = Math.max.apply(Math,lats); var LNGmin = Math.min.apply(Math,lngs); var LNGmax = Math.max.apply(Math,lngs); var itemHTML = ''; var popHTML = ''; var szobak = 0; $.getJSON('/map/search/polygon/',{lat_min: LATmin, lat_max: LATmax, lon_min: LNGmin, lon_max: LNGmax},function(resp) { if (resp.code=='01') { pois = resp.pois; poisall = resp.poisall; counter = 0; } //Roll all JSON data to check POIs $.each(poisall,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon isInside = google.maps.geometry.poly.containsLocation(cord,poly); if (isInside) { counter++; //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } popHTML = '
'; popHTML += '
'; popHTML += '
'; popHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; popHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { popHTML += ''+poi.meret_telek+' m2
'; } popHTML += ''+szobak.toString()+' szoba
'; popHTML += ''+poi.name+''; //popHTML += ' Contact'; //popHTML += ' Favorite'; popHTML += '
'; popHTML += '
'; var infowindow = new google.maps.InfoWindow({ content: popHTML }); //Add marker var marker = new google.maps.Marker({ position: cord, map: map, title: poi.name, icon: '/uix/images/marker.png' }); //Bind click event to marker to open modal marker.addListener('click',function() { infowindow.open(map,marker); }); markers.push(marker); } }); $('#properties_count').html(counter); if (counter>0) { $('.error-message').hide(); } else { $('.error-message').show(); } $.each(pois,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon isInside = google.maps.geometry.poly.containsLocation(cord,poly); if (isInside) { //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } itemHTML += '
'; itemHTML += '
'; itemHTML += '
'; itemHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; itemHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { itemHTML += ''+poi.meret_telek+' m2
'; } itemHTML += ''+szobak.toString()+' szoba
'; itemHTML += ''+poi.name+''; //itemHTML += ' Contact'; //itemHTML += ' Favorite'; itemHTML += '
'; itemHTML += '
'; } }); itemHTML += '
'; $.get('/map/lazy/check/',function(resp) { itemHTML += resp; $('.result-list-thin').html(itemHTML); if ($(window).width()>500) { $('#content').css('height',$('.result-list-thin').height()+360); $('#map').css('height',$('.result-list-thin').height()+160); } else { $('#content').css('height',$('.result-list-thin').height()+145); $('#map').css('height',$('.result-list-thin').height()+160); } }); }); }); //Add event listener for circle complete signal google.maps.event.addListener(drawingManager,'circlecomplete',function(circle) { disableLazyLoad = true; activeCircle = circle; allShapes.push(circle); //console.log(allShapes); for (var i = 0; i < markers.length; i++) { markers[i].setMap(null); } markers = []; drawingManager.setDrawingMode(null); drawingManager.setOptions({ drawingControl: false }); //Get radius path var cord = null; var isInside = false; var itemHTML = ''; var popHTML = ''; var szobak = 0; $.getJSON('/map/search/circle/',function(resp) { if (resp.code=='01') { pois = resp.pois; poisall = resp.poisall; counter = 0; } //Roll all JSON data to check POIs $.each(pois,function(key,poi) { isInside = false; //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the circle if (google.maps.geometry.spherical.computeDistanceBetween(cord,activeCircle.getCenter()) <= activeCircle.getRadius()) { isInside = true; } else { isInside = false; } if (isInside==true) { counter++; //console.log('OK for #'+counter); //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } popHTML = '
'; popHTML += '
'; popHTML += '
'; popHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; popHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { popHTML += ''+poi.meret_telek+' m2
'; } popHTML += ''+szobak.toString()+' szoba
'; popHTML += ''+poi.name+''; //popHTML += ' Contact'; //popHTML += ' Favorite'; popHTML += '
'; popHTML += '
'; //Add marker var marker = new google.maps.Marker({ position: cord, map: map, title: poi.name, icon: '/uix/images/marker.png' }); var infowindow = new google.maps.InfoWindow({ content: popHTML }); //Bind click event to marker to open modal marker.addListener('click',function() { infowindow.open(map,marker); }); markers.push(marker); } else { //console.log('BAD for #'+counter); } }); $('#properties_count').html(counter); if (counter>0) { $('.error-message').hide(); } else { $('.error-message').show(); } $.each(pois,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the circle if (google.maps.geometry.spherical.computeDistanceBetween(cord,activeCircle.getCenter()) <= activeCircle.getRadius()) { isInside = true; } else { isInside = false; } if (isInside) { //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } itemHTML += '
'; itemHTML += '
'; itemHTML += '
'; itemHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; itemHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { itemHTML += ''+poi.meret_telek+' m2
'; } itemHTML += ''+szobak.toString()+' szoba
'; itemHTML += ''+poi.name+''; //itemHTML += ' Contact'; //itemHTML += ' Favorite'; itemHTML += '
'; itemHTML += '
'; } }); itemHTML += '
'; //alert('ok'); //$.get('/map/lazy/check/',function(resp) { //itemHTML += resp; $('.result-list-thin').html(itemHTML); if ($(window).width()>500) { $('#content').css('height',$('.result-list-thin').height()+360); $('#map').css('height',$('.result-list-thin').height()+160); } else { $('#content').css('height',$('.result-list-thin').height()+145); $('#map').css('height',$('.result-list-thin').height()+160); } //}); //} }); }); //Draw initialized map drawingManager.setMap(map); } //Google maps initialization function initMap2(viewchage) { getDefaultPropertyList('first'); var geocoder = new google.maps.Geocoder(); //Init map div var map = new google.maps.Map(document.getElementById('map'),{ zoom: 8, disableDefaultUI: true, zoomControl: true, zoomControlOptions: { position: google.maps.ControlPosition.LEFT_TOP }, center: {lat: 46.897913, lng: 20.540236} }); /*geocoder.geocode({'address': "Paris"}, function(results, status) { if (status === 'OK') { map.setCenter(results[0].geometry.location); } });*/ var centerControlDiv = document.createElement('div'); var centerControl3 = new addMoveButton(centerControlDiv, map); var centerControl2 = new addDrawButton(centerControlDiv, map); var centerControl4 = new addCircleButton(centerControlDiv, map); var centerControl1 = new addClearButton(centerControlDiv, map); centerControlDiv.index = 1; map.controls[google.maps.ControlPosition.TOP_CENTER].push(centerControlDiv); var counter = 0; //Init drawing tools and polygon properties drawingManager = new google.maps.drawing.DrawingManager({ drawingMode: null, drawingControl: false, drawingControlOptions: { position: google.maps.ControlPosition.TOP_CENTER, drawingModes: ['polygon','circle'] }, polygonOptions: { fillColor: '#ff0000', fillOpacity: 0.5, strokeWeight: 2, clickable: false, editable: true, zIndex: 1 } }); //Add default result list $.getJSON('/map/search/reload/',function(resp) { if (resp.pois!=null) { pois = resp.pois; poisall = resp.poisall; $('#properties_count').html(poisall.length); if (pois.length>0) { $('.error-message').hide(); } else { $('.error-message').show(); } counter = 0; } //Roll all JSON data to check POIs $.each(poisall,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon //isInside = google.maps.geometry.poly.containsLocation(cord,activePoly); //if (isInside) { counter++; //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } popHTML = '
'; popHTML += '
'; popHTML += '
'; popHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; popHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { popHTML += ''+poi.meret_telek+' m2
'; } popHTML += ''+szobak.toString()+' szoba
'; popHTML += ''+poi.name+''; //popHTML += ' Contact'; //popHTML += ' Favorite'; popHTML += '
'; popHTML += '
'; var infowindow = new google.maps.InfoWindow({ content: popHTML }); //Add marker var marker = new google.maps.Marker({ position: cord, map: map, title: poi.name, icon: '/uix/images/marker.png' }); //Bind click event to marker to open modal marker.addListener('click',function() { infowindow.open(map,marker); }); markers.push(marker); //} }); $('#properties_count').html(counter); if (counter==0) { $('#properties_count').parent('h3').html('

Nincs találat : (

Jelenleg nincs a megadott keresési feltételeknek megfelelő ingatlan az adatbázisunkban. Kérjük adjon meg más keresési paramétereket!
'); } if (counter>0) { if (counter>0) { $('.error-message').hide(); } else { $('.error-message').show(); } $.each(pois,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon //isInside = google.maps.geometry.poly.containsLocation(cord,activePoly); //if (isInside) { //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } itemHTML += '
'; itemHTML += '
'; itemHTML += '
'; itemHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; itemHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { itemHTML += ''+poi.meret_telek+' m2
'; } itemHTML += ''+szobak.toString()+' szoba
'; itemHTML += ''+poi.name+''; //itemHTML += ' Contact'; //itemHTML += ' Favorite'; itemHTML += '
'; itemHTML += '
'; //} }); } itemHTML += '
'; $.get('/map/lazy/check/',function(resp) { if (counter>5) { itemHTML += resp; } $('.result-list-thin').html(itemHTML); if ($(window).width()>500) { $('#content').css('height',$('.result-list-thin').height()+360); $('#map').css('height',$('.result-list-thin').height()+160); } else { $('#content').css('height',$('.result-list-thin').height()+145); $('#map').css('height',$('.result-list-thin').height()+160); } }); }); //End on default result list //Add event listener for drawing complete signal google.maps.event.addListener(drawingManager,'polygoncomplete',function(poly) { activePoly = poly; allShapes.push(poly); for (var i = 0; i < markers.length; i++) { markers[i].setMap(null); } markers = []; google.maps.event.addListener(activePoly.getPath(),'insert_at',function() { //Get polygon path var points = activePoly.getPath(); var lats = []; var lngs = []; var cord = null; var isInside = false; //Get polygon points points.b.forEach(function(row,i) { lats.push(row.lat()); lngs.push(row.lng()); }); //Set max and min points to build rectangle var LATmin = Math.min.apply(Math,lats); var LATmax = Math.max.apply(Math,lats); var LNGmin = Math.min.apply(Math,lngs); var LNGmax = Math.max.apply(Math,lngs); var popHTML = ''; var szobak = 0; $.getJSON('/map/search/polygon/',{lat_min: LATmin, lat_max: LATmax, lon_min: LNGmin, lon_max: LNGmax},function(resp) { if (resp.code=='01') { pois = resp.pois; poisall = resp.poisall; $('#properties_count').html(poisall.length); counter = 0; } //Roll all JSON data to check POIs $.each(poisall,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon isInside = google.maps.geometry.poly.containsLocation(cord,activePoly); if (isInside) { counter++; //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } popHTML = '
'; popHTML += '
'; popHTML += '
'; popHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; popHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { popHTML += ''+poi.meret_telek+' m2
'; } popHTML += ''+szobak.toString()+' szoba
'; popHTML += ''+poi.name+''; //popHTML += ' Contact'; //popHTML += ' Favorite'; popHTML += '
'; popHTML += '
'; var infowindow = new google.maps.InfoWindow({ content: popHTML }); //Add marker var marker = new google.maps.Marker({ position: cord, map: map, title: poi.name, icon: '/uix/images/marker.png' }); //Bind click event to marker to open modal marker.addListener('click',function() { infowindow.open(map,marker); }); markers.push(marker); } }); $('#properties_count').html(counter); if (counter>0) { $('.error-message').hide(); } else { $('.error-message').show(); } $.each(pois,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon isInside = google.maps.geometry.poly.containsLocation(cord,activePoly); if (isInside) { //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } itemHTML += '
'; itemHTML += '
'; itemHTML += '
'; itemHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; itemHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { itemHTML += ''+poi.meret_telek+' m2
'; } itemHTML += ''+szobak.toString()+' szoba
'; itemHTML += ''+poi.name+''; //itemHTML += ' Contact'; //itemHTML += ' Favorite'; itemHTML += '
'; itemHTML += '
'; } }); itemHTML += '
'; $.get('/map/lazy/check/',function(resp) { itemHTML += resp; $('.result-list-thin').html(itemHTML); if ($(window).width()>500) { $('#content').css('height',$('.result-list-thin').height()+360); $('#map').css('height',$('.result-list-thin').height()+160); } else { $('#content').css('height',$('.result-list-thin').height()+145); $('#map').css('height',$('.result-list-thin').height()+160); } }); }); }); drawingManager.setDrawingMode(null); drawingManager.setOptions({ drawingControl: false }); //Get polygon path var points = poly.getPath(); var lats = []; var lngs = []; var cord = null; var isInside = false; //Get polygon points //console.log(points.j); points.j.forEach(function(row,i) { lats.push(row.lat()); lngs.push(row.lng()); }); $.post('/map/storepolygon/',{lats: lats, lngs: lngs},function() { console.log('Polygon stored'); storedLats = lats; storedLngs = lngs; }); //Set max and min points to build rectangle var LATmin = Math.min.apply(Math,lats); var LATmax = Math.max.apply(Math,lats); var LNGmin = Math.min.apply(Math,lngs); var LNGmax = Math.max.apply(Math,lngs); var itemHTML = ''; var popHTML = ''; var szobak = 0; $.getJSON('/map/search/polygon/',{lat_min: LATmin, lat_max: LATmax, lon_min: LNGmin, lon_max: LNGmax},function(resp) { if (resp.code=='01') { pois = resp.pois; poisall = resp.poisall; counter = 0; } //Roll all JSON data to check POIs $.each(poisall,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon isInside = google.maps.geometry.poly.containsLocation(cord,poly); if (isInside) { counter++; //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } popHTML = '
'; popHTML += '
'; popHTML += '
'; popHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; popHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { popHTML += ''+poi.meret_telek+' m2
'; } popHTML += ''+szobak.toString()+' szoba
'; popHTML += ''+poi.name+''; //popHTML += ' Contact'; //popHTML += ' Favorite'; popHTML += '
'; popHTML += '
'; var infowindow = new google.maps.InfoWindow({ content: popHTML }); //Add marker var marker = new google.maps.Marker({ position: cord, map: map, title: poi.name, icon: '/uix/images/marker.png' }); //Bind click event to marker to open modal marker.addListener('click',function() { infowindow.open(map,marker); }); markers.push(marker); } }); $('#properties_count').html(counter); if (counter>0) { $('.error-message').hide(); } else { $('.error-message').show(); } $.each(pois,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the polygon isInside = google.maps.geometry.poly.containsLocation(cord,poly); if (isInside) { //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } itemHTML += '
'; itemHTML += '
'; itemHTML += '
'; itemHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; itemHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { itemHTML += ''+poi.meret_telek+' m2
'; } itemHTML += ''+szobak.toString()+' szoba
'; itemHTML += ''+poi.name+''; //itemHTML += ' Contact'; //itemHTML += ' Favorite'; itemHTML += '
'; itemHTML += '
'; } }); itemHTML += '
'; $.get('/map/lazy/check/',function(resp) { itemHTML += resp; $('.result-list-thin').html(itemHTML); if ($(window).width()>500) { $('#content').css('height',$('.result-list-thin').height()+360); $('#map').css('height',$('.result-list-thin').height()+160); } else { $('#content').css('height',$('.result-list-thin').height()+145); $('#map').css('height',$('.result-list-thin').height()+160); } }); }); }); //Add event listener for circle complete signal google.maps.event.addListener(drawingManager,'circlecomplete',function(circle) { disableLazyLoad = true; activeCircle = circle; allShapes.push(circle); //console.log(allShapes); for (var i = 0; i < markers.length; i++) { markers[i].setMap(null); } markers = []; drawingManager.setDrawingMode(null); drawingManager.setOptions({ drawingControl: false }); //Get radius path var cord = null; var isInside = false; var itemHTML = ''; var popHTML = ''; var szobak = 0; $.getJSON('/map/search/circle/',function(resp) { if (resp.code=='01') { pois = resp.pois; poisall = resp.poisall; counter = 0; } //Roll all JSON data to check POIs $.each(pois,function(key,poi) { isInside = false; //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the circle if (google.maps.geometry.spherical.computeDistanceBetween(cord,activeCircle.getCenter()) <= activeCircle.getRadius()) { isInside = true; } else { isInside = false; } if (isInside==true) { counter++; //console.log('OK for #'+counter); //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } popHTML = '
'; popHTML += '
'; popHTML += '
'; popHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; popHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { popHTML += ''+poi.meret_telek+' m2
'; } popHTML += ''+szobak.toString()+' szoba
'; popHTML += ''+poi.name+''; //popHTML += ' Contact'; //popHTML += ' Favorite'; popHTML += '
'; popHTML += '
'; //Add marker var marker = new google.maps.Marker({ position: cord, map: map, title: poi.name, icon: '/uix/images/marker.png' }); var infowindow = new google.maps.InfoWindow({ content: popHTML }); //Bind click event to marker to open modal marker.addListener('click',function() { infowindow.open(map,marker); }); markers.push(marker); } else { //console.log('BAD for #'+counter); } }); $('#properties_count').html(counter); if (counter>0) { $('.error-message').hide(); } else { $('.error-message').show(); } $.each(pois,function(key,poi) { //Create google maps coordinate cord = new google.maps.LatLng(poi.lat,poi.lng); //Check inside the circle if (google.maps.geometry.spherical.computeDistanceBetween(cord,activeCircle.getCenter()) <= activeCircle.getRadius()) { isInside = true; } else { isInside = false; } if (isInside) { //Add info popup szobak = parseInt(poi.szoba_egesz)+parseInt(poi.szoba_fel); if (poi.tipus=='tarsashazi') { var mytipus = 'lakas'; } else { var mytipus = poi.tipus; } itemHTML += '
'; itemHTML += '
'; itemHTML += '
'; itemHTML += '
'+numberWithCommas(poi.iranyar)+' FT
'; itemHTML += ''+poi.meret_brutto+' m2
'; if (poi.meret_telek!=='0') { itemHTML += ''+poi.meret_telek+' m2
'; } itemHTML += ''+szobak.toString()+' szoba
'; itemHTML += ''+poi.name+''; //itemHTML += ' Contact'; //itemHTML += ' Favorite'; itemHTML += '
'; itemHTML += '
'; } }); itemHTML += '
'; //alert('ok'); //$.get('/map/lazy/check/',function(resp) { //itemHTML += resp; $('.result-list-thin').html(itemHTML); if ($(window).width()>500) { $('#content').css('height',$('.result-list-thin').height()+360); $('#map').css('height',$('.result-list-thin').height()+160); } else { $('#content').css('height',$('.result-list-thin').height()+145); $('#map').css('height',$('.result-list-thin').height()+160); } //}); //} }); }); //Draw initialized map drawingManager.setMap(map); } function slider(obj) { var image_list = $(obj).attr('data-images'); var images = image_list.split(','); var text_list = $(obj).attr('data-texts'); var texts = text_list.split('|'); var index = 0; if (images[index]!=='' && texts[index]!=='') { $(obj).animate({opacity: 0}, 0).css("background-image", "url("+images[index]+")").animate({opacity: 1}, 1000); $(obj).children('h1').html(texts[index]); index++; } if (images.length>2) { var sliderTimer = setInterval(function() { if (images[index]!=='' && texts[index]!=='') { $(obj).animate({opacity: 0}, 0).css("background-image", "url("+images[index]+")").animate({opacity: 1}, 1000); $(obj).children('h1').html(texts[index]); index++; } else { index = 0; $(obj).animate({opacity: 0}, 0).css("background-image", "url("+images[index]+")").animate({opacity: 1}, 1000); $(obj).children('h1').html(texts[index]); index++; } },8000); } } function news(obj) { var image_list = $(obj).attr('data-images'); var images = image_list.split(','); var text_list = $(obj).attr('data-texts'); var texts = text_list.split('|'); var sub_list = $(obj).attr('data-subtexts'); var subs = sub_list.split('|'); var btntext_list = $(obj).attr('data-buttontexts'); var btntext = btntext_list.split('|'); var btnurl_list = $(obj).attr('data-buttonurls'); var btnurl = btnurl_list.split('|'); var index = 0; if (images[index]!=='' && texts[index]!=='') { $(obj).animate({opacity: 0}, 0).css("background-image", "url("+images[index]+")").animate({opacity: 1}, 1000); $(obj).children('article').children('h3').html(texts[index]); $(obj).children('article').children('.lead').html(subs[index]); $(obj).children('article').children('.details').children('button').html(btntext[index]); $(obj).children('article').children('.details').children('button').attr('onclick','window.location=\''+btnurl[index]+'\''); index++; } if (images.length>2) { var sliderTimer2 = setInterval(function() { if (images[index]!=='' && texts[index]!=='') { $(obj).animate({opacity: 0}, 0).css("background-image", "url("+images[index]+")").animate({opacity: 1}, 1000); $(obj).children('article').children('h3').html(texts[index]); $(obj).children('article').children('.lead').html(subs[index]); $(obj).children('article').children('.details').children('button').html(btntext[index]); $(obj).children('article').children('.details').children('button').attr('onclick','window.location=\''+btnurl[index]+'\''); index++; } else { index = 0; $(obj).animate({opacity: 0}, 0).css("background-image", "url("+images[index]+")").animate({opacity: 1}, 1000); $(obj).children('article').children('h3').html(texts[index]); $(obj).children('article').children('.lead').html(subs[index]); $(obj).children('article').children('.details').children('button').html(btntext[index]); $(obj).children('article').children('.details').children('button').attr('onclick','window.location=\''+btnurl[index]+'\''); index++; } },8000); } } function ajax_page_load(obj) { window.location=$(obj).attr('data-href'); return true; } function check_email(obj) { $.post('/auth/check/email',{address: $(obj).val()},function(resp) { if (resp==='ok') { $('.error-email').hide(); $(obj).removeClass('error'); } else { $('.error-email').show(); $(obj).addClass('error'); } }); } function save_pass() { var isError = false; if ($('#new_pass').val()!='' && $('#new_pass2').val()!='' && $('#new_pass').val()==$('#new_pass2').val()) { isError = false; $.post('/profile/settings/newpass',{pass: $('#new_pass').val()},function(resp) { $('.error-pass').hide(); $('.success-settings').show(); }); } else if (($('#new_pass').val()!='' || $('#new_pass2').val()!='') && $('#new_pass').val()!=$('#new_pass2').val()) { isError = true; $('.success-settings').hide(); $('.error-pass').show(); } } function save_settings() { var subs = 'n'; var isError = false; if ($('#subscribe').is(':checked')) subs = 'y'; if ($('#new_pass').val()!='' && $('#new_pass2').val()!='' && $('#new_pass').val()==$('#new_pass2').val()) { isError = false; $.post('/profile/settings/newpass',{pass: $('#new_pass').val()},function(resp) { $('.error-pass').hide(); }); } else if (($('#new_pass').val()!='' || $('#new_pass2').val()!='') && $('#new_pass').val()!=$('#new_pass2').val()) { isError = true; $('.error-pass').show(); } if (validateEmail($('#email').val())===false) { isError = true; } if (isError===false) { //console.log(subs); $.post('/profile/settings/save',{ fname: $('#firstname').val(), lname: $('#lastname').val(), username: $('#username').val(), email: $('#email').val(), //street: $('#street').val(), //city: $('#city').val(), //state: $('#state').val(), //zip: $('#zip').val(), //country: $('#country').val(), subscribe: subs },function(resp) { window.scrollTo(0,0); $('.success-settings').show(); }); } else { $('#email').addClass('error'); window.location.hash='jumper'; } } function login(e) { e.preventDefault(); var username = $('#email1').val(); var pass = $('#pass1').val(); var keepmeloggedin = 'n'; if ($('#keepmeloggedin').is(':checked')) keepmeloggedin = 'y'; $.post('/auth/login/',{username: username, pass: pass, keepmeloggedin: keepmeloggedin},function(resp) { if (resp==='Sikeres bejelentkezés') { $('.error-login').hide(); $('.success-bar').html(' Sikeres bejelentkezés...'); $('.success-bar').toggle(); var shtimer = setInterval(function() { $('.success-bar').toggle(); clearInterval(shtimer); var loc = window.location.href; if (loc.indexOf('authed')>-1) { window.location='/'; } else { window.location.reload(); } },2000); return false; } else { $('.error-login').show(); return false; } }); } function send_reminder() { var email = $('#regemail').val(); if (email!=='') { $.post('/auth/reminder/send',{email: email},function(resp) { if (resp==='error') { $('.error-reminder').show(); } else { $('.error-reminder').hide(); $('.success-message').show(); $('.popup-content').html('A megadott email címre elküldtük a jelszóemlékeztetőt.'); } }); } else { $('.error-reminder').show(); var ct = setInterval(function() { $('.error-reminder').fadeOut(); clearInterval(ct); },3000); } } function validateEmail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); } function register() { var fname = $('#first_name').val(); var lname = $('#last_name').val(); var email = $('#regemail').val(); //var gender = $('#gender').val(); var pass1 = $('#pass1').val(); var pass2 = $('#pass2').val(); var accepted = 0; var newsletter = 0; if ($('#accepted').is(':checked')) { accepted = 1; } if ($('#newsletter').is(':checked')) { newsletter = 1; } //var rememberme = $('#rememberme').is(':checked'); if (pass1!=='' && pass2!=='' && pass1==pass2 && fname!='' && lname!=='' && validateEmail(email) && accepted==1) { $.post('/auth/register/',{ pass: pass1, fname: fname, lname: lname, email: email, newsletter: newsletter, accepted: accepted },function(resp) { if (resp=='error') { $('.error-message').show(); $('.error-message').html('A megadott email cím már szerepel rendszerünkben!'); var ct = setInterval(function() { $('.error-message').fadeOut(); clearInterval(ct); },3000); } else { $('.popup-content').html(resp); $('.form-group-gray').html('A belépéshez kérjük kattints az email címedre elküldött jóváhagyó linkre!'); } }); } else { $('.error-message').show(); $('.error-message').html('Kérjük ellenőrizd a megadott mezőket: '); if (pass1==='' || pass2==='' || pass1!==pass2) { $('#pass1').addClass('error'); $('#pass2').addClass('error'); $('.error-message').append('
- A megadott jelszavak egyezőségét!'); } else { $('#pass1').removeClass('error'); $('#pass2').removeClass('error'); } if (accepted==0) { $('#accepted').parent('div').children('label').css('color','#ff0000'); $('.error-message').append('
- El kell fogadnod az adatkezelési szabályokat!'); } else { $('#accepted').parent('div').children('label').css('color','#555555'); } if (fname==='') { $('#first_name').addClass('error'); $('.error-message').append('
- A vezetékneved!'); } else { $('#first_name').removeClass('error'); } if (lname==='') { $('#last_name').addClass('error'); $('.error-message').append('
- A keresztneved!'); } else { $('#last_name').removeClass('error'); } if (!validateEmail(email)) { $('#regemail').addClass('error'); $('.error-message').append('
- Az email címed!'); } else { $('#regemail').removeClass('error'); } var ct = setInterval(function() { $('.error-message').fadeOut(); clearInterval(ct); },3000); } } function send_property_contact() { var url = $('#contactFRM').attr('action'); var ctype = $('input[name=contact_type]:checked').val(); var fname = $('#firstname').val(); var lname = $('#lastname').val(); var email = $('#email').val(); var phone = $('#phone').val(); var message = $('#message').val(); if (url!=='' && ctype!=='' && fname!=='' && lname!=='' && phone!=='') { $.post(url,{ fname: fname, lname: lname, email: email, phone: phone, ctype: ctype, message: message },function(resp) { $('.success-message').html('Üzenetedet továbbítottuk. Köszönjük megkeresésed!'); $('.success-message').show(); }); } else { $('.error-message').html('Hiányos mezők: '); if (ctype=='') { $('input[name=contact_type]').addClass('error'); $('.error-message').append('kapcsolat típus, '); } else { $('input[name=contact_type]').removeClass('error'); } if (fname=='') { $('#firstname').addClass('error'); $('.error-message').append('vezetéknév, '); } else { $('#firstname').removeClass('error'); } if (lname=='') { $('#lastname').addClass('error'); $('.error-message').append('keresztnév, '); } else { $('#lastname').removeClass('error'); } if (phone=='') { $('#phone').addClass('error'); $('.error-message').append('telefonszám, '); } else { $('#phone').removeClass('error'); } $('.error-message').show(); var ct = setInterval(function() { $('.error-message').fadeOut(); clearInterval(ct); },3000); } } function send_agent_message() { var url = $('#contactFRM').attr('action'); var ctype = $('input[name=contact_type]:checked').val(); var fname = $('#firstname').val(); var lname = $('#lastname').val(); var email = $('#email').val(); var phone = $('#phone').val(); var message = $('#message').val(); if (url!='' && ctype!='' && fname!='' && lname!='' && phone!='') { $.post(url,{ fname: fname, lname: lname, email: email, phone: phone, ctype: ctype, message: message },function(resp) { //$('.popup-content').html(resp); //$('.form-group-gray').html('Üzenetét továbbítottuk. Köszönjük megkeresését!'); $('.success-message').html('Üzenetedet továbbítottuk. Köszönjük megkeresésed!'); $('.success-message').show(); $('#firstname').val(''); $('#lastname').val(''); $('#email').val(''); $('#phone').val(''); $('#message').val(''); }); } else { $('.error-message').html('Hiányos mezők: '); if (ctype=='') { $('input[name=contact_type]').addClass('error'); $('.error-message').append('kapcsolat típus, '); } else { $('input[name=contact_type]').removeClass('error'); } if (fname=='') { $('#firstname').addClass('error'); $('.error-message').append('vezetéknév, '); } else { $('#firstname').removeClass('error'); } if (lname=='') { $('#lastname').addClass('error'); $('.error-message').append('keresztnév, '); } else { $('#lastname').removeClass('error'); } if (phone=='') { $('#phone').addClass('error'); $('.error-message').append('telefonszám, '); } else { $('#phone').removeClass('error'); } $('.error-message').show(); var ct = setInterval(function() { $('.error-message').fadeOut(); clearInterval(ct); },3000); } } function send_office_contact() { var url = $('#contactFRM').attr('action'); var ctype = $('input[name=contact_type]:checked').val(); var fname = $('#firstname').val(); var lname = $('#lastname').val(); var email = $('#email').val(); var phone = $('#phone').val(); var message = $('#message').val(); if (url!=='' && ctype!=='' && fname!=='' && lname!=='' && phone!=='') { $.post(url,{ fname: fname, lname: lname, email: email, phone: phone, ctype: ctype, message: message },function(resp) { $('.success-message').html('Üzenetedet továbbítottuk. Köszönjük megkeresésed!'); $('.success-message').show(); $('#firstname').val(''); $('#lastname').val(''); $('#email').val(''); $('#phone').val(''); $('#message').val(''); }); } else { $('.error-message').html('Hiányos mezők: '); if (ctype=='') { $('input[name=contact_type]').addClass('error'); $('.error-message').append('kapcsolat típus, '); } else { $('input[name=contact_type]').removeClass('error'); } if (fname=='') { $('#firstname').addClass('error'); $('.error-message').append('vezetéknév, '); } else { $('#firstname').removeClass('error'); } if (lname=='') { $('#lastname').addClass('error'); $('.error-message').append('keresztnév, '); } else { $('#lastname').removeClass('error'); } if (phone=='') { $('#phone').addClass('error'); $('.error-message').append('telefonszám, '); } else { $('#phone').removeClass('error'); } $('.error-message').show(); var ct = setInterval(function() { $('.error-message').fadeOut(); clearInterval(ct); },3000); } } function add_agent_to_favorite(agent_id,obj) { $.post('/profile/favorites/addagent',{agent_id: agent_id},function(resp) { if (resp==='ok') { $('.success-bar').html(' A tanácsadót sikeresen felvetted a kedvenceid közé...'); $('.success-bar').toggle(); $(obj).css('color','red'); $(obj).css('cursor','initial'); $(obj).html(' Hozzáadva'); var shtimer = setInterval(function() { $('.success-bar').toggle(); clearInterval(shtimer); },3000); } else if (resp==='login') { login_modal(); $('.error-bar').html(' A kedvencekhez csak belépett felhasználóként tudsz felvenni elemeket...'); $('.error-bar').toggle(); var shtimer = setInterval(function() { $('.error-bar').toggle(); clearInterval(shtimer); },3000); } else { $('.error-bar').html(' A tanácsadó már szerepel a kedvenceid között...'); $('.error-bar').toggle(); var shtimer = setInterval(function() { $('.error-bar').toggle(); clearInterval(shtimer); },3000); } }); } function add_office_to_favorite(office_id) { $.post('/profile/favorites/addoffice',{office_id: office_id},function(resp) { if (resp==='ok') { $('.success-bar').html(' Az irodát sikeresen felvetted a kedvenceid közé...'); $('.success-bar').toggle(); $('#addtofavorites').html(' Hozzáadva'); $('#addtofavorites').css('color','#ff0000'); $('#addtofavorites').css('cursor','initial'); var shtimer = setInterval(function() { $('.success-bar').toggle(); clearInterval(shtimer); },3000); } else if (resp==='login') { login_modal(); $('.error-bar').html(' A kedvencekhez csak belépett felhasználóként tudsz felvenni elemeket...'); $('.error-bar').toggle(); var shtimer = setInterval(function() { $('.error-bar').toggle(); clearInterval(shtimer); },3000); } else { $('.error-bar').html(' Az iroda már szerepel a kedvenceid között...'); $('.error-bar').toggle(); var shtimer = setInterval(function() { $('.error-bar').toggle(); clearInterval(shtimer); },3000); } }); } function add_property_to_favorite(property_id) { $.post('/profile/favorites/add',{property_id: property_id},function(resp) { if (resp==='ok') { $('.success-bar').html(' Az ingatlant sikeresen felvetted a kedvenceid közé...'); $('.success-bar').toggle(); $('#addtofavorites').html(' Hozzáadva'); $('#addtofavorites').css('color','#ff0000'); $('#addtofavorites').css('cursor','initial'); var shtimer = setInterval(function() { $('.success-bar').toggle(); clearInterval(shtimer); },3000); } else if (resp==='login') { login_modal(); $('.error-bar').html(' A kedvencekhez csak belépett felhasználóként tudsz felvenni elemeket...'); $('.error-bar').toggle(); var shtimer = setInterval(function() { $('.error-bar').toggle(); clearInterval(shtimer); },3000); } else { $('.error-bar').html(' Az ingatlan már szerepel a kedvenceid között...'); $('.error-bar').toggle(); var shtimer = setInterval(function() { $('.error-bar').toggle(); clearInterval(shtimer); },3000); } }); } function propertySlideURL(filename) { return 'https://prod.rockhome.hu'+filename; /*if (filename!=='' && typeof filename !== 'undefined') { var maindir = filename.substring(1,4); var subdir = filename.substring(1,6); var url = 'https://prod.rockhome.hu/pictures/ingatlan/'+maindir+'/'+subdir+'/'+filename; return url; } else { return false; }*/ } function propertySlideshow() { var indexImage = $('.slider-picture').attr('data-src'); if (indexImage!=='' && indexImage!==null && typeof indexImage!=='undefined') { var imageURL = propertySlideURL(indexImage); var img = ''; $('.slider-picture').css('background-image','url('+imageURL+')'); $('.image-thumbs').children('img').each(function() { img = propertySlideURL($(this).attr('src')); $(this).attr('src',img); $(this).on('click',function() { $('.slider-picture').css('background-image','url('+$(this).attr('src')+')'); $('.slider-picture').parent('a').attr('href',$(this).attr('src')); $('.image-thumb').removeClass('active-thumb'); $(this).addClass('active-thumb'); active = $(this); }); }); } else { return false; } } function search_small(origin) { var city = $('#city').val(); var name = $('#name').val(); var requestURL = origin; var parameterURL = '?'; if (city!='' && city!='undefined') parameterURL += 'city='+city+'&'; if (name!='' && name!='undefined') parameterURL += 'name='+name+'&'; if (origin.indexOf('/rockhome-irodak/properties')>-1) { $.get(requestURL+parameterURL+'from='+origin,function(resp) { $('.result-list').html(resp); }); } else if (origin.indexOf('/rockhome-tanacsadok/iroda')>-1) { window.location = requestURL+parameterURL+'from='+origin; /*$.get(requestURL+parameterURL+'from='+origin,function(resp) { $('.result-list').html(resp); });*/ } else { window.location = requestURL+parameterURL+'from='+origin; } } function search(origin) { var ertekesites = $('#ertekesites').val(); var jelleg = $('#jelleg').val(); var city = $('#city').val(); var iranyar_min = $('#iranyar_min').val(); var iranyar_max = $('#iranyar_max').val(); var meret_netto_min = $('#meret_netto_min').val(); var meret_netto_max = $('#meret_netto_max').val(); var altipus = $('#altipus').val(); var jogi_statusz = $('#jogi_statusz').val(); var szoba_min = $('#szoba_min').val(); var szoba_max = $('#szoba_max').val(); var kilatas = $('#kilatas').val(); var futes = $('#futes').val(); var ovezet = $('#ovezet').val(); var tajolas = $('#tajolas').val(); var allapot = $('#allapot').val(); var kornyek = $('#kornyek').val(); var telek_min = $('#telek_min').val(); var telek_max = $('#telek_max').val(); var epites_eve_min = $('#epites_eve_min').val(); var epites_eve_max = $('#epites_eve_max').val(); var ferohely_garazs_min = $('#ferohely_garazs_min').val(); var ferohely_garazs_max = $('#ferohely_garazs_max').val(); var name = $('#name').val(); var kulon_nyilo_szobak = 0; if ($('#kulon_nyilo_szobak').is(':checked')) kulon_nyilo_szobak=1; var terasz = 0; if ($('#terasz').is(':checked')) terasz=1; var erkely = 0; if ($('#erkely').is(':checked')) erkely=1; var pince = 0; if ($('#pince').is(':checked')) pince=1; var tarolo = 0; if ($('#tarolo').is(':checked')) tarolo=1; var garazs = 0; if ($('#garazs').is(':checked')) garazs=1; var ferohely_fedettbeallo = 0; if ($('#ferohely_fedettbeallo').is(':checked')) ferohely_fedettbeallo=1; var kertkapcsolatos = 0; if ($('#kertkapcsolatos').is(':checked')) kertkapcsolatos=1; var viz = 0; if ($('#viz').is(':checked')) viz=1; var gaz = 0; if ($('#gaz').is(':checked')) gaz=1; var villany = 0; if ($('#villany').is(':checked')) villany=1; var csatorna = 0; if ($('#csatorna').is(':checked')) csatorna=1; var lift = 0; if ($('#lift').is(':checked')) lift=1; var requestURL = origin; var parameterURL = '?'; if (ertekesites!='' && ertekesites!='undefined') parameterURL += 'ertekesites='+ertekesites+'&'; if (jelleg!='' && jelleg!='undefined') parameterURL += 'jelleg='+jelleg+'&'; if (city!='' && city!='undefined') parameterURL += 'city='+city+'&'; if (iranyar_min!='' && iranyar_min!='undefined') parameterURL += 'iranyar_min='+iranyar_min+'&'; if (iranyar_max!='' && iranyar_max!='undefined') parameterURL += 'iranyar_max='+iranyar_max+'&'; if (meret_netto_min!='' && meret_netto_min!='undefined') parameterURL += 'meret_netto_min='+meret_netto_min+'&'; if (meret_netto_max!='' && meret_netto_max!='undefined') parameterURL += 'meret_netto_max='+meret_netto_max+'&'; if (altipus!='' && altipus!='undefined') parameterURL += 'altipus='+altipus+'&'; if (jogi_statusz!='' && jogi_statusz!='undefined') parameterURL += 'jogi_statusz='+jogi_statusz+'&'; if (szoba_min!='' && szoba_min!='undefined') parameterURL += 'szoba_min='+szoba_min+'&'; if (szoba_max!='' && szoba_max!='undefined') parameterURL += 'szoba_max='+szoba_max+'&'; if (kilatas!='' && kilatas!='undefined') parameterURL += 'kilatas='+kilatas+'&'; if (futes!='' && futes!='undefined') parameterURL += 'futes='+futes+'&'; if (ovezet!='' && ovezet!='undefined') parameterURL += 'ovezet='+ovezet+'&'; if (tajolas!='' && tajolas!='undefined') parameterURL += 'tajolas='+tajolas+'&'; if (allapot!='' && allapot!='undefined') parameterURL += 'allapot='+allapot+'&'; if (kornyek!='' && kornyek!='undefined') parameterURL += 'kornyek='+kornyek+'&'; if (telek_min!='' && telek_min!='undefined') parameterURL += 'telek_min='+telek_min+'&'; if (telek_max!='' && telek_max!='undefined') parameterURL += 'telek_max='+telek_max+'&'; if (epites_eve_min!='' && epites_eve_min!='undefined') parameterURL += 'epites_eve_min='+epites_eve_min+'&'; if (epites_eve_max!='' && epites_eve_max!='undefined') parameterURL += 'epites_eve_max='+epites_eve_max+'&'; if (ferohely_garazs_min!='' && ferohely_garazs_min!='undefined') parameterURL += 'ferohely_garazs_min='+ferohely_garazs_min+'&'; if (ferohely_garazs_max!='' && ferohely_garazs_max!='undefined') parameterURL += 'ferohely_garazs_max='+ferohely_garazs_max+'&'; if (kulon_nyilo_szobak==1) parameterURL += 'kulon_nyilo_szobak='+kulon_nyilo_szobak+'&'; if (terasz==1) parameterURL += 'terasz='+terasz+'&'; if (erkely==1) parameterURL += 'erkely='+erkely+'&'; if (pince==1) parameterURL += 'pince='+pince+'&'; if (tarolo==1) parameterURL += 'tarolo='+tarolo+'&'; if (garazs==1) parameterURL += 'garazs='+garazs+'&'; if (ferohely_fedettbeallo==1) parameterURL += 'ferohely_fedettbeallo='+ferohely_fedettbeallo+'&'; if (kertkapcsolatos==1) parameterURL += 'kertkapcsolatos='+kertkapcsolatos+'&'; if (viz==1) parameterURL += 'viz='+viz+'&'; if (gaz==1) parameterURL += 'gaz='+gaz+'&'; if (villany==1) parameterURL += 'villany='+villany+'&'; if (csatorna==1) parameterURL += 'csatorna='+csatorna+'&'; if (lift==1) parameterURL += 'lift='+lift+'&'; if (name!='' && name!='undefined') parameterURL += 'name='+name+'&'; if (origin.indexOf('/rockhome-irodak/properties')>-1) { $.get(requestURL+parameterURL+'from='+origin,function(resp) { $('.result-list').html(resp); }); } else if (origin.indexOf('/rockhome-tanacsadok/properties')>-1) { $.get(requestURL+parameterURL+'from='+origin,function(resp) { $('.result-list').html(resp); }); } else { window.location = requestURL+parameterURL+'from='+origin; } } function search_by_agent(origin) { var ertekesites = $('#ertekesites').val(); var jelleg = $('#jelleg').val(); var city = $('#city').val(); var iranyar_min = $('#iranyar_min').val(); var iranyar_max = $('#iranyar_max').val(); var meret_netto_min = $('#meret_netto_min').val(); var meret_netto_max = $('#meret_netto_max').val(); $.post('/rockhome-tanacsadok/properties/filter/',{ ertekesites: ertekesites, jelleg: jelleg, city: city, iranyar_min: iranyar_min, iranyar_max: iranyar_max, meret_netto_min: meret_netto_min, meret_netto_max: meret_netto_max, origin: origin, from: '/rockhome-tanacsadok/show/'+origin+'/' },function(response) { if (response=='') { $('.result-list').html('

Nincs találat : (

Jelenleg nincs a megadott keresési feltételeknek megfelelő ingatlan az adatbázisunkban. Kérjük adjon meg más keresési paramétereket!
'); } else { $('.result-list').html(response); } }); } function search_by_office(origin) { var ertekesites = $('#ertekesites').val(); var jelleg = $('#jelleg').val(); var city = $('#city').val(); var iranyar_min = $('#iranyar_min').val(); var iranyar_max = $('#iranyar_max').val(); var meret_netto_min = $('#meret_netto_min').val(); var meret_netto_max = $('#meret_netto_max').val(); var szoba_min = $('#szoba_min').val(); var szoba_max = $('#szoba_max').val(); $.post('/rockhome-irodak/properties/filter/',{ ertekesites: ertekesites, jelleg: jelleg, city: city, iranyar_min: iranyar_min, iranyar_max: iranyar_max, meret_netto_min: meret_netto_min, meret_netto_max: meret_netto_max, szoba_min: szoba_min, szoba_max: szoba_max, origin: origin, from: '/rockhome-irodak/show/'+origin+'/' },function(response) { if (response=='') { $('.result-list').html('

Nincs találat : (

Jelenleg nincs a megadott keresési feltételeknek megfelelő ingatlan az adatbázisunkban. Kérjük adjon meg más keresési paramétereket!
'); } else { $('.result-list').html(response); } }); } function set_search_filter_category(action,obj) { filterCategory = action; $('.icon-item').css('background-color','transparent'); $(obj).css('background-color','#999'); } function clearMainSearch() { $('.icon-item').css('background-color','transparent'); filterCategory = ''; $('.location-search-layer').hide(); $('#search_location').val(''); } function showHideDetailSearch() { if ($('.detailed-filter').is(':visible')) { $('#gogogo').show(); $('#showhideDetailSearch').html('Részletes keresés'); $('.detailed-filter').toggle(); $('#dsBtn').html('Részletes'); $('#dsBtn').css('margin-top','160px'); } else { $('#gogogo').hide(); $('#showhideDetailSearch').html('Bezárás'); $('.detailed-filter').toggle(); $('#dsBtn').html('Elrejt'); var marg = $('.detailed-filter').height()+170; $('#dsBtn').css('margin-top',marg+'px'); } } function showHideSearch(obj) { if ($('.filter-bar').is(':visible')) { $('.filter-bar').hide(); $('#nsBtn').html('Keresés'); $('.showhideDetailSearch').show(); $('#showhideDetailClose').hide(); } else { $('.filter-bar').show(); $('#nsBtn').html('Elrejt'); $('.showhideDetailSearch').hide(); $('#showhideDetailClose').show(); } } function setDetailedForm(obj,origin) { var tipus = $(obj).val(); if (tipus!=='') { $.get('/property/setdetailed/show/?tipus='+tipus+'&origin='+origin,function(resp) { $('.detailed-filter').html(resp); $('#altipus').selectize({ }); $('#kilatas').selectize({ }); $('#futes').selectize({ }); $('#tajolas').selectize({ }); $('#kornyek').selectize(); $('#allapot').selectize(); $('#ovezet').selectize(); if ($('.detailed-filter').is(':visible')) { } else { //$('#dsBtn').trigger('click'); } }); } else { return false; } } function loadDetailedForm(tipus) { if (tipus!=='') { $.get('/property/detailed/show/?tipus='+tipus+'&origin='+page,function(resp) { $('.detailed-filter').html(resp); $('#altipus').selectize(); $('#kilatas').selectize(); $('#futes').selectize(); $('#tajolas').selectize(); $('#kornyek').selectize(); $('#allapot').selectize(); $('#ovezet').selectize(); //$('#dsBtn').trigger('click'); }); } else { return false; } } function clear_search() { $.get('/property/clearsearch/',function(resp) { window.location = '/property/search'; /*if (redirectURL=='' || redirectURL==undefined) { window.location = '/property/search'; } else { if (redirectURL.indexOf('map')>0) { window.location = '/map'; } else { window.location = '/property/search'; } }*/ }); } function hideMenu() { $('.submenu').hide(); } function showHideMenu(event,main,obj) { event.stopPropagation(); hideMenu(); var parental = $(main).attr('data-sub'); var corrector = 0; if (parental=='#ingatlan-submenu') { corrector = 80; } else if (parental=='#services-submenu') { corrector = 65; } else if (parental=='#connect-submenu') { corrector = 20; } var leftPos = 0; var pos = $(main).position(); leftPos = Math.round(pos.left)+corrector; $(obj).children('.thicker').css('margin-left',leftPos+'px'); $(obj).toggle(); } function next_thumb() { var active = null; var next = null; $('.image-thumb').each(function() { if ($(this).hasClass('active-thumb')) { active = $(this); } }); $(active).removeClass('active-thumb'); next = $(active).closest('a').next().find('.image-thumb'); if ($(next).attr('src')!==undefined) { $(next).addClass('active-thumb'); $('.slider-picture').css('background-image','url('+$(next).attr('src')+')'); } else { next = $('.image-thumbs img').first(); $(next).addClass('active-thumb'); $('.slider-picture').css('background-image','url('+$(next).attr('src')+')'); } } function prev_thumb() { var active = null; var next = null; $('.image-thumb').each(function() { if ($(this).hasClass('active-thumb')) { active = $(this); } }); $(active).removeClass('active-thumb'); next = $(active).closest('a').prev().find('.image-thumb'); if ($(next).attr('src')!==undefined) { $(next).addClass('active-thumb'); $('.slider-picture').css('background-image','url('+$(next).attr('src')+')'); } else { next = $('.image-thumbs img').last(); $(next).addClass('active-thumb'); $('.slider-picture').css('background-image','url('+$(next).attr('src')+')'); } } function setMapHeight() { var maxHeight = $(window).height(); //maxHeight = maxHeight-165; listMaxHeight = maxHeight-350; $('.map-block').css('min-height',maxHeight+'px'); $('.map-block').css('height',maxHeight+'px'); $('.map-block').css('max-height',maxHeight+'px'); $('body').css('overflow-y','hidden'); $('.result-list-thin').css('min-height',listMaxHeight-0+'px'); $('.result-list-thin').css('height',listMaxHeight-0+'px'); $('.result-list-thin').css('max-height',listMaxHeight-0+'px'); $('.result-list-thin').css('padding-bottom','100px'); $('.result-list-thin').css('overflow-y','scroll'); //$('.result-list-thin').append('















'); } function next_scroll() { var leftPos = $('.thumbs-container').scrollLeft(); $(".thumbs-container").animate({scrollLeft: '+=500'}, 500); } function prev_scroll() { var leftPos = $('.thumbs-container').scrollLeft(); $(".thumbs-container").animate({scrollLeft: '-=500'}, 500); } function share_property(propertyID) { if (propertyID!='') { uglipop({ class: 'share-popup', source: 'html', content: '\n\ ' }); grecaptcha.render('revalidate', { 'sitekey' : '6LespnkUAAAAAGCD4LxSKwADNqbzSiTR1SON0lMn' }); } else { return false; } } function share(e) { e.preventDefault(); var nev = $('#sharenev').val(); var email = $('#shareemail').val(); var propertyID = $('#property_id').val(); if (grecaptcha.getResponse()!='') { $.post('/property/share/'+propertyID,{nev: nev, email: email, propertyID: propertyID},function(resp) { if (resp==='sent') { close_modal(); $('.error-login').hide(); $('.success-bar').html(' Sikeres email küldés...'); $('.success-bar').toggle(); var shtimer = setInterval(function() { $('.success-bar').toggle(); clearInterval(shtimer); },2000); return false; } else { $('.error-login').show(); return false; } }); } else { $('.error-login').show(); return false; } } function start_main_search(obj) { if ($('#search_keyword').val()!='') { $('#search-form').submit(); } } function globalSearch(event,obj) { var char = event.which || event.keyCode; if (char==13 && $(obj).val()!='') { window.location = '/search/index/?keyword='+$(obj).val(); } else { var keyword = $(obj).val(); if (keyword.length>1) { $.get('/search/ajax/'+keyword,function(resp) { $('#responsePreview').html(resp); $('#responsePreview').show(); }); } else { $('#responsePreview').html(''); $('#responsePreview').hide(); return false; } } } function globalSearch2(event,obj) { var char = event.which || event.keyCode; if (char==13) { window.location = '/search/index/?keyword='+$(obj).val(); } else { var keyword = $(obj).val(); if (keyword.length>1) { $.get('/search/ajax/'+keyword,function(resp) { $('#responsePreview').html(resp); $('#responsePreview').show(); }); } else { $('#responsePreview').html(''); $('#responsePreview').hide(); return false; } } } function hideSuggests() { $('#responsePreview').html(''); $('#responsePreview').hide(); return true; } function showSuggests() { var keyword = $('#start_search').val(); if (keyword.length>1) { $.get('/search/ajax/'+keyword,function(resp) { $('#responsePreview').html(resp); $('#responsePreview').show(); }); } else { $('#responsePreview').html(''); $('#responsePreview').hide(); return false; } } function set_ertekesites_tipus(tipus) { $('.ertekesites-check').removeClass('check-active'); $('#ertekesites').val(tipus); if (tipus=='elado') { $('#elado').addClass('check-active'); $('.currency-label').html('M Ft'); } else { $('#kiado').addClass('check-active'); $('.currency-label').html('E Ft'); } } function set_ertekesites_tipus_mobile(tipus) { $('.ertekesites-check').removeClass('check-active'); $('#ertekesites_mobil').val(tipus); if (tipus=='elado') { $('#elado_mobile').addClass('check-active'); $('.currency-label').html('M Ft'); } else { $('#kiado_mobile').addClass('check-active'); $('.currency-label').html('E Ft'); } } function print_property(obj,id) { var pos = $(obj).position(); var left = pos.left; var top = pos.top; $('#printpop').css('top',top); $('#printpop').css('left',left); $('#printpop').html(''); $('#printpop').show(); } function print_property_portrai(id) { $('#printpop').hide(); if (id!='') { $.get('/property/pdfexport/'+id+'/',function(resp) { var myWindow=window.open('','','width=1000,height=600'); myWindow.document.write(resp); setTimeout(function() { myWindow.document.close(); myWindow.focus(); myWindow.print(); myWindow.close(); },500); }); } else { return false; } } function print_property_landscape(id) { $('#printpop').hide(); if (id!='') { $.get('/property/pdfexport/'+id+'/?landscape=y',function(resp) { var myWindow=window.open('','','width=1000,height=600'); myWindow.document.write(resp); setTimeout(function() { myWindow.document.close(); myWindow.focus(); myWindow.print(); myWindow.close(); },500); }); } else { return false; } } function print_office(id) { if (id!='') { uglipop({ class: 'register-popup', source: 'html', content: '
\n\ \n\ Dokumentum létrehozása folyamatban...\n\
' }); $.get('/rockhome-irodak/pdfexport/'+id,function(filename) { close_modal(); window.open('/'+filename); }); } else { return false; } } function print_agent(id) { if (id!='') { uglipop({ class: 'register-popup', source: 'html', content: '
\n\ \n\ Dokumentum létrehozása folyamatban...\n\
' }); $.get('/rockhome-tanacsadok/pdfexport/'+id,function(filename) { close_modal(); window.open('/'+filename); }); } else { return false; } } function set_search_focus() { if ($('.input-search').is(':visible')) { } else { $('.input-search').animate({width:'toggle'},350,function() { $('.input-search').css('display','block'); $('.input-search').focus(); }); } } function hide_search_focus() { if ($('.input-search').val()=='') { $('.input-search').animate({width:'toggle'},285); } } function showMobileMenu(obj) { if ($(obj).children('ul').is(':visible')) { $('.mobile-submenu').hide(); $(obj).children('a').children('i').addClass('fa-angle-right'); $(obj).children('a').children('i').removeClass('fa-angle-down'); } else { $('.mobile-submenu').hide(); $(obj).children('ul').toggle(); $(obj).children('a').children('i').removeClass('fa-angle-right'); $(obj).children('a').children('i').addClass('fa-angle-down'); } } function showPagesSubmenu(obj) { if (obj) { var blocks = $(obj).parent('ul'); if ($(blocks).hasClass('menu-state-hidden')) { $('.menu-state-show').children('.submenu-hidden').hide(); $('.menu-state-show').children('.submenu-title').children('span').html('+'); $(blocks).children('.submenu-hidden').show(); $(blocks).removeClass('menu-state-hidden'); $(blocks).addClass('menu-state-show'); $(obj).children('span').html('-'); } else { $(blocks).children('.submenu-hidden').hide(); $(blocks).removeClass('menu-state-show'); $(blocks).addClass('menu-state-hidden'); $(obj).children('span').html('+'); } } else { return false; } } function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+ d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for (var i = 0; i = $(this)[0].scrollHeight-1 && isScrollEnabled) { lazyShowMore($('button[name=show_more]')); } });*/ //alert(page); if (page=='index') { $(document).on('scroll', function() { if (screen.width>1000) { if ($(document).scrollTop() >= $('.result-list').innerHeight()-400 && isScrollEnabled && storedCat.indexOf('arcsokkent')==-1) { lazyShowMoreGrid($('button[name=show_more]')); } } else { if ($(document).scrollTop() >= $('.result-list-thin').innerHeight()-400 && isScrollEnabled && storedCat.indexOf('arcsokkent')==-1) { lazyShowMoreGrid($('button[name=show_more]')); } } }); } if (page=='index') { //slider($('#slide_banner')); //news($('#news')); //var pos = $('#search_location').position(); //var ntop = pos.top+168; //$('.location-search-layer').css('top',ntop); //$('.location-search-layer').css('left',pos.left); //$('.suggession').css('width',$('#search_location').width()); //$('.suggession').css('top',pos.top-50); //$('.suggession').css('left',pos.left); filterCategory = storedCat; if (storedCat.indexOf('/property/search/filter/')>-1) { $('.property').css('background-color','#999'); } else if (storedCat.indexOf('/rockhome-tanacsadok/search/filter/')>-1) { $('.agents').css('background-color','#999'); } else if (storedCat.indexOf('/rockhome-irodak/search/filter/')>-1) { $('.offices').css('background-color','#999'); } } else if (page=='map') { //var pos2 = $('#filter_filter').position(); //var nleft2 = pos2.left; //$('#detailsicon').css('left',nleft2); $('body').css('overflow-y','hidden !important'); setMapHeight(); } $('#city').selectize(); $('#altipus').selectize(); $('#kilatas').selectize(); $('#futes').selectize(); $('#ovezet').selectize(); $('#search_location').selectize(); $('#tajolas').selectize(); $('#kornyek').selectize(); $('#allapot').selectize(); $('#name').selectize(); loadDetailedForm(detailType); propertySlideshow(); }); $(window).resize(function() { if (page=='index') { var pos = $('#search_location').position(); var ntop = pos.top+168; $('.location-search-layer').css('top',ntop); $('.location-search-layer').css('left',pos.left); } else if (page=='map') { var pos2 = $('#filter_filter').position(); var nleft2 = pos2.left; $('#detailsicon').css('left',nleft2); setMapHeight(); } });