PageSourceSearch

https://starrcompanies.cl/-/media/Themes/Starr/Starr/Starr-Base-Theme/Scripts/traveldepositdate.js

js starrcompanies.cl collected 2026-09-30 22:03:34 UTC 50,672 bytes, 1,344 lines download raw bytes

1var plantypeselect_text = $("#plantypeselect").find("option:selected").text();
2if (plantypeselect_text == "Cuba") {
3    $("#travel_forms8").show();
4} else {
5    $("#travel_forms8").hide();
6}
7
8function plantypeselectcuba(seltext) {
9
10    if (seltext.options[seltext.selectedIndex].text == "Cuba") {
11        $("#travel_forms8").show();
12        $("#cubaselecterror").hide();
13
14    } else {
15        $("#travel_forms8").hide();
16
17    }
18
19}
20
21$("#cubaselectlist").on("change", function () {
22
23    var cubaselectlist_val = document.getElementById("cubaselectlist").value;
24
25    if (cubaselectlist_val.length == 0) {
26        var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
27        $("#cubaselecterror").html(validation_icon + 'Select Purpose of Trip');
28        $("#cubaselecterror").show();
29
30    } else if (cubaselectlist_val.length !== 0) {
31        $("#cubaselecterror").html();
32        $("#cubaselecterror").hide();
33
34
35    }
36});
37
38$("#residentstateselect").on("change", function () {
39    var residentstateselect = $("#residentstateselect").val();
40
41
42    if (residentstateselect.length == 0) {
43        var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
44
45        $("#residentstateselecterror").html(validation_icon + 'Please select a state');
46        $("#residentstateselecterror").show();
47
48    } else if (residentstateselect.length !== 0) {
49        $("#residentstateselecterror").html();
50        $("#residentstateselecterror").hide();
51
52
53    }
54});
55
56$("#plantypeselect").on("change", function () {
57
58    var plantypeselect = document.getElementById("plantypeselect").value;
59
60    if (plantypeselect.length == 0) {
61        var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
62
63        $("#plantypeselecterror").html(validation_icon + 'Please select a country');
64        $("#plantypeselecterror").show();
65
66    } else if (plantypeselect.length !== 0) {
67        $("#plantypeselecterror").html();
68        $("#plantypeselecterror").hide();
69
70
71    }
72
73
74});
75
76
77var travelsRadios_value = document.getElementsByName("travelsRadios");
78
79for (var i = 0, length = travelsRadios_value.length; i < length; i++) {
80    if (travelsRadios_value[i].checked) {
81        // do whatever you want with the checked radio
82        // console.log(travelsRadios_value[i].value);
83        // console.log("fdfdf");
84        if (travelsRadios_value[i].value == 2) {
85
86
87
88            $('#agelabel').html('Age ( Traveler 1 )');
89            $('#tripcostlabel').html('Trip Cost ( Traveler 1 )');
90            $("#traveldateslabelRental").hide();
91			$("#airTicketCostMessage").hide();
92
93        } else if (travelsRadios_value[i].value == 1) {
94
95            $('#agelabel').html('Age ( Traveler 1 )');
96
97        } else if (travelsRadios_value[i].value == 4) {
98
99            $('#agelabel').html('Age ( Traveler 1 )');
100            $('#tripcostlabel').html('Air Ticket Cost ( Traveler 1 )');
101
102        }
103
104        break;
105    }
106}
107
108$("#travel_forms1").show();
109$("#travel_forms2").show();
110$("#travel_forms3").hide();
111$("#travel_forms4").show();
112$("#travel_forms5").show();
113$("#travel_forms6").show();
114$("#travel_forms7").show();
115
116
117
118
119$("#getstart").click(function () {
120    $(".getstartshow").show();
121    $(".agentcode").show();
122    $(".formangleup").show();
123    $("#but_add").show();
124    $("#indformbtn").show();
125    $("#getstart").hide();
126
127});
128
129$("#contentslide1forms .formangleup").click(function () {
130    $(".getstartshow").hide();
131    $(".agentcode").hide();
132    $(".formangleup").hide();
133    $("#but_add").hide();
134    $("#indformbtn").hide();
135    $("#getstart").show();
136    $("#residentstateselecterror").hide();
137    $("#plantypeselecterror").hide();
138    $("#travedDatesselecterror").hide();
139    $(".primarytravelererrorright").hide();
140    $(".primarytravelererrorleft").hide();
141    $("#travedDatesselect").val('');
142    $('#TripDepositDateselect').val("");
143    $('#policystartdate').val("");
144    $('#residentstateselect').val("");
145    $('#plantypeselect').val("");
146    $('#primarytravelerstripcost_').val("");
147    $('#primarytravelersage_').val("");
148    $("#tripDeposidateselecterror").hide();
149});
150
151jQuery("#travelsRadios,#travelsRadios1,#travelsRadios2").click(function () {
152    $('#residentstateselect').val("");
153    $('#plantypeselect').val("");
154    $('#primarytravelersage_').val("");
155    $('#primarytravelerstripcost_').val("");
156    $('#cubaselectlist').val("");
157
158});
159
160
161//jQuery("#travelsRadios").click('clickRange.daterangepicker', function (ev, picker) {
162//    alert("testing");
163
164
165//});
166/*$('input[name="travelsRadios"]').on('clickRange.daterangepicker', function (ev, picker) {
167    alert("inside function");
168    picker.setStartDate({});
169    picker.setEndDate({});
170});*/
171
172
173jQuery('#TripDepositDateselect').val("");
174jQuery('#policystartdate').val("");
175jQuery("#travelsRadios").click(function () {
176    $('#TripDepositDateselect').val("");
177    $('#policystartdate').val("");
178});
179
180
181$("input[name='travelsRadios']").click(function () {
182
183    var travelsRadios_value = document.getElementsByName("travelsRadios");
184
185    for (var i = 0, length = travelsRadios_value.length; i < length; i++) {
186        if (travelsRadios_value[i].checked) {
187            // do whatever you want with the checked radio
188            // console.log(travelsRadios_value[i].value);
189            // console.log("fdfdf");
190            if (travelsRadios_value[i].value == 2) {
191
192                var plantypeselect_text = $("#plantypeselect").find("option:selected").text();
193                // console.log(plantypeselect_text);
194                if (plantypeselect_text == "Cuba") {
195                    $("#travel_forms8").show();
196                } else {
197                    $("#travel_forms8").hide();
198                }
199
200                function plantypeselectcuba(seltext) {
201
202                    if (seltext.options[seltext.selectedIndex].text == "Cuba") {
203                        $("#travel_forms8").show();
204                    } else {
205                        $("#travel_forms8").hide();
206                    }
207
208                }
209                $("#travel_forms1").show();
210                $("#travel_forms2").show();
211                $("#travel_forms3").hide();
212                $("#travel_forms4").show();
213                $("#travel_forms5").show();
214                $("#travel_forms6").show();
215                $("#travel_forms6").removeClass("travel_forms6");
216                $("#travel_forms7").show();
217                $("#but_add").show();
218
219                $('#agelabel').html('Age ( Traveler 1 )');
220                $('#tripcostlabel').html('Trip Cost ( Traveler 1 )');
221
222                $(".scrollbarstarrtravel1").removeClass("scrollbarstarrtravel");
223                $(".scrollbarstarrtravel-forceoverflow1").removeClass("scrollbarstarrtravel-forceoverflow");
224
225
226                $(".getstartshow").show();
227                $(".agentcode").show();
228                $(".formangleup").show();
229                $("#but_add").show();
230                $("#indformbtn").show();
231                $("#getstart").hide();
232                $("#traveldateslabel").show();
233                $("#traveldateslabelRental").hide();
234				$("#tripCostMessage").show();
235				$("#airTicketCostMessage").hide();
236
237            } else if (travelsRadios_value[i].value == 1) {
238
239
240
241                $("#travel_forms1").show();
242                $("#travel_forms2").hide();
243                $("#travel_forms3").show();
244                $("#travel_forms4").hide();
245                $("#travel_forms5").hide();
246                $("#travel_forms6").show();
247                $("#travel_forms6").addClass("travel_forms6");
248                $("#travel_forms7").hide();
249                $("#travel_forms8").hide();
250
251                $("#but_add").show();
252
253                $('#agelabel').html('Age ( Traveler 1 )');
254
255                $(".scrollbarstarrtravel1").removeClass("scrollbarstarrtravel");
256                $(".scrollbarstarrtravel-forceoverflow1").removeClass("scrollbarstarrtravel-forceoverflow");
257
258                $(".getstartshow").show();
259                $(".agentcode").show();
260                $(".formangleup").show();
261                $("#but_add").show();
262                $("#indformbtn").show();
263                $("#getstart").hide();
264                $("#traveldateslabel").show();
265                $("#traveldateslabelRental").hide();
266				$("#tripCostMessage").show();
267				$("#airTicketCostMessage").hide();
268
269
270            } else if (travelsRadios_value[i].value == 4) {
271
272                var plantypeselect_text = $("#plantypeselect").find("option:selected").text();
273                if (plantypeselect_text == "Cuba") {
274                    $("#travel_forms8").show();
275                } else {
276                    $("#travel_forms8").hide();
277                }
278
279                function plantypeselectcuba(seltext) {
280
281                    if (seltext.options[seltext.selectedIndex].text == "Cuba") {
282                        $("#travel_forms8").show();
283                    } else {
284                        $("#travel_forms8").hide();
285                    }
286
287                }
288
289
290
291
292                $("#travel_forms1").show();
293                $("#travel_forms2").show();
294                $("#travel_forms3").hide();
295                $("#travel_forms4").show();
296                $("#travel_forms5").show();
297                $("#travel_forms6").show();
298                $("#travel_forms6").removeClass("travel_forms6");
299                $("#travel_forms7").show();
300                $("#but_add").show();
301
302                $('#agelabel').html('Age ( Traveler 1 )');
303                $('#tripcostlabel').html('Air Ticket Cost ( Traveler 1 )');
304
305                $(".scrollbarstarrtravel1").removeClass("scrollbarstarrtravel");
306                $(".scrollbarstarrtravel-forceoverflow1").removeClass("scrollbarstarrtravel-forceoverflow");
307
308                $(".getstartshow").show();
309                $(".agentcode").show();
310                $(".formangleup").show();
311                $("#but_add").show();
312                $("#indformbtn").show();
313                $("#getstart").hide();
314                $("#traveldateslabel").show();
315                $("#traveldateslabelRental").hide();
316				$("#tripCostMessage").hide();
317				$("#airTicketCostMessage").show();
318
319            } else if (travelsRadios_value[i].value == 3) {
320
321                $("#travel_forms1").show();
322                $("#travel_forms2").show();
323                $("#travel_forms3").hide();
324                $("#travel_forms4").show();
325                $("#travel_forms5").hide();
326                $("#travel_forms6").hide();
327                $("#travel_forms6").removeClass("travel_forms6");
328                $("#travel_forms7").hide();
329				$("#travel_forms8").hide();
330                $("#but_add").hide();
331
332                $(".scrollbarstarrtravel1").removeClass("scrollbarstarrtravel");
333                $(".scrollbarstarrtravel-forceoverflow1").removeClass("scrollbarstarrtravel-forceoverflow");
334
335                $(".getstartshow").show();
336                $(".agentcode").show();
337                $(".formangleup").show();
338                $("#indformbtn").show();
339                $("#getstart").hide();
340                $("#traveldateslabelRental").show();
341                $("#traveldateslabel").hide();
342				$("#tripCostMessage").show();
343				$("#airTicketCostMessage").hide();
344            }
345            break;
346        }
347    }
348
349});
350
351
352//Hide validation message while switching radio buttton
353$(".starrradios .form-check-input").on("click", function () {
354    $("#residentstateselecterror").hide();
355    $("#plantypeselecterror").hide();
356    $("#travedDatesselecterror").hide();
357    $(".primarytravelererrorright").hide();
358    $(".primarytravelererrorleft").hide();
359    $("#error_msg").hide();
360    $("#travedDatesselect").val('');
361    $("#tripDeposidateselecterror").hide();
362    $("#policystartdatesselecterror").hide();
363});
364
365$("#indformbtn").on("click", function () {
366
367    var primarytravelerslength = $(".primarytravelers").length;
368
369    for (ind = 1; ind < primarytravelerslength; ind++) {
370
371        var starflag = true;
372
373        this.primarytravelersage_values = document.getElementById("primarytravelersage_" + ind).value;
374
375        $('#primarytravelersage_' + ind).each(function () {
376
377
378
379            if ($(this).val() > 85 || $(this).val() <= 0) {
380
381                flag = false;
382                return false;
383                var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
384                $(this).parent().find("#primarytravelererrorleft" + ind).html(validation_icon + 'Traveler age must be between 1 and 85');
385                $(this).parent().find("#primarytravelererrorleft" + ind).show();
386
387            }
388
389
390
391        })
392
393        if (this.primarytravelersage_values <= 85 && this.primarytravelersage_values > 0) {
394            $(this).parent().find("#primarytravelererrorleft" + ind).html();
395            $(this).parent().find("#primarytravelererrorleft" + ind).hide();
396
397        } else {
398            var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
399            $(this).parent().find("#primarytravelererrorleft" + ind).html(validation_icon + 'Traveler age must be between 1 and 85');
400            $(this).parent().find("#primarytravelererrorleft" + ind).show();
401
402        }
403
404
405
406
407    }
408
409    var air_primarytravelerslength = $(".air_primarytravelers").length;
410
411    for (ind = 1; ind < air_primarytravelerslength; ind++) {
412
413
414
415        $('#primarytravelerstripcost_' + ind).each(function () {
416
417            this.tripcost = $(this).val().replace(/,/g, '').substring(1);
418
419
420
421            if (this.tripcost > 25000 || this.tripcost <= 0) {
422
423
424                var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
425                $(this).parent().find("#primarytravelererrorright" + ind).html(validation_icon + 'Must be between $1 and $25,000');
426                $(this).parent().find("#primarytravelererrorright" + ind).show();
427
428                flag = false;
429                return false;
430
431
432
433            }
434
435
436
437        })
438
439        if (primarytravelerstripcost_values_clone <= 25000 && primarytravelerstripcost_values_clone > 0) {
440
441            $("#primarytravelererrorright").html();
442            $("#primarytravelererrorright").hide();
443
444        } else {
445            var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
446            $("#primarytravelererrorright").html(validation_icon + 'Must be between $1 and $25,000');
447            $("#primarytravelererrorright").show();
448
449        }
450
451    }
452
453
454    var primarytravelerstripcost_values_dollar_clone = document.getElementById("primarytravelerstripcost_").value;
455
456
457
458    var primarytravelerstripcost_values_dollar_comma_remove = primarytravelerstripcost_values_dollar_clone.replace(/,/g, '');
459
460    //var primarytravelerstripcost_values_dollar_remove = primarytravelerstripcost_values_comma_remove.substring(1,primarytravelerstripcost_values_dollar_remove.length);
461
462    var primarytravelerstripcost_values_clone = primarytravelerstripcost_values_dollar_comma_remove.substring(1);
463
464
465    if (primarytravelerstripcost_values_clone <= 25000 && primarytravelerstripcost_values_clone > 0) {
466
467        $("#primarytravelererrorright").html();
468        $("#primarytravelererrorright").hide();
469
470    } else {
471        var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
472        $("#primarytravelererrorright").html(validation_icon + 'Must be between $1 and $25,000');
473        $("#primarytravelererrorright").show();
474
475
476    }
477
478    var residentstateselect = $("#residentstateselect").val();
479    let residentstateselecterror = document.getElementById('residentstateselecterror');
480
481    var plantypeselect = $("#plantypeselect").val();
482    let plantypeselecterror = document.getElementById('plantypeselecterror');
483
484    var travedDatesselect_input = $("#travedDatesselect").val();
485    var travedDatesselecterror = document.getElementById('travedDatesselecterror');
486
487
488    if (residentstateselect.length == 0) {
489        var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
490
491        $("#residentstateselecterror").html(validation_icon + 'Please select a state');
492        $("#residentstateselecterror").show();
493
494    } else if (residentstateselect.length !== 0) {
495        $("#residentstateselecterror").html();
496        $("#residentstateselecterror").hide();
497
498
499    }
500
501
502    if (plantypeselect.length == 0) {
503        var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
504
505        $("#plantypeselecterror").html(validation_icon + 'Please select a country');
506        $("#plantypeselecterror").show();
507
508    } else if (plantypeselect.length !== 0) {
509        $("#plantypeselecterror").html();
510        $("#plantypeselecterror").hide();
511
512
513    }
514
515
516
517
518    var primarytravelersage_values = document.getElementById("primarytravelersage_").value;
519
520    if (primarytravelersage_values <= 85 && primarytravelersage_values > 0) {
521        $(this).parent().find("#primarytravelererrorleft").html();
522        $(this).parent().find("#primarytravelererrorleft").hide();
523
524    } else {
525        var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
526        $(this).parent().find("#primarytravelererrorleft").html(validation_icon + 'Traveler age must be between 1 and 85');
527        $(this).parent().find("#primarytravelererrorleft").show();
528
529    }
530
531    var travedDatesselect_input = document.getElementById("travedDatesselect").value;
532
533    if (travedDatesselect_input.length !== 0) {
534
535
536        $("#travedDatesselecterror").html();
537
538        $("#travedDatesselecterror").hide();
539
540
541    } else {
542        var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
543
544        $("#travedDatesselecterror").html(validation_icon + 'The Travel Dates  field is required.');
545        $("#travedDatesselecterror").show();
546
547    }
548
549    var tripDepositDateselect_input = document.getElementById("TripDepositDateselect").value;
550
551    if (tripDepositDateselect_input.length !== 0) {
552
553        $("#tripDeposidateselecterror").html();
554
555        $("#tripDeposidateselecterror").hide();
556
557    } else {
558        var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
559
560        $("#tripDeposidateselecterror").html(validation_icon + 'The Tripdeposit Dates  field is required.');
561        $("#tripDeposidateselecterror").show();
562
563    }
564    var policystartdateselect_input = document.getElementById("policystartdate").value;
565
566    if (policystartdateselect_input.length !== 0) {
567
568        $("#policystartdatesselecterror").html();
569
570        $("#policystartdatesselecterror").hide();
571
572    } else {
573        var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
574
575        $("#policystartdatesselecterror").html(validation_icon + 'The Policy Dates  field is required.');
576        $("#policystartdatesselecterror").show();
577
578    }
579
580    var plantypeselect_text = $("#plantypeselect").find("option:selected").text();
581    if (plantypeselect_text == "Cuba") {
582        $("#travel_forms8").show();
583    } else {
584        $("#travel_forms8").hide();
585    }
586
587    function plantypeselectcuba(seltext) {
588
589        if (seltext.options[seltext.selectedIndex].text == "Cuba") {
590            $("#travel_forms8").show();
591        } else {
592            $("#travel_forms8").hide();
593        }
594
595    }
596
597    var travelsRadios_value = document.getElementsByName("travelsRadios");
598
599    for (var i = 0, length = travelsRadios_value.length; i < length; i++) {
600        if (travelsRadios_value[i].checked) {
601
602            if (travelsRadios_value[i].value == 2) {
603
604                var plantypeselect_text = $("#plantypeselect").find("option:selected").text();
605                if (plantypeselect_text == "Cuba") {
606                    $("#travel_forms8").show();
607                } else {
608                    $("#travel_forms8").hide();
609                }
610
611                var cubaselectlist_val = document.getElementById("cubaselectlist").value;
612
613                if (cubaselectlist_val.length == 0) {
614                    var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
615                    $("#cubaselecterror").html(validation_icon + 'Select Purpose of Trip');
616                    $("#cubaselecterror").show();
617                } else {
618                    $("#cubaselecterror").html();
619                    $("#cubaselecterror").hide();
620
621                }
622
623                var plantypeselect_text = $("#plantypeselect").find("option:selected").text();
624                if (plantypeselect_text == "Cuba") {
625                    var cubaselectlist_val = document.getElementById("cubaselectlist").value;
626                    if (cubaselectlist_val.length == "" || residentstateselect.length == "" || plantypeselect.length == "" || travedDatesselect_input.length == "" || primarytravelersage_values.length == "" || primarytravelersage_values <= 85 || primarytravelerstripcost_values_clone.length == "") {
627
628                        event.preventDefault();
629
630
631                    }
632                    // if (cubaselectlist_val.length != 0 && residentstateselect.length != 0 && plantypeselect.length != 0 && primarytravelersage_values > 0 && primarytravelersage_values <= 85 && primarytravelerstripcost_values_clone <= 25000 && primarytravelerstripcost_values_clone > 0) {
633                    //     //event.preventDefault();
634                    //     $.ajax({
635                    //         type: 'POST',
636                    //         url: `Travel-Assitance.html`,
637                    //         success: function(data) {
638                    //             //  console.log(data);
639                    //             $(".submitloadicon").css('visibility', 'visible');
640                    //             window.location.href = "Travel-Assitance.html";
641                    //         },
642                    //         error: function() {
643                    //             $(".submitloadicon").css('visibility', 'hidden');
644                    //         }
645                    //     }).done(function() {
646                    //         setTimeout(function() {
647                    //             $(".submitloadicon").css('visibility', 'hidden');
648                    //         }, 8000);
649                    //     });
650
651                    // }
652
653                } else {
654                    if (residentstateselect.length == "" || plantypeselect.length == "" || travedDatesselect_input.length == "" || primarytravelersage_values.length == "" || primarytravelersage_values <= 85 || primarytravelerstripcost_values_clone.length == "") {
655
656                        event.preventDefault();
657
658
659                    }
660                    // if (residentstateselect.length != 0 && plantypeselect.length != 0 && primarytravelersage_values > 0 && primarytravelersage_values <= 85 && primarytravelerstripcost_values_clone <= 25000 && primarytravelerstripcost_values_clone > 0) {
661                    //     //event.preventDefault();
662                    //     $.ajax({
663                    //         type: 'POST',
664                    //         url: `Travel-Assitance.html`,
665                    //         success: function(data) {
666                    //             //  console.log(data);
667                    //             $(".submitloadicon").css('visibility', 'visible');
668                    //             window.location.href = "Travel-Assitance.html";
669                    //         },
670                    //         error: function() {
671                    //             $(".submitloadicon").css('visibility', 'hidden');
672                    //         }
673                    //     }).done(function() {
674                    //         setTimeout(function() {
675                    //             $(".submitloadicon").css('visibility', 'hidden');
676                    //         }, 8000);
677                    //     });
678
679                    // }
680                }
681
682                //console.log("radio1"); 
683                if (residentstateselect.length == "" || plantypeselect.length == "" || travedDatesselect_input.length == "" || primarytravelersage_values.length == "" || primarytravelersage_values <= 85 || primarytravelerstripcost_values_clone.length == "") {
684
685                    event.preventDefault();
686
687
688                }
689
690
691
692
693            } else if (travelsRadios_value[i].value == 1) {
694                //console.log("radio2"); 
695
696                if (residentstateselect.length == "" || primarytravelersage_values.length == "") {
697
698                    event.preventDefault();
699
700
701                }
702
703
704
705                // if (residentstateselect.length != 0 && primarytravelersage_values > 0 && primarytravelersage_values <= 85) {
706                //     //event.preventDefault();
707                //     $.ajax({
708                //         type: 'POST',
709                //         url: `Travel-Assitance.html`,
710                //         success: function(data) {
711                //             //  console.log(data);
712                //             $(".submitloadicon").css('visibility', 'visible');
713                //             window.location.href = "Travel-Assitance.html";
714                //         },
715                //         error: function() {
716                //             $(".submitloadicon").css('visibility', 'hidden');
717                //         }
718                //     }).done(function() {
719                //         setTimeout(function() {
720                //             $(".submitloadicon").css('visibility', 'hidden');
721                //         }, 8000);
722                //     });
723
724                // }
725            } else if (travelsRadios_value[i].value == 4) {
726
727                var plantypeselect_text = $("#plantypeselect").find("option:selected").text();
728                if (plantypeselect_text == "Cuba") {
729                    $("#travel_forms8").show();
730                } else {
731                    $("#travel_forms8").hide();
732                }
733
734                var cubaselectlist_val = document.getElementById("cubaselectlist").value;
735
736                if (cubaselectlist_val.length == 0) {
737                    var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
738                    $("#cubaselecterror").html(validation_icon + 'Select Purpose of Trip');
739                    $("#cubaselecterror").show();
740                } else {
741                    $("#cubaselecterror").html();
742                    $("#cubaselecterror").hide();
743
744                }
745
746                var plantypeselect_text = $("#plantypeselect").find("option:selected").text();
747                if (plantypeselect_text == "Cuba") {
748                    var cubaselectlist_val = document.getElementById("cubaselectlist").value;
749                    if (cubaselectlist_val.length == "" || residentstateselect.length == "" || plantypeselect.length == "" || travedDatesselect_input.length == "" || primarytravelersage_values.length == "" || primarytravelersage_values <= 85 || primarytravelerstripcost_values_clone.length == "") {
750
751                        event.preventDefault();
752
753
754                    }
755                    // if (cubaselectlist_val.length != 0 && residentstateselect.length != 0 && plantypeselect.length != 0 && travedDatesselect_input.length != 0 && primarytravelersage_values > 0 && primarytravelersage_values <= 85 && primarytravelerstripcost_values_clone <= 25000 && primarytravelerstripcost_values_clone > 0) {
756                    //     //event.preventDefault();
757                    //     $.ajax({
758                    //         type: 'POST',
759                    //         url: `Travel-Assitance.html`,
760                    //         success: function(data) {
761                    //             //  console.log(data);
762                    //             $(".submitloadicon").css('visibility', 'visible');
763                    //             window.location.href = "Travel-Assitance.html";
764                    //         },
765                    //         error: function() {
766                    //             $(".submitloadicon").css('visibility', 'hidden');
767                    //         }
768                    //     }).done(function() {
769                    //         setTimeout(function() {
770                    //             $(".submitloadicon").css('visibility', 'hidden');
771                    //         }, 8000);
772                    //     });
773
774                    // }
775
776                } else {
777                    if (residentstateselect.length == "" || plantypeselect.length == "" || travedDatesselect_input.length == "" || primarytravelersage_values.length == "" || primarytravelersage_values <= 85 || primarytravelerstripcost_values_clone.length == "") {
778
779                        event.preventDefault();
780
781
782                    }
783                    // if (residentstateselect.length != 0 && plantypeselect.length != 0 && travedDatesselect_input.length != 0 && primarytravelersage_values > 0 && primarytravelersage_values <= 85 && primarytravelerstripcost_values_clone <= 25000 && primarytravelerstripcost_values_clone > 0) {
784                    //     //event.preventDefault();
785                    //     $.ajax({
786                    //         type: 'POST',
787                    //         url: `Travel-Assitance.html`,
788                    //         success: function(data) {
789                    //             //  console.log(data);
790                    //             $(".submitloadicon").css('visibility', 'visible');
791                    //             window.location.href = "Travel-Assitance.html";
792                    //         },
793                    //         error: function() {
794                    //             $(".submitloadicon").css('visibility', 'hidden');
795                    //         }
796                    //     }).done(function() {
797                    //         setTimeout(function() {
798                    //             $(".submitloadicon").css('visibility', 'hidden');
799                    //         }, 8000);
800                    //     });
801
802                    // }
803                }
804
805                //console.log("radio1"); 
806                if (residentstateselect.length == "" || plantypeselect.length == "" || travedDatesselect_input.length == "" || primarytravelersage_values.length == "" || primarytravelersage_values <= 85 || primarytravelerstripcost_values_clone.length == "") {
807
808                    event.preventDefault();
809
810
811                }
812
813
814
815
816            } else if (travelsRadios_value[i].value == 3) {
817
818                var plantypeselect_text = $("#plantypeselect").find("option:selected").text();
819                if (plantypeselect_text == "Cuba") {
820                    $("#travel_forms8").show();
821                } else {
822                    $("#travel_forms8").hide();
823                }
824
825                var cubaselectlist_val = document.getElementById("cubaselectlist").value;
826
827                if (cubaselectlist_val.length == 0) {
828                    var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
829                    $("#cubaselecterror").html(validation_icon + 'Select Purpose of Trip');
830                    $("#cubaselecterror").show();
831                } else {
832                    $("#cubaselecterror").html();
833                    $("#cubaselecterror").hide();
834
835                }
836
837                var plantypeselect_text = $("#plantypeselect").find("option:selected").text();
838                if (plantypeselect_text == "Cuba") {
839                    var cubaselectlist_val = document.getElementById("cubaselectlist").value;
840                    if (cubaselectlist_val.length == "" || residentstateselect.length == "" || plantypeselect.length == "" || travedDatesselect_input.length == "") {
841
842                        event.preventDefault();
843
844
845                    }
846                    // if (cubaselectlist_val.length != 0 && residentstateselect.length != 0 && plantypeselect.length != 0 && travedDatesselect_input.length != 0) {
847                    //     //event.preventDefault();
848                    //     $.ajax({
849                    //         type: 'POST',
850                    //         url: `Travel-Assitance.html`,
851                    //         success: function(data) {
852                    //             //  console.log(data);
853                    //             $(".submitloadicon").css('visibility', 'visible');
854                    //             window.location.href = "Travel-Assitance.html";
855                    //         },
856                    //         error: function() {
857                    //             $(".submitloadicon").css('visibility', 'hidden');
858                    //         }
859                    //     }).done(function() {
860                    //         setTimeout(function() {
861                    //             $(".submitloadicon").css('visibility', 'hidden');
862                    //         }, 8000);
863                    //     });
864
865                    // }
866
867                } else {
868                    if (residentstateselect.length == "" || plantypeselect.length == "" || travedDatesselect_input.length == "" || primarytravelersage_values.length == "" || primarytravelersage_values <= 85 || primarytravelerstripcost_values_clone.length == "") {
869
870                        event.preventDefault();
871
872
873                    }
874                    // if (residentstateselect.length != 0 && plantypeselect.length != 0 && travedDatesselect_input.length != 0) {
875                    //     //event.preventDefault();
876                    //     $.ajax({
877                    //         type: 'POST',
878                    //         url: `Travel-Assitance.html`,
879                    //         success: function(data) {
880                    //             //  console.log(data);
881                    //             $(".submitloadicon").css('visibility', 'visible');
882                    //             window.location.href = "Travel-Assitance.html";
883                    //         },
884                    //         error: function() {
885                    //             $(".submitloadicon").css('visibility', 'hidden');
886                    //         }
887                    //     }).done(function() {
888                    //         setTimeout(function() {
889                    //             $(".submitloadicon").css('visibility', 'hidden');
890                    //         }, 8000);
891                    //     });
892
893                    // }
894                }
895
896                //console.log("radio1"); 
897                if (residentstateselect.length == "" || plantypeselect.length == "" || travedDatesselect_input.length == "") {
898
899                    event.preventDefault();
900
901
902                }
903
904
905
906
907            }
908
909            break;
910        }
911    }
912
913
914
915
916});
917
918
919
920
921$('#but_add').click(function () {
922
923
924
925    if ($(".input-form.primarytraveler.primarytravelers").length <= 8 || $(".air_primarytravelers").length <= 8) {
926
927
928
929
930        var lastname_id = $('.input-form input[type=text]:nth-child(1)').last().attr('id');
931        var split_id = lastname_id.split('_');
932
933        // New index
934        var index = Number(split_id[1]) + 1;
935
936        var index1 = index + 1;
937        // Create clone
938        var newel = $('.input-form:last').clone(true);
939
940        //document.getElementById("primarytravelertitle").innerHTML = index;
941
942
943        // $(newel).find('#tripcostlabel').html('Trip Cost ( Traveler ' + index1 + ' )');
944        // Set id of new element
945
946
947        $(newel).find('.primarytravelererrorleft').attr("id", "primarytravelererrorleft" + index).addClass("primarytravelererrorleft_clone").hide();
948
949
950        // Set value
951        $(newel).find('input[type=text]:nth-child(1)').val("");
952
953
954        // Insert element
955        $(newel).insertAfter(".input-form:last");
956
957        // $('.primarytravelers.primarytraveler span.removeclones:first').hide();
958        // $('.primarytravelers.primarytraveler  span.removeclones').hide();
959        // $('.primarytravelers.primarytraveler span.removeclones:last').show();
960
961
962
963
964        var airlastname_id = $('.air_primarytravelers input[type=text]:nth-child(1)').last().attr('id');
965        var airsplit_id = airlastname_id.split('_');
966
967        // New index
968        var airindex = Number(airsplit_id[1]) + 1;
969
970        var airindex1 = airindex + 1;
971        // Create clone
972        var airnewel = $('.air_primarytravelers:last').clone(true);
973
974        //document.getElementById("primarytravelertitle").innerHTML = index;
975
976
977
978
979        $(airnewel).find('input[type=text]:nth-child(1)').attr("id", "primarytravelerstripcost_" + airindex).addClass("primarytravelerstripcost");
980
981
982        $(airnewel).find('.primarytravelererrorright').attr("id", "primarytravelererrorright" + airindex).addClass("primarytravelererrorright_clone").hide();
983
984
985        // Set value
986        $(airnewel).find('input[type=text]:nth-child(1)').val("");
987
988
989        // Insert element
990        $(airnewel).insertAfter(".air_primarytravelers:last");
991
992        $('.air_primarytravelers span.airremoveclones:first').hide();
993        $('.air_primarytravelers span.airremoveclones').hide();
994        $('.air_primarytravelers span.airremoveclones:last').show();
995        // $('.primarytravelercostremove:first').hide();
996
997
998        $(".scrollbarstarrtravel1").addClass("scrollbarstarrtravel");
999        $("#scrollbarstarrtravel1").attr("id", "scrollbarstarrtravel");
1000        $(".scrollbarstarrtravel-forceoverflow1").addClass("scrollbarstarrtravel-forceoverflow");
1001
1002
1003        var travelsRadios_value = document.getElementsByName("travelsRadios");
1004
1005        for (var i = 0, length = travelsRadios_value.length; i < length; i++) {
1006            if (travelsRadios_value[i].checked) {
1007
1008                if (travelsRadios_value[i].value == 2) {
1009                    $(newel).find('#agelabel').html('Age ( Traveler ' + airindex1 + ' )');
1010
1011                    $(airnewel).find('#tripcostlabel').html('Trip Cost ( Traveler ' + airindex1 + ' )');
1012
1013                    $('.primarytravelers.primarytraveler .removeclones').hide();
1014
1015                    $(newel).find('input[type=text]:nth-child(1)').attr("id", "primarytravelersage_" + index).addClass("primarytravelersage");
1016
1017
1018
1019                } else if (travelsRadios_value[i].value == 1) {
1020                    $(newel).find('#agelabel').html('Age ( Traveler ' + index1 + ' )');
1021                    $(airnewel).find('#tripcostlabel').html('Trip Cost ( Traveler ' + airindex1 + ' )');
1022
1023                    $('.primarytravelers.primarytraveler span.removeclones:first').hide();
1024                    $('.primarytravelers.primarytraveler  span.removeclones').hide();
1025                    $('.primarytravelers.primarytraveler span.removeclones:last').show();
1026
1027                    $(newel).find('input[type=text]:nth-child(1)').attr("id", "primarytravelersage_" + index).addClass("primarytravelersageannual");
1028
1029                    $('.primarytravelererrorleft_clone').css('width', '92%');
1030
1031                } else if (travelsRadios_value[i].value == 4) {
1032                    $(newel).find('#agelabel').html('Age ( Traveler ' + airindex1 + ' )');
1033                    $(airnewel).find('#tripcostlabel').html('Air Ticket Cost ( Traveler ' + airindex1 + ' )');
1034
1035                    $('.primarytravelers.primarytraveler .removeclones').hide();
1036
1037                    $(newel).find('input[type=text]:nth-child(1)').attr("id", "primarytravelersage_" + index).addClass("primarytravelersage");
1038
1039
1040                } else if (travelsRadios_value[i].value == 3) {
1041                    $('.primarytravelers.primarytraveler .removeclones').hide();
1042
1043                }
1044                break;
1045            }
1046        }
1047
1048
1049        $("#primarytravelersage_" + index).keypress(function (e) {
1050            if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
1051                return false;
1052            }
1053        });
1054
1055
1056
1057
1058        $("#primarytravelersage_" + index).keyup(function () {
1059
1060            this.primarytravelersage_values = document.getElementById("primarytravelersage_" + index).value;
1061
1062
1063
1064            if (this.primarytravelersage_values <= 85 && this.primarytravelersage_values > 0) {
1065                $(this).parent().find("#primarytravelererrorleft" + index).html();
1066                $(this).parent().find("#primarytravelererrorleft" + index).hide();
1067
1068            } else {
1069                var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
1070                $(this).parent().find("#primarytravelererrorleft" + index).html(validation_icon + 'Traveler age must be between 1 and 85');
1071                $(this).parent().find("#primarytravelererrorleft" + index).show();
1072
1073            }
1074        });
1075
1076
1077        $("#primarytravelerstripcost_" + airindex).keyup(function () {
1078
1079
1080
1081            var primarytravelerstripcost_values_dollar_clone = document.getElementById("primarytravelerstripcost_" + airindex).value;
1082
1083
1084
1085            var primarytravelerstripcost_values_dollar_comma_remove = primarytravelerstripcost_values_dollar_clone.replace(/,/g, '');
1086
1087
1088            var primarytravelerstripcost_values_clone = primarytravelerstripcost_values_dollar_comma_remove.substring(1);
1089
1090
1091            if (primarytravelerstripcost_values_clone <= 25000 && primarytravelerstripcost_values_clone > 0) {
1092                $(this).parent().find("#primarytravelererrorright" + airindex).html();
1093                $(this).parent().find("#primarytravelererrorright" + airindex).hide();
1094
1095            } else {
1096                var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
1097                $(this).parent().find("#primarytravelererrorright" + airindex).html(validation_icon + 'Must be between $1 and $25,000');
1098                $(this).parent().find("#primarytravelererrorright" + airindex).show();
1099
1100
1101            }
1102
1103        });
1104
1105        // function checkForInput(element) { // element is passed to the function 
1106        //     const $label = $(element).siblings('label');
1107        //     if ($(element).val().length > 0) {
1108        //         $label.addClass('input-has-value');
1109        //     } else {
1110        //         $label.removeClass('input-has-value');
1111        //     }
1112        // }
1113        // $('input.text-trip-cost').each(function() {
1114        //     checkForInput(this);
1115        // }); // The lines below (inside) are executed on change & keyup
1116        // $('input.text-trip-cost').on('change keyup', function() {
1117        //     checkForInput(this);
1118        // });
1119
1120
1121
1122    }
1123
1124
1125
1126});
1127
1128
1129
1130
1131$(".form-check.form-check-inline.starrradios").click(function () {
1132    // $('.col-lg-4.input-form.primarytravelers .primarytraveler  span.removeclones').hide();
1133    $('.primarytravelers.primarytraveler span.removeclones').first().hide();
1134    $('.primarytravelers').not(':first').remove();
1135    $('.primarytravelers.primarytraveler span.removeclones').not(':first').last().show();
1136
1137    $('.air_primarytravelers span.airremoveclones').first().hide();
1138    $('.air_primarytravelers').not(':first').remove();
1139    $('.air_primarytravelers span.airremoveclones').not(':first').last().show();
1140});
1141
1142jQuery(".starrradios .form-check-input").click(function () {
1143    $('#TripDepositDateselect').val("");
1144    $('#policystartdate').val("");
1145    $('#residentstateselect').val("");
1146    $('#plantypeselect').val("");
1147    $('#primarytravelerstripcost_').val("");
1148});
1149
1150$("#removeclones").click(function () {
1151    // $('.col-lg-4.input-form.primarytravelers .primarytraveler  span.removeclones').hide();
1152    $('.primarytravelers.primarytraveler span.removeclones').first().hide();
1153    $('.primarytravelers').not(':first').last().remove();
1154    $('.primarytravelers.primarytraveler span.removeclones').not(':first').last().show();
1155
1156    var wwlength = $(".input-form.primarytraveler.primarytravelers").length;
1157
1158    if (wwlength == 1) {
1159        $(".scrollbarstarrtravel1").removeClass("scrollbarstarrtravel");
1160        $(".scrollbarstarrtravel-forceoverflow1").removeClass("scrollbarstarrtravel-forceoverflow");
1161    }
1162
1163});
1164
1165
1166
1167$("#airremoveclones").click(function () {
1168
1169    $('.primarytravelers.primarytraveler span.removeclones').first().hide();
1170    $('.primarytravelers').not(':first').last().remove();
1171    $('.primarytravelers.primarytraveler span.removeclones').not(':first').last().show();
1172
1173
1174    $('.air_primarytravelers span.airremoveclones').first().hide();
1175    $('.air_primarytravelers').not(':first').last().remove();
1176    $('.air_primarytravelers span.airremoveclones').not(':first').last().show();
1177
1178    $('.primarytravelers.primarytraveler .removeclones').hide();
1179
1180    var wwlength = $(".input-form.primarytraveler.primarytravelers").length;
1181
1182    if (wwlength == 1) {
1183        $(".scrollbarstarrtravel1").removeClass("scrollbarstarrtravel");
1184        $(".scrollbarstarrtravel-forceoverflow1").removeClass("scrollbarstarrtravel-forceoverflow");
1185    }
1186
1187    var wwwlength = $(".air_primarytravelers").length;
1188
1189    if (wwwlength == 1) {
1190        $(".scrollbarstarrtravel1").removeClass("scrollbarstarrtravel");
1191        $(".scrollbarstarrtravel-forceoverflow1").removeClass("scrollbarstarrtravel-forceoverflow");
1192    }
1193
1194});
1195
1196
1197$("#primarytravelererrorleft").hide();
1198$("#primarytravelererrorright").hide();
1199
1200
1201
1202$("#primarytravelersage_").keypress(function (e) {
1203    if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
1204        return false;
1205    }
1206});
1207
1208
1209$("#primarytravelersage_").keyup(function () {
1210    var primarytravelersage_values = document.getElementById("primarytravelersage_").value;
1211
1212    if (primarytravelersage_values <= 85 && primarytravelersage_values > 0) {
1213        $(this).parent().find("#primarytravelererrorleft").html();
1214        $(this).parent().find("#primarytravelererrorleft").hide();
1215
1216    } else {
1217        var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
1218        $(this).parent().find("#primarytravelererrorleft").html(validation_icon + 'Traveler age must be between 1 and 85');
1219        $(this).parent().find("#primarytravelererrorleft").show();
1220
1221    }
1222});
1223
1224
1225$("#primarytravelerstripcost_").on({
1226    keyup: function () {
1227        formatCurrency($(this));
1228    },
1229    // change: function () {
1230    //     formatCurrency($(this), "change");
1231    // }
1232});
1233
1234
1235
1236function formatNumber(n) {
1237    // format number 1000000 to 1,234,567
1238    return n.replace(/\D/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")
1239}
1240
1241
1242function formatCurrency(input) {
1243    // appends $ to value, validates decimal side
1244    // and puts cursor back in right position.
1245
1246    // get input value
1247    var input_val = input.val();
1248
1249    // don't validate empty input
1250    if (input_val === "") {
1251        return;
1252    }
1253
1254    // original length
1255    var original_len = input_val.length;
1256
1257    // initial caret position 
1258    var caret_pos = input.prop("selectionStart");
1259
1260    // check for decimal
1261    if (input_val.indexOf(".") >= 0) {
1262
1263        // get position of first decimal
1264        // this prevents multiple decimals from
1265        // being entered
1266        var decimal_pos = input_val.indexOf(".");
1267
1268        // split number by decimal point
1269        var left_side = input_val.substring(0, decimal_pos);
1270        var right_side = input_val.substring(decimal_pos);
1271
1272        // add commas to left side of number
1273        left_side = formatNumber(left_side);
1274
1275        // validate right side
1276        right_side = formatNumber(right_side);
1277
1278
1279
1280
1281        // join number by .
1282        input_val = "$";
1283
1284    } else {
1285        // no decimal entered
1286        // add commas to number
1287        // remove all non-digits
1288        input_val = formatNumber(input_val);
1289        input_val = "$  " + input_val;
1290
1291
1292    }
1293
1294    // send updated string to input
1295    input.val(input_val);
1296
1297    // put caret back in the right position
1298    var updated_len = input_val.length;
1299    caret_pos = updated_len - original_len + caret_pos;
1300    input[0].setSelectionRange(caret_pos, caret_pos);
1301}
1302
1303
1304$("#primarytravelerstripcost_").keyup(function () {
1305
1306    var primarytravelerstripcost_values_dollar = document.getElementById("primarytravelerstripcost_").value;
1307
1308    var primarytravelerstripcost_values_comma_remove = primarytravelerstripcost_values_dollar.replace(/,/g, '');
1309
1310    //var primarytravelerstripcost_values_dollar_remove = primarytravelerstripcost_values_comma_remove.substring(1,primarytravelerstripcost_values_dollar_remove.length);
1311
1312    var primarytravelerstripcost_values = primarytravelerstripcost_values_comma_remove.substring(1);
1313
1314    if (primarytravelerstripcost_values <= 25000 && primarytravelerstripcost_values > 0) {
1315        $(this).parent().find("#primarytravelererrorright").html();
1316        $(this).parent().find("#primarytravelererrorright").hide();
1317    } else {
1318        var validation_icon = "<i class='fa fa-caret-up validation_icon_top' aria-hidden='true'></i>";
1319        $(this).parent().find("#primarytravelererrorright").html(validation_icon + 'Must be between $1 and $25,000');
1320        $(this).parent().find("#primarytravelererrorright").show();
1321
1322    }
1323
1324});
1325
1326$(".drp-selected1").on("click", function () {
1327    $(".daterangepicker.ltr.show-calendar.opensright").hide();
1328});
1329// $("#travedDatesselect").on("click", function () {
1330//     $(".daterangepicker.ltr.show-calendar.opensright").show();
1331// });
1332
1333var btnstarr = $('.angleup');
1334
1335btnstarr.on('click', function (e) {
1336    e.preventDefault();
1337    $('html, body').animate({
1338        scrollTop: 0
1339    }, '300');
1340});
1341
1342
1343
1344

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.