PageSourceSearch

https://www.teflonline.net/js/function.js?v=20240628

js teflonline.net collected 2026-09-29 15:48:38 UTC 99,011 bytes, 2,343 lines download raw bytes

1/**
2 *
3 * Custom function
4 *
5 */
6
7(function ($) {
8
9    /*
10     *	Funzione per rendere un box tutto cliccabile. ATTENZIONE: all'interno del box deve esserci un unico link non in target blank
11     */
12
13    function allClick() {
14
15        var clickbox = $('.allclick');
16
17        clickbox.each(function () {
18            var $this = $(this);
19            $this.css('cursor', 'pointer');
20            $this.find('a').on('click', function (event) {
21                event.preventDefault();
22            });
23
24            $this.on('click', function (event) {
25                if ($this.is('.blank')) {
26                    window.open($('a', this).attr('href'), '_blank');
27                } else {
28
29                    if ($('a', this).attr('href').indexOf('#') == 0) {
30                        event.preventDefault();
31                        var anchor = $('a', this).attr('href');
32                        $(anchor).animatescroll({ padding: 80 });
33                    } else if (!$('a[data-rel*= "lightgallery"]', this))
34                        window.open($('a', this).attr('href'), '_self');
35                    else
36                        $('a', this).trigger('click');
37
38                }
39            });
40
41        });
42    }
43
44
45    var video_wrapper = $('.youtube-video-place');//  Check to see if youtube wrapper exists
46    if (video_wrapper.length) {// If user clicks on the video wrapper load the video.
47        $('.play-youtube-video').on('click', function () {
48            $(this).parent().html('<iframe allowfullscreen="" width="560" height="315" frameborder="0" class="embed-responsive-item" src="' + $(this).parent().data('yt-url') + '"></iframe>');
49        });
50    }
51
52    /*
53     *	Funzione per la gestione dei bottoni "condividi" legati ai social
54     */
55
56    function socialOpen() {
57        $('[data-socialurl]').each(function () {
58            var $this = $(this),
59                url = $this.attr('data-socialurl');
60
61            $this.on('click', function () {
62                window.open(url, '', 'width=500');
63            });
64        });
65    }
66
67
68    /*
69     *	Funzione per la formattazione e resa del responsive su tabelle e iframe
70     */
71
72    function responsiveElements() {
73        $('.entry-content table').each(function () {
74            var $this = $(this);
75            $this.addClass('table table-striped table-responsive');
76        });
77
78        $('.entry-content iframe.embed-responsive-item').each(function () {
79            var $this = $(this);
80            $this.wrap('<div class="embed-responsive embed-responsive-16by9"></div>');
81        });
82    }
83
84
85    /*
86     *	Animazione link con ancora
87     */
88    function linkScroll() {
89        $('a[href^="#"]').each(function () {
90            $(this).on('click', function (event) {
91                event.preventDefault();
92                var anchor = $(this).attr('href');
93                var id = $(this).attr('id');
94                if (id) {
95                    $('#' + id.replace('id', 'zf')).animatescroll({ padding: 180 });
96                } else {
97                    $(anchor).animatescroll({ padding: 120 });
98                }
99            });
100        });
101    }
102/*
103    function linkScroll() {
104        $('a[href^="#"]').each(function () {
105            $(this).on('click', function (event) {
106                event.preventDefault();
107                var anchor = $(this).attr('href');
108                if (anchor !== '#') {
109                    $(anchor).animatescroll({ padding: 120 });
110                }
111            });
112        });
113    }
114*/
115
116    /*
117     *	Animazione header allo scroll
118     */
119
120    function scrollAnimations() {
121        var header = $('header.site-header'),
122            scrollpoint = 0,
123            scrolltop = 0;
124
125        if (!$j('body.mobile') && $(window).width() > 767.98) {
126            if ($j('body.home')) {
127                $(window).on('scroll', function () {
128                    scrolltop = $(window).scrollTop();
129                    if (scrolltop >= $('header.site-header').height() - $('header.site-header .container-menu').height())
130                        header.addClass('scroll');
131                    else
132                        header.removeClass('scroll');
133                });
134            } else {
135                //$('#page.site').css({'paddingTop': $('header.site-header').height()});
136                $(window).on('scroll', function () {
137                    scrolltop = $(window).scrollTop();
138                    if (scrolltop >= $('header.site-header .container-top-bar').outerHeight())
139                        header.addClass('scroll').css({ 'top': -$('header.site-header .container-top-bar').outerHeight() });
140                    else
141                        header.removeClass('scroll').css({ 'top': 0 });
142                });
143            }
144        }
145
146    }
147
148    /*
149     *	Attivazione del lightbox
150     */
151
152    function lightGalleryActivator() {
153
154        $(document).lightGallery({
155            selector: '[data-rel="lightgallery"]',
156            //mode 				: 'lg-zoom-in',
157            download: false,
158            mousewheel: false,
159            autoplay: false,
160            autoplayControls: false,
161            showThumbByDefault: false,
162            hash: false,
163            getCaptionFromTitleOrAlt: false,
164            //thumbnail			: false,
165        });
166
167        $('.container-tp-gallery').each(function () {
168
169            $(this).lightGallery({
170                selector: '[data-rel="lightgallery-gallery"]',
171                download: false,
172                mousewheel: false,
173                autoplay: false,
174                autoplayControls: false,
175                showThumbByDefault: false,
176                hash: false,
177                getCaptionFromTitleOrAlt: false,
178                //thumbnail			: false,
179            });
180
181        });
182
183        $(document).on('onAfterOpen.lg', function (event) {
184
185            $('html').css({
186                'overflow': 'hidden'
187            });
188
189        });
190
191        $(document).on('onCloseAfter.lg', function (event) {
192
193            $('html').css({
194                'overflow': 'visible'
195            });
196
197        });
198    }
199
200    /*
201     *	Animazione header allo scroll
202     */
203
204    function slideshowWindowSize() {
205
206        if ($j('body.home') && window.innerWidth > 767.98) {
207            if ($j('body.mobile')) {
208                $('header.site-header .container-header-side').outerHeight($(window).height() - $('header.site-header .container-top-bar').outerHeight() - 30);
209                $('header.site-header .container-header-slider .item').height($(window).height() - 30);
210            } else {
211                $('header.site-header .container-header-side').outerHeight($(window).height() - $('header.site-header .container-top-bar').outerHeight());
212                $('header.site-header .container-header-slider .item').height($(window).height());
213            }
214        }
215
216    }
217
218    $('.accordion_faq li').on('click', function (event) {
219        $('.accordion_faq li .content_accorddion').css('max-height', '0');
220        $(this).find('.content_accorddion').css('max-height', '1200px');
221        $(this).find('.content_accorddion').show();
222    });
223    /*
224     *	Gestione apertua e chiusura dello slideout menu
225     */
226
227    function toggleSlideoutMenu() {
228
229        $('#menu.mobile-menu').show();
230
231        var slideout = new Slideout({
232            'panel': document.getElementById('page'),
233            'menu': document.getElementById('menu'),
234            'padding': 256,
235            'tolerance': 70
236        });
237
238        $('.slideout-toggle-button').on('click', function () {
239            slideout.toggle();
240        });
241
242        $('.slideout-menu .menu-item-has-children').each(function () {
243
244            var $this = $(this);
245
246            $this.children('a').after('<span class="sub-menu-button"><i class="fa fa-caret-down"></i></span><div class="clearfix"></div>');
247
248            $this.children('.sub-menu-button').on('click', function () {
249                $(this).siblings('ul.sub-menu').slideToggle();
250            });
251
252            if ($this.children('a').attr('href') == '#') {
253                $this.children('a').on('click', function (event) {
254                    event.preventDefault();
255                    $(this).siblings('ul.sub-menu').slideToggle();
256                });
257            }
258
259        });
260
261    }
262
263
264    /*
265     *	Attivazione e gestione degli slider tramite Slick
266     */
267
268    function activateSlickCarousel() {
269
270        $('[data-slick-id="header-slider"], [data-slick-id="text-review-slider"]').each(function () {
271
272            $(this).slick({
273                fade: true,
274                slide: '.item',
275                adaptiveHeight: true,
276                infinite: true,
277                speed: 2000,
278                autoplay: true,
279                autoplaySpeed: 4000,
280                pauseOnHover: false,
281                arrows: false,
282                dots: false,
283                dots: true,
284                customPaging: function (slider, i) {
285                    return '';
286                },
287                appendDots: $('.container-pager', this),
288            });
289
290        });
291
292        $('[data-slick-id="small-courses-slider"]').slick({
293            fade: false,
294            vertical: true,
295            slide: '.item',
296            //slidesToShow	: 	3,
297            slidesToShow: 1,
298            slidesToScroll: 1,
299            adaptiveHeight: true,
300            infinite: true,
301            speed: 2000,
302            autoplay: true,
303            autoplaySpeed: 2000,
304            pauseOnHover: true,
305            arrows: true,
306            prevArrow: '<i class="fal fa-angle-up slick-arrow"></i>',
307            nextArrow: '<i class="fal fa-angle-down slick-arrow"></i>',
308            dots: false,
309        });
310
311        $('[data-slick-id="item-list-slider"]').each(function () {
312
313            $(this).slick({
314                fade: false,
315                vertical: true,
316                slide: '.item',
317                slidesToShow: 8,
318                slidesToScroll: 3,
319                adaptiveHeight: true,
320                infinite: true,
321                speed: 1000,
322                autoplay: false,
323                autoplaySpeed: 1000,
324                pauseOnHover: true,
325                arrows: true,
326                prevArrow: '<i class="fal fa-angle-up slick-arrow"></i>',
327                nextArrow: '<i class="fal fa-angle-down slick-arrow"></i>',
328                dots: false,
329                responsive: [
330                    {
331                        breakpoint: 2000,
332                        settings: "init",
333                    },
334                    {
335                        breakpoint: 1199.98,
336                        settings: "unslick",
337                    },
338                ]
339            });
340
341        });
342
343        $('[data-slick-id="video-review-slider"]').slick({
344            fade: false,
345            slide: '.item',
346            slidesToShow: 4,
347            slidesToScroll: 1,
348            infinite: true,
349            speed: 1000,
350            autoplay: false,
351            autoplaySpeed: 2000,
352            //centerMode		:	true,
353            swipe: false,
354            focusOnSelect: true,
355            arrows: true,
356            prevArrow: '<i class="fal fa-angle-left slick-arrow"></i>',
357            nextArrow: '<i class="fal fa-angle-right slick-arrow"></i>',
358            dots: false,
359            asNavFor: '[data-slick-id="video-review-slider-preview"]',
360        });
361
362        $('[data-slick-id="video-review-slider-preview"]').slick({
363            fade: true,
364            slide: '.item',
365            slidesToShow: 1,
366            slidesToScroll: 1,
367            adaptiveHeight: true,
368            speed: 1000,
369            autoplay: false,
370            arrows: false,
371            dots: false,
372            asNavFor: '[data-slick-id="video-review-slider"]',
373        });
374
375        $('[data-slick-id="video-review-slider-preview"]').on('beforeChange', function (event, slick) {
376            var currentSlide;
377            currentSlide = $(slick.$slider).find('.slick-current');
378            currentIframe = currentSlide.find('iframe');
379            currentIframe.attr('src', currentIframe.attr('src'));
380        });
381
382        $('[data-slick-item="jobs-carousel"]').slick({
383            fade: false,
384            slide: '.item',
385            slidesToScroll: 1,
386            variableWidth: true,
387            centerMode: true,
388            adaptiveHeight: true,
389            infinite: true,
390            speed: 2000,
391            autoplay: true,
392            autoplaySpeed: 4000,
393            pauseOnHover: true, /*
394             arrows			: 	true, 
395             prevArrow		:	'<i class="fal fa-angle-left slick-arrow"></i>',
396             nextArrow		:	'<i class="fal fa-angle-right slick-arrow"></i>',
397             dots			:	false,*/
398            arrows: false,
399            dots: true,
400            customPaging: function (slider, i) {
401                return '';
402            },
403            responsive: [
404                {
405                    breakpoint: 575.98,
406                    settings: {
407                        slidesToShow: 1,
408                        variableWidth: false,
409                        centerMode: true,
410                    }
411                },
412            ],
413        });
414
415    }
416
417
418
419    /*****************************************************************************************/
420
421    function toConsole(string) {
422        if ((typeof window.console == 'undefined')) {
423            alert(string);
424        } else
425            console.log(string);
426    }
427
428    function $j(argument) {
429        var result = jQuery(argument);
430        if (result.length == 0)
431            return null;
432        else
433            return result;
434    }
435
436
437    $j(window).on('load', function () {
438
439        console.log('START LAZY');
440        (function (w, d) {
441            var b = d.getElementsByTagName('body')[0];
442            var s = d.createElement("script");
443            var v = !("IntersectionObserver" in w) ? "8.17.0" : "10.19.0";
444            s.async = true; // This includes the script as async. See the "recipes" section for more information about async loading of LazyLoad.
445            s.src = "https://cdn.jsdelivr.net/npm/vanilla-lazyload@" + v + "/dist/lazyload.min.js";
446            w.lazyLoadOptions = { elements_selector: '.lazy', };
447            b.appendChild(s);
448        }(window, document));
449
450        if ($j('body.mobile'))
451            toggleSlideoutMenu();
452        allClick();
453        activateSlickCarousel();
454        //loadAsynchronousImage();
455        lightGalleryActivator();
456        linkScroll();
457        responsiveElements();
458
459        $('[data-toggle="tooltip"]').tooltip();
460
461        // Attivazione della convalida personalizzata dei form Contact Form 7
462
463        $('.wpcf7-form').each(function () {
464            $(this).wpcf7Check();
465        });
466
467        slideshowWindowSize();
468        scrollAnimations();
469
470        // 	Disattivazione cover loading
471
472        $("#loading-cover").fadeOut(1000);
473        $("#page").css({ "height": "auto" });
474
475        $(window).trigger('scroll');
476        socialOpen();
477
478        $('.container-location-switch .tab').each(function () {
479            $(this).click(function () {
480
481                if ($(this).not('.active')) {
482                    var key = $(this).data('tab');
483
484                    $('.container-location-switch .tab, .container-locations-maps .container-tab-content').removeClass('active');
485                    $('.container-location-switch .tab[data-tab="' + key + '"], .container-locations-maps .container-tab-content[data-tab="' + key + '"]').addClass('active');
486
487                    var position = $('.container-locations-maps .container-tab-content[data-tab="' + key + '"]').position();
488                    $('.container-locations-maps').css({ 'left': -position.left });
489
490                }
491            });
492        });
493
494        $('#type_of_course').addClass('green-border');
495
496        // Attraverso il Google Loader carico il modulo mappa
497
498        if ($j('[data-location]')) {
499
500            $.getScript('https://www.google.com/jsapi', function () {
501                google.load('maps', '3', {
502                    other_params: 'language=en&key=AIzaSyByCE-tqAFU02wpzGIACDfUngqsZlxcCIo', callback: function () {
503                        $('[data-location]').each(function () {
504
505                            var map = $(this).setCustomMap({
506                                data: $(this).data(),
507                                style: [
508                                    {
509                                        "featureType": "administrative",
510                                        "elementType": "labels.text.fill",
511                                        "stylers": [
512                                            {
513                                                "color": "#444444"
514                                            }
515                                        ]
516                                    },
517                                    {
518                                        "featureType": "landscape",
519                                        "elementType": "all",
520                                        "stylers": [
521                                            {
522                                                "color": "#f2f2f2"
523                                            }
524                                        ]
525                                    },
526                                    {
527                                        "featureType": "poi",
528                                        "elementType": "all",
529                                        "stylers": [
530                                            {
531                                                "visibility": "off"
532                                            }
533                                        ]
534                                    },
535                                    {
536                                        "featureType": "road",
537                                        "elementType": "all",
538                                        "stylers": [
539                                            {
540                                                "saturation": -100
541                                            },
542                                            {
543                                                "lightness": 45
544                                            }
545                                        ]
546                                    },
547                                    {
548                                        "featureType": "road.highway",
549                                        "elementType": "all",
550                                        "stylers": [
551                                            {
552                                                "visibility": "simplified"
553                                            }
554                                        ]
555                                    },
556                                    {
557                                        "featureType": "road.arterial",
558                                        "elementType": "labels.icon",
559                                        "stylers": [
560                                            {
561                                                "visibility": "off"
562                                            }
563                                        ]
564                                    },
565                                    {
566                                        "featureType": "transit",
567                                        "elementType": "all",
568                                        "stylers": [
569                                            {
570                                                "visibility": "off"
571                                            }
572                                        ]
573                                    },
574                                    {
575                                        "featureType": "water",
576                                        "elementType": "all",
577                                        "stylers": [
578                                            {
579                                                "color": "#89bdd3"
580                                            },
581                                            {
582                                                "visibility": "on"
583                                            }
584                                        ]
585                                    }
586                                ]
587                            });
588
589                        });
590                    }
591                });
592            });
593
594        }
595
596        //openModal();
597
598    });
599
600    $j(window).on('resize', function () {
601
602        slideshowWindowSize();
603
604        if (!$j('body.mobile'))
605            scrollAnimations();
606
607    });
608
609})(jQuery);
610
611
612/* form aplication */
613$('#jsForGlo').on('submit', function () {
614    //var message = 'Attention: all compulsory fields must be filled';
615    var message = original_message = 'Please check which fields haven\'t been completed yet (highlighted in <span class="red">red</span>)';
616    var error = false;
617    var title;
618
619
620    if (!error) {
621        error = !check_email($.trim($('#email').val()));
622        if (error) {
623            $('#email').addClass('error');
624        } else {
625            $('#email').removeClass('error');
626        }
627    }
628
629    $('#email').val($.trim($('#email').val()));
630    $('#email_conf').val($.trim($('#email_conf').val()));
631
632    if (!error && $('#email').val().toLowerCase() != $('#email_conf').val().toLowerCase()) {
633        error = true;
634        if (error) {
635            $('#email').addClass('error');
636            $('#email_conf').addClass('error');
637        }
638
639    } else if (!error && $('#email').val().toLowerCase() == $('#email_conf').val().toLowerCase()) {
640        $('#email').removeClass('error');
641        $('#email_conf').removeClass('error');
642    }
643
644    if ($('#type_of_course_combined').is(':checked')) {
645        var fields = new Array('combined_course', 'combined_first_date');
646        for (i in fields) {
647            console.log($('#' + fields[i]).val());
648            if (!$('#' + fields[i]).val()) {
649                error = true;
650                $('#' + fields[i]).addClass('error');
651                if (error) {
652                    message = original_message; //'All fields are compulsory.';
653                }
654            } else {
655                $('#' + fields[i]).removeClass('error');
656            }
657        }
658    } else if ($('#type_of_course_inclass').is(':checked')) {
659        var fields = new Array('first_choice', 'first_date');
660        for (i in fields) {
661            console.log($('#' + fields[i]).val());
662            if (!$('#' + fields[i]).val()) {
663                error = true;
664                $('#' + fields[i]).addClass('error');
665            } else {
666                $('#' + fields[i]).removeClass('error');
667            }
668        }
669        if (error) {
670            message = original_message; //'All fields are compulsory.';
671        }
672    } else if ($('#type_of_course_online').is(':checked')) {
673        var fields = new Array('online_course');
674        for (i in fields) {
675            if (!$('#' + fields[i]).val()) {
676                error = true;
677                $('#' + fields[i]).addClass('error');
678            } else {
679                $('#' + fields[i]).removeClass('error');
680            }
681        }
682    }
683    if (!error) {
684        if ($('#name').val().toLowerCase() != 'test' && $('#name').val() == $('#surname').val()) {
685            message = 'Attention: name can not coincide with surname.';
686            error = true;
687        }
688    }
689    if (error) {
690        $('#wait').modal('hide');
691        $('#field_incomplete').modal('show');
692        setTimeout(function () {
693            $('.modal-backdrop').hide();
694
695        }, 200);
696
697        jQuery.ajax({
698            type: 'POST',
699            url: '/apply_error',
700            data: $("#jsForGlo").serialize(),
701            success: function (dati) {
702                console.log('invio ok');
703            }
704        });
705        return false;
706    } else {
707        $('#wait').modal('show');
708        var ua = window.navigator.userAgent;
709        var msie = ua.indexOf("MSIE ");
710        var trident = ua.indexOf('Trident/');
711        var edge = ua.indexOf('Edge/');
712        if (msie > 0 || trident > 0 || edge > 0) {
713            // IE
714            $('#wait_img img').remove();
715            var pb = document.getElementById("wait_img");
716            pb.innerHTML = '<img  src="/images/loading_m.gif" width="100" height="100" />';
717            pb.style.display = '';
718        }
719        //$('#wait').show();
720        //Save form data for control
721        string_b64 = base64_encode($(this).serialize());
722        return true;
723    }
724    return false;
725});
726
727var FRtax = 0; // FIrst installments fee
728$('.jsOnlineCourse').on('change', function () {
729    var type = $('.jsOnlineCourse').val();
730    if (type == '120-hr course with Tutor & Videos: (for teaching abroad)'
731        || type == '170-hr course with Tutor & Videos: (for teaching abroad & online)') {
732        $('.jsAll').show();
733        $('.jsAll option[value="120 hr"]').prop('disabled', true);
734        if (type == '120-hr course with Tutor & Videos: (for teaching abroad)') {
735            $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English to young learners">Teaching English to young learners (CTEYL)</option><option value="Teaching business English">Teaching business English (CTBE)</option><option value="Teaching English Online">Teaching English Online (CTEO)</option>');
736        } else {
737            $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English to young learners">Teaching English to young learners (CTEYL)</option><option value="Teaching business English">Teaching business English (CTBE)</option>');
738        }
739    } else if (type == '370-hr diploma course: (TEFL/TESOL Certificate & Diploma)') {
740        $('.jsAll').show();
741        $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English to young learners">Teaching English to young learners (CTEYL)</option><option value="Teaching business English">Teaching business English (CTBE)</option><option value="Teaching English Online">Teaching English Online (CTEO)</option>');
742    } else if (type == '220-hr course with Tutor & Videos: (for teaching abroad  & Young Learners & Business English)'
743        || type == '470-hr diploma course: (TEFL/TESOL Certificate & Diploma-Young Learners & Business)') {
744        $('.jsAll').show();
745        $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English Online">Teaching English Online (CTEO)</option>');
746    }
747    else if (type == '550-hr diploma course:  (TEFL/TESOL Certificate & Diploma-Young Learners & Business + Practicum)') {
748        $('#additional_course').html('');
749        $('.jsAll').hide();
750        //$('.jsAll').show();
751        //$('#additional_course').html('<option value="Academy Planning">ITTT 50-hour Certification Course in ELT Academic Planning (AP)</option>');
752    }
753    else {
754        $('#additional_course').html('');
755        $('.jsAll').hide();
756    }
757
758    if (type !== '') {
759        var labels = $('.jsOnlineCourse option:selected').text().split('|');
760        if (labels[1]) {
761            $('.showinst').show(); // Inst
762            price = labels[1].replace(' ', '').replace('$', "");
763            price2 = Math.ceil(price / 2);
764            price3 = Math.ceil(price / 3);
765            price4 = Math.ceil(price / 4);
766            price5 = Math.ceil(price / 5);
767            first2 = price2 + FRtax;
768            first3 = price3 + FRtax;
769            if (FRtax > 0) {
770                ph_price2 = "monthly, each installment: $" + price2;
771                ph_price3 = "monthly, each installment: $" + price3;
772            } else {
773                ph_price2 = "monthly, each installment: $" + price2;
774                ph_price3 = "monthly, each installment: $" + price3;
775                ph_price4 = "(+ free course)<br>monthly, each installment: $" + price4;
776            }
777            if (type.indexOf('Diploma') !== -1) {
778                $('#inst_one').html(' $' + price);
779                $('#inst_two').html(' ' + ph_price2);
780                $('#inst_three').html(' ' + ph_price3);
781                $('#inst_four').html(' ' + ph_price4);
782                $('.diplomainst').hide(); // Inst
783            } else {
784                $('#inst_one').html(' $' + price);
785                $('#inst_two').html(' ' + ph_price2);
786                $('#inst_three').html(' ' + ph_price3);
787                $('#inst_four').html(' ' + ph_price4);
788                $('.diplomainst').hide(); // Inst
789            }
790            /*
791            $('#inst_one').html(' $' + price);
792            $('#inst_two').html(' $' + price2);
793            $('#inst_three').html(' $' + price3);
794            $('#inst_four').html(' $' + price4);
795            $('#inst_five').html(' $' + price5);
796            */
797            $('#amounttopay').val(price);
798            $('#green-arrow-online').hide();
799            $('#green-arrow-installments').show();
800        }
801    } else {
802        $('.showinst').hide(); // Inst
803        $('#inst_one').html();
804        $('#inst_two').html();
805        $('#inst_three').html();
806        $('#inst_four').html();
807        $('#inst_five').html();
808        $('#amounttopay').val(0);
809        $('#green-arrow-online').show();
810        $('#green-arrow-installments').hide();
811    }
812
813    if (type != '') {
814        $('.jsOnlineCourse').removeClass('green-border');
815    }
816});
817
818$('#c_infojobs option').on('mousedown', function (e) {
819    e.preventDefault();
820    $(this).toggleClass('selected');
821    $(this).prop('selected', !$(this).prop('selected'));
822    return false;
823});
824
825
826$('.jsTypeCourse').on('change', function () {
827    var type;
828    if ($('#type_of_course_online').is(':checked'))
829        type = 'Online Course';
830    else if ($('#type_of_course_inclass').is(':checked'))
831        type = 'Intensive Course';
832    else if ($('#type_of_course_combined').is(':checked'))
833        type = 'Combined Course';
834
835    $('.type_course').attr('style', '');
836    $('.type_course').parent().removeClass('wpcf7-form-control-error');
837
838    $('.jsInclass').each(function (item) {
839        $(this).find('.notifyjs-wrapper').trigger('click');
840    });
841    $(this).removeClass('error');
842
843    $('.jsOnline').each(function (item) {
844        $(this).find('.notifyjs-wrapper').trigger('click');
845    });
846    $(this).removeClass('error');
847
848    $('.jsCombined').each(function (item) {
849        $(this).find('.notifyjs-wrapper').trigger('click');
850    });
851    $(this).removeClass('error');
852
853    //var type = $('.jsTypeCourse').is(':checked').val();
854    if (type == 'Combined Course') {
855        /*if ($('#dip_rem').length > 0)
856         {
857         $('.jsAll option[value="Diploma in TESOL"]').unwrap('<span>').show();
858         }*/
859        $('.jsAll option[value="Diploma in TESOL"]').prop('disabled', false);
860        $('.jsAll option[value="120 hr"]').prop('disabled', true);
861
862        $('.jsTypeCombined').removeAttr('disabled');
863        $('.jsTypeInclass').attr('disabled', 'disabled');
864        $('.jsCombined').show();
865        $('.jsCombined select').each(function () {
866            if ($(this).val() == '') {
867                $(this).addClass('green-border');
868            }
869        });
870        $('.showinst').hide(); // Inst
871        $('#inst_one').html();
872        $('#inst_two').html();
873        $('#inst_three').html();
874        $('#inst_four').html();
875        $('#inst_five').html();
876        $('#amounttopay').val(0);
877        $('.jsAll').show();
878        $('.jsInclass').hide();
879        $("input:radio[name=installment]:checked")[0].checked = false;
880        $('.jsOnline').hide();
881        $('#for_amount').html('Amount (Deposit) $');
882        $('#amount').val(600);
883        $('#only_online_course').hide();
884        $('#why_tefl').attr('placeholder', 'Please briefly explain why you wish to take a TEFL course and your employment plans after you complete the course. *');
885        $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English to young learners">Teaching English to young learners (CTEYL)</option><option value="Teaching business English">Teaching business English (CTBE)</option><option value="Teaching English Online">Teaching English Online (CTEO)</option><option value="Diploma in TESOL">Diploma in TESOL</option>');
886        /*$('#education').show();
887         $('#language_knowledge').show();*/
888        $('#green-arrow').hide();
889        $('#green-arrow-combined').show();
890        $('#why_tefl').removeClass('wpcf7-validates-as-required');
891    } else if (type == 'Intensive Course') {
892
893        $('.jsAll option[value="Diploma in TESOL"]').prop('disabled', false);
894        $('.jsAll option[value="120 hr"]').prop('disabled', true);
895
896        $('.jsTypeCombined').attr('disabled', 'disabled');
897        $('.jsTypeInclass').removeAttr('disabled');
898        $('.jsCombined').hide();
899        $('.jsAll').show();
900        $('.jsInclass').show();
901        $('.jsInclass select').each(function () {
902            if ($(this).val() == '') {
903                $(this).addClass('green-border');
904            }
905        });
906        $('.jsOnline').hide();
907        $('.showinst').hide(); // Inst
908        $('#inst_one').html();
909        $('#inst_two').html();
910        $('#inst_three').html();
911        $('#inst_four').html();
912        $('#inst_five').html();
913        $('#amounttopay').val(0);
914        $('#for_amount').html('Amount (Deposit) $');
915        $("input:radio[name=installment]:checked")[0].checked = false;
916        $('#amount').val(600);
917        $('#only_online_course').hide();
918        $('#why_tefl').attr('placeholder', 'Please briefly explain why you wish to take a TEFL course and your employment plans after you complete the course. *');
919        $('#green-arrow').hide();
920        $('#green-arrow-inclass').show();
921        $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English to young learners">Teaching English to young learners (CTEYL)</option><option value="Teaching business English">Teaching business English (CTBE)</option><option value="Teaching English Online">Teaching English Online (CTEO)</option><option value="Diploma in TESOL">Diploma in TESOL</option>');
922        /*$('#education').show();
923         $('#language_knowledge').show();*/
924        $('#why_tefl').removeClass('wpcf7-validates-as-required');
925    } else if (type == 'Online Course') {
926        $('.jsAll option[value="Diploma in TESOL"]').wrap('<span id="dip_rem">').hide();
927        var type = $('.jsOnlineCourse').val();
928        if (type == '120-hr course with Tutor & Videos: (for teaching abroad)'
929            || type == '170-hr course with Tutor & Videos: (for teaching abroad & online)') {
930            $('.jsAll').show();
931
932            $('.jsAll option[value="120 hr"]').prop('disabled', true);
933            if (type == '120-hr course with Tutor & Videos: (for teaching abroad)') {
934                $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English to young learners">Teaching English to young learners (CTEYL)</option><option value="Teaching business English">Teaching business English (CTBE)</option><option value="Teaching English Online">Teaching English Online (CTEO)</option>');
935            } else {
936                $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English to young learners">Teaching English to young learners (CTEYL)</option><option value="Teaching business English">Teaching business English (CTBE)</option>');
937            }
938        } else if (type == '370-hr diploma course: (TEFL/TESOL Certificate & Diploma)') {
939            $('.jsAll').show();
940            $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English to young learners">Teaching English to young learners (CTEYL)</option><option value="Teaching business English">Teaching business English (CTBE)</option><option value="Teaching English Online">Teaching English Online (CTEO)</option>');
941        } else if (type == '220-hr course with Tutor & Videos: (for teaching abroad  & Young Learners & Business English)'
942            || type == '470-hr diploma course: (TEFL/TESOL Certificate & Diploma-Young Learners & Business)') {
943            $('.jsAll').show();
944            $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English Online">Teaching English Online (CTEO)</option>');
945        }
946        else if (type == '550-hr diploma course:  (TEFL/TESOL Certificate & Diploma-Young Learners & Business + Practicum)') {
947            $('#additional_course').html('');
948            $('.jsAll').hide();
949            //$('.jsAll').show();
950            //$('#additional_course').html('<option value="Academy Planning">ITTT 50-hour Certification Course in ELT Academic Planning (AP)</option>');
951        }
952        else {
953            $('#additional_course').html('');
954            $('.jsAll').hide();
955        }
956
957        if (type !== '') {
958            var labels = $('.jsOnlineCourse option:selected').text().split('|');
959            if (labels[1]) {
960                $('.showinst').show(); // Inst
961                price = labels[1].replace(' ', '').replace('$', "");
962                price2 = Math.ceil(price / 2);
963                price3 = Math.ceil(price / 3);
964                price4 = Math.ceil(price / 4);
965                price5 = Math.ceil(price / 5);
966                first2 = price2 + FXtax;
967                first3 = price3 + FXtax;
968                if (FRtax > 0) {
969                    ph_price2 = "monthly, each installment: $" + price2;
970                    ph_price3 = "monthly, each installment: $" + price3;
971                } else {
972                    ph_price2 = "monthly, each installment: $" + price2;
973                    ph_price3 = "monthly, each installment: $" + price3;
974                    ph_price4 = "(+ free course)<br>monthly, each installment: $" + price4;
975                }
976                if (type.indexOf('Diploma') !== -1) {
977                    $('#inst_one').html(' $' + price);
978                    $('#inst_two').html(' ' + ph_price2);
979                    $('#inst_three').html(' ' + ph_price3);
980                    $('#inst_four').html(' ' + ph_price4);
981                    $('.diplomainst').hide(); // Inst
982                } else {
983                    $('#inst_one').html(' $' + price);
984                    $('#inst_two').html(' ' + ph_price2);
985                    $('#inst_three').html(' ' + ph_price3);
986                    $('#inst_four').html(' ' + ph_price4);
987                    $('.diplomainst').hide(); // Inst
988                }
989                /*
990                $('#inst_one').html(' $' + price);
991                $('#inst_two').html(' $' + price2);
992                $('#inst_three').html(' $' + price3);
993                $('#inst_four').html(' $' + price4);
994                $('#inst_five').html(' $' + price5);
995                */
996                $('#amounttopay').val(price);
997                $('#green-arrow-online').hide();
998                $('#green-arrow-installments').show();
999            }
1000        } else {
1001            $('.showinst').hide(); // Inst
1002            $('#inst_one').html();
1003            $('#inst_two').html();
1004            $('#inst_three').html();
1005            $('#inst_four').html();
1006            $('#inst_five').html();
1007            $('#amounttopay').val(0);
1008            $('#green-arrow-online').show();
1009            $('#green-arrow-installments').hide();
1010        }
1011
1012        $('.jsTypeCombined').attr('disabled', 'disabled');
1013        $('.jsTypeInclass').attr('disabled', 'disabled');
1014        $('.jsCombined').hide();
1015        $('.jsInclass').hide();
1016        $('.jsOnline').show();
1017        $('.showP').hide();
1018        $('#only_online_course').show();
1019        $('#why_tefl').attr('placeholder', 'Please briefly explain why you wish to take a TEFL course and your employment plans after you complete the course.');
1020        /*$('#education').show();
1021         $('#language_knowledge').show();*/
1022        $('#why_tefl').removeClass('wpcf7-validates-as-required');
1023        $('#green-arrow').hide();
1024        var course = $('#online_course').val();
1025        var re = /^(\d)+ x.*/;
1026        var m = re.exec(course);
1027        if (m !== null) {
1028            $('.jsPartecipantsLabel').hide();
1029            $('.jsPartecipants').hide();
1030        }
1031        $('.jsAll').hide();
1032        $('#for_amount').html('Amount $');
1033        textval = $("#online_course option:selected").text();
1034        two_pie = textval.split(" - USD ");
1035        deposit = two_pie[1];
1036        $('#amount').val(deposit);
1037        if (type == '') {
1038            $('.jsOnlineCourse').addClass('green-border');
1039        }
1040    } else {
1041        $('.jsAll option[value="Diploma in TESOL"]').wrap('<span id="dip_rem">').hide();
1042        $('.jsTypeCombined').attr('disabled', 'disabled');
1043        $('.jsTypeInclass').attr('disabled', 'disabled');
1044        $('.jsCombined').hide();
1045        $('.jsInclass').hide();
1046        $('.jsOnline').hide();
1047        $('.showinst').hide(); // Inst
1048        $('#inst_one').html();
1049        $('#inst_two').html();
1050        $('#inst_three').html();
1051        $('#inst_four').html();
1052        $('#inst_five').html();
1053        $('#amounttopay').val(0);
1054        $('#additional_course').hide();
1055        $('.showP').hide();
1056    }
1057
1058    if ($('#type_of_course_online').is(':checked') || $('#type_of_course_inclass').is(':checked') || $('#type_of_course_combined').is(':checked')) {
1059        $('#type_course').removeClass('green-border');
1060        //$('#green-arrow').hide();
1061    } else {
1062        $('#type_course').addClass('green-border');
1063        //$('#green-arrow').show();
1064    }
1065});
1066
1067
1068$('#showmulti').on('change', function () {
1069    if ($(this).is(':checked')) {
1070        $('.showP').show();
1071        $('.jsPartecipantsLabel').show();
1072        $('.jsPartecipants').show();
1073
1074        $('#course_partecipants').children('option[value="1"]').attr('disabled', true);
1075        var nr_partecipants = 2;
1076        $('#course_partecipants').val(nr_partecipants);
1077        for (i = 2; i <= 10; i++) {
1078            if (i <= nr_partecipants) {
1079                $('.jsPartecipants' + i).show();
1080            } else {
1081                $('.jsPartecipants' + i).hide();
1082                $('.jsPartecipants' + i).find('input').val('');
1083            }
1084        }
1085    } else {
1086        $('.showP').hide();
1087        $('.jsPartecipantsLabel').hide();
1088        $('.jsPartecipants').hide();
1089        $('.jsPartecipants').val(1);
1090        $('.jsPartecipantsLabel').show();
1091        $('#course_partecipants').children('option[value="1"]').attr('disabled', false);
1092        $('.jsPartecipants').show();
1093        for (i = 2; i <= 10; i++) {
1094            $('.jsPartecipants' + i).hide();
1095            $('.jsPartecipants' + i).find('input').val('');
1096        }
1097    }
1098});
1099
1100$(".installments").on('click', function () {
1101    var $_hmi = parseInt($('input[name="installment"]:checked').val());
1102    /*
1103    if ($_hmi > 0) {
1104        $('#additional_course').html('');
1105        $('#additional_course').hide();
1106    } else { */
1107    var type_i = $('.jsOnlineCourse').val();
1108    if (type_i === '120-hr course with Tutor & Videos: (for teaching abroad)'
1109        || type_i === '170-hr course with Tutor & Videos: (for teaching abroad & online)') {
1110        $('.jsAll option[value="120 hr"]').prop('disabled', true);
1111        if (type_i === '120-hr course with Tutor & Videos: (for teaching abroad)') {
1112            $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English to young learners">Teaching English to young learners (CTEYL)</option><option value="Teaching business English">Teaching business English (CTBE)</option><option value="Teaching English Online">Teaching English Online (CTEO)</option>');
1113        } else {
1114            $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English to young learners">Teaching English to young learners (CTEYL)</option><option value="Teaching business English">Teaching business English (CTBE)</option>');
1115        }
1116        $('#additional_course').show();
1117    } else if (type_i === '370-hr diploma course: (TEFL/TESOL Certificate & Diploma)') {
1118        $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English to young learners">Teaching English to young learners (CTEYL)</option><option value="Teaching business English">Teaching business English (CTBE)</option><option value="Teaching English Online">Teaching English Online (CTEO)</option>');
1119        $('#additional_course').show();
1120    } else if (type_i === '220-hr course with Tutor & Videos: (for teaching abroad  & Young Learners & Business English)'
1121        || type_i == '470-hr diploma course: (TEFL/TESOL Certificate & Diploma-Young Learners & Business)') {
1122        $('#additional_course').html('<option value="">Choose your Free Course</option><option value="Teaching English Online">Teaching English Online (CTEO)</option>');
1123        $('#additional_course').show();
1124    }
1125    else if (type_i === '550-hr diploma course:  (TEFL/TESOL Certificate & Diploma-Young Learners & Business + Practicum)') {
1126        $('#additional_course').html('');
1127        $('#additional_course').hide();
1128    }
1129    else {
1130        $('#additional_course').html('');
1131        $('#additional_course').hide();
1132    }
1133    /*}*/
1134});
1135
1136$('#custom_type').on('change', function () {
1137    if ($(this).val() == 'client') {
1138        $('#course-type').addClass('wpcf7-validates-as-required');
1139        //$('#user-id').addClass('wpcf7-validates-as-required');
1140    } else {
1141        $('#course-type').removeClass('wpcf7-validates-as-required');
1142        //$('#user-id').removeClass('wpcf7-validates-as-required');       
1143    }
1144});
1145
1146$('#jsContactForm').on('submit', function () {
1147    $('[type=submit]').attr('disabled', 'disabled');
1148    var message = 'Please check which fields haven\'t been completed yet (highlighted in <span class="red">red</span>)';
1149    var fields = $(this).serializeArray();
1150    var error = false;
1151    $.each(fields, function (i, field) {
1152        if (field.value == 'undefined' || field.value == '') {
1153            if (field.name != 'city' && field.name != 'user_id' && field.name != 'ci_csrf_token') {
1154                error = true;
1155                $('#' + field.name).prev('label').addClass('error');
1156            }
1157        }
1158    });
1159
1160    if (error) {
1161        $('#wait').modal('hide');
1162        show_error_message(message, 0);
1163        $('[type=submit]').removeAttr('disabled');
1164        return false;
1165    }
1166    /*else
1167    {
1168        $.ajax({
1169            url: $(this).attr('action'),
1170            data: $(this).serialize(),
1171            type: "post",
1172            success: function () {
1173                var redir = 1;
1174                if (typeof page != 'undefined' && page == 'faq')
1175                {
1176                    redir = 0;
1177                }
1178                $('#wait').modal('hide');
1179                show_error_message('Your information has been sent and we will be in touch with you very soon.', redir, 'Contact Form');
1180            },
1181            error: function () {
1182                $('#wait').modal('hide');
1183                show_error_message('Please check which fields haven\'t been completed yet (highlighted in red)', 0);
1184            }
1185        });
1186    }*/
1187    return true;
1188});
1189
1190$('#jsSellCert').on('submit', function () {
1191    $('[type=submit]').attr('disabled', 'disabled');
1192    var message = 'Please check which fields haven\'t been completed yet (highlighted in <span class="red">red</span>)';
1193    var fields = $(this).serializeArray();
1194    var error = false;
1195    $.each(fields, function (i, field) {
1196        if (field.value == 'undefined' || field.value == '') {
1197            if (field.name != 'email' && field.name != 'user_id') {
1198                error = true;
1199                $('#' + field.name).prev('label').addClass('error');
1200            }
1201        }
1202    });
1203
1204    if (error) {
1205        $('#wait').modal('hide');
1206        show_error_message(message, 0);
1207        $('[type=submit]').removeAttr('disabled');
1208        return false;
1209    } else {
1210        $.ajax({
1211            url: $(this).attr('action'),
1212            data: $(this).serialize(),
1213            type: "post",
1214            success: function () {
1215                var redir = 0;
1216                if (typeof page != 'undefined' && page == 'faq') {
1217                    redir = 0;
1218                }
1219                $('#wait').modal('hide');
1220                show_error_message('Your information has been sent and we will be in touch with you very soon.', redir);
1221                setTimeout(function () {
1222                    top.location.assign('https://coursepayment.com/grad-teaching-english-cert');
1223                }, 3000);
1224            },
1225            error: function () {
1226                $('#wait').modal('hide');
1227                show_error_message('Please check which fields haven\'t been completed yet (highlighted in red)', 0);
1228            }
1229        });
1230    }
1231    return false;
1232});
1233
1234$('#jsCallmeback').on('submit', function () {
1235    $('[type=submit]').attr('disabled', 'disabled');
1236    var message = 'Please check which fields haven\'t been completed yet (highlighted in <span class="red">red</span>)';
1237    var fields = $(this).serializeArray();
1238    var error = false;
1239    $.each(fields, function (i, field) {
1240        if (field.value == 'undefined' || field.value == '') {
1241            if (field.name != 'city' && field.name != 'user_id') {
1242                error = true;
1243                $('#' + field.name).prev('label').addClass('error');
1244            }
1245        }
1246    });
1247
1248    if (error) {
1249        $('#wait').modal('hide');
1250        show_error_message(message, 0);
1251        $('[type=submit]').removeAttr('disabled');
1252        return false;
1253    } else {
1254        $.ajax({
1255            url: $(this).attr('action'),
1256            data: $(this).serialize(),
1257            type: "post",
1258            success: function () {
1259                var redir = 1;
1260                if (typeof page != 'undefined' && page == 'faq') {
1261                    redir = 0;
1262                }
1263                $('#wait').modal('hide');
1264                show_error_message('Your information has been sent and we will be in touch with you very soon.', redir);
1265            },
1266            error: function () {
1267                $('#wait').modal('hide');
1268                show_error_message('Please check which fields haven\'t been completed yet (highlighted in red)', 0);
1269            }
1270        });
1271    }
1272    return false;
1273});
1274
1275$('#jsContactNewsletter').on('submit', function (e) {
1276    e.preventDefault();
1277
1278    $('[type=submit]').attr('disabled', 'disabled');
1279    var message = 'Please check which fields haven\'t been completed yet (highlighted in <span class="red">red</span>)';
1280    var fields = $(this).serializeArray();
1281    var error = false;
1282
1283
1284    if (error) {
1285        $('#wait').modal('hide');
1286        show_error_message(message, 0);
1287        $('[type=submit]').removeAttr('disabled');
1288        return false;
1289    } else {
1290        $.ajax({
1291            url: $(this).attr('action'),
1292            data: $(this).serialize(),
1293            type: "post",
1294            success: function () {
1295                var redir = 1;
1296                if (typeof page != 'undefined' && page == 'faq') {
1297                    redir = 0;
1298                }
1299                $('#wait').modal('hide');
1300                show_error_message('Thank you for subscribing to our newsletter!', redir, 'Subscription completed!');
1301            },
1302            error: function () {
1303                $('#wait').modal('hide');
1304                show_error_message('Please check which fields haven\'t been completed yet (highlighted in red)', 0);
1305            }
1306        });
1307    }
1308    return false;
1309});
1310
1311function show_error_message(message, redirect_to_home, title) {
1312    title = typeof title !== 'undefined' ? title : 'All compulsory fields must be completed!';
1313    $('#jsDialogTitle').html(title);
1314    $("#dialogContent").html(message);
1315    $('#messageModal').modal('show');
1316    if (message == 'Your information has been sent and we will be in touch with you very soon.') {
1317        $("#jsDialogTitle").html('Thank you for contacting us!');
1318    } else if (message == 'You can now close this message and proceed to checkout!') {
1319        $("#jsDialogTitle").html('Course changes have been successfully submitted!');
1320    }
1321    if (redirect_to_home == 1) {
1322        setTimeout(function () {
1323            location.href = '/';
1324        }, 2000);
1325
1326        /*
1327         setTimeout(function () {
1328         window.location = '/';
1329         }, 3000);
1330         */
1331    } else {
1332        setTimeout(function () {
1333            $('#messageModal').modal('hide');
1334
1335        }, 3000);
1336    }
1337}
1338
1339function base64_decode(data) {
1340    var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
1341    var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
1342        ac = 0,
1343        dec = "",
1344        tmp_arr = [];
1345
1346    if (!data) {
1347        return data;
1348    }
1349
1350    data += '';
1351
1352    do { // unpack four hexets into three octets using index points in b64
1353        h1 = b64.indexOf(data.charAt(i++));
1354        h2 = b64.indexOf(data.charAt(i++));
1355        h3 = b64.indexOf(data.charAt(i++));
1356        h4 = b64.indexOf(data.charAt(i++));
1357
1358        bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;
1359
1360        o1 = bits >> 16 & 0xff;
1361        o2 = bits >> 8 & 0xff;
1362        o3 = bits & 0xff;
1363
1364        if (h3 == 64) {
1365            tmp_arr[ac++] = String.fromCharCode(o1);
1366        } else if (h4 == 64) {
1367            tmp_arr[ac++] = String.fromCharCode(o1, o2);
1368        } else {
1369            tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
1370        }
1371    } while (i < data.length);
1372
1373    dec = tmp_arr.join('');
1374
1375    return dec;
1376}
1377
1378function base64_encode(data) {
1379    var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
1380    var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
1381        ac = 0,
1382        enc = "",
1383        tmp_arr = [];
1384
1385    if (!data) {
1386        return data;
1387    }
1388
1389    do { // pack three octets into four hexets
1390        o1 = data.charCodeAt(i++);
1391        o2 = data.charCodeAt(i++);
1392        o3 = data.charCodeAt(i++);
1393
1394        bits = o1 << 16 | o2 << 8 | o3;
1395
1396        h1 = bits >> 18 & 0x3f;
1397        h2 = bits >> 12 & 0x3f;
1398        h3 = bits >> 6 & 0x3f;
1399        h4 = bits & 0x3f;
1400
1401        // use hexets to index into b64, and append result to encoded string
1402        tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
1403    } while (i < data.length);
1404
1405    enc = tmp_arr.join('');
1406
1407    var r = data.length % 3;
1408
1409    return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
1410
1411}
1412
1413$('.wpcf7-form').ajaxComplete(function () {
1414    if ($(this).hasClass('invalid') || $(this).hasClass('sent')) {
1415        console.log('The form is invalid.');
1416        $('.forkit-curtain').animate({
1417            scrollTop: $(".wpcf7-form-control-error").first().offset().top + 100
1418        }, 2000);
1419    }
1420});
1421
1422$('#online_course').on('change', function () {
1423    var course = $('#online_course').val();
1424    if (course == '') {
1425        return;
1426    }
1427    $('.jsOnline').each(function (item) {
1428        $(this).find('.notifyjs-wrapper').trigger('click');
1429    });
1430    $(this).removeClass('error');
1431
1432    var re = /^(\d)+ x.*/;
1433    var m = re.exec(course);
1434    if (m == null) {
1435        $('.jsPartecipants').val(1);
1436        $('.jsPartecipantsLabel').show();
1437        $('.jsPartecipants').show();
1438
1439        for (i = 2; i <= 10; i++) {
1440            $('.jsPartecipants' + i).hide();
1441            $('.jsPartecipants' + i).find('input').val('');
1442            $('#applicant_name_' + i).removeClass('wpcf7-validates-as-required');
1443            $('#applicant_email_' + i).removeClass('wpcf7-validates-as-required');
1444        }
1445    } else {
1446        $('.jsPartecipantsLabel').hide();
1447        $('.jsPartecipants').hide();
1448        //$('.showmulti').hide();
1449        var nr_partecipants = m[1];
1450        $('#course_partecipants').val(nr_partecipants);
1451        for (i = 2; i <= 10; i++) {
1452            if (i <= nr_partecipants) {
1453                $('.jsPartecipants' + i).show();
1454                //$('#applicant_name_' + i).addClass('wpcf7-validates-as-required');
1455                //$('#applicant_email_' + i).addClass('wpcf7-validates-as-required');
1456            } else {
1457                $('.jsPartecipants' + i).hide();
1458                $('.jsPartecipants' + i).find('input').val('');
1459                $('#applicant_name_' + i).removeClass('wpcf7-validates-as-required');
1460                $('#applicant_email_' + i).removeClass('wpcf7-validates-as-required');
1461            }
1462        }
1463    }
1464});
1465
1466if ($('.jsPartecipants').length > 0) {
1467    $('.jsPartecipants').on('change', function () {
1468        var nr_partecipants = $('.jsPartecipants').val();
1469        for (i = 2; i <= 10; i++) {
1470            if (i <= nr_partecipants) {
1471                $('.jsPartecipants' + i).show();
1472            } else {
1473                $('.jsPartecipants' + i).hide();
1474                $('.jsPartecipants' + i).find('input').val('');
1475            }
1476        }
1477    });
1478}
1479
1480if ($('.jsDate').length > 0) {
1481    $('.jsDate').on('change', function () {
1482        var course_id = $(this).val();
1483        var field_to_update = $(this).attr('id');
1484        field_to_update = field_to_update.replace('choice', 'date');
1485        if (course_id) {
1486            update_options(dates[course_id], field_to_update);
1487        }
1488    });
1489}
1490
1491if ($('.jsTRDate').length > 0) {
1492    $('.jsTRDate').on('change', function () {
1493        var course_id = $(this).val();
1494        field_to_update = "course_date";
1495        if (course_id) {
1496            update_options(dates[course_id], field_to_update);
1497        }
1498    });
1499}
1500
1501if ($('.jsDC').length > 0) {
1502    $('.jsDC').on('change', function () {
1503        var course_id = $(this).val();
1504        var field_to_update = $(this).attr('id');
1505        field_to_update = 'combined_first_date';
1506        if (course_id) {
1507            update_options(cdates[course_id], field_to_update);
1508        }
1509    });
1510}
1511
1512$('#confchange_we').on('click', function () {
1513    location.href = "https://www.teflcourse.net/wechat-payment?pp=" + $('#amount_we').val() + "&em=" + escape($('#email_we').val());
1514});
1515$('#confchange_ali').on('click', function () {
1516    location.href = "https://www.teflcourse.net/wechat-payment?pp=" + $('#amount_we').val() + "&em=" + escape($('#email_we').val());
1517});
1518$('#confchange_we_real').on('click', function () {
1519    location.href = "/create-source/wechat";
1520});
1521
1522$('#confchange_ali_real').click(function () {
1523    location.href = "/create-source/alipay";
1524});
1525
1526$('#confchange_wise').on("click", function () {
1527    location.href = "https://www.teflcourse.net/wise/?pp=" + $('#amount_we').val() + "&em=" + escape($('#email_we').val()) + "&appid=" + escape($('#application_id').val());
1528});
1529
1530if ($('#first_choice').length > 0) {
1531    $('#first_choice').on('change', function () {
1532        $(this).removeClass('green-border');
1533        var location_id = $(this).val();
1534        field_to_update = 'first_date';
1535        /*if (location_id)
1536         {
1537         $.ajax({
1538         type: "post",
1539         //dataType: 'json',
1540         url: '/cicd',
1541         data: {lcid: location_id},
1542         success: function (e) {
1543         if (e)
1544         {
1545         update_options(e, field_to_update);
1546         }
1547         }
1548         });
1549         }*/
1550    });
1551}
1552
1553
1554function update_options(e, field_to_update) {
1555    $('#' + field_to_update).find('option').remove();
1556    $('#' + field_to_update).append(new Option('Course your dates!', ''));
1557    var str = e.split(";");
1558    for (i in str) {
1559        if (str[i].length) {
1560            $('#' + field_to_update)
1561                .append($("<option></option>")
1562                    .attr("value", str[i])
1563                    .text(str[i].replace(" 00:00:00", "")));
1564        }
1565    }
1566}
1567
1568function check_email(email) {
1569    var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
1570    if (email.search(emailRegEx) == -1) {
1571        return false;
1572    } else {
1573        return true;
1574    }
1575}
1576
1577$('#jsForOtp').on('submit', function () {
1578    var message = original_message = 'Please check which fields haven\'t been completed yet (highlighted in <span class="red">red</span>)';
1579    var error = false;
1580    var title;
1581    string_b64 = base64_encode($(this).serialize());
1582    last_form = $.cookie('otp_form');
1583    if (last_form == string_b64) {
1584        title = 'Your application has already been received!';
1585        message = 'Your application has already been received. You do not need to resubmit unless you wish to make some changes.';
1586        error = true;
1587    }
1588    $.each($('.jsReq', this), function (i, field) {
1589        if (field.value == 'undefined' || field.value == '') {
1590            error = true;
1591        }
1592    });
1593    if (!error) {
1594        error = !check_email($.trim($('#email').val()));
1595    }
1596
1597    if (error) {
1598        show_error_message(message, 0, title);
1599        return false;
1600    } else {
1601        var ua = window.navigator.userAgent;
1602        var msie = ua.indexOf("MSIE ");
1603        var trident = ua.indexOf('Trident/');
1604        var edge = ua.indexOf('Edge/');
1605        if (msie > 0 || trident > 0 || edge > 0) {
1606            $('#wait_img img').remove();
1607            var pb = document.getElementById("wait_img");
1608            pb.innerHTML = '<img  src="https://www.teflcourse.net/images/loading_m.gif" width="100" height="100" />';
1609            pb.style.display = '';
1610        }
1611        $('#wait').modal('show');
1612        string_b64 = base64_encode($(this).serialize());
1613        last_form = $.cookie('otp_form', string_b64, { expires: 1 });
1614        return true;
1615    }
1616    return false;
1617});
1618
1619$('#confchange_pp').on('click', function () {
1620    startPayment();
1621    $('#paypal').trigger('submit');
1622});
1623
1624var ajaxCall = false;
1625
1626$('#confchange_gpay').on('click', function () {
1627    if (!ajaxCall) {
1628        $.ajax({
1629            url: '/checksession/get_stripe',
1630            data: { 'amount': 1, 'gpay': 0 },
1631            type: "post",
1632            success: function (html) {
1633                ajaxCall = true;
1634                $('#stripe_body').html(html);
1635                $('#modalStripe').modal('show');
1636            },
1637            error: function () {
1638                console.log('error');
1639            }
1640        });
1641    } else {
1642        $('#modalStripe').modal('show');
1643    }
1644});
1645
1646$('#confchange').click(function () {
1647    if (!verifyFormCheckout()) {
1648        show_error_message('Please fill in the fields that have not been completed yet and try again.', 0);
1649        return false;
1650    } else {
1651        startPayment();
1652        if ($('input[name=mode]').val() == '2CO')
1653            $('#2checkout').trigger('submit');
1654        else if ($('input[name=mode]').val() == 'EXPRESS')
1655            $('#express').trigger('submit');
1656        else if ($('input[name=tp]').val() == 'pp')
1657            $('#paypal').trigger('submit');
1658        else {
1659            if (true) {
1660                console.log('stripe...');
1661                if (!ajaxCall) {
1662                    $.ajax({
1663                        url: '/checksession/get_stripe',
1664                        data: { 'amount': 1 },
1665                        type: "post",
1666                        success: function (html) {
1667                            ajaxCall = true;
1668                            $('#stripe_body').html(html);
1669                            $('#modalStripe').modal('show');
1670                        },
1671                        error: function () {
1672                            console.log('error');
1673                        }
1674                    });
1675                } else {
1676                    $('#modalStripe').modal('show');
1677                }
1678            } else {
1679                $('#modalStripe').modal('show');
1680            }
1681        }
1682    }
1683});
1684
1685
1686function startPayment() {
1687    appid = $('input[name="application_id"]').val();
1688    $.ajax({
1689        url: '/start_payment/' + $('input[name="application_id"]').val(),
1690        type: "get",
1691        success: function () {
1692            console.log('ok');
1693        },
1694        error: function () {
1695            console.log('ko');
1696        }
1697    });
1698    console.log(appid);
1699}
1700
1701/*
1702 $('#confchange').click(function () {
1703 if (!verifyFormCheckout())
1704 {
1705 show_error_message('Please fill in the fields that have not been completed yet and try again.', 0);
1706 return false;
1707 } else
1708 {
1709 if ($('input[name=mode]').val() == '2CO')
1710 $('#2checkout').submit();
1711 else if ($('input[name=mode]').val() == 'EXPRESS')
1712 $('#express').submit();
1713 else if ($('input[name=tp]').val() == 'pp')
1714 $('#paypal').submit();
1715 else
1716 $('#bluesnap').submit();
1717 }
1718 });
1719 */
1720
1721$('#selectservice').on('change', function () {
1722    if ($(this).val()) {
1723        $('#phone').attr('placeholder', jsUcfirst($(this).val()) + " *");
1724    } else {
1725        $('#phone').attr('placeholder', "Telephone *");
1726    }
1727});
1728
1729
1730function jsUcfirst(string) {
1731    return string.charAt(0).toUpperCase() + string.slice(1);
1732}
1733
1734
1735$('#jsLogin').on('submit', function () {
1736    var username = $('#username').val();
1737    location.href = 'https://login.teflserver.net/?username=' + username;
1738    return false;
1739});
1740
1741function verifyFormCheckout() {
1742    Error = false;
1743
1744    $type_ofc = $('#type_of_course').val();
1745    if ($type_ofc == 'Combined Course') {
1746        if ($('#combined_course').val() == '')
1747            Error = true;
1748        else
1749            $('form#2checkout input[name=li_1_name]').val("Combined course " + $('#combined_course option:selected').text());
1750    } else if ($type_ofc == 'Intensive Course') {
1751        if ($('#first_choice').val() == '' || $('#first_date').val() == '')
1752            Error = true;
1753        else
1754            $('form#2checkout input[name=li_1_name]').val("Intensive course " + $('#first_choice option:selected').text() + " " + $('#first_date').val());
1755    } else if ($type_ofc == 'Online Course') {
1756        if ($('#online_course').val() == '' || $('#course_partecipants').val() == '')
1757            Error = true;
1758        else
1759            $('form#2checkout input[name=li_1_name]').val("Online course " + $('#online_course option:selected').text() + ". Participants: " + $('#course_partecipants').val());
1760    }
1761
1762    return !Error;
1763}
1764
1765$('.click-on-apply').on('click', function () {
1766    dataLayer.push({
1767        "event": "promotionClick",
1768        "ecommerce": {
1769            "promoClick": {
1770                "promotions": [{
1771                    "id": "apply-embedded",
1772                    "name": "application",
1773                    "creative": "link application",
1774                    "position": $(this).attr('rel')
1775                }]
1776            }
1777        }
1778    });
1779});
1780
1781(function (e) {
1782    typeof define == "function" && define.amd ? define(["jquery"], e) : typeof module == "object" && module.exports ? module.exports = function (t, n) {
1783        return n === undefined && (typeof window != "undefined" ? n = require("jquery") : n = require("jquery")(t)), e(n), n
1784    } : e(jQuery)
1785})(function (e) {
1786    function A(t, n, i) {
1787        typeof i == "string" && (i = { className: i }), this.options = E(w, e.isPlainObject(i) ? i : {}), this.loadHTML(), this.wrapper = e(h.html), this.options.clickToHide && this.wrapper.addClass(r + "-hidable"), this.wrapper.data(r, this), this.arrow = this.wrapper.find("." + r + "-arrow"), this.container = this.wrapper.find("." + r + "-container"), this.container.append(this.userContainer), t && t.length && (this.elementType = t.attr("type"), this.originalElement = t, this.elem = N(t), this.elem.data(r, this), this.elem.before(this.wrapper)), this.container.hide(), this.run(n)
1788    }
1789    var t = [].indexOf || function (e) {
1790        for (var t = 0, n = this.length; t < n; t++)
1791            if (t in this && this[t] === e)
1792                return t;
1793        return -1
1794    }, n = "notify", r = n + "js", i = n + "!blank", s = { t: "top", m: "middle", b: "bottom", l: "left", c: "center", r: "right" }, o = ["l", "c", "r"], u = ["t", "m", "b"], a = ["t", "b", "l", "r"], f = { t: "b", m: null, b: "t", l: "r", c: null, r: "l" }, l = function (t) {
1795        var n;
1796        return n = [], e.each(t.split(/\W+/), function (e, t) {
1797            var r;
1798            r = t.toLowerCase().charAt(0);
1799            if (s[r])
1800                return n.push(r)
1801        }), n
1802    }, c = {}, h = { name: "core", html: '<div class="' + r + '-wrapper">\n	<div class="' + r + '-arrow"></div>\n	<div class="' + r + '-container"></div>\n</div>', css: "." + r + "-corner {\n	position: fixed;\n	margin: 5px;\n	z-index: 1050;\n}\n\n." + r + "-corner ." + r + "-wrapper,\n." + r + "-corner ." + r + "-container {\n	position: relative;\n	display: block;\n	height: inherit;\n	width: inherit;\n	margin: 3px;\n}\n\n." + r + "-wrapper {\n	z-index: 1;\n	position: absolute;\n	display: inline-block;\n	height: 0;\n	width: 0;\n}\n\n." + r + "-container {\n	display: none;\n	z-index: 1;\n	position: absolute;\n}\n\n." + r + "-hidable {\n	cursor: pointer;\n}\n\n[data-notify-text],[data-notify-html] {\n	position: relative;\n}
1802\n\n." + r + "-arrow {\n	position: absolute;\n	z-index: 2;\n	width: 0;\n	height: 0;\n}" }, p = { "border-radius": ["-webkit-", "-moz-"] }, d = function (e) {
1803        return c[e]
1804    }, v = function (e) {
1805        if (!e)
1806            throw "Missing Style name";
1807        c[e] && delete c[e]
1808    }, m = function (t, i) {
1809        if (!t)
1810            throw "Missing Style name";
1811        if (!i)
1812            throw "Missing Style definition";
1813        if (!i.html)
1814            throw "Missing Style HTML";
1815        var s = c[t];
1816        s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
1817        var o = "";
1818        i.classes && e.each(i.classes, function (t, n) {
1819            return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
1820                return p[t] && e.each(p[t], function (e, r) {
1821                    return o += "	" + r + t + ": " + n + ";\n"
1822                }), o += "	" + t + ": " + n + ";\n"
1823            }), o += "}\n"
1824        }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
1825        var u = {}, a = e(i.html);
1826        y("html", a, u), y("text", a, u), i.fields = u
1827    }, g = function (t) {
1828        var n, r, i;
1829        r = x("style"), r.attr("type", "text/css"), e("head").append(r);
1830        try {
1831            r.html(t)
1832        } catch (s) {
1833            r[0].styleSheet.cssText = t
1834        }
1835        return r
1836    }, y = function (t, n, r) {
1837        var s;
1838        return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
1839            var n;
1840            n = e(this).attr(s), n || (n = i), r[n] = t
1841        })
1842    }, b = function (e, t) {
1843        return e.is(t) ? e : e.find(t)
1844    }, w = { clickToHide: !0, autoHide: !0, autoHideDelay: 5e3, arrowShow: !0, arrowSize: 5, breakNewLines: !0, elementPosition: "bottom", globalPosition: "top right", style: "bootstrap", className: "error", showAnimation: "slideDown", showDuration: 400, hideAnimation: "slideUp", hideDuration: 200, gap: 5 }, E = function (t, n) {
1845        var r;
1846        return r = function () { }, r.prototype = t, e.extend(!0, new r, n)
1847    }, S = function (t) {
1848        return e.extend(w, t)
1849    }, x = function (t) {
1850        return e("<" + t + "></" + t + ">")
1851    }, T = {}, N = function (t) {
1852        var n;
1853        return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
1854            return e(r).attr("name") === t.attr("name")
1855        }), t = n.first()), t
1856    }, C = function (e, t, n) {
1857        var r, i;
1858        if (typeof n == "string")
1859            n = parseInt(n, 10);
1860        else if (typeof n != "number")
1861            return;
1862        if (isNaN(n))
1863            return;
1864        return r = s[f[t.charAt(0)]], i = t, e[r] !== undefined && (t = s[r.charAt(0)], n = -n), e[t] === undefined ? e[t] = n : e[t] += n, null
1865    }, k = function (e, t, n) {
1866        if (e === "l" || e === "t")
1867            return 0;
1868        if (e === "c" || e === "m")
1869            return n / 2 - t / 2;
1870        if (e === "r" || e === "b")
1871            return n - t;
1872        throw "Invalid alignment"
1873    }, L = function (e) {
1874        return L.e = L.e || x("div"), L.e.text(e).html()
1875    };
1876    A.prototype.loadHTML = function () {
1877        var t;
1878        t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields
1879    }, A.prototype.show = function (e, t) {
1880        var n, r, i, s, o;
1881        r = function (n) {
1882            return function () {
1883                !e && !n.elem && n.destroy();
1884                if (t)
1885                    return t()
1886            }
1887        }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
1888        if (o && e)
1889            s = "show";
1890        else if (o && !e)
1891            s = "hide";
1892        else if (!o && e)
1893            s = this.options.showAnimation, n.push(this.options.showDuration);
1894        else {
1895            if (!!o || !!e)
1896                return r();
1897            s = this.options.hideAnimation, n.push(this.options.hideDuration)
1898        }
1899        return n.push(r), i[s].apply(i, n)
1900    }, A.prototype.setGlobalPosition = function () {
1901        var t = this.getPosition(), n = t[0], i = t[1], o = s[n], u = s[i], a = n + "|" + i, f = T[a];
1902        if (!f || !document.body.contains(f[0])) {
1903            f = T[a] = x("div");
1904            var l = {};
1905            l[o] = 0, u === "middle" ? l.top = "45%" : u === "center" ? l.left = "45%" : l[u] = 0, f.css(l).addClass(r + "-corner"), e("body").append(f)
1906        }
1907        return f.prepend(this.wrapper)
1908    }, A.prototype.setElementPosition = function () {
1909        var n, r, i, l, c, h, p, d, v, m, g, y, b, w, E, S, x, T, N, L, A, O, M, _, D, P, H, B, j;
1910        H = this.getPosition(), _ = H[0], O = H[1], M = H[2], g = this.elem.position(), d = this.elem.outerHeight(), y = this.elem.outerWidth(), v = this.elem.innerHe
1910ight(), m = this.elem.innerWidth(), j = this.wrapper.position(), c = this.container.height(), h = this.container.width(), T = s[_], L = f[_], A = s[L], p = {}, p[A] = _ === "b" ? d : _ === "r" ? y : 0, C(p, "top", g.top - j.top), C(p, "left", g.left - j.left), B = ["top", "left"];
1911        for (w = 0, S = B.length; w < S; w++)
1912            D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
1913        b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
1914        if (!this.options.arrowShow)
1915            this.arrow.hide();
1916        else {
1917            i = this.options.arrowSize, r = e.extend({}, p), n = this.userContainer.css("border-color") || this.userContainer.css("border-top-color") || this.userContainer.css("background-color") || "white";
1918            for (E = 0, x = a.length; E < x; E++) {
1919                D = a[E], P = s[D];
1920                if (D === L)
1921                    continue;
1922                l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l
1923            }
1924            C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2)
1925        }
1926        t.call(u, _) >= 0 ? (C(p, "left", k(O, h, y)), r && C(r, "left", k(O, i, m))) : t.call(o, _) >= 0 && (C(p, "top", k(O, c, d)), r && C(r, "top", k(O, i, v))), this.container.is(":visible") && (p.display = "block"), this.container.removeAttr("style").css(p);
1927        if (r)
1928            return this.arrow.removeAttr("style").css(r)
1929    }, A.prototype.getPosition = function () {
1930        var e, n, r, i, s, f, c, h;
1931        h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
1932        if (n = e[0], t.call(a, n) < 0)
1933            throw "Must be one of [" + a + "]";
1934        if (e.length === 1 || (r = e[0], t.call(u, r) >= 0) && (i = e[1], t.call(o, i) < 0) || (s = e[0], t.call(o, s) >= 0) && (f = e[1], t.call(u, f) < 0))
1935            e[1] = (c = e[0], t.call(o, c) >= 0) ? "m" : "l";
1936        return e.length === 2 && (e[2] = e[1]), e
1937    }, A.prototype.getStyle = function (e) {
1938        var t;
1939        e || (e = this.options.style), e || (e = "default"), t = c[e];
1940        if (!t)
1941            throw "Missing style: " + e;
1942        return t
1943    }, A.prototype.updateClasses = function () {
1944        var t, n;
1945        return t = ["base"], e.isArray(this.options.className) ? t = t.concat(this.options.className) : this.options.className && t.push(this.options.className), n = this.getStyle(), t = e.map(t, function (e) {
1946            return r + "-" + n.name + "-" + e
1947        }).join(" "), this.userContainer.attr("class", t)
1948    }, A.prototype.run = function (t, n) {
1949        var r, s, o, u, a;
1950        e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
1951        if (this.container && !t) {
1952            this.show(!1);
1953            return
1954        }
1955        if (!this.container && !t)
1956            return;
1957        s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
1958        for (o in s) {
1959            r = s[o], u = this.userFields[o];
1960            if (!u)
1961                continue;
1962            u === "text" && (r = L(r), this.options.breakNewLines && (r = r.replace(/\n/g, "<br/>"))), a = o === i ? "" : "=" + o, b(this.userContainer, "[data-notify-" + u + a + "]").html(r)
1963        }
1964        this.updateClasses(), this.elem ? this.setElementPosition() : this.setGlobalPosition(), this.show(!0), this.options.autoHide && (clearTimeout(this.autohideTimer), this.autohideTimer = setTimeout(this.show.bind(this, !1), this.options.autoHideDelay))
1965    }, A.prototype.destroy = function () {
1966        this.wrapper.data(r, null), this.wrapper.remove()
1967    }, e[n] = function (t, r, i) {
1968        return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t
1969    }, e.fn[n] = function (t, n) {
1970        return e(this).each(function () {
1971            var i = N(e(this)).data(r);
1972            i && i.destroy();
1973            var s = new A(e(this), t, n)
1974        }), this
1975    }, e.extend(e[n], { defaults: S, addStyle: m, removeStyle: v, pluginOptions: w, getStyle: d, insertCSS: g }), m("bootstrap", { html: "<div>\n<span data-notify-text></span>\n</div>", classes: { base: { "font-weight": "bold", padding: "8px 15px 8px 14px", "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)", "background-color": "#fcf8e3", border: "1px solid #fbeed5", "border-radius": "4px", "white-space": "nowrap", "padding-left": "25px", "background-repeat": "no-repeat", "background-position": "3px 7px" }, error: { color: "#B94A48", "background-color": "#F2DEDE", "border-color": "#EED3D7", "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAtRJREFUeNqkVc1u00AQHq+dOD+0poIQfkIjalW0SEGqRMuRnHos3DjwAH0ArlyQeANOOSMeAA5VjyBxKBQhgSpVUKKQNGloFdw4cWw2jtfMOna6JOUArDTazXi/b3dm55socPqQhFka++aHBsI8GsopRJERNFlY88FCEk9Yiwf8RhgRyaHFQpPHCDmZG5oX2ui2yilkcTT1AcDsbYC1NMAyOi7zTX2Agx7A9luAl88BauiiQ/cJaZQfIpAlngDcvZZMrl8vFPK5+XktrWlx3/ehZ5r9+t6e+WVnp1pxnNIjgBe4/6dAysQc8dsmHwPcW9C0h3fW1hans1ltwJhy0GxK7XZbUlMp5Ww2eyan6+ft/f2FAqXGK4CvQk5HueFz7D6GOZtIrK+srupdx1GRBBqNBtzc2AiMr7nPplRdKhb1q6q6zjFhrklEFOUutoQ50xcX86ZlqaZpQrfbBdu2R6/G19zX6XSgh6RX5ubyHCM8nqSID6ICrGiZjGYYxojEsiw4PDwMSL5VKsC8Yf4VRYFzMzMaxwjlJSlCyAQ9l0CW44PBADzXhe7xMdi9HtTrdYjFYkDQL0cn4Xdq2/EAE+InCnvADTf2eah4Sx9vExQjkqXT6aAERICMewd/UAp/IeYANM2joxt+q5VI+ieq2i0Wg3l6DNzHwTERPgo1ko7XBXj3vdlsT2F+UuhIhYkp7u7CarkcrFOCtR3H5JiwbAIeImjT/YQKKBtGjRFCU5IUgFRe7fF4cCNVIPMYo3VKqxwjyNAXNepuopyqnld602qVsfRpEkkz+GFL1wPj6ySXBpJtWVa5xlhpcyhBNwpZHmtX8AGgfIExo0ZpzkWVTBGiXCSEaHh62/PoR0p/vHaczxXGnj4bSo+G78lELU80h1uogBwWLf5YlsPmgDEd4M236xjm+8nm4IuE/9u+/PH2JXZfbwz4zw1WbO+SQPpXfwG/BBgAhCNZiSb/pOQAAAAASUVORK5CYII=)" }, success: { color: "#468847", "background-color": "#DFF0D8", "border-color": "#D6E9C6", "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAutJREFUeNq0lctPE0Ecx38zu/RFS1EryqtgJFA08YCiMZIAQQ4eRG8eDGdPJiYeTIwHTfwPiAcvXIwXLwoXPaDxkWgQ6islKlJLS
1975QWLUraPLTv7Gme32zoF9KSTfLO7v53vZ3d/M7/fIth+IO6INt2jjoA7bjHCJoAlzCRw59YwHYjBnfMPqAKWQYKjGkfCJqAF0xwZjipQtA3MxeSG87VhOOYegVrUCy7UZM9S6TLIdAamySTclZdYhFhRHloGYg7mgZv1Zzztvgud7V1tbQ2twYA34LJmF4p5dXF1KTufnE+SxeJtuCZNsLDCQU0+RyKTF27Unw101l8e6hns3u0PBalORVVVkcaEKBJDgV3+cGM4tKKmI+ohlIGnygKX00rSBfszz/n2uXv81wd6+rt1orsZCHRdr1Imk2F2Kob3hutSxW8thsd8AXNaln9D7CTfA6O+0UgkMuwVvEFFUbbAcrkcTA8+AtOk8E6KiQiDmMFSDqZItAzEVQviRkdDdaFgPp8HSZKAEAL5Qh7Sq2lIJBJwv2scUqkUnKoZgNhcDKhKg5aH+1IkcouCAdFGAQsuWZYhOjwFHQ96oagWgRoUov1T9kRBEODAwxM2QtEUl+Wp+Ln9VRo6BcMw4ErHRYjH4/B26AlQoQQTRdHWwcd9AH57+UAXddvDD37DmrBBV34WfqiXPl61g+vr6xA9zsGeM9gOdsNXkgpEtTwVvwOklXLKm6+/p5ezwk4B+j6droBs2CsGa/gNs6RIxazl4Tc25mpTgw/apPR1LYlNRFAzgsOxkyXYLIM1V8NMwyAkJSctD1eGVKiq5wWjSPdjmeTkiKvVW4f2YPHWl3GAVq6ymcyCTgovM3FzyRiDe2TaKcEKsLpJvNHjZgPNqEtyi6mZIm4SRFyLMUsONSSdkPeFtY1n0mczoY3BHTLhwPRy9/lzcziCw9ACI+yql0VLzcGAZbYSM5CCSZg1/9oc/nn7+i8N9p/8An4JMADxhH+xHfuiKwAAAABJRU5ErkJggg==)" }, info: { color: "#3A87AD", "background-color": "#D9EDF7", "border-color": "#BCE8F1", "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QYFAhkSsdes/QAAA8dJREFUOMvVlGtMW2UYx//POaWHXg6lLaW0ypAtw1UCgbniNOLcVOLmAjHZolOYlxmTGXVZdAnRfXQm+7SoU4mXaOaiZsEpC9FkiQs6Z6bdCnNYruM6KNBw6YWewzl9z+sHImEWv+vz7XmT95f/+3/+7wP814v+efDOV3/SoX3lHAA+6ODeUFfMfjOWMADgdk+eEKz0pF7aQdMAcOKLLjrcVMVX3xdWN29/GhYP7SvnP0cWfS8caSkfHZsPE9Fgnt02JNutQ0QYHB2dDz9/pKX8QjjuO9xUxd/66HdxTeCHZ3rojQObGQBcuNjfplkD3b19Y/6MrimSaKgSMmpGU5WevmE/swa6Oy73tQHA0Rdr2Mmv/6A1n9w9suQ7097Z9lM4FlTgTDrzZTu4StXVfpiI48rVcUDM5cmEksrFnHxfpTtU/3BFQzCQF/2bYVoNbH7zmItbSoMj40JSzmMyX5qDvriA7QdrIIpA+3cdsMpu0nXI8cV0MtKXCPZev+gCEM1S2NHPvWfP/hL+7FSr3+0p5RBEyhEN5JCKYr8XnASMT0xBNyzQGQeI8fjsGD39RMPk7se2bd5ZtTyoFYXftF6y37gx7NeUtJJOTFlAHDZLDuILU3j3+H5oOrD3yWbIztugaAzg
1975nBKJuBLpGfQrS8wO4FZgV+c1IxaLgWVU0tMLEETCos4xMzEIv9cJXQcyagIwigDGwJgOAtHAwAhisQUjy0ORGERiELgG4iakkzo4MYAxcM5hAMi1WWG1yYCJIcMUaBkVRLdGeSU2995TLWzcUAzONJ7J6FBVBYIggMzmFbvdBV44Corg8vjhzC+EJEl8U1kJtgYrhCzgc/vvTwXKSib1paRFVRVORDAJAsw5FuTaJEhWM2SHB3mOAlhkNxwuLzeJsGwqWzf5TFNdKgtY5qHp6ZFf67Y/sAVadCaVY5YACDDb3Oi4NIjLnWMw2QthCBIsVhsUTU9tvXsjeq9+X1d75/KEs4LNOfcdf/+HthMnvwxOD0wmHaXr7ZItn2wuH2SnBzbZAbPJwpPx+VQuzcm7dgRCB57a1uBzUDRL4bfnI0RE0eaXd9W89mpjqHZnUI5Hh2l2dkZZUhOqpi2qSmpOmZ64Tuu9qlz/SEXo6MEHa3wOip46F1n7633eekV8ds8Wxjn37Wl63VVa+ej5oeEZ/82ZBETJjpJ1Rbij2D3Z/1trXUvLsblCK0XfOx0SX2kMsn9dX+d+7Kf6h8o4AIykuffjT8L20LU+w4AZd5VvEPY+XpWqLV327HR7DzXuDnD8r+ovkBehJ8i+y8YAAAAASUVORK5CYII=)" }, warn: { color: "#C09853", "background-color": "#FCF8E3", "border-color": "#FBEED5", "background-image": "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAABJlBMVEXr6eb/2oD/wi7/xjr/0mP/ykf/tQD/vBj/3o7/uQ//vyL/twebhgD/4pzX1K3z8e349vK6tHCilCWbiQymn0jGworr6dXQza3HxcKkn1vWvV/5uRfk4dXZ1bD18+/52YebiAmyr5S9mhCzrWq5t6ufjRH54aLs0oS+qD751XqPhAybhwXsujG3sm+Zk0PTwG6Shg+PhhObhwOPgQL4zV2nlyrf27uLfgCPhRHu7OmLgAafkyiWkD3l49ibiAfTs0C+lgCniwD4sgDJxqOilzDWowWFfAH08uebig6qpFHBvH/aw26FfQTQzsvy8OyEfz20r3jAvaKbhgG9q0nc2LbZxXanoUu/u5WSggCtp1anpJKdmFz/zlX/1nGJiYmuq5Dx7+sAAADoPUZSAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfdBgUBGhh4aah5AAAAlklEQVQY02NgoBIIE8EUcwn1FkIXM1Tj5dDUQhPU502Mi7XXQxGz5uVIjGOJUUUW81HnYEyMi2HVcUOICQZzMMYmxrEyMylJwgUt5BljWRLjmJm4pI1hYp5SQLGYxDgmLnZOVxuooClIDKgXKMbN5ggV1ACLJcaBxNgcoiGCBiZwdWxOETBDrTyEFey0jYJ4eHjMGWgEAIpRFRCUt08qAAAAAElFTkSuQmCC)" } } }), e(function () {
1976        g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
1977            e(this).trigger("notify-hide")
1978        }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
1979            var n = e(this).data(r);
1980            n && n.show(!1)
1981        })
1982    })
1983});
1984
1985if ($('#first_choice').length > 0) {
1986    $('#first_choice').on('change', function () {
1987        var location_id = $(this).val();
1988        if (location_id) {
1989            // remove notify
1990            $('.jsInclass').each(function (item) {
1991                $(this).find('.notifyjs-wrapper').trigger('click');
1992            });
1993            $(this).removeClass('error');
1994        }
1995        $(this).removeClass('green-border');
1996        field_to_update = 'first_date';
1997    });
1998}
1999
2000$('#first_date').on('change', function () {
2001    if ($(this).val() != '') {
2002        // remove notify
2003        $('.jsInclass').each(function (item) {
2004            $(this).find('.notifyjs-wrapper').trigger('click');
2005        });
2006        if ($('#first_choice').val() == '') {
2007            $('#first_choice').notify("WAIT.\nPlease select your location.", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2008            $('#first_choice').addClass('error');
2009        }
2010        $(this).removeClass('error');
2011        $(this).removeClass('green-border');
2012    }
2013});
2014$('#first_date').on('focus', function () {
2015    $('.jsInclass').each(function (item) {
2016        $(this).find('.notifyjs-wrapper').trigger('click');
2017    });
2018});
2019
2020$('#combined_course').on('change', function () {
2021    if ($(this).val() != '') {
2022        $('.jsCombined').each(function (item) {
2023            console.log(item);
2024            $(this).find('.notifyjs-wrapper').trigger('click');
2025        });
2026        $(this).removeClass('green-border');
2027        $(this).removeClass('error');
2028    }
2029});
2030/*$('#combined_course').change(function () {
2031 $('.jsCombined').each(function (item) {
2032 console.log(item);
2033 $(this).find('.notifyjs-wrapper').trigger('click');
2034 });
2035 });*/
2036
2037$('#combined_first_date').on('change', function () {
2038    if ($(this).val() != '') {
2039        $('.jsCombined').each(function (item) {
2040            console.log(item);
2041            $(this).find('.notifyjs-wrapper').trigger('click');
2042        });
2043        if ($('#combined_course').val() == '') {
2044            $('#combined_course').notify("WAIT.\nPlease select your location.", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2045            $('#combined_course').addClass('error');
2046        }
2047        $(this).removeClass('green-border');
2048    }
2049});
2050$('#combined_first_date').on('change', function () {
2051    $('.jsCombined').each(function (item) {
2052        console.log(item);
2053        $(this).find('.notifyjs-wrapper').trigger('click');
2054    });
2055});
2056
2057$('#name').on('keypress', function (e) {
2058    $('.first_name > .notifyjs-wrapper').trigger('click');
2059    $(this).removeClass('error');
2060});
2061
2062$('#name').on('focus', function (e) {
2063    console.log('focus name');
2064    $('.first_name > .notifyjs-wrapper').trigger('click');
2065    if (!$(this).hasClass('error')) {
2066        $(this).addClass('green-border');
2067    }
2068});
2069
2070$('#name').on('blur', function () {
2071    $(this).removeClass('green-border');
2072    if ($(this).val()) {
2073        $(this).removeClass('error');
2074        $(this).next('.fa-check').removeClass('hide');
2075    } else {
2076        $(this).next('.fa-check').addClass('hide');
2077    }
2078});
2079
2080$('#surname').on('keypress', function (e) {
2081    $('.last_name > .notifyjs-wrapper').trigger('click');
2082    $(this).removeClass('error');
2083    checkErrors(1);
2084});
2085
2086$('#surname').on('focus', function (e) {
2087    $('.last_name > .notifyjs-wrapper').trigger('click');
2088    if (!$(this).hasClass('error')) {
2089        $(this).addClass('green-border');
2090    }
2091});
2092
2093$('#surname').on('blur', function () {
2094    $(this).removeClass('green-border');
2095    if ($(this).val()) {
2096        $(this).removeClass('error');
2097        $(this).next('.fa-check').removeClass('hide');
2098    } else {
2099        $(this).next('.fa-check').addClass('hide');
2100    }
2101});
2102
2103$('#email').on('keypress', function (e) {
2104    $('.email > .notifyjs-wrapper').trigger('click');
2105    $(this).removeClass('error');
2106    checkErrors(2);
2107});
2108
2109$('#email').on('focus', function (e) {
2110    $('.email > .notifyjs-wrapper').trigger('click');
2111    if (!$(this).hasClass('error')) {
2112        $(this).addClass('green-border');
2113    }
2114});
2115
2116$('#email').on('blur', function () {
2117    $(this).removeClass('green-border');
2118    email_clean = cleanField($(this).val());
2119    if (email_clean != $(this).val()) {
2120        $(this).val(email_clean);
2121    }
2122    if ($(this).val() && isEmail($(this).val())) {
2123        $(this).removeClass('error');
2124        $(this).next('.fa-check').removeClass('hide');
2125    } else {
2126        $(this).next('.fa-check').addClass('hide');
2127    }
2128});
2129
2130$('#email_conf').on('keypress', function (e) {
2131    $('.email_conf > .notifyjs-wrapper').trigger('click');
2132    $(this).removeClass('error');
2133    if (checkErrors(3)) {
2134        /*
2135         if ($('#email').val() == '') {
2136         $('#email').notify("WAIT.\nPlease confirm your Email", {position: "top left", autoHideDelay: 1000000, autoHide: false});
2137         $('#email').addClass('error');
2138         }
2139         else */
2140    } else if (!isEmail($('#email').val())) {
2141        $('#email').notify("WAIT.\nPlease insert a valid email.", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2142        $('#email').addClass('error');
2143    }
2144});
2145$('#email_conf').on('focus', function (e) {
2146    $('.email_conf > .notifyjs-wrapper').trigger('click');
2147    if (!$(this).hasClass('error')) {
2148        $(this).addClass('green-border');
2149    }
2150});
2151
2152$('#email_conf').on('blur', function () {
2153    $(this).removeClass('green-border');
2154    email_clean = cleanField($(this).val());
2155    if (email_clean != $(this).val()) {
2156        $(this).val(email_clean);
2157    }
2158    if ($(this).val() && isEmail($(this).val()) && $(this).val() == $('#email').val()) {
2159        $(this).removeClass('error');
2160        $(this).next('.fa-check').removeClass('hide');
2161    } else {
2162        $(this).next('.fa-check').addClass('hide');
2163    }
2164});
2165
2166$('#educational_detail').on('click', function (e) {
2167    if (checkErrors(4)) {
2168    } else if (!isEmail($('#email_conf').val())) {
2169        $('#email_conf').notify("WAIT.\nPlease insert a valid email.", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2170        $('#email_conf').addClass('error');
2171    } else if ($('#email_conf').val().toLowerCase() != $('#email').val().toLowerCase()) {
2172        $('#email_conf').notify("WAIT.\nThe Email Confirmation does not match the Email.", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2173        $('#email_conf').addClass('error');
2174    }
2175});
2176
2177$('#educational_detail').on('blur', function () {
2178    if ($(this).val()) {
2179        $(this).removeClass('error');
2180        $(this).next('.fa-check').removeClass('hide');
2181    } else {
2182        $(this).next('.fa-check').addClass('hide');
2183    }
2184});
2185
2186$('.type_course').on('click', function (e) {
2187    $('.type_course').prev('.notifyjs-wrapper').trigger('click');
2188    $(this).removeClass('error');
2189    console.log(presel_course);
2190    if (!presel_course) {
2191        if (checkErrors(4)) {
2192        } else if (!isEmail($('#email_conf').val())) {
2193            $('#email_conf').notify("WAIT.\nPlease insert a valid email.", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2194            $('#email_conf').addClass('error');
2195        } else if ($('#email_conf').val().toLowerCase() != $('#email').val().toLowerCase()) {
2196            $('#email_conf').notify("WAIT.\nThe Email Confirmation does not match the Email.", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2197            $('#email_conf').addClass('error');
2198        }
2199    }
2200});
2201
2202$('#why_tefl').on('click', function (e) {
2203    $('.why_tefl > .notifyjs-wrapper').trigger('click');
2204
2205    $(this).removeClass('error');
2206    if (!$('#type_of_course_online').is(':checked') && !$('#type_of_course_inclass').is(':checked') && !$('#type_of_course_combined').is(':checked')) {
2207        $('.type_course').notify("WAIT.\nPlease choose the course type", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2208        $('.type_course').addClass('error');
2209    }
2210
2211    if ($('#type_of_course_online').is(':checked') && $('#online_course').val() == '') {
2212        $('#online_course').notify("WAIT.\nPlease select one of our Online Courses", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2213        $('#online_course').addClass('error');
2214    }
2215
2216    if ($('#type_of_course_inclass').is(':checked') && $('#first_choice').val() == '') {
2217        $('#first_choice').notify("WAIT.\nPlease select your location.", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2218        $('#first_choice').addClass('error');
2219    }
2220
2221    if ($('#type_of_course_inclass').is(':checked') && $('#first_date').val() == '') {
2222        $('#first_date').notify("WAIT.\nPlease select your date.", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2223        $('#first_date').addClass('error');
2224    }
2225
2226    if ($('#type_of_course_combined').is(':checked') && $('#combined_course').val() == '') {
2227        $('#combined_course').notify("WAIT.\nPlease select your location.", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2228        $('#combined_course').addClass('error');
2229    }
2230
2231    if ($('#type_of_course_inclass').is(':checked') && $('#combined_first_date').val() == '') {
2232        $('#combined_first_date').notify("WAIT.\nPlease select your date.", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2233        $('#combined_first_date').addClass('error');
2234    }
2235
2236});
2237
2238$('#why_tefl').on('focus', function (e) {
2239    $('.why_tefl > .notifyjs-wrapper').trigger('click');
2240    $(this).addClass('green-border');
2241});
2242
2243function isEmail(email) {
2244    var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
2245    return regex.test(email);
2246}
2247
2248function checkErrors(maxindex) {
2249    var err = 0;
2250    console.log('Chiamata');
2251    $('.wpcf7-validates-as-required').each(function (index) {
2252        console.log('Giro ' + index);
2253        if ($(this).val() == '') {
2254            if (!err && maxindex > index) {
2255                if ($(this).attr('id') == 'name') {
2256                    $('#name').notify("WAIT.\nPlease insert your First Name", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2257                    $('#name').addClass('error');
2258                    err++;
2259                } else if ($(this).attr('id') == 'surname') {
2260                    $('#surname').notify("WAIT.\nPlease insert your Last Name", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2261                    $('#surname').addClass('error');
2262                    err++;
2263                } else if ($(this).attr('id') == 'email') {
2264                    $('#email').notify("WAIT.\nPlease insert your Email", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2265                    $('#email').addClass('error');
2266                    err++;
2267                } else if ($(this).attr('id') == 'email_conf') {
2268                    $('#email_conf').notify("WAIT.\nPlease confirm your email", { position: "top left", autoHideDelay: 1000000, autoHide: false });
2269                    $('#email_conf').addClass('error');
2270                    err++;
2271                }
2272            }
2273        }
2274    });
2275    return err;
2276}
2277
2278
2279$('#english_speaker').on('blur', function () {
2280    if ($(this).val()) {
2281        $(this).removeClass('error');
2282        $(this).next('.fa-check').removeClass('hide');
2283    } else {
2284        $(this).next('.fa-check').addClass('hide');
2285
2286    }
2287});
2288$('#online_course').on('blur', function () {
2289    if ($(this).val()) {
2290        $(this).removeClass('error');
2291        $(this).next('.fa-check').removeClass('hide');
2292    } else {
2293        $(this).next('.fa-check').addClass('hide');
2294    }
2295});
2296$('#first_choice').on('blur', function () {
2297    if ($(this).val()) {
2298        $(this).removeClass('error');
2299        $(this).next('.fa-check').removeClass('hide');
2300    } else {
2301        $(this).next('.fa-check').addClass('hide');
2302    }
2303});
2304$('#first_date').on('blur', function () {
2305    if ($(this).val()) {
2306        $(this).removeClass('error');
2307        $(this).next('.fa-check').removeClass('hide');
2308    } else {
2309        $(this).next('.fa-check').addClass('hide');
2310    }
2311});
2312
2313$('#combined_course').on('blur', function () {
2314    if ($(this).val()) {
2315        $(this).removeClass('error');
2316        $(this).next('.fa-check').removeClass('hide');
2317    } else {
2318        $(this).next('.fa-check').addClass('hide');
2319    }
2320});
2321$('#combined_first_date').on('blur', function () {
2322    if ($(this).val()) {
2323        $(this).removeClass('error');
2324        $(this).next('.fa-check').removeClass('hide');
2325    } else {
2326        $(this).next('.fa-check').addClass('hide');
2327    }
2328});
2329
2330$('#why_tefl').on('blur', function () {
2331    $(this).removeClass('green-border');
2332    if ($(this).val()) {
2333        $(this).removeClass('error');
2334        $(this).next('.fa-check').removeClass('hide');
2335    } else {
2336        $(this).next('.fa-check').addClass('hide');
2337    }
2338});
2339
2340function cleanField(value) {
2341    new_email = value.trim().replace(",", ".").replace(".con", ".com");
2342    return new_email;
2343}

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.