PageSourceSearch

https://www.protank.com/js/plugincompany/contactforms/pccforms.js

js protank.com collected 2026-10-02 21:35:57 UTC 47,273 bytes, 1,411 lines download raw bytes

1/**
2 *
3 * Created by:  Milan Simek
4 * Company:     Plugin Company
5 *
6 * LICENSE: http://plugin.company/docs/magento-extensions/magento-extension-license-agreement
7 *
8 * YOU WILL ALSO FIND A PDF COPY OF THE LICENSE IN THE DOWNLOADED ZIP FILE
9 *
10 * FOR QUESTIONS AND SUPPORT
11 * PLEASE DON'T HESITATE TO CONTACT US AT:
12 *
13 * [email protected]
14 *
15 */
16
17var PCCForms = false;
18var PCCFThemes = [];
19var PCCBaseJSURL;
20var PCCFLightbox = false;
21var RECAPTCHA_PUBLIC_KEY = '';
22var PCCFHasVisualCaptcha = false;
23var PCCFHasReCaptcha = false;
24var PCCFileUploadUrl;
25var PCCFDate;
26var PCCFVisualCaptchaUrl;
27var pc_resizing = false;
28var $PC;
29var PCCFDependentFields = [];
30var PCCFOnLoadJS = {};
31var PCCFCloseButtonText = 'close';
32
33/**
34 * Used to modify formdummy element to form element
35 * By default embedding forms on other form elements is not allowed in HTML
36 * This workaround fixes this issue for pop-up forms embedded in product pages
37 */
38function initChangeElement(){
39    $PC.fn.changeElementType = function(newType) {
40        this.each(function() {
41            var attrs = {};
42
43            $PC.each(this.attributes, function(idx, attr) {
44                attrs[attr.nodeName] = attr.nodeValue;
45            });
46
47            $PC(this).replaceWith(function() {
48                return $PC("<" + newType + "/>", attrs).append($PC(this).contents());
49            });
50        });
51    };
52}
53
54head.ready(document, function () {
55    //if no forms, no need to load PCCForms is set by widget/view.phtml
56    if(!PCCForms){
57        return false;
58    }
59
60    //load recaptcha api
61
62    if (!window.jQuery) {
63        //if needed load jQuery
64        PCHead.load(PCCBaseJSURL + "jquerynoconflict.js", function () {
65            //after jquery load init all
66            if(typeof $PC == "undefined"){
67                $PC = jQuery.noConflict(true);
68            }
69            if(typeof jQuery == "undefined"){
70                jQuery = $PC;
71            }
72            //init all
73            initPCCFAll();
74        })
75    }else{
76        if(!PCCFCheckMinVersion("1.9.1",jQuery.fn.jquery)){
77            PCHead.load(PCCBaseJSURL + "jquerynoconflict.js", function () {
78                if(typeof $PC == "undefined"){
79                    $PC = jQuery.noConflict(true);
80                }
81                if(typeof jQuery == "undefined"){
82                    jQuery = $PC;
83                }
84                //init all
85                initPCCFAll();
86            });
87        }else{
88            //init all
89            if(typeof $PC == "undefined"){
90                $PC = jQuery;
91            }
92            if(typeof jQuery == "undefined"){
93                jQuery = $PC;
94            }
95            initPCCFAll();
96        }
97    }
98
99});
100
101/**
102 * Initial constructor for all form methods
103 */
104function initPCCFAll() {
105
106    pccfAddPopupFormsToBody();
107
108    initChangeElement();
109
110    //load themes
111    loadPCCFThemes();
112
113    //load form.js
114    PCHead.load(PCCBaseJSURL + 'contactforms/lib/jquery.form.js',function() {
115        initPccf();
116    });
117
118
119    //init pages
120    initPCCFPages();
121    
122    //init split form
123    initPCCFSplitColumns();
124
125    //load lightbox
126    if(PCCFLightbox) {
127        pccfLightbox();
128    }
129
130    //init upload fields
131    initPCCFUploadFields();
132
133    //init datetime fields
134    initPCCFDate();
135
136    //init visual captcha fields
137    initPCCFCaptcha();
138
139    //init recaptcha
140    initPCCFReCaptcha();
141
142    //init slideout forms
143    initPCCFSlideOut();
144
145    PCCFExecuteOnLoadScripts();
146}
147
148function pccfAddPopupFormsToBody() {
149    jQuery('.pccf_form_popup_container').each(function(){
150        jQuery(this).before(jQuery(this).html());
151    })
152}
153
154
155/**
156 * Loads all needed theme files dynamically using AJAX
157 */
158function loadPCCFThemes() {
159    //load shared css
160    PCHead.load(PCCBaseJSURL + "contactforms/css/shared.css");
161    var alreadyAdded = [];
162    var urls = [];
163    //loop through themes set in widget/view.phtml
164    $PC.each(PCCFThemes, function (k, v) {
165        //check if theme is not added yet
166        if($PC.inArray(v,alreadyAdded) < 0){
167            alreadyAdded.push(v);
168            urls.push(PCCBaseJSURL + "contactforms/css/themes/" + v + ".css")
169        }
170    });
171    PCHead.load(urls,function() {
172        PCCFAfterThemesLoaded();
173    })
174    if(urls.length == 1){ //prototypejs adds function to array, making empty array have length of 1
175        PCCFAfterThemesLoaded();
176    }
177}
178
179function PCCFAfterThemesLoaded(){
180    initPCCFRTL();
181
182    $PC('.pccf_loader').fadeOut('normal',function() {
183        $PC(this).next().css({ 'visibility':'visible',opacity:0}
183).animate({opacity: 1.0});
184        $PC(this).remove();
185    });
186
187    //load html5shiv and respond.js if ie8 or below
188    if(typeof oldBrowser != "undefined"){
189        PCHead.load(PCCBaseJSURL + "lib/html5shiv.min.js")
190        PCHead.load(PCCBaseJSURL + "lib/respond.min.js")
191    }
192}
193/**
194 * Initializes slide-out form functionality
195 */
196function initPCCFSlideOut() {
197    $PC('.open_pcform').css('visibility','hidden');
198    if(typeof PCCFSlideout == 'undefined' ){
199        return;
200    }
201
202    PCHead.load(PCCBaseJSURL + "contactforms/css/iconfont/css/pccontact.css");
203    PCHead.load(PCCBaseJSURL + "contactforms/css/slideout.css",function() {
204        $PC('.pcform_slide').prependTo('body').css('z-index',10001).fadeIn();
205        $PC('.pcform_bottom_left,.pcform_bottom_right').each(function() {
206            var height = $PC(this).find('.pccf').height() + 'px';
207            $PC(this)
208                .css('bottom','-' + height)
209                .css('height',height)
210            ;
211            var that = $PC(this);
212            $PC(this).find('button').click(function() {
213                slideOutResize(that);
214            })
215            $PC(this).find('input').keypress(function() {
216                slideOutResize(that);
217            })
218        })
219    });
220
221
222    initPCCFanimateCSS();
223
224    setTimeout(function() {
225        $PC('.open_pcform').css('visibility','visible');
226        PCHead.load(PCCBaseJSURL + "contactforms/lib/jquery.scrollbar.min.js",function(){
227            $PC('.pcform_slide .slideout_scroll_wrapper').scrollbar();
228        })
229    },1500)
230}
231
232/**
233 * Resizes slide out forms to match size of contents
234 *
235 * @param element
236 * @param adjustMargin
237 */
238function slideOutResize(element,adjustMargin) {
239    var element = element;
240    var adjustm = false;
241    if(typeof adjustMargin !== "undefined"){
242        adjustm = true;
243    }
244
245    doSlideOutResize(element,adjustm);
246    setTimeout(function() {
247        doSlideOutResize(element,adjustm);
248    },1)
249    setTimeout(function() {
250        doSlideOutResize(element,adjustm);
251    },5)
252    setTimeout(function() {
253        doSlideOutResize(element,adjustm);
254    },7)
255    setTimeout(function() {
256        doSlideOutResize(element,adjustm);
257    },10)
258    setTimeout(function() {
259        doSlideOutResize(element,adjustm);
260    },100)
261    setTimeout(function() {
262        doSlideOutResize(element,adjustm);
263    },500)
264    setTimeout(function() {
265        doSlideOutResize(element,adjustm);
266    },1000)
267    setTimeout(function() {
268        doSlideOutResize(element,adjustm);
269    },1500)
270}
271
272/**
273 * Resizes slide-out forms to match content size
274 *
275 * @param element
276 * @param adjustm
277 */
278function doSlideOutResize(element,adjustm){
279    var element = element;
280    var adjustm = adjustm;
281    var height = element.find('.slideout_scroll_wrapper').height() + 'px';
282    element
283        .css('height',height)
284    ;
285    if(adjustm && !element.hasClass('expanded')){
286        element
287            .css('bottom','-' + height);
288    }
289}
290
291/**
292 * Initializes actual contact form functionality
293 */
294function initPccf(){
295    //custom varien validator for checkboxes
296    Validation.add('validate-one-required-custom','Please select one of the above options.', function (v,elm) {
297        var p = elm.parentNode.parentNode;
298        if(p.hasClassName("checkbox")){
299            p = p.parentNode;
300        }
301        var options = p.getElementsByTagName('INPUT');
302        return $A(options).any(function(elm) {
303            return $F(elm);
304        });
305    });
306
307    $PC('.pccform input').blur(function() {
308        $PC(this).val($PC(this).val().trim());
309    });
310
311    var i = 0;
312    $PC('.pccform').each(function(){
313        i++;
314        var form = $PC(this);
315
316        //set unique id for each form and elements, for validation
317        form.attr('id','pccf_' + i);
318        form.parents('.pccf').each(function() {
319            $PC(this).attr('id',$PC(this).attr('id') + i);
320            var prev = $PC(this).parent().prev();
321            if(prev.is('.pccflightbox')){
322                prev.attr('href',prev.attr('href') + i);
323            }else if(prev){
324                prev.find('.pccflightbox').each(function(){
325                    $PC(this).attr('href',$PC(this).attr('href') + i);
326                })
327            }
328        })
329
330        if(form.parents('.pccf_lightbox_wrapper').length || form.parents('.pcform_slide')){
331            form.parents('.pccf_lightbox_wrapper').prependTo('body');
332            form.changeElementType('form');
333            form = $PC('#' + form.attr('id'));
334        }
335
336        form.find('input,textarea,select,button,p,h1,h2,h3,h4,h5,h6,h7,.pcfileupload').each(function() {
337            if($PC(this).attr('id') && $PC(this).attr('id').indexOf('captcha') == '-1'){
338                $PC(this).attr('id', $PC(this).attr('id') + i);
339                if($PC(this).attr('name') ){
340                    if($PC(this).attr('multiple') || $PC(this).attr('type') == 'checkbox'){
341                        $PC(this).attr('name', $PC(this).attr('name') + i + '[]');
342                    }else{
343                        $PC(this).attr('name', $PC(this).attr('name') + i);
344                    }
345                }
346            }
347        })
348
349        //adjust labels for new ids
350        form.find('label').each(function() {
351            $PC(this).attr('for', $PC(this).attr('for') + i);
352        })
353
354        form.append('<input type="hidden" name="form_increment" id="form_increment" value="' + i + '" />')
355        form.append('<input class="pcc_uid" type="hidden" name="form_unique_id" value="' + PCRandId() + '" />')
356
357        form.find('.captcha').attr('id', 'captchawrapper' + i);
358
359        //focus on first field, if enabled for only one form on page
360        if(form.closest('.pccf').hasClass('focus_first_field') && $PC('.pccf.focus_first_field').length == 1)
361        {
362            var focusFirstField = true;
363        }else{
364            var focusFirstField = false;
365        }
366
367        //init validator
368        new VarienForm('pccf_' + i, focusFirstField);
369        if(focusFirstField){
370            setTimeout(function(){
371                form.find('input').eq(0).focus();
372            },1000)
373        }
374
375        //init ajax form submit
376        form.ajaxForm({
377            beforeSubmit: function(){
378                if(form.attr('submitting') == "true"){
379                    return false;
380                }
381                form.attr('submitting', true);
382                var submitMessage = form.parents('.pccformwrapper').find('.submitting');
383                submitMessage.fadeIn();
384            },
385            beforeSerialize: function(){
386                window['PCCF' + form.closest('.pccf').attr('formid') + 'BeforeSubmitJS']();
387                form.find('.form-group[disabled="disabled"]').remove();
388            },
389            success: function(responseText) {
390                form.attr('submitting', false);
391                if(responseText == 'captcha_error')
392                {
393                    grecaptcha.reset();
394                    form.parents('.pccformwrapper').find('.submitting').fadeOut(function(){
395                        $PC('<div style="display:none;" class="alert alert-warning" role="alert">Captcha validation failed, please try again.</div>')
396                            .prependTo(form).fadeIn().delay(4000).fadeOut(function() {
397                                $PC(this).parents('.pcform_bottom_right,.pcform_bottom_left').each(function() {
398                                    slideOutResize($PC(this));
399                                })
400                            });
401                        ;
402                    });
403                    return false;
404                }else if(responseText == 'visualcaptcha_error'){
405                    form.parents('.pccf').data('vcaptcha').refresh();
406                    form.parents('.pccformwrapper').find('.submitting').fadeOut(function(){
407                        $PC('<div style="display:none;" class="alert alert-warning" role="alert">Captcha validation failed, please try again.</div>')
408                            .prependTo(form).fadeIn().delay(4000).fadeOut(function() {
409                                $PC(this).parents('.pcform_bottom_right,.pcform_bottom_left').each(function() {
410                                    slideOutResize($PC(this));
411                                })
412                            });
413                        ;
414                    });
415                    return false;
416                }else{
417                    window['PCCF' + form.closest('.pccf').attr('formid') + 'SubmitJS']();
418                    var fwrap = form.parents('.pccformwrapper');
419                    fwrap.css({height:fwrap.height()+'px',width:fwrap.outerWidth()+'px'});
420                    fwrap.children().fadeOut(function() {
421                        fwrap.children().remove();
422                        fwrap.html(responseText);
423                        fwrap.children().fadeIn();
424                    });
425
426                    if(form.closest('.slideout_scroll_wrapper').length){
427                        //slideout form
428                        $PC('.slideout_scroll_wrapper').animate({
429                            scrollTop: 0
430                        }, 'slow');
431                    }else{
432                        //normal form
433                        $PC('html, body').animate({
434                            scrollTop: fwrap.offset().top - 40
435                        }, 'slow');
436                    }
437
438                    //auto close
439                    if(form.closest('.pccf_autohide').length){
440                        setTimeout(function(){
441                            //pop-up
442                            jQuery.colorbox.close();
443                            //slide-out
444                            if(fwrap.closest('.expanded').length && fwrap.closest('.pcform_slide').length){
445                                fwrap.closest('.pcform_slide').find('.open_pcform').trigger('click');
446                            }
447                        },2000)
448                    }
449
450                }
451            }
452        });
453    })
454
455    $PC('.pccform .input-group,.pccform .checkbox-inline,.pccform .checkbox,.pccform .radio-inline,.pccform .radio').bind("DOMSubtreeModified",function(){
456        $PC(this).find('.validation-advice').insertAfter(this);
457    });
458
459    //resize slideout forms once more
460    $PC('.pcform_bottom_left,.pcform_bottom_right').each(function() {
461        slideOutResize($PC(this),true);
462    });
463
464    //dependent fields
465    initPCCFDependentFields();
466
467    initPCCFResize();
468
469}
470
471/**
472 * Initializes form upload element
473 */
474function initPCCFUploadFields() {
475    if(!$PC('.pcc_upload').length){
476        return;
477    }
478
479    PCHead.load(PCCBaseJSURL + "contactforms/upload.js",function() {
480        //init upload fields
481        $PC('.pcc_upload').each(function() {
482            var uploadText = $PC(this).find('.fs-upload-target').text();
483            $PC(this).find('.fs-upload-target').remove();
484            var parentId = $PC(this).parents('.pccf').attr('formid');
485            var uniqId = $PC(this).parents('.pccf').find('.pcc_uid').val();
486            var index = $PC(this).parents('.pccf').find('.pcc_upload').index($PC(this));
487            var maxSize = $PC(this).attr('max_filesize');
488            if(maxSize){
489                maxSize = parseInt(maxSize) * 1024 * 1024;
490            }else{
491                maxSize = 5242880;
492            }
493            jQuery(this).upload({
494                action: PCCFileUploadUrl + 'form_id/' + parentId + '/uid/' + uniqId + '/index/' + index + '/',
495                label: uploadText,
496                maxSize: maxSize
497            }).on("start.upload", PCCFUploadOnStart)
498                .on("complete.upload", PCCFUploadOnComplete)
499                .on("filestart.upload", PCCFUploadOnFileStart)
500                .on("fileprogress.upload", PCCFUploadOnFileProgress)
501                .on("filecomplete.upload", PCCFUploadOnFileComplete)
502                .on("fileerror.upload", PCCFUploadOnFileError);
503        });
504        var i = 0;
505        $PC('.pcc_upload').each(function() {
506            if($PC(this).closest('.form-group').hasClass('required-control')){
507                $PC(this).find('input')
508                    .addClass('required-entry')
509                    .prop('id','pc-upload-' + i);
510                i++;
511            };
512        });
513    });
514}
515
516/**
517 * Loads date picker libraries
518 *
519 * @returns {boolean}
520 */
521function initPCCFDate() {
522    if(!PCCFDate) {
523        return false;
524    }
525
526    PCHead.load(PCCBaseJSURL + "contactforms/lib/datetime/moment.min.js",function() {
527            PCHead.load(
528                [
529                    PCCBaseJSURL + "contactforms/lib/datetime/bootstrap-datetimepicker.min.css",
530                    PCCBaseJSURL + "contactforms/lib/datetime/collapse-transitions.min.js",
531                    PCCBaseJSURL + "contactforms/lib/datetime/bootstrap-datetimepicker.min.js"
532                ],
533                function() {
534                    initPCCFDateElements();
535                }
536            );
537        }
538    )
539}
540
541/**
542 * Initializes date picker elements
543 */
544function initPCCFDateElements() {
545    var locale =  document.documentElement.lang.split('_')[0].split('-')[0].toLowerCase();
546    moment.locale(locale);
547    //date & time
548    $PC('.pccf .date.dateandtime').datetimepicker({
549        allowInputToggle: true,
550        sideBySide:true,
551        widgetPositioning: {horizontal:'right'},
552        locale: locale
553    });
554    //only date
555    $PC('.pccf .date.dateonly').datetimepicker({
556        allowInputToggle: true,
557        format:'L',
558        locale: locale
559    });
560    //only time
561    $PC('.pccf .date.time').datetimepicker({
562        format: 'LT',
563        allowInputToggle: true,
564        locale: locale
565    });
566    //date range
567    $PC('.pccf .date.daterange').datetimepicker({
568        allowInputToggle: true,
569        format:'L',
570        locale: locale
571    });
572    $PC('.pccf .date.daterange.datestart').on("dp.show", function (e) {
573        var maxDateObj = $PC(e.target).parent().parent().next().find('.dateend').data("DateTimePicker");
574
575        if(maxDateObj && maxDateObj.date()){
576            //set max date according to date end value
577            $PC(e.target).data('DateTimePicker').maxDate(maxDateObj.date());
578            //set min date according to max days parameter
579            var max_days = $PC(this).attr("max_days");
580            if (typeof max_days != "undefined" && max_days) {
581                $PC(e.target).data('DateTimePicker').minDate(maxDateObj.date().subtract(max_days, "day"));
582            }
583        }
584    });
585
586    $PC('.pccf .date.daterange.dateend').on("dp.show", function (e) {
587        var minDateObj = $PC(e.target).parent().parent().prev().find('.datestart').data("DateTimePicker");
588        if(minDateObj && minDateObj.date()){
589            //set min date according to date start value
590            $PC(e.target).data('DateTimePicker').minDate(minDateObj.date());
591            //set max date according to max days parameter
592            var max_days = $PC(this).attr("max_days");
593            if (typeof max_days != "undefined" && max_days) {
594                $PC(e.target).data('DateTimePicker').maxDate(minDateObj.date().add(max_days, "day"));
595            }
596        }
597    })
598}
599
600/**
601 * Initializes visual captcha
602 */
603function initPCCFCaptcha() {
604    if(!PCCFHasVisualCaptcha){
605        return;
606    }
607    PCHead.load(PCCBaseJSURL + "contactforms/lib/visualcaptcha/js/visualcaptcha.jquery.js",function() {
608        var i = 0;
609        $PC( '.vcaptcha').each(function() {
610            $PC(this).parents('form.pccform').append('<input type="hidden" name="vcaptcha_namespace" value="namespace' + i +'" />');
611            var captchaEl = jQuery(this).visualCaptcha({
612                imgPath: PCCBaseJSURL + 'contactforms/lib/visualcaptcha/img/',
613                url: PCCFVisualCaptchaUrl,
614                captcha: {
615                    numberOfImages: 5,
616                    routes: {
617                        start: 'startvcaptcha/vcaptcha_namespace/namespace' + i + '/count',
618                        image: 'imagevcaptcha/vcaptcha_namespace/namespace' + i +'/index',
619                        audio: 'audiovcaptcha/vcaptcha_namespace/namespace' + i
620                    }
621                }
622            } );
623            var captcha = captchaEl.data( 'captcha' );
624            $PC(this).parents('.pccf').data('vcaptcha', captcha);
625            i++;
626        })
627    });
628    PCHead.load(PCCBaseJSURL + "contactforms/lib/visualcaptcha/css/visualcaptcha.css");
629}
630
631/**
632 * Initializes reCaptcha functionality
633 */
634function initPCCFReCaptcha(){
635    if(!PCCFHasReCaptcha){
636        return;
637    }
638    //write recaptcha api js
639    if(typeof grecaptcha == "undefined"){
640        $PC('body').append("<script " + "src='https://www.google.com/recaptcha/api.js?render=explicit' async defer><\/script>");
641    }
642    //wait until loaded before initiating captchas
643    var initReCaptcha = setInterval(function(){
644        if(typeof grecaptcha == "undefined") {
645            return;
646        }
647        if(typeof grecaptcha.render == "undefined") {
648            return;
649        }
650        clearInterval(initReCaptcha);
651        initPCCFReCaptchaElements();
652    },50)
653}
654
655/**
656 * Initializes or re-initializes reCaptcha elements
657 */
658var PCCFReCaptchaInitialized = false;
659function initPCCFReCaptchaElements(){
660    if(typeof grecaptcha != "undefined") {
661        $PC('.pccf .g-recaptcha').each(function () {
662            try {
663                $PC(this).before('<div class="g-recaptcha" />');
664                var newCaptcha = $PC(this).prev();
665                $(this).remove();
666                grecaptcha.render(newCaptcha[0], {sitekey: RECAPTCHA_PUBLIC_KEY})
667            } catch (err) {
668            }
669        });
670        $PC('.pcform_bottom_right,.pcform_bottom_left').each(function () {
671            slideOutResize($PC(this), true);
672        })
673    }
674}
675
676/**
677 * Initializes colorbox pop-up form functionality
678 */
679function pccfLightbox() {
680    //load lightbox
681    if(typeof jQuery.colorbox == 'undefined'){
682        PCHead.load(PCCBaseJSURL + 'contactforms/lib/colorbox/colorbox.css');
683        PCHead.load(PCCBaseJSURL + 'contactforms/lib/colorbox/colorbox.js',function() {
684            setTimeout(function(){
685                jQuery(".pccflightbox").each(function() {
686                    var width = '600px';
687                    if(jQuery(this).attr('popupminwidth')){
688                        width = jQuery(this).attr('popupminwidth');
689                    }
690                    jQuery(this).colorbox({
691                        inline: true,
692                        width: width,
693                        maxWidth: '95%',
694                        close: PCCFCloseButtonText,
695                        onComplete: function () {
696                            initPCCFReCaptchaElements();
697                            PCCFExecuteResize();
698                        }
699                    })
700                });
701            },1000)
702            //exit intent popup
703            if(jQuery('.pccf_exit_intent').length){
704                PCHead.load(PCCBaseJSURL + 'lib/ouibounce.js',function() {
705                    jQuery('.pccf_exit_intent').each(function(){
706                        var form = jQuery(this).find('.pccf');
707                        var width = '600px';
708                        if(jQuery(this).attr('popupminwidth')){
709                            width = jQuery(this).attr('popupminwidth');
710                        }
711                        var aggressive = jQuery(this).attr('aggressive');
712                        if(aggressive === '1'){
713                            aggressive = true;
714                        }else{
715                            aggressive = false;
716                        }
717                        var cookieLifetime = jQuery(this).attr('cookielifetime');
718                        if(!cookieLifetime){
719                            cookieLifetime = 1;
720                        }
721                        ouibounce(false, {
722                            aggressive:aggressive,
723                            cookieExpire:cookieLifetime,
724                            callback: function() {
725                                jQuery.colorbox({
726                                    href: form,
727                                    inline:true,
728                                    width: width,
729                                    maxWidth: '95%',
730                                    close: PCCFCloseButtonText,
731                                    onComplete: function () {
732                                        initPCCFReCaptchaElements();
733                                        PCCFExecuteResize();
734                                    }
735                                })
736                            }
737                        });
738                    })
739                });
740            }
741        })
742    }else{
743        //ultimo theme
744        var oldBackgroundColor;
745        jQuery(".pccflightbox").each(function() {
746            var width = '600px';
747            if(jQuery(this).attr('popupminwidth')){
748                width = jQuery(this).attr('popupminwidth');
749            }
750            jQuery(this).colorbox({
751                inline: true, width: width, maxWidth: '95%', close: '', onComplete: function () {
752                    initPCCFReCaptchaElements();
753                    PCCFExecuteResize();
754                },
755                onOpen: function() {
756                    if(!oldBackgroundColor){
757                        oldBackgroundColor = jQuery('#cboxContent').css('background-color');
758                    }
759                    jQuery('#cboxClose').css('top', '10px');
760                    jQuery('#cboxContent').css('background', 'transparent');
761                },
762                onCleanup: function() {
763                    jQuery('#cboxContent').css('background-color', oldBackgroundColor);
764                    jQuery('#cboxClose').css('top', '');
765                    jQuery('.pccf_lightbox_wrapper').eq(0).append(jQuery('#cboxLoadedContent .pccf'));
766                },
767                onClose: function() {
768                    jQuery('#cboxContent').css('background-color', oldBackgroundColor);
769                }
770            })
771        });
772    }
773    //resize colorbox if submitted, because validation message takes space
774    $PC('.pccf button[type="submit"]').on('click',function() {
775        if($PC(this).parents('#colorbox').length){
776            setTimeout(function() {
777                jQuery.colorbox.resize();
778            },50)
779        }
780    })
781}
782
783/**
784 * Shows slide-out form
785 *
786 * @param position
787 * @param animation
788 * @param element
789 * @param size
790 */
791function showPCForm(position,animation,element,size){
792    var element = $PC(element).parent();
793    var position = position;
794    var animation = animation;
795    var size = size;
796    var isvertical = false;
797
798    if(size == 'ownheight'){
799        size = $PC(element).height();
800        isvertical = true;
801    }
802
803    //adjust width based on viewport
804    if(!isvertical){
805        if($PC( document ).width() < 530){
806            //mobile view
807            if(!isvertical) {
808                size = $PC(document).width();
809            }
810            element.css('width', $PC(document).width() + 'px');
811            element.prepend('<img class="pccf-slide-out-close" src="' + PCCBaseJSURL + 'contactforms/img/x.png" onclick="showPCForm(\'' + position + "','" + animation + "',this,500)\" />")
812        }else{
813            //desktop / tablet view
814            element.css('width', '500px');
815            size = 500;
816        }
817    }
818
819
820
821    if(element.hasClass('expanded')){
822        element
823            .removeClass('expanded ' + animation)
824            .addClass('animated ' + animation.replace('In','Out').replace('Up','Down'))
825        ;
826        setTimeout(function(){
827            element
828                .fadeOut(0)
829                .removeClass('animated ' + animation.replace('In','Out').replace('Up','Down'))
830                .fadeIn('fast')
831                .css(position, '-' + size + 'px');
832        },1000);
833    }
834    else{
835        element.fadeOut('fast',function(){
836            element.addClass('expanded animated ' + animation).fadeIn(0).css(position,'-0px')
837            setTimeout(function() {
838                element.removeClass('animated ' + animation);
839                element.removeClass('expanded');
840                setTimeout(function() {
841                    element.addClass('expanded');
842                    initPCCFReCaptchaElements();
843                },10)
844            },1200)
845        });
846    }
847}
848
849/*
850* initialize animate.css library if not loaded yet
851*/
852
853function initPCCFanimateCSS(){
854    if(typeof BrowserIE9 != "undefined"){
855        return;
856    }
857    var dummyAnimateCss = $PC('<dummy class="animated" style="display:none;"/>').appendTo('body');
858    var animateCssLoaded = dummyAnimateCss.css('animation-duration');
859    dummyAnimateCss.remove();
860    if(!animateCssLoaded || animateCssLoaded == '0s') {
861        PCHead.load(PCCBaseJSURL + "lib/animate.min.css");
862    }
863}
864
865function initPCCFSplitColumns(){
866    $PC('.pccf .pcform-section').each(function(){
867        $PC(this)
868            .find('.sectioncontents')
869            .append($PC(this).nextUntil('.formpage,.pcform-section'))
870        
871        //split in two columns if needed
872        if($PC(this).hasClass('columns_2')){
873            var content = $PC(this).find('.sectioncontents');
874            var columnOneLenght = Math.ceil(content.children('div.row,div.form-group').length/2);
875
876            if(!columnOneLenght){
877                return;
878            }
879            
880            if(content.find('button[type="submit"]').length){
881                columnOneLenght--;
882            }
883            if(content.find('.navbuttons').length){
884                columnOneLenght--;
885            }
886
887            var col1 = $PC("<div class='col-md-6' />");
888            var col2 = $PC("<div class='col-md-6' />");
889            col1.prepend(content.children('div.row,div.form-group').slice(0, columnOneLenght));
890            col2.prepend(content.children('div.row,div.form-group'));
891            content.prepend(col1).append(col2);
892            
893            content.find('button[type="submit"]').closest('.form-group').appendTo(col2);
894            content.find('.navbuttons').closest('.form-group').appendTo(col2);
895        }
896    });
897    
898    return;
899    $PC('.pccf fieldset, .pccf .formpage').each(function(){
900    });
901}
902
903/**
904 * Initialize Multi-page contact form pages
905 */
906function initPCCFPages(){
907    $PC('.pccf fieldset').each(function(){
908        var form = $PC(this);
909        if(form.find('.formpage').length < 1){
910            return;
911        }
912        $PC(document).keydown(function (event) {
913            if (event.keyCode == 13 && $PC(event.target).parents('.formpage').length && !$PC(event.target).is('textarea')) {
914                event.preventDefault();
915                return false;
916            }
917        });
918
919        if($PC(this).parents('.pcform_bottom_right,.pcform_bottom_left').length){
920            $PC(this).css({
921                '-webkit-transition': 'all 0s',
922                '-moz-transition': 'all 0s',
923                '-o-transition': 'all 0s',
924                '-ms-transition': 'all 0s',
925                'transition': 'all 0s'
926            })
927        }
928        initPCCFanimateCSS();
929
930        $PC(this).css({
931            'clear': 'both',
932            'position': 'relative'
933        });
934
935        if(!form.children().eq(0).is('.formpage')){
936            form.prepend('<div class="formpage" pagetitle="page 1" nexttext="Next" />');
937        }
938
939        form.parent().prepend('<ul class="nav-wizard" />');
940
941        form.children('.formpage').each(function(){
942            $PC(this).removeClass('form-group').html('');
943            $PC(this).append($PC(this).nextUntil('.formpage'));
944
945            $PC(this).parents('.pccf').find('.nav-wizard').append('<li><a>' + $PC(this).attr('pagetitle') + '</a></li>');
946
947            var prevNext = $PC('<div class="form-group"><div class="col-md-offset-3 col-md-6 navbuttons"></div></div>');
948            var navb = prevNext.find('.navbuttons');
949            navb.append('<div style="margin-left:10px;float:right;"><button style="float:right;" onclick="PCCFnextPage(this)" type="button" class="next btn btn-primary">' + $PC(this).attr('nexttext') + '</button></div>');
950            if($PC(this).attr('prev') == 1){
951                navb.append('<button style="float:right;" onclick="PCCFprevPage(this)" type="button" class="prev btn btn-default">' + $PC(this).attr('prevtext') + '</button>');
952            }
953            $PC(this).append(prevNext);
954        })
955
956        form.children('.formpage').last().find('.next').remove();
957        form.children('.formpage').first().find('.prev').remove();
958        form.parent().find('.nav-wizard li').eq(0).addClass('active');
959
960        if(typeof BrowserIE9 != "undefined"){
961            form.find('.formpage').hide();
962            form.find('.formpage').first().show();
963        }
964    })
965}
966
967function PCCFToggleNavType(){
968    //adjust pager items based on form width
969    jQuery('.pccf').each(function(){
970        var useSmallNav = false;
971        jQuery(this).removeClass('smallnav');
972        jQuery(this).find('.nav-wizard > li').each(function () {
973            if (!jQuery(this).is("li:first-child")) {
974                if (jQuery(this).offset().top > jQuery(this).prev().offset().top) {
975                    useSmallNav = true;
976                }
977            }
978        });
979        if(useSmallNav){
980            jQuery(this).addClass('smallnav');
981        }else{
982            jQuery(this).removeClass('smallnav');
983        }
984    })
985}
986
987/**
988 * Next page functionality for multi-page forms
989 *
990 * @param element
991 * @returns {boolean}
992 * @constructor
993 */
994function PCCFnextPage(element){
995    var form = $PC(element).parents('.pccf');
996    if(form.find('.animated').length){
997        return;
998    }
999    if(!form.attr('curpage')){
1000        form.attr('curpage', 1);
1001    }
1002
1003    var validated = true;
1004    $PC(element).parents('.formpage').find('input,select,textarea').each(function () {
1005        var eId = $PC(this).attr('id');
1006        if(eId){
1007            if(!Validation.validate($(eId))){
1008                validated = false;
1009            }
1010        }
1011    });
1012
1013    if(!validated){
1014        if($PC(element).parents('#colorbox').length){
1015            setTimeout(function(){
1016                PCCFExecuteResize();
1017            },50)
1018        }
1019        return false;
1020    }
1021
1022    var curPage = parseInt(form.attr('curpage'));
1023    var curIndex = curPage - 1;
1024
1025    var curPageEm =  form.find('.formpage').eq(curIndex);
1026    var nextPageEm =  form.find('.formpage').eq(curPage);
1027
1028    form.attr('curpage', curPage + 1);
1029
1030    form.find('.nav-wizard li.active').removeClass('active');
1031    form.find('.nav-wizard li').eq(curIndex + 1).addClass('active');
1032
1033    form.css('overflow','hidden');
1034    var fieldset = form.find('fieldset');
1035    fieldset.css('height',fieldset.height()+'px');
1036
1037    curPageEm.addClass('animated fadeOutLeft anipage');
1038    nextPageEm.addClass('animated fadeInRight').show();
1039
1040    nextPageEm.wrap('<fieldset />');
1041    var newHeight = nextPageEm.parent().outerHeight() + 'px';
1042    nextPageEm.unwrap();
1043
1044    fieldset.css('height', newHeight);
1045
1046    if($PC(element).closest('#colorbox').length){
1047        var cnt = 0;
1048        var timer = setInterval(function(){
1049            jQuery.colorbox.resize();
1050            cnt++;
1051            if(cnt > 3){
1052                clearInterval(timer);
1053            }
1054        },100);
1055    }
1056
1057    var timeout = 1200;
1058    if(typeof BrowserIE9 != "undefined"){
1059        timeout = 0;
1060    }
1061
1062    setTimeout(function () {
1063        curPageEm.removeClass('animated fadeOutLeft anipage');
1064        curPageEm.hide();
1065        nextPageEm.removeClass('animated fadeInRight');
1066        fieldset.css('height','auto');
1067        form.css('overflow','');
1068        initPCCFReCaptchaElements();
1069    }, timeout);
1070}
1071
1072/**
1073 * Prev page functionality for multi-page forms
1074 *
1075 * @param element
1076 * @constructor
1077 */
1078function PCCFprevPage(element){
1079    var form = $PC(element).parents('.pccf');
1080    if(form.find('.animated').length){
1081        return;
1082    }
1083    var curPage = parseInt(form.attr('curpage'));
1084    var curIndex = curPage - 1;
1085
1086    var curPageEm =  form.find('.formpage').eq(curIndex);
1087    var prevPageEm =  form.find('.formpage').eq(curIndex - 1);
1088
1089    form.attr('curpage', curPage - 1);
1090
1091    form.find('.nav-wizard li.active').removeClass('active');
1092    form.find('.nav-wizard li').eq(curIndex - 1).addClass('active');
1093
1094    form.css('overflow','hidden');
1095
1096    var fieldset = form.find('fieldset');
1097
1098    curPageEm.addClass('animated fadeOutRight anipage');
1099    prevPageEm.addClass('animated fadeInLeft').show();
1100
1101
1102    if($PC(element).closest('#colorbox').length){
1103        var cnt = 0;
1104        var timer = setInterval(function(){
1105            jQuery.colorbox.resize();
1106            cnt++;
1107            if(cnt > 3){
1108                clearInterval(timer);
1109            }
1110        },100)
1111    }
1112
1113    var timeout = 1200;
1114    if(typeof BrowserIE9 != "undefined"){
1115        timeout = 0;
1116    }
1117
1118    setTimeout(function () {
1119        curPageEm.removeClass('animated fadeOutRight anipage');
1120        curPageEm.hide();
1121        prevPageEm.removeClass('animated fadeInRight');
1122        form.css('overflow','');
1123        initPCCFReCaptchaElements();
1124    }, timeout);
1125}
1126
1127/**
1128 * Initialize depended fields functionality
1129 */
1130function initPCCFDependentFields(){
1131    if(PCCFDependentFields.length == 0){
1132        return;
1133    }
1134
1135    PCHead.load(PCCBaseJSURL + 'contactforms/lib/dependsOn.js',function() {
1136        //var dFormIds = PCCFarrayUnique(PCCFDependentFields);
1137        var dFormIds = jQuery.makeArray(jQuery(PCCFDependentFields).filter(function(i,itm){
1138            // note: 'index', not 'indexOf'
1139            return i == jQuery.inArray(itm,PCCFDependentFields);
1140        }));
1141
1142        jQuery.each(dFormIds,function(k,formId){
1143            jQuery('.pccf[formid=' + formId + ']').each(function(){
1144                var form = $PC(this);
1145                var increment = form.find('form').attr('id').replace('pccf_','');
1146                var dfields = JSON.parse(form.find('.dependent_fields').text());
1147                //console.log(dfields);
1148
1149                //set option values
1150                form.find('option').each(function(){
1151                   if(!jQuery(this).attr('value') && jQuery(this).attr('value') != ""){
1152                       jQuery(this).attr('value',jQuery(this).text());
1153                   }
1154                });
1155
1156                $PC.each(dfields,function(fKey,fValue){
1157                    var dependencies = {};
1158                    $PC.each(fValue.dependencies,function(dKey,dValue){
1159                        switch(dValue.fieldType){
1160                            case 'dropdown':
1161                            case 'multiple':
1162                                var selector = '#' + dValue.field + increment;
1163                                var values = dValue.value;
1164                                values = [values];
1165                                break;
1166                            case 'text':
1167                                var selector = '#' + dValue.field + increment;
1168                                var values = dValue.value.split(';;');
1169                                break;
1170                            case 'checkboxes':
1171                                var selector = PCCFGetDfieldCheckboxRadioSelector(dValue.field, increment);
1172                                var values = dValue.value;
1173                                values = [values];
1174                                break;
1175                            case 'radios':
1176                                var selector = PCCFGetDfieldCheckboxRadioSelector(dValue.field, increment);
1177                                var values = dValue.value;
1178                                values = [values];
1179                                break;
1180                            default:
1181                                return true;
1182                        }
1183                        var deps = {};
1184                        deps[dValue.condition] = values;
1185                        deps['enabled'] = true;
1186                        dependencies[selector] = deps;
1187                    });
1188                    if(!jQuery.isEmptyObject(dependencies)){
1189                        var em = form.find('label[for=' + fValue.name + increment + ']').parent();
1190                        if(!em.length){
1191                            em = form.find('#' + fValue.name + increment).closest('.row');
1192                        }
1193                        if(!em.length){
1194                            em = form.find('label[for=' + fValue.name + '_start' + increment + '], label[for=' + fValue.name + '_end' + increment + ']').parent();
1195                        }
1196                        em.dependsOn(dependencies,{
1197                            onEnable: function(event, subject){
1198                                subject
1199                                    .find('input,select,textarea')
1200                                    .prop('disabled', false)
1201                                    .trigger("change")
1202                                ;
1203                                setTimeout(function(){
1204                                    PCCFExecuteResize();
1205                                },250);
1206                            },
1207                            onDisable: function(event, subject){
1208                                subject
1209                                    .find('input,select,textarea')
1210                                    .prop('disabled', 'disabled')
1211                                    .trigger("change")
1212                                ;
1213                                setTimeout(function(){
1214                                    PCCFExecuteResize();
1215                                },250);
1216                            }
1217                        });
1218                    }
1219                });
1220            });
1221        });
1222    });
1223}
1224
1225function PCCFGetDfieldCheckboxRadioSelector(fieldId, increment) {
1226    var field = jQuery('#' + fieldId + '-0' + increment);
1227    var className = fieldId + '-' + increment;
1228    field
1229        .closest('.form-group')
1230        .addClass(className)
1231    ;
1232    // console.log(className);
1233    // console.log(jQuery)
1234    return '.' + className + ' input';
1235}
1236
1237/**
1238 * Generates random string
1239 *
1240 * @returns {string}
1241 * @constructor
1242 */
1243function PCs4() {
1244    return Math.floor((1 + Math.random()) * 0x10000)
1245        .toString(16)
1246        .substring(1);
1247}
1248
1249/**
1250 * Generates random ID
1251 *
1252 * @returns {string}
1253 * @constructor
1254 */
1255function PCRandId() {
1256    return PCs4() + PCs4();
1257}
1258
1259/**
1260 * intializes resize functionality for slide-out forms
1261 * Also toggles nav menu type on resize
1262 */
1263function initPCCFResize(){
1264    $PC( window ).resize(function() {
1265        PCCFStartResize();
1266    });
1267}
1268
1269function PCCFStartResize(){
1270    if(pc_resizing) {
1271        return false;
1272    }
1273    pc_resizing = true;
1274    setTimeout(function(){
1275        PCCFExecuteResize();
1276        setTimeout(function() {
1277            pc_resizing = false;
1278            PCCFExecuteResize();
1279        },1500)
1280    },200);
1281}
1282
1283function PCCFExecuteResize(){
1284    //toggle navigation menu type
1285    PCCFToggleNavType();
1286    if(typeof jQuery.colorbox != "undefined"){
1287        jQuery.colorbox.resize();
1288    }
1289
1290    //resize slide out forms
1291    $PC('.pcform_bottom_left,.pcform_bottom_right').each(function () {
1292        slideOutResize($PC(this),true);
1293    });
1294}
1295
1296/**
1297 * Initializes RTL functionality
1298 */
1299function initPCCFRTL(){
1300    //set direction to rtl
1301    $PC('.pccf.rtl').css('direction','rtl');
1302    //modify all elements to rtl
1303    $PC('.pccf.rtl').find('*').each(function(){
1304        var el = $PC(this);
1305        var mLeft = el.css('margin-left');
1306        var mRight = el.css('margin-right');
1307        var pLeft = el.css('padding-left');
1308        var pRight = el.css('padding-right');
1309        var borderBL = el.css('border-bottom-left-radius');
1310        var borderTL = el.css('border-top-left-radius');
1311        var borderBR = el.css('border-bottom-right-radius');
1312        var borderTR = el.css('border-top-right-radius');
1313
1314        if(el.css('float') == 'right'){
1315            el[0].style.setProperty('float','left','important');
1316        }else if(el.css('float') == 'left'){
1317            el[0].style.setProperty('float','right','important');
1318        }
1319
1320        el[0].style.setProperty('margin-left',mRight,'important');
1321        el[0].style.setProperty('margin-right',mLeft,'important');
1322        el[0].style.setProperty('padding-left',pRight,'important');
1323        el[0].style.setProperty('padding-right',pLeft,'important');
1324        el[0].style.setProperty('border-bottom-left-radius',borderBR,'important');
1325        el[0].style.setProperty('border-bottom-right-radius',borderBL,'important');
1326        el[0].style.setProperty('border-top-left-radius',borderTR,'important');
1327        el[0].style.setProperty('border-top-right-radius',borderTL,'important');
1328
1329        if(el.is('label')){
1330            el[0].style.setProperty('text-align','left','important');
1331        }
1332        if(el.is('.radio-inline') || el.is('.radio') || el.is('.checkbox-inline') || el.is('.checkbox') || el.is('button')){
1333            el[0].style.setProperty('float','right','important');
1334        }
1335        if(el.is('.help-block')){
1336            el[0].style.setProperty('text-align','right','important');
1337        }
1338        if(el.attr('class') && el.attr('class').match(/col\-/g)){
1339            el[0].style.setProperty('float','right','important');
1340        }
1341    })
1342}
1343
1344/**
1345 * Parses version string. Used to check loaded jQuery version
1346 *
1347 * @param str
1348 * @returns {*}
1349 * @constructor
1350 */
1351function PCCFparseVersionString(str){
1352    if (typeof(str) != 'string') { return false; }
1353    var x = str.split('.');
1354    // parse from string or default to 0 if can't parse
1355    var maj = parseInt(x[0]) || 0;
1356    var min = parseInt(x[1]) || 0;
1357    var pat = parseInt(x[2]) || 0;
1358    return {
1359        major: maj,
1360        minor: min,
1361        patch: pat
1362    }
1363}
1364
1365/**
1366 * Checks if min version is matched
1367 * Used for jQuery checking
1368 *
1369 * @param vmin
1370 * @param vcurrent
1371 * @returns {boolean}
1372 * @constructor
1373 */
1374function PCCFCheckMinVersion(vmin, vcurrent) {
1375    var minimum = PCCFparseVersionString(vmin);
1376    var running = PCCFparseVersionString(vcurrent);
1377    if (running.major != minimum.major)
1378        return (running.major > minimum.major);
1379    else {
1380        if (running.minor != minimum.minor)
1381            return (running.minor > minimum.minor);
1382        else {
1383            if (running.patch != minimum.patch)
1384                return (running.patch > minimum.patch);
1385            else
1386                return true;
1387        }
1388    }
1389};
1390
1391function PCCFExecuteOnLoadScripts()
1392{
1393    for (var key in PCCFOnLoadJS) {
1394        if (PCCFOnLoadJS.hasOwnProperty(key)) {
1395            PCCFOnLoadJS[key]();
1396        }
1397    }
1398}
1399
1400/**
1401 * Returns array of unique values
1402 *
1403 * @param array
1404 * @returns {*}
1405 * @constructor
1406 */
1407function PCCFarrayUnique(array){
1408    return array.filter(function(el, index, arr) {
1409        return index === arr.indexOf(el);
1410    });
1411}

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.