function sendfeedback(){ $(function() { var feedback = $("#feedback" ).val(); $.ajax({ type: 'POST', cache: false, url: 'ajaxfeedback.php', data: {"data":feedback}, success: function(data) { console.log('1: '+ data); } }); }); //close modal $('#contactform').modal('hide'); } $(function() { $(".opencontactform").click(function(){ $("#contactform").modal(); }); }); $(function() { if ($(window).width() < 768) { // do something for small screens // console.log('xs'); //close options! $( ".divs_options" ).toggle(); $( ".arrow_icon" ).toggleClass( "arrow-down arrow-right" ); $( ".adleftcol" ).hide(); $( ".removeonsmallscreens" ).hide(); $( ".onlyonsmallscreens" ).show(); } else if ($(window).width() >= 768 && $(window).width() <= 992) { // do something for medium screens // console.log('s'); } else if ($(window).width() > 992 && $(window).width() <= 1200) { // do something for big screens // console.log('m'); } else { // do something for huge screens // console.log('l'); } $("#locateme").click(function(){ //console.log('locate me'); if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition,showError); } else{ swal({title: "Geolocation is not supported by this browser",type: "error"}); } }); function showPosition(position) { //console.log("Latitude: " + position.coords.latitude + "
Longitude: " + position.coords.longitude); //redraw google maps. var newLatLng = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); var mapOptions = { navigationControl: false, mapTypeControl: false, scaleControl: false, draggable: false, scrollwheel: false, zoom: 11, center: newLatLng, mapTypeId: google.maps.MapTypeId.ROADMAP, disableDefaultUI: true, styles:[{ featureType:"poi", elementType:"labels", stylers:[{ visibility:"off" }] }] } map = new google.maps.Map(document.getElementById('google_maps'),mapOptions); var theDate = new Date(); var oneHourLater = new Date( theDate.getTime() + 3600000 ); var expiryDate = oneHourLater.toGMTString(); //store in cookie document.cookie = 'BBGEO='+position.coords.latitude+"@"+position.coords.longitude+';expires='+expiryDate; // console.log("searchnow: latitude:"+ position.coords.latitude+", longitude: "+position.coords.longitude ); searchnow(1,100, position.coords.latitude,position.coords.longitude); $(function(){ $( "#geolocation" ).addClass( "colorred" ); }); } function showError(error) { switch(error.code) { case error.PERMISSION_DENIED: swal({title: "User denied the request for Geolocation",type: "error"}); break; case error.POSITION_UNAVAILABLE: swal({title: "Location information is unavailable",type: "error"}); break; case error.TIMEOUT: swal({title: "The request to get user location timed out",type: "error"}); break; case error.UNKNOWN_ERROR: swal({title: "An unknown error occurred",type: "error"}); break; } } function getFormattedLocation() { if (google.loader.ClientLocation.address.country_code == "US" && google.loader.ClientLocation.address.region) { return google.loader.ClientLocation.address.city + ", " + google.loader.ClientLocation.address.region.toUpperCase(); } else { return google.loader.ClientLocation.address.city + ", " + google.loader.ClientLocation.address.country_code; } } var map; function initialize() { //console.log('x'); var zoom = 16; var myLatlng = new google.maps.LatLng(40, 4); var location = "Showing default location for map."; var geotype = 1; // If ClientLocation was filled in by the loader, use that info instead if (google.loader.ClientLocation) { myLatlng = new google.maps.LatLng(google.loader.ClientLocation.latitude, google.loader.ClientLocation.longitude); location = "Showing IP-based location: " + getFormattedLocation() + ""; var geotype = 2; } //console.log(geotype+" - "+location); if (geotype==1){ //try another way. myLatlng = new google.maps.LatLng(geoplugin_latitude(), geoplugin_longitude()); location = "Showing IP-based location: " + geoplugin_countryName() + ""; geotype = 3; } //console.log(geotype+" - "+location); var mapOptions = { navigationControl: false, mapTypeControl: false, scaleControl: false, draggable: false, scrollwheel: false, zoom: 11, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP, disableDefaultUI: true, styles:[{ featureType:"poi", elementType:"labels", stylers:[{ visibility:"off" }] }] } var map = new google.maps.Map(document.getElementById('google_maps'), mapOptions); } google.maps.event.addDomListener(window, 'load', initialize); $.ajaxSetup({ beforeSend:function(){ $("#loading").show(); }, complete:function(){ $("#loading").hide(); } }); $("#sel_club").click(function () { value = $(this).is(":checked"); if (value==true){ $("#sel_beach").prop("disabled", false); } if (value==false){ $("#sel_beach").prop("disabled", true); } }) $("#sel_beach").click(function () { value = $(this).is(":checked"); if (value==true){ $("#sel_club").prop("disabled", false); } if (value==false){ $("#sel_club").prop("disabled", true); } }) $(".filtercategory").click(function(){ var clickedcath = $(this).attr('id'); // console.log(clickedcath); var part = clickedcath.split("_"); // console.log(part); $( "#div_"+part[1] ).toggle(); $( "#arrow_"+part[1] ).toggleClass( "arrow-down arrow-right" ); }); $("input:checkbox[class=searchoption]").click(function () { var id_option = ''; var value = ''; id_option = $(this).attr("id"); id_option = id_option.replace("sel","div") value = $(this).is(":checked"); if (value==true){ $("#"+id_option).addClass( "selectedcb" ); } if (value==false){ $("#"+id_option).removeClass( "selectedcb" ); } searchnow(1); }); $("input:checkbox[class=searchoptiondb]").click(function () { var id_option = ''; var value = ''; id_option = $(this).attr("id"); id_option = id_option.replace("sel","div") value = $(this).is(":checked"); if (value==true){ $("#"+id_option).addClass( "selectedcb" ); } if (value==false){ $("#"+id_option).removeClass( "selectedcb" ); } searchnow(1); }); $( "#searchbutton" ).click(function() { searchnow(1); }); function searchnow(page,totalpages,coorlat,coorlng) { //console.log('start searchnow'); $('#pagination').hide(); var coords = '' ; //var pagination = 0; var numberofpages = 0; if (totalpages) numberofpages = totalpages; if((coorlat) && (coorlng)){ if((coorlat!=0) && (coorlng!=0)){ coords = coorlat+"@"+coorlng; } } var dbarray = {}; var id_db = ''; var value_db = ''; $("input:checkbox[class=searchoptiondb]").each(function () { id_db = $(this).attr("id"); value_db = $(this).is(":checked"); dbarray[id_db]=value_db; }); var optionsarray = {}; var id_option = ''; var value = ''; $("input:checkbox[class=searchoption]").each(function () { id_option = $(this).attr("id"); value = $(this).is(":checked"); optionsarray[id_option]=value; }); var searchterms = $("#searchinput" ).val(); // console.log(optionsarray); // console.log(dbarray); $.ajax({ type: 'POST', cache: false, url: 'searchresults.php', data: {"db":dbarray,"data":optionsarray,"searchterms":searchterms,"coords":coords,"page":page}, success: function(data) { var res = data.split("@#$%^&*"); $('.resultcol2').html(res[0]); var numberofresponses = res[1]; if (numberofpages==0) numberofpages = Math.round(numberofresponses/10)+1; //console.log('after success searchnow ; page:'+ page+', numberofpages:'+numberofpages); displaypage(page,numberofpages); $('#pagination').show(); } }); }; $( "#searchinput" ).autocomplete({ source:'suggest_name.php', minLength:3, dataType: "JSON", select: function( event, ui ) { // console.log('selected autocomplete'); $('#filterbox_wrap')[0].reset(); // console.log(ui.item.id); $.ajax({ type: 'POST', dataType: 'JSON', cache: false, url: 'getitems.php?term='+ui.item.id, success: function(data) { // console.log(data); $.each(data, function(item, value) { // console.log(item+" - "+value); if (value==1) { // $('#sel_'+item).prop('checked', true); $('#div_'+item).addClass( "selectedcb" ); } if (value==0) { // $('#sel_'+item).prop('checked', false); $('#div_'+item).removeClass( "selectedcb" ); } }); } }); }, response: function( event, ui ) { // console.log(1); }, close: function( event, ui ) { // console.log(2); searchnow(1); } }); $("#resetform").click(function(){ $("#searchinput").val(''); $('#filterbox_wrap')[0].reset(); $('.checkbox').removeClass( "selectedcb" ); searchnow(1); }); var exitConfirmDialog = new BootstrapDialog({ title: 'Open Google maps', message: 'Are you sure you want to continue?', closable: false, buttons: [ { label: 'Cancel', action: function(dialog) { dialog.close(); } }, { label: 'Continue', cssClass: 'btn-primary', action: function(dialog) { dialog.close(); $.fancybox.open({ openEffect : 'elastic', closeEffect : 'elastic', width : "100%", height : "100%", href: 'largegm.php?uid=new', type: 'iframe' }); } } ] }); $('.openlargegmresult').on('click touchend', function(event) { $.fancybox.open({ openEffect : 'elastic', closeEffect : 'elastic', width : "100%", height : "100%", href: 'largegm.php?uid=new', type: 'iframe' }); // event.stopPropagation(); // event.preventDefault(); // exitConfirmDialog.open(); // BootstrapDialog.confirm('Open in large google maps?', function(result){ /* if(result) { $.fancybox.open({ openEffect : 'elastic', closeEffect : 'elastic', width : "100%", height : "100%", href: 'largegm.php?uid=new', type: 'iframe' }); } */ // }); }); $('#pagination').twbsPagination({ startPage: 1, totalPages: 100, onPageClick: function (event, page) { } }); //alert ($(window).width() ); if ($(window).width() < 768) { var vp = '2'; } else if ($(window).width() >= 768 && $(window).width() <= 992) { var vp = '5'; } else if ($(window).width() > 992 && $(window).width() <= 1200) { var vp = '7'; } else { var vp = '10'; } //alert (vp); function displaypage(page, total){ var totalpages = 100; if (total) totalpages = total; // console.log('start displaypage; page:'+ page+', totalpages:'+totalpages); //destroy plugin $('#pagination').twbsPagination('destroy'); //set new options $('#pagination').twbsPagination({ visiblePages: vp, startPage: page, totalPages: totalpages, initiateStartPageClick: false, onPageClick: function (event, page) { searchnow(page); // console.log("onclick page , start searchnow : page:"+page + " totalpages:"+totalpages); return; } }); } //console.log("firstrun displaypage: "+new Date()); searchnow(1); }); function opencr(kind,id,name){ window.open('/'+kind+'/'+id+'/'+name+'.html','_blank'); } $(function(){ $(".fancybox-inner").fancybox({ width: "100%", margin: [0, 0, 0, 100] // top, right, bottom, left }); // CLEARABLE INPUT function tog(v){return v?'addClass':'removeClass';} $(document).on('input', '.clearable', function(){ $(this)[tog(this.value)]('x'); }).on('mousemove', '.x', function( e ){ $(this)[tog(this.offsetWidth-30 < e.clientX-this.getBoundingClientRect().left)]('onX'); }).on('touchstart click', '.onX', function( ev ){ ev.preventDefault(); $(this).removeClass('x onX').val('').change(); }); // $('.clearable').trigger("input"); // Uncomment the line above if you pre-fill values from LS or server $("#searchinput").keyup(function(event){ if(event.keyCode == 13){ $("#searchbutton").click(); $('#searchinput').autocomplete('close'); } }); }); /* function get_currency(caller){ //console.log(caller); $.ajax({ url: "cc.php?cc="+caller, success: function(data) { $("#cc").html(data); } }); } */ function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i