document.write (''); document.write (''); document.write (''); document.write (''); document.write (''); document.write (''); document.write (''); var stateCA = new Array(13); stateCA[0] = ""; stateCA[1] = ""; stateCA[2] = ""; stateCA[3] = ""; stateCA[4] = ""; stateCA[5] = ""; stateCA[6] = ""; stateCA[7] = ""; stateCA[8] = ""; stateCA[9] = ""; stateCA[10] = ""; stateCA[11] = ""; stateCA[12] = ""; stateCA[13] = ""; var stateUS = new Array(54); stateUS[0] = ""; stateUS[1] = ""; stateUS[2] = ""; stateUS[3] = ""; stateUS[4] = ""; stateUS[5] = ""; stateUS[6] = ""; stateUS[7] = ""; stateUS[8] = ""; stateUS[9] = ""; stateUS[10] = ""; stateUS[11] = ""; stateUS[12] = ""; stateUS[13] = ""; stateUS[14] = ""; stateUS[15] = ""; stateUS[16] = ""; stateUS[17] = ""; stateUS[18] = ""; stateUS[19] = ""; stateUS[20] = ""; stateUS[21] = ""; stateUS[22] = ""; stateUS[23] = ""; stateUS[24] = ""; stateUS[25] = ""; stateUS[26] = ""; stateUS[27] = ""; stateUS[28] = ""; stateUS[29] = ""; stateUS[30] = ""; stateUS[31] = ""; stateUS[32] = ""; stateUS[33] = ""; stateUS[34] = ""; stateUS[35] = ""; stateUS[36] = ""; stateUS[37] = ""; stateUS[38] = ""; stateUS[39] = ""; stateUS[40] = ""; stateUS[41] = ""; stateUS[42] = ""; stateUS[43] = ""; stateUS[44] = ""; stateUS[45] = ""; stateUS[46] = ""; stateUS[47] = ""; stateUS[48] = ""; stateUS[49] = ""; stateUS[50] = ""; stateUS[51] = ""; stateUS[52] = ""; stateUS[53] = ""; stateUS[54] = ""; jQuery(document).ready(function($) { $(".progressBar").each(function(index) {var currId = $(this).attr('id');$(this).wrap("
");$(this).css("display", "block");$(this).css("width", "0%");});$("#birthday").datepicker({ changeYear: true, dateFormat: "mm/dd/yy", minDate: "-100Y", maxDate: 0, yearRange: "1900:" + new Date().getFullYear() }); }); if(typeof FORM_MESSAGES == 'undefined') FORM_MESSAGES = {}; jQuery(document).ready(function($) { /******************************************************************************* * Format answer blocks' width according to the question text width ******************************************************************************/ $.formatAnswers = function() { var answerList = $("#surveyStart div.answerBlock"); $.each(answerList, function(key, val) { if ($(val).prev().css("display") == "inline-block") { var questWidth = $(val).prev().css("width").replace("px", ""); var containerWidth = $(val).closest("#surveyStart").css("width").replace("px", ""); $(val).css("width", (parseInt(containerWidth) - parseInt(questWidth) - 70) + "px");// -70 because of the naviBar width } }); } $.applyInlineForIE7 = function() { $.each($("#surveyStart > div > div"), function(key, val) { if ($(val).prev().css("display") == "inline-block") $(val).prev().addClass("inlineIE7"); }); } $.formatAnswers(); $.applyInlineForIE7(); /******************************************************************************* * Registration fields logic ******************************************************************************/ $('#surveyStart .datepicker').each(function() { if ($(this).val() != "") { // Converts Java date format back to datepicker format var myDate = new Date($(this).val()); var month = (myDate.getMonth()+1); var day = myDate.getDate(); if (month < 10) month = "0" + month; if (day < 10) day = "0" + day; $(this).val(month + "/" + day + "/" + myDate.getFullYear()); } var options = { changeYear: true }; if ($(this).hasClass("showAlways")) options.altField = 'input#date' + $(this).attr('id'); if ($(this).closest('.packageBlock').length > 0) options.minDate = +1; if ($(this).hasClass("packageAddon")){ // add liquid to be executed on the second pass to inject reservation Dates // liquid timestamps are in seconds so we need to multiply by 1000 try{ var checkIn = +""; var checkOut = +""; if(checkIn > 0){ options.minDate = new Date(checkIn * 1000); } if(checkOut > 0){ options.maxDate = new Date(checkOut * 1000); } }catch(e){} } $(this).datepicker(options); }); $('#surveyStart select#country').change(function(){ selectedCountry = $('#surveyStart #country :selected').val(); if (selectedCountry == 'CA') { var newHtmlCA = ""; $('#surveyStart #fieldBlockstate > div.fieldBlockInput').html(newHtmlCA); } else if (selectedCountry == 'US') { var newHtmlUS = ""; $('#surveyStart #fieldBlockstate > div.fieldBlockInput').html(newHtmlUS); } else { var newHtml = ""; $('#surveyStart #fieldBlockstate > div.fieldBlockInput').html(newHtml); } }); $("#surveyStart [id^=homePhone]").keyup(function(){ if(this.value.length == $(this).attr('maxlength')) { var inputs = $(this).closest('form').find(':input'); inputs.eq( inputs.index(this)+ 1 ).focus(); } }); $("#surveyStart [id^=officePhone]").keyup(function(){ if(this.value.length == $(this).attr('maxlength')) { var inputs = $(this).closest('form').find(':input'); inputs.eq( inputs.index(this)+ 1 ).focus(); } }); $("#surveyStart [id^=cellPhone]").keyup(function(){ if(this.value.length == $(this).attr('maxlength')) { var inputs = $(this).closest('form').find(':input'); inputs.eq( inputs.index(this)+ 1 ).focus(); } }); $("#surveyStart [id^=faxNumber]").keyup(function(){ if(this.value.length == $(this).attr('maxlength')) { var inputs = $(this).closest('form').find(':input'); inputs.eq( inputs.index(this)+ 1 ).focus(); } }); /******************************************************************************* * Add a selectAll and DeselectAll button for multiple Answer questions ******************************************************************************/ $("#surveyStart .selectAll").click(function() { $(this).parent().find("input[type='checkbox']").attr("checked", true); }); $("#surveyStart .deselectAll").click(function() { $(this).parent().find("input[type='checkbox']").attr("checked", false); }); /******************************************************************************* * Add opt in wording to the form ******************************************************************************/ try{ var wording = ""; var parent = $("#surveyStart input[name=optinCheckbox]").parent(); if(parent.is("div")){ // handle new surveys wording = parent.find("label")[0].textContent.trim(); }else{ // handle legacy surveys wording = parent.text().trim(); } $("").appendTo('form'); }catch(err){} /******************************************************************************* * Remove all the hidden questions to not submit them to the form controller ******************************************************************************/ $("#surveyStart > #submitButton > input[type='DONATE'], #surveyStart > #submitButton > button[type='DOANTE']").click(function() { $.each($("#surveyStart > div.questionBlock"), function(key, val) { if ($(val).css("display") == "none") $(val).remove(); }); }); $("#surveyStart > #unsubscribeButton > input[type='DONATE'], #surveyStart > #unsubscribeButton > button[type='DONATE']").click(function() { $.each($("#surveyStart > div.questionBlock"), function(key, val) { if ($(val).css("display") == "none") $(val).remove(); }); $("").appendTo('form'); }); /******************************************************************************* * Trigger the click event on each of the checked inputs to unhide questions ******************************************************************************/ $("#surveyStart input:checked").each(function() { $(this).trigger("click"); $(this).prop('checked', true); } ); /******************************************************************************* * Check / Uncheck radio buttons ******************************************************************************/ $('#surveyStart :radio').click(function() { var previousValue = $(this).attr('previousValue'); if(previousValue == 'true' || previousValue == 'checked') $(this).attr('checked', false).attr('previousValue', false); else { $(this).closest(".radioGroup").find(':radio').attr('previousValue', false); $(this).attr('previousValue', true); } }); $('fieldset.highlightLeft div.ui-radio, fieldset.starPicker div.ui-radio').click(function() { var remove = false; if($(this).find('label').hasClass('ui-btn-active')) remove = true; $(this).find('label').removeClass('ui-btn-highlighted'); var elem = $(this).prev(); while(elem.length > 0) { if(remove) elem.find('label').removeClass('ui-btn-highlighted'); else elem.find('label').addClass('ui-btn-highlighted'); elem = elem.prev(); } elem = $(this).next(); while(elem.length > 0) { elem.find('label').removeClass('ui-btn-highlighted'); elem = elem.next(); } }); $('fieldset.highlightLeft div.ui-radio input, fieldset.starPicker div.ui-radio input').each(function() { if($(this).is(':checked')) { var $uiRadio = $(this).closest('div.ui-radio'); var elem = $uiRadio.prev(); while(elem.length > 0) { elem.find('label').addClass('ui-btn-highlighted'); elem = elem.prev(); } } }); $.each($('.zd-slider'), function() { var emoji = []; var values = []; var name; var selectedVal; $.each($(this).find('.zd-slider-hidden input'), function(index) { emoji.push($(this).parent().find('label[for='+$(this).attr('id')+']').html()); values.push($(this).attr('value')); name = $(this).attr('name'); if($(this).is(':checked')) selectedVal = index; }); if(selectedVal == undefined) selectedVal = Math.floor(emoji.length/2); $(this).find('.zd-top-slider') .slider({ max: emoji.length-1, value: selectedVal }) .slider("pips", { rest: "label", labels: emoji }) .on("slidechange", function( e, ui ) { var input = $('.zd-slider .zd-slider-hidden input[name="'+name+'"][value="'+values[ui.value]+'"]'); input.prop('checked', true).trigger("click"); }); }); try { $('fieldset div.ui-checkbox input[type=checkbox]').checkboxradio('refresh'); } catch(e) {} $('fieldset.highlightLeft div.ui-radio, fieldset.starPicker div.ui-radio').mouseenter(function() { var elem = $(this).prev(); while(elem.length > 0) { elem.find('label').addClass('ui-btn-hovered'); elem = elem.prev(); } }).mouseleave(function() { var elem = $(this); while(elem.length > 0) { elem.find('label').removeClass('ui-btn-hovered'); elem = elem.prev(); } elem = $(this).next(); while(elem.length > 0) { elem.find('label').removeClass('ui-btn-hovered'); elem = elem.next(); } }); }); /******************************************************************************* * new validation only for new forms contains
* or element on the form
******************************************************************************/ function replaceValidationUI( form ) { form.addEventListener( "invalid", function( event ) { event.preventDefault(); }, true ); form.addEventListener( "submit", function( event ) { if ( !this.checkValidity() ) { event.preventDefault(); } }); var submitButton = form.querySelector( "button:not([type=button]), input[type=submit]" ); submitButton.addEventListener( "click", function( event ) { var invalidFields = form.querySelectorAll( ":invalid" ), errorMessages = form.querySelectorAll( ".error-message" ), parent; for ( var i = 0; i < errorMessages.length; i++ ) { errorMessages[ i ].parentNode.removeChild( errorMessages[ i ] ); } for ( var i = 0; i < invalidFields.length; i++ ) { invalidFields[ i ].addEventListener( "blur", function( event ) { var error = this.nextSibling; if(error && this.checkValidity()){ error.style.display = 'none'; }else if(error){ error.style.display = 'block'; } }); data_error = invalidFields[ i ].getAttribute("data-error"); data_name = invalidFields[ i ].name; parent = invalidFields[ i ].parentNode; if(data_error){ msg= data_error; }else{ msg = invalidFields[ i ].validationMessage ; } parent.insertAdjacentHTML( "beforeend", "

" + msg +"

" ); } if ( invalidFields.length > 0 ) { invalidFields[ 0 ].focus(); } }); } $(document).ready(function() { var forms = document.querySelectorAll( "form" ); var forms_element_validation = document.getElementById( "validation-err" ); if(forms_element_validation ){ console.log("new validationn"); for ( var i = 0; i < forms.length; i++ ) { console.log(i); replaceValidationUI( forms[ i ] ); } var form = document.querySelector('form'); var isValidForm = form.checkValidity(); } if(document.getElementsByClassName("datepickermask").length >0 ){ $('input.datepickermask').datepicker({ altFormat: "dd/mm/yy", dateFormat: "dd/mm/yy", beforeShow: function(input, inst) { var calendar = inst.dpDiv; setTimeout(function() { calendar.position({ my: 'right top', at: 'right bottom', collision: 'none', of: input } ); } , 1); } } ); $('input.datepicker').mask('01/01/2022',{ autoclear: false} ); } $("form input.animation-label, form textarea.animation-label").on("blur input focus", function() { var $field = $(this).closest(".fieldBlock"); if (this.value) { $field.addClass("filled"); } else { $field.removeClass("filled"); } }); $("form input.animation-label, form textarea.animation-label").on("focus", function() { var $field = $(this).closest(".fieldBlock"); if (this) { $field.addClass("filled"); }else { $field.removeClass("filled"); } }); }); jQuery(document).ready(function($) { $('form').on('submit', function() { var formData = {}; if(document.getElementsByName('surveyId').length > 0){ formData['surveyId'] = document.getElementsByName('surveyId')[0].value; } if(document.getElementsByName('landingPageId').length > 0){ formData['landingPageId'] = document.getElementsByName('landingPageId')[0].value; } formData['iframeSrc'] = window.location.href; parent.postMessage(JSON.stringify({ 'event': 'gms-form-submit', 'formData': formData }), '*'); }); }); document.write(''); document.write (''); document.write (''); document.write (''); document.write ('
YOUR EMAIL ADDRESS
Email:

Yes, opt me in to receive updates about Gildred Hot Seat IIED Lawsuit, insider tips, and more.

'); document.write ('');