var URL=document.location.origin;$("#menu .mobile_only, #filternav").hide();function mobileMenu(){if($(window).width()<769){$(function(){$.mmenu.configuration.classNames.fixedElements={fixed:"Fixed",sticky:"Sticky"};$("#menu").mmenu({"navbars":[{"position":"bottom","content":["<a href='language.php?lang=en&link="+encodeURIComponent(CurrentURL)+"'>EN</a>","<a href='language.php?lang=zh&link="+encodeURIComponent(CurrentURL)+"'>中文</a>","<a href='language.php?lang=my&link="+encodeURIComponent(CurrentURL)+"'>BM</a>"]},{"height":4,"position":'top',"content":['<div id="logo" class="site-logo"><a href="'+URL+'"><img src="Images/page_loading.png?v=1"></div>','prev','title']},],"extensions":["pagedim-black"]});$(".mh-head.mm-sticky").mhead({scroll:!0});$("#filternav").mmenu({navbar:{title:"Filter"},offCanvas:{position:"right"},"navbars":[{"position":"bottom","content":["<a class='filter_reset' href=''>RESET</a>","<a class='filter_done' href=''>DONE</a>"]}]})});$(document).ready(function(){$(".mobile_only, #filternav").show()})}else{$(document).on("click",".mh-hamburger",function(e){$('.desk_filter_box').toggle();e.preventDefault()})}}
function mobileMenu2(){$(function(){$.mmenu.configuration.classNames.fixedElements={fixed:"Fixed",sticky:"Sticky"};$("#menu2").mmenu({"navbars":[{"position":"bottom","content":["<a href='language.php?lang=en&link="+encodeURIComponent(CurrentURL)+"'>EN</a>","<a href='language.php?lang=zh&link="+encodeURIComponent(CurrentURL)+"'>中文</a>","<a href='language.php?lang=bm&link="+encodeURIComponent(CurrentURL)+"'>BM</a>"]},{"height":4,"position":'top',"content":['<div id="logo" class="site-logo"><a href="'+URL+'"><img src="Images/page_loading.png?v=1"></div>','prev','title']},],"extensions":["pagedim-black"]});$(".mh-head.mm-sticky").mhead({scroll:!0})})}
$(window).on("load",function(e){mobileMenu()});$(document).ready(function(){mobileMenu2()});$(document).ready(function(){$('.bxslider').bxSlider({controls:!1,auto:!0,stopAutoOnClick:!0,pager:!0,preloadImages:'all',onSliderLoad:function(){$(".slide_box").removeClass("hidden").addClass("shown")}})});$(window).on("resize",function(e){mobileMenu()});function resultQuickviewClose(){$("body").removeClass('modal-open');var html=jQuery('html');var scrollPosition=html.data('scroll-position');html.css('overflow',html.data('previous-overflow'));window.scrollTo(scrollPosition[0],scrollPosition[1])
$('#result_quickview_text').fadeOut('fast');if(!($('.main_product_box').hasClass('section_product_box'))){$('.zoomContainer').remove()}}
$(document).ready(function(){$('.alltooltip').tooltipster({maxWidth:400,side:'right'});$(document).on("click",'.result_quickview_close',function(){resultQuickviewClose();return!1});$(document).keyup(function(e){if(e.keyCode==27){resultQuickviewClose()}});$(".page_loader_V2").hide();$(window).bind("load",function(){});if($('#map').length!==0){var ThisParentHidden=$('body').find('div:hidden');var zOoM=10;$('#my_location, #my_location2').click(function(e){$("#gAddress").hide();if(navigator&&navigator.geolocation){navigator.geolocation.getCurrentPosition(function(position){var latlng={lat:position.coords.latitude,lng:position.coords.longitude};updateLatLng(position.coords.latitude,position.coords.longitude);runMap(latlng)},function(error){toastr.error('It was not possible to detect your location, Please enable your gps!')})}else{error('Geolocation is not supported.')}
e.preventDefault()});getDefaultLatLng();function mapPriority(latlng){var ThisFormLogin=$('#form_login').find("[name^='Token']").val(),ThisFormLat=$('#form_getlatlng').find("#Lat").val(),ThisFormLng=$('#form_getlatlng').find("#Lng").val();if(ThisFormLogin!=''||(ThisFormLat!=''&&ThisFormLng!='')){getDefaultLatLng()}else{updateLatLng(latlng.lat,latlng.lng);runMap(latlng)}}
function getDefaultLatLng(){getMemberLatLng();var latlng,ThisForm=$('#form_getlatlng'),Lat=ThisForm.find("#Lat").val(),Lng=ThisForm.find("#Lng").val();if($.isNumeric(Lat)&&$.isNumeric(Lng)){latlng={lat:Number(Lat),lng:Number(Lng)}}else{latlng={lat:3.1556012,lng:101.71465220000005}}
runMap(latlng)}
function getMemberLatLng(){var ThisForm=$('#form_getMemberLatLng'),ThisFormLatLng=$('#form_getlatlng');ajaxCall(ThisForm,function(output){if(output.result=='success-get-mapping'){var list=output.list;ThisFormLatLng.find("#Lat").val(list.Lat);ThisFormLatLng.find("#Lng").val(list.Lng)}})}
function updateLatLng(Lat,Lng,type=''){var ThisForm=ThisParentHidden.find('#form_getlatlng');ThisForm.find("#Lat").val(Lat);ThisForm.find("#Lng").val(Lng);$("#NeW_Lat").val(Lat);$("#NeW_Lng").val(Lng);if(type=='geocoder'||type=='gmap'){var geocoder=new google.maps.Geocoder;var latlng={lat:parseFloat(Lat),lng:parseFloat(Lng)};geocoder.geocode({'location':latlng},function(results,status){console.log('results:'+results);console.log(results);console.log('status:'+status);if(status==='OK'){if(results[0]){if(type=='gmap'){var m=$('#pac-input').val();$('.d2a').val(m);$('#pac-input2, .d2a2').val(results[0].formatted_address)}else{$('#pac-input, #pac-input2, .d2a, .d2a2').val(results[0].formatted_address)}}}})}
ajaxCall(ThisForm,function(output){if((output.result=="success-mapping")||(output.result=="success-area-only")){if(output.list.AreaID!==null&&typeof output.list.AreaID==='object'){toastr.success($(".success-area").text())}else{toastr.error($(".failed-area").text())}}else if(output.result=="map-getlatlng-return"){if($.isNumeric(output.list.Lat)&&$.isNumeric(output.list.Lng)){toastr.success($(".success-area").text())}else{toastr.error($(".failed-area").text())}}
console.log('Lat:'+Lat);console.log('Lng:'+Lng)})}
function runMap(latlng){var me_image=document.location.origin+'/Images/me_image.png';var defaultLocation=latlng;var map=new google.maps.Map(document.getElementById('map'),{center:defaultLocation,zoom:zOoM,streetViewControl:!1,mapTypeControl:!1,fullscreenControl:!1,});var marker=new google.maps.Marker({position:defaultLocation,map:map,animation:google.maps.Animation.DROP,icon:{url:me_image,scaledSize:new google.maps.Size(64,64)},draggable:!0});var multiLayer=new google.maps.Data();multiLayer.loadGeoJson(URL+'/geojson.php');multiLayer.setStyle({fillColor:'red',strokeColor:'red',strokeOpacity:0,strokeWeight:0,});multiLayer.setMap(map);getUrl(URL+'/map_company.php?r='+getUrlParam('r'),function(data){var xml=data.responseXML;var markers=xml.documentElement.getElementsByTagName('marker');Array.prototype.forEach.call(markers,function(markerElem){var id=markerElem.getAttribute('id');var name=markerElem.getAttribute('name');var address=markerElem.getAttribute('address');var type=markerElem.getAttribute('type');var Mimg=markerElem.getAttribute('img');var point=new google.maps.LatLng(parseFloat(markerElem.getAttribute('lat')),parseFloat(markerElem.getAttribute('lng')));var infowincontent=document.createElement('div');var strong=document.createElement('strong');strong.textContent=name
infowincontent.appendChild(strong);infowincontent.appendChild(document.createElement('br'));var text=document.createElement('text');text.textContent=address
infowincontent.appendChild(text);marker2=new CustomMarker(point,map,Mimg)})});var trg=!0;var input=document.getElementById('pac-input');google.maps.event.addDomListener(input,'keydown',function(e){console.log(e);if(e.keyCode===13&&!e.triggered){var request={query:input.value,fields:['formatted_address','geometry'],};console.log(request);service=new google.maps.places.PlacesService(map);service.findPlaceFromQuery(request,function(results,status){if(status===google.maps.places.PlacesServiceStatus.OK){console.log(results);console.log(status);var bounds=new google.maps.LatLngBounds();bounds.extend(results[0].geometry.location);marker.setPosition(results[0].geometry.location);updateLatLng(marker.getPosition().lat(),marker.getPosition().lng(),'gmap');trg=!1;map.fitBounds(bounds);map.setZoom(zOoM)}})}});if($("#pac-input").length!==0){var searchBox=new google.maps.places.Autocomplete(input);searchBox.setFields(['formatted_address','geometry']);searchBox.addListener('place_changed',function(){console.log(searchBox);var places=searchBox.getPlace();console.log(places);var bounds=new google.maps.LatLngBounds();var i,place;if(!places.geometry){console.log("Returned place contains no geometry");return}
bounds.extend(places.geometry.location);marker.setPosition(places.geometry.location);updateLatLng(marker.getPosition().lat(),marker.getPosition().lng(),'geocoder');trg=!1;map.fitBounds(bounds);map.setZoom(zOoM)})}
google.maps.event.addListener(marker,'dragend',function(){zOoM=map.getZoom();updateLatLng(marker.getPosition().lat(),marker.getPosition().lng(),'geocoder');trg=!1;var Lat=marker.getPosition().lat(),Lng=marker.getPosition().lng();if($.isNumeric(Lat)&&$.isNumeric(Lng)){latlng={lat:Number(Lat),lng:Number(Lng)}}else{latlng={lat:3.1556012,lng:101.71465220000005}}});if(trg){updateLatLng(latlng.lat,latlng.lng,'geocoder')}}}
$(document).on("click",".first_preview_detail_close",function(e){$('#first_preview').fadeOut('fast');$("body").css("overflow","inherit");return!1;e.preventDefault()});$(document).on('click','#first_preview',function(e){$('#first_preview').fadeOut('fast');$("body").css("overflow","inherit");return!1;e.preventDefault()}).on('click','#first_preview_detail',function(e){e.stopPropagation()});if($('#map2').length!==0){var ThisParentHidden=$('body').find('div:hidden');$('#my_location').click(function(e){if(navigator&&navigator.geolocation){navigator.geolocation.getCurrentPosition(function(position){var latlng={lat:position.coords.latitude,lng:position.coords.longitude};runMap2(latlng)},function(error){getDefaultLatLng2()})}else{error('Geolocation is not supported.')}
e.preventDefault()});if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(position){var latlng={lat:position.coords.latitude,lng:position.coords.longitude};mapPriority2(latlng)},function(error){getDefaultLatLng2()})}else{getDefaultLatLng2()}
function mapPriority2(latlng){var ThisFormLogin=$('#form_login').find("[name^='Token']").val(),ThisFormLat=$('#form_getlatlng').find("#Lat").val(),ThisFormLng=$('#form_getlatlng').find("#Lng").val();if(ThisFormLogin!=''||(ThisFormLat!=''&&ThisFormLng!='')){getDefaultLatLng2()}else{runMap2(latlng)}}
function getDefaultLatLng2(){getMemberLatLng2();var latlng,ThisForm=$('#form_getlatlng'),Lat=ThisForm.find("#Lat").val(),Lng=ThisForm.find("#Lng").val();if($.isNumeric(Lat)&&$.isNumeric(Lng)){latlng={lat:Number(Lat),lng:Number(Lng)}}else{latlng={lat:3.1556012,lng:101.71465220000005}}
runMap2(latlng)}
function getMemberLatLng2(){var ThisForm=$('#form_getMemberLatLng'),ThisFormLatLng=$('#form_getlatlng');ajaxCall(ThisForm,function(output){if(output.result=='success-get-mapping'){var list=output.list;ThisFormLatLng.find("#Lat").val(list.Lat);ThisFormLatLng.find("#Lng").val(list.Lng)}})}
function updateLatLng2(Lat,Lng){var ThisForm=ThisParentHidden.find('#form_getlatlng');ThisForm.find("#Lat").val(Lat);ThisForm.find("#Lng").val(Lng);ajaxCall(ThisForm,function(output){if(output.result=="success-mapping"){if(output.list.AreaID!==null&&typeof output.list.AreaID==='object'){toastr.success($(".success-area").text())}else{toastr.error($(".failed-area").text())}}else if(output.result=="map-getlatlng-return"){if($.isNumeric(output.list.Lat)&&$.isNumeric(output.list.Lng)){toastr.success($(".success-area").text())}else{toastr.error($(".failed-area").text())}}
console.log('Lat:'+Lat);console.log('Lng:'+Lng)})}
function runMap2(latlng){var me_image=document.location.origin+'/Images/me_image.png';var defaultLocation=latlng;var map=new google.maps.Map(document.getElementById('map2'),{center:defaultLocation,zoom:10});var marker=new google.maps.Marker({position:defaultLocation,map:map,animation:google.maps.Animation.DROP,icon:me_image,draggable:!0});var customLabel={merchant:{label:'R'},bar:{label:'B'}};var URL=document.location.origin;getUrl(URL+'/map_company.php?r='+getUrlParam('r'),function(data){var xml=data.responseXML;var markers=xml.documentElement.getElementsByTagName('marker');Array.prototype.forEach.call(markers,function(markerElem){var id=markerElem.getAttribute('id');var name=markerElem.getAttribute('name');var address=markerElem.getAttribute('address');var type=markerElem.getAttribute('type');var point=new google.maps.LatLng(parseFloat(markerElem.getAttribute('lat')),parseFloat(markerElem.getAttribute('lng')));var infowincontent=document.createElement('div');var strong=document.createElement('strong');strong.textContent=name
infowincontent.appendChild(strong);infowincontent.appendChild(document.createElement('br'));var text=document.createElement('text');text.textContent=address
infowincontent.appendChild(text);var icon=customLabel[type]||{};var marker=new google.maps.Marker({map:map,position:point,label:icon.label})})});var searchBox=new google.maps.places.SearchBox(document.getElementById('pac-input'));google.maps.event.addListener(searchBox,'places_changed',function(){var places=searchBox.getPlaces();var bounds=new google.maps.LatLngBounds();var i,place;for(i=0;place=places[i];i++){bounds.extend(place.geometry.location);marker.setPosition(place.geometry.location);updateLatLng2(marker.getPosition().lat(),marker.getPosition().lng())}
map.fitBounds(bounds);map.setZoom(10)});google.maps.event.addListener(marker,'dragend',function(){updateLatLng2(marker.getPosition().lat(),marker.getPosition().lng())})}}
if($('#map3').length!==0){var ThisParentHidden=$('body').find('div:hidden');getDefaultLatLng3();function mapPriority3(latlng){var ThisFormLogin=$('#form_login').find("[name^='Token']").val(),ThisFormLat=$('#form_getlatlng').find("#Lat").val(),ThisFormLng=$('#form_getlatlng').find("#Lng").val();if(ThisFormLogin!=''||(ThisFormLat!=''&&ThisFormLng!='')){getDefaultLatLng3()}else{runMap3(latlng)}}
function getDefaultLatLng3(){getMemberLatLng3();var latlng,ThisForm=$('#form_getlatlng'),Lat=ThisForm.find("#Lat").val(),Lng=ThisForm.find("#Lng").val();if($.isNumeric(Lat)&&$.isNumeric(Lng)){latlng={lat:Number(Lat),lng:Number(Lng)}}else{latlng={lat:3.1556012,lng:101.71465220000005}}
runMap3(latlng)}
function getMemberLatLng3(){var ThisForm=$('#form_getMemberLatLng'),ThisFormLatLng=$('#form_getlatlng');ajaxCall(ThisForm,function(output){if(output.result=='success-get-mapping'){var list=output.list;ThisFormLatLng.find("#Lat").val(list.Lat);ThisFormLatLng.find("#Lng").val(list.Lng)}})}
function runMap3(latlng){var me_image=document.location.origin+'/Images/me_image.png';var defaultLocation=latlng;var map=new google.maps.Map(document.getElementById('map3'),{center:defaultLocation,zoom:10});var marker=new google.maps.Marker({position:defaultLocation,map:map,animation:google.maps.Animation.DROP,icon:me_image,});var customLabel={merchant:{label:'R'},bar:{label:'B'}};var URL=document.location.origin;var dis=$("#custom_distance").val();getUrl(URL+'/map_company3.php?r='+getUrlParam('r')+'&d='+dis,function(data){var xml=data.responseXML;var markers=xml.documentElement.getElementsByTagName('marker');Array.prototype.forEach.call(markers,function(markerElem){var id=markerElem.getAttribute('id');var name=markerElem.getAttribute('name');var address=markerElem.getAttribute('address');var type=markerElem.getAttribute('type');var Mimg=markerElem.getAttribute('img');var point=new google.maps.LatLng(parseFloat(markerElem.getAttribute('lat')),parseFloat(markerElem.getAttribute('lng')));var infowincontent=document.createElement('div');var strong=document.createElement('strong');strong.textContent=name
infowincontent.appendChild(strong);infowincontent.appendChild(document.createElement('br'));var text=document.createElement('text');text.textContent=address
infowincontent.appendChild(text);marker2=new CustomMarker(point,map,Mimg)})})}}})