OnTheWater

Camping and Reservation Information – FLORIDA STATE PARKS


‘ });
}
}
function ClearMainControl() {
$(‘#autocomplete’).val(“”);
$(“#AdvanceMainSearch_txtArrivalDate”).val($.datepicker.formatDate(“mm/dd/yy”, new Date()));
$(“#hdnArrivalDate”).val($.datepicker.formatDate(“mm/dd/yy”, new Date()));

     $('#ddlNights').val(0);

 }
 function SetDateinHiddenfield() {
     // 
     $('#hdnArrivalDate').val($("#AdvanceMainSearch_txtArrivalDate").val());
     return;
     var dt = $("#AdvanceMainSearch_txtArrivalDate").val().split('/');

     $('#hdnArrivalDate').val(dt[0] + "/" + dt[1] + "/" + dt[2]);

 }

 function fnGetPlaceName(AutocompleteControl) {
     var urlname = '';
     if (IsMobileBrowser.toLowerCase() == "true") {
         urlname = baseurlmain + '/Facilities/AdvanceSearchm.aspx/GetCityPlacename';
     } else {
         urlname = baseurlmain + '/Facilities/AdvanceSearch.aspx/GetCityPlacename';
     }
     AutocompleteControl.autocomplete({

         source: function (request, response) {

             $("#hdnLat").val('');
             $("#hdnLag").val('');
             var param = { name: AutocompleteControl.val() };
             $.ajax({
                 url: urlname,
                 data: JSON.stringify(param),
                 dataType: "json",
                 type: "POST",
                 contentType: "application/json; charset=utf-8",
                 dataFilter: function (data) { return data; },
                 success: function (data) {

                     response($.map(data.d, function (item) {
                         if (item.Place_alias == "") {
                             return {
                                 label: item.Name,//+ "," + item.EntityType,
                                 value: item.Latitude + "," + item.Longitude,
                                 logo: item.EntityType,
                                 CityPark: item.CityParkId,
                                 ParkSize: item.ParkSize,
                                 Placeid: item.PlaceId,
                                 PlaceAlias: item.Place_alias,
                                 placeName: item.Name
                             }
                         }
                         if (item.Place_alias != "") {
                             return {
                                 label: item.Place_alias,//+ "," + item.EntityType,
                                 value: item.Latitude + "," + item.Longitude,
                                 logo: item.EntityType,
                                 CityPark: item.CityParkId,
                                 ParkSize: item.ParkSize,
                                 Placeid: item.PlaceId,
                                 PlaceAlias: item.Place_alias,
                                 placeName: item.Name

                             }
                         }
                     }));
                     if (data.d.length == 0) {
                         $("#hdnLat").val("");
                         $("#hdnLag").val("");
                     }

                 },
                 error: function (XMLHttpRequest, textStatus, errorThrown) {
                     alert(textStatus);
                 }
             });
         },

         search: function (event, ui) {
             $("#hdnLat").val('');
             $("#hdnLag").val('');
         },
         select: function (e, ui) {

             ChnageDragandZoom = false;
             e.preventDefault();
             boolAutosearchvalues = true;
             $("#hdnsearchplaceid").val(ui.item.Placeid);
             $("#hdnparksize").val(ui.item.ParkSize);

             parkSize = ui.item.ParkSize;
             $("#hdndefaultLat").val(ui.item.value.split(',')[0]);
             $("#hdndefaultLag").val(ui.item.value.split(',')[1]);
             $("#hdnLat").val(ui.item.value.split(',')[0]);
             $("#hdnLag").val(ui.item.value.split(',')[1]);
             $("#hdnAutoPlaceId").val(ui.item.CityPark);
             $("#autocomplete2").val(ui.item.placeName);
             $("#autocomplete1").val(ui.item.label);
             $("#autocomplete2").val(ui.item.label);
             $("#mainContent_hdnSearchtype").val(ui.item.logo);
             $("#hdnSearchType").val(ui.item.logo);

             MapboxPlaceid = ui.item.Placeid;
             if (ui.item.placeName != "" && ui.item.PlaceAlias == "") {

                 $("#hdnsearchPlaceAlias").val(0);
             }
             else {
                 $("#hdnsearchPlaceAlias").val(1);
             }
            if ($("#hdnsearchPlaceAlias").val().toString() == "1") {

              $("#hdnIsAutocompleteFillHome").val(1);
             $("#divPlaceinformation").css("z-index", 1300);
             $("#divPlaceinformation .modal-body").html('The place you selected is an Alias for ' + ui.item.placeName + ',' + ' , click on OK button to continue. ');
             $("#divPlaceinformation .modal-title").html("Information");
             $('#divPlaceinformation').modal();
                return false;
            }
             //$("#autocomplete2").val()
             // $("#btn_search").click();


             Allevent();


         },

         response: function (event, ui) {

             if (ui.content[0] == undefined) {
                 $("#hdnLat").val('');
                 $("#hdnLag").val('');
             } else {

                 ChnageDragandZoom = false;
                 $("#hdnLat").val(ui.content[0].value.split(',')[0]);
                 $("#hdnLag").val(ui.content[0].value.split(',')[1]);
                 $("#hdncustomautocomplete").val(ui.content[0].label);

                 $("#autocomplete1").val($("#autocomplete2").val());
             }
         },
         focus: function (event, ui) {

             $("#hdnLat").val(ui.item.value.split(',')[0]);
             $("#hdnLag").val(ui.item.value.split(',')[1]);
             this.value = ui.item.label;
             $("#hdncustomautocomplete").val(this.value);
             $("#autocomplete2").val(ui.item.placeName);
             event.preventDefault(); // Prevent the default focus behavior.
         },
         minLength: 2
     }).data("ui-autocomplete")._renderItem = function (ul, item) {

         if (item.PlaceAlias != "" || item.PlaceAlias == undefined) {

             return $('')                   .data("item.autocomplete", item)                   .append('<a> ' + item.label + '</a>')                   .appendTo(ul);             }             else {                 return $('')                    .data("item.autocomplete", item)                    .append('<a> ' + item.label + '</a>')
                .appendTo(ul);
         }
     };

 }


 function fnTourActivity() {


     var placeid = GetParameterValues('placeid');
     if (window.location.href.toLowerCase().indexOf('advancesearch') == -1) {

         if ($('#hdnLat').val() == "") {
             $('#hdnLat').val('0');
             $('#hdnLag').val('0');
         }
     } else {
         if ($("#hdnLat").val() == "") {
             $("#messageBoxLightbox2 .modal-body").html("Place not Found");
             $("#messageBoxLightbox2 .modal-title").html("Message");
             $('#messageBoxLightbox2').modal();
             $(".ui-widget-content").css("display", "none");
             return false;
         }
     }

     var urlname = baseurlmain + '/Facilities/CascadingDropdown.asmx/GoCamping';
     var param = { currentdate: $('#hdnArrivalDate').val(), nights: $('#hdnNights').val(), hdnLat: $('#hdnLat').val(), hdnLag: $('#hdnLag').val(), landingaddress: $('#autocomplete2').val() };
     $.ajax({
         url: urlname,
         data: JSON.stringify(param),
         dataType: "json",
         type: "POST",
         contentType: "application/json; charset=utf-8",

         success: function (data) {
             var result = data.d;

             if ($('#ddlFacilityCategory').val() == '1' || $('#ddlFacilityCategory').val() == '2' || $('#ddlFacilityCategory').val() == 'trail') {


                 if (window.location.href.toLowerCase().indexOf('advancesearch') == -1) {
                     window.location.href = baseurlmain + '/Facilities/AdvanceSearch.aspx';
                 }
             }
             if ($('#ddlFacilityCategory').val() == '6') {
                 placeid = result;
                 placeid = $("#hdnAutoPlaceId").val();
                 var urlname = baseurlmain + '/Memberships/AdvanceCustomerMemberships.aspx?placeid=' + placeid + '&lat=' + $("#hdnLat").val() + '&long=' + $("#hdnLag").val();
                 OpenLoginBox(iscustomernull, true, urlname, '');
             }
             if ($('#ddlFacilityCategory').val() == '3') {
                 placeid = result;
                 placeid = $("#hdnAutoPlaceId").val();
                 //var urlname = baseurlmain + '/Activities/AdvanceTourAndActivities.aspx?placeid=' + placeid + '&lat=' + $("#hdnLat").val() + '&long=' + $("#hdnLag").val();
                 var urlname = baseurlmain + '/Activities/ProgramsAndTours.aspx?placeid=' + placeid + '&lat=' + $("#hdnLat").val() + '&long=' + $("#hdnLag").val();
                 window.location.href = urlname;
             }
             if ($('#ddlFacilityCategory').val() == 'anonuevotourtour') {
                 placeid = result;
                 placeid = $("#hdnAutoPlaceId").val();
                 //var urlname = baseurlmain + '/Activities/AdvanceTourAndActivities.aspx?placeid=' + placeid + '&lat=' + $("#hdnLat").val() + '&long=' + $("#hdnLag").val();
                 var urlname = baseurlmain + '/Activities/ProgramsAndTours.aspx?placeid=' + placeid + '&lat=' + $("#hdnLat").val() + '&long=' + $("#hdnLag").val();
                 window.location.href = urlname;
             }
             if ($('#ddlFacilityCategory').val() == '4') {
                 placeid = result;
                 placeid = $("#hdnAutoPlaceId").val();
                 //var urlname = baseurlmain + '/Activities/AdvanceTourAndActivities.aspx?placeid=' + placeid + '&lat=' + $("#hdnLat").val() + '&long=' + $("#hdnLag").val();
                 var urlname = baseurlmain + '/Activities/HearstCastleTours.aspx';
                 window.location.href = urlname;
             }
             if ($('#ddlFacilityCategory').val() == 'hearstsansimeontour') {
                 placeid = result;
                 placeid = $("#hdnAutoPlaceId").val();
                 //var urlname = baseurlmain + '/Activities/AdvanceTourAndActivities.aspx?placeid=' + placeid + '&lat=' + $("#hdnLat").val() + '&long=' + $("#hdnLag").val();
                 var urlname = baseurlmain + '/Activities/ProgramsAndTours.aspx?placeid=' + placeid + '&lat=' + $("#hdnLat").val() + '&long=' + $("#hdnLag").val();
                 window.location.href = urlname;
             }
         },
         error: function (XMLHttpRequest, textStatus, errorThrown) {
             //alert(textStatus);
         }
     });


 }
 $('#btn_search').click(function () {



     var placeid = GetParameterValues('placeid');
     if (window.location.href.toLowerCase().indexOf('advancesearch') == -1) {

         if ($('#hdnLat').val() == "") {
             $('#hdnLat').val('0');
             $('#hdnLag').val('0');
         }
     } else {
         if ($("#hdnLat").val() == "") {
             $("#messageBoxLightbox2 .modal-body").html("Place not Found");
             $("#messageBoxLightbox2 .modal-title").html("Message");
             $('#messageBoxLightbox2').modal();
             $(".ui-widget-content").css("display", "none");
             return false;
         }
     }

     var urlname = baseurlmain + '/Facilities/CascadingDropdown.asmx/GoCamping';
     var param = { currentdate: $('#hdnArrivalDate').val(), nights: $('#hdnNights').val(), hdnLat: $('#hdnLat').val(), hdnLag: $('#hdnLag').val(), landingaddress: $('#autocomplete1').val() };
     $.ajax({
         url: urlname,
         data: JSON.stringify(param),
         dataType: "json",
         type: "POST",
         contentType: "application/json; charset=utf-8",

         success: function (data) {

             var result = data.d;

             if ($('#ddlactivity').val() == 'camping' || $('#ddlactivity').val() == 'dayuse' || $('#ddlactivity').val() == 'trail') {


                 if (window.location.href.toLowerCase().indexOf('advancesearch') == -1) {
                     window.location.href = baseurlmain + '/Facilities/AdvanceSearch.aspx';
                 }
             }
             if ($('#ddlactivity').val() == 'permit') {
                 placeid = result;
                 placeid = $("#hdnAutoPlaceId").val();
                 var urlname = baseurlmain + '/Memberships/AdvanceCustomerMemberships.aspx?placeid=' + placeid + '&lat=' + $("#hdnLat").val() + '&long=' + $("#hdnLag").val();
                 OpenLoginBox(iscustomernull, true, urlname, '');
             }
             if ($('#ddlactivity').val() == 'tour') {
                 placeid = result;
                 placeid = $("#hdnAutoPlaceId").val();
                 var urlname = baseurlmain + '/Activities/AdvanceTourAndActivities.aspx?placeid=' + placeid + '&lat=' + $("#hdnLat").val() + '&long=' + $("#hdnLag").val();
                 window.location.href = urlname;
             }
         },
         error: function (XMLHttpRequest, textStatus, errorThrown) {
             //alert(textStatus);
         }
     });


 });
 function GetParameterValues(param) {
     var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
     for (var i = 0; i

Read more from this Story