PageSourceSearch

https://www.americaninsurance.com/sites/default/files/js/js_0B3MIY_ADAGp6dQ6ph7R7Osqeth8ePIeEn3bbQW0s8Q.js

js americaninsurance.com collected 2026-09-28 12:50:06 UTC 153,679 bytes, 1,750 lines download raw bytes

1(function(t){if(typeof define==='function'&&define.amd){define(['jquery'],t)}
2else if(typeof module==='object'&&module.exports){module.exports=t(require('jquery'))}
3else{t(jQuery)}}(function(t){var e=(function(){function e(){var e=this,h=function(){var n=['br-wrapper'];if(e.options.theme!==''){n.push('br-theme-'+e.options.theme)};e.$elem.wrap(t('<div />',{'class':n.join(' ')}))},m=function(){e.$elem.unwrap()},s=function(n){if(t.isNumeric(n)){n=Math.floor(n)};return t('option[value="'+n+'"]',e.$elem)},v=function(){var n=e.options.initialRating;if(!n){return t('option:selected',e.$elem)};return s(n)},y=function(){var n=e.$elem.find('option[value="'+e.options.emptyValue+'"]');if(!n.length&&e.options.allowEmpty){n=t('<option />',{'value':e.options.emptyValue});return n.prependTo(e.$elem)};return n},n=function(t){var n=e.$elem.data('barrating');if(typeof t!=='undefined'){return n[t]};return n},i=function(t,n){if(n!==null&&typeof n==='object'){e.$elem.data('barrating',n)}
4else{e.$elem.data('barrating')[t]=n}},b=function(){var n=v(),t=y(),a=n.val(),r=n.data('html')?n.data('html'):n.text(),o=(e.options.allowEmpty!==null)?e.options.allowEmpty:!!t.length,l=(t.length)?t.val():null,s=(t.length)?t.text():null;i(null,{userOptions:e.options,ratingValue:a,ratingText:r,originalRatingValue:a,originalRatingText:r,allowEmpty:o,emptyRatingValue:l,emptyRatingText:s,readOnly:e.options.readonly,ratingMade:!1})},w=function(){e.$elem.removeData('barrating')},r=function(){return n('ratingText')},a=function(){return n('ratingValue')},x=function(){var i=t('<div />',{'class':'br-widget'});e.$elem.find('option').each(function(){var r,a,o,l;r=t(this).val();if(r!==n('emptyRatingValue')){a=t(this).text();o=t(this).data('html');if(o){a=o};l=t('<a />',{'href':'#','data-rating-value':r,'data-rating-text':a,'html':(e.options.showValues)?a:''});i.append(l)}});if(e.options.showSelectedRating){i.append(t('<div />',{'text':'','class':'br-current-rating'}))};if(e.options.reverse){i.addClass('br-reverse')};if(e.options.readonly){i.addClass('br-readonly')};return i},u=function(){if(n('userOptions').reverse){return'nextAll'}
5else{return'prevAll'}},f=function(t){s(t).prop('selected',!0);e.$elem.change()},R=function(){t('option',e.$elem).prop('selected',function(){return this.defaultSelected});e.$elem.change()},o=function(t){t=t?t:r();if(t==n('emptyRatingText')){t=''};if(e.options.showSelectedRating){e.$elem.parent().find('.br-current-rating').text(t)}},V=function(t){return Math.round(((Math.floor(t*10)/10)%1)*100)},d=function(){e.$widget.find('a').removeClass(function(t,e){return(e.match(/(^|\s)br-\S+/g)||[]).join(' ')})},l=function(){var i=e.$widget.find('a[data-rating-value="'+a()+'"]'),r=n('userOptions').initialRating,f=t.isNumeric(a())?a():0,l=V(r),s,o;d();i.addClass('br-selected br-current')[u()]().addClass('br-selected');if(!n('ratingMade')&&t.isNumeric(r)){if((r<=f)||!l){return};s=e.$widget.find('a');o=(i.length)?i[(n('userOptions').reverse)?'prev':'next']():s[(n('userOptions').reverse)?'last':'first']();o.addClass('br-fractional');o.addClass('br-fractional-'+l)}},O=function(t){if(!n('allowEmpty')||!n('userOptions').deselectable){return!1};return(a()==t.attr('data-rating-value'))},C=function(s){s.on('click.barrating',function(s){var c=t(this),g=n('userOptions'),u,d;s.preventDefault();u=c.attr('data-rating-value');d=c.attr('data-rating-text');if(O(c)){u=n('emptyRatingValue');d=n('emptyRatingText')};i('ratingValue',u);i('ratingText',d);i('ratingMade',!0);f(u);o(d);l();g.onSelect.call(e,a(),r(),s);return!1})},S=function(e){e.on('mouseenter.barrating',function(){var e=t(this);d();e.addClass('br-active')[u()]().addClass('br-active');o(e.attr('data-rating-text'))})},T=function(t){e.$widget.on('mouseleave.barrating blur.barrating',function(){o();l()})},c=function(e){e.on('touchstart.barrating',function(e){e.preventDefault();e.stopPropagation();t(this).click()})},M=function(t){t.on('click.barrating',function(t){t.preventDefault()})},j=function(t){C(t);if(e.options.hoverState){S(t);T(t)}},g=function(t){t.off('.barrating')},p=function(t){var n=e.$widget.find('a');if(c){c(n)};if(t){g(n);M(n)}
6else{j(n)}};this.show=function(){if(n())return;h();b();e.$widget=x();e.$widget.insertAfter(e.$elem);l();o();p(e.options.readonly);e.$elem.hide()};this.readonly=function(t){if(typeof t!=='boolean'||n('readOnly')==t)return;p(t);i('readOnly',t);e.$widget.toggleClass('br-readonly')};this.set=function(t){var s=n('userOptions');if(!e.$elem.find('option[value="'+t+'"]').val())return;
6i('ratingValue',t);i('ratingText',e.$elem.find('option[value="'+t+'"]').text());i('ratingMade',!0);f(a());o(r());l();if(!s.silent){s.onSelect.call(this,a(),r())}};this.clear=function(){var t=n('userOptions');i('ratingValue',n('originalRatingValue'));i('ratingText',n('originalRatingText'));i('ratingMade',!1);R();o(r());l();t.onClear.call(this,a(),r())};this.destroy=function(){var t=a(),i=r(),o=n('userOptions');g(e.$widget.find('a'));e.$widget.remove();w();m();e.$elem.show();o.onDestroy.call(this,t,i)}};e.prototype.init=function(e,n){this.$elem=t(n);this.options=t.extend({},t.fn.barrating.defaults,e);return this.options};return e})();t.fn.barrating=function(n,i){return this.each(function(){var a=new e();if(!t(this).is('select')){t.error('Sorry, this plugin only works with select fields.')};if(a.hasOwnProperty(n)){a.init(i,this);if(n==='show'){return a.show(i)}
7else{if(a.$elem.data('barrating')){a.$widget=t(this).next('.br-widget');return a[n](i)}}}
8else if(typeof n==='object'||!n){i=n;a.init(i,this);return a.show()}
9else{t.error('Method '+n+' does not exist on jQuery.barrating')}})};t.fn.barrating.defaults={theme:'',initialRating:null,allowEmpty:null,emptyValue:'',showValues:!1,showSelectedRating:!0,deselectable:!0,reverse:!1,readonly:!1,fastClicks:!0,hoverState:!0,silent:!1,onSelect:function(t,e,n){},onClear:function(t,e){},onDestroy:function(t,e){}};t.fn.barrating.BarRating=e}));;
10(function(e){Drupal.behaviors.field_rating={attach:function(t){e('.field-type-field-rating select.field-rating-stars-widget').once('field-type-field-rating-stars-widget-init',function(t){var i=e(this);e(this).barrating('show',{theme:'css-stars',onSelect:function(e,n,t){if(typeof(t)!=='undefined'){console.log(e);i.val(e)}
11else{}}})})}}})(jQuery);;
12(function(t){Drupal.progressBar=function(r,i,e,s){var a=this;this.id=r;this.method=e||'GET';this.updateCallback=i;this.errorCallback=s;this.element=t('<div class="progress" aria-live="polite"></div>').attr('id',r);this.element.html('<div class="bar"><div class="filled"></div></div><div class="percentage"></div><div class="message">&nbsp;</div>')};Drupal.progressBar.prototype.setProgress=function(r,i){if(r>=0&&r<=100){t('div.filled',this.element).css('width',r+'%');t('div.percentage',this.element).html(r+'%')};t('div.message',this.element).html(i);if(this.updateCallback){this.updateCallback(r,i,this)}};Drupal.progressBar.prototype.startMonitoring=function(t,r){this.delay=r;this.uri=t;this.sendPing()};Drupal.progressBar.prototype.stopMonitoring=function(){clearTimeout(this.timer);this.uri=null};Drupal.progressBar.prototype.sendPing=function(){if(this.timer){clearTimeout(this.timer)};if(this.uri){var r=this;t.ajax({type:this.method,url:this.uri,data:'',dataType:'json',success:function(t){if(t.status==0){r.displayError(t.data);return};r.setProgress(t.percentage,t.message);r.timer=setTimeout(function(){r.sendPing()},r.delay)},error:function(t){r.displayError(Drupal.ajaxError(t,r.uri))}})}};Drupal.progressBar.prototype.displayError=function(r){var i=t('<div class="messages error"></div>').html(r);t(this.element).before(i).hide();if(this.errorCallback){this.errorCallback(this)}}})(jQuery);;
13;jQuery(function(e){if(typeof Drupal.ajax!='undefined'){for(var t in Drupal.ajax){if(typeof Drupal.ajax[t].callback!='undefined'&&Drupal.ajax[t].callback=='ins_forms_updateFeed'){var c=Drupal.ajax[t].options.beforeSend,r=e(Drupal.ajax[t].element),i=jQuery.extend({},Drupal.ajax[t].options);Drupal.ajax[t].options.beforeSubmit=function(a,t){var n=e(window).width();if(n>=768)i.beforeSubmit(a,t)};Drupal.ajax[t].options.beforeSerialize=function(a,t){var n=e(window).width();if(n>=768)i.beforeSerialize(a,t)};Drupal.ajax[t].options.complete=function(a,t){var n=e(window).width();if(n>=768)i.complete(a,t)};Drupal.ajax[t].options.success=function(a,t){var n=e(window).width();if(n>=768)i.success(a,t)};Drupal.ajax[t].options.beforeSend=function(a,t){var i=e(window).width();if(i>=768){c(a,t);e('.feedContainer').addClass('updateFeed')}
14else{if(r.attr('type')=='submit')r.parents('form').submit()}}}};Drupal.ajax.prototype.commands.updateStateBlock=function(a,t,s){var n=e(a.form.context);n.removeClass('waiting');var i=n.parents('.statesBlock');i.removeClass('starting');i.find('.stateInput').val(t.data.state);i.find('.stateTitle').text(t.data.title);i.find('.stateStates').find('.req').find('.value').text(t.data.min);i.find('.stateStates').find('.descr').find('.value').text(t.data.state_type);i.find('.stateStates').find('.descr').find('.sub').text(t.data.state_type_note);var d=parseFloat(t.data.avg).toFixed(0)+'';d=d.replace(/(\d)(?=(\d{3})+\.?)/g,'$1,');i.find('.stateStates').find('.average').find('.value').text('$'+d);i.find('.stateStates').find('.average').find('.sub').text(t.data.state_type_descr);if(t.data.page)n.attr('action',t.data.url);else n.attr('action','/auto-insurance-providers')};Drupal.ajax.prototype.commands.updateFeed=function(e,a,t){s(a.data)};if(typeof Drupal.ajax['edit-states']!='undefined')Drupal.ajax['edit-states'].options.beforeSubmit=function(a,t,i){var n=e(t.context);n.addClass('waiting')};e('.ins-forms-state-form #edit-submit').on('click',function(a){if
14(e(this).parents('form').hasClass('waiting'))a.preventDefault()});e('.ins-forms-state-form #edit-states').trigger('change')};e('.ins-forms-state-update-form').each(function(){if(!e(this).find('.form-submit').length)e(this).find('select').on('change',function(){var a=e(this).parents('form');a.submit()})});e('.ins-forms-feed-form .form-radio,.ins-forms-feed-form .form-select,.ins-forms-feed-form .form-checkbox').on('change',function(){var a=e(window).width();if(a>=768)e(this).parents('form').find('.form-submit').trigger('mousedown')});e('.ins-forms-calc-form,.ins-forms-quotes-form').on('submit',function(a){var t=e(this),n=!1,s=t.find('[name="insurance_type"]').val();if(!!s)t.attr('action',s);if(t.find('select[name="insurance_type"]').length){if(t.find('select[name="insurance_type"]')[0].offsetParent===null){return!0};e(t.find('select[name="insurance_type"]').parents('.form-item')).removeClass('errored');var d=t.find('select[name="insurance_type"]').val();if(!d){e(t.find('select[name="insurance_type"]').parents('.form-item')).addClass('errored');n=!0}}
15else if(t.find('input[name="insurance_type"]').length){var d=t.find('input[name="insurance_type"]').val()};if(t.find('input[name="zip"]'.offsetParent!==null).length){if(t.find('select[name="zip"]')[0].offsetParent===null){return!0}};var i=t.find('input[name="zip"]');if(i.length){i.parents('.form-item').removeClass('errored');var o=i.val();if(o.match(/^\d{5}$/)===null){i.parents('.form-item').addClass('errored');n=!0}};if(n)return!1;var r=e(window).width()});e('.inputTel').attr('type','tel');var a={};if(e('.feedMenu').length&&typeof Drupal.settings.feedOptions!='undefined'&&typeof Drupal.settings.feedOptions.zip!='undefined'){e('.feedMenu a').each(function(){var a=e(this).attr('href');if(a.indexOf('?')!==-1){a+='&zip='}
16else{a+='?zip='};e(this).attr('href',a+Drupal.settings.feedOptions.zip)})};if(e('.feedContainer').length&&typeof Drupal.settings.feedOptions!='undefined'){e('.feedContainer').removeClass('updateFeed');e.ajax({url:'/getmixedfeed',type:'post',dataType:'json',data:Drupal.settings.feedOptions,timeout:0,success:function(e){s(e)},error:function(){e('.page-feed').addClass('showForm')}})}
17else if(e('.feedContainer').length&&typeof Drupal.settings.feedResult!='undefined'){setTimeout(function(){e('.feedContainer').removeClass('updateFeed');s(Drupal.settings.feedResult)},500)};if(e('.pageFeeds').hasClass('showForm'))e('.page-feed').addClass('showForm');function l(t){var i=t.attr('data-lid'),n=a[i].clickurl,d=a[i].sid;e('.feedContainer').trigger('feedClick',{feed:a[i],feed_dom:t,type:'click'});e.ajax({url:'/ozsid',type:'GET',data:{sid:d,c:t.parent().children().length,i:t.index(),}});window.open(n,'_blank')};function f(t){var i=t.attr('data-lid'),d=a[i].sid;e('.feedContainer').trigger('feedClick',{feed:a[i],feed_dom:t,type:'call'});e.ajax({url:'/ozsid',type:'GET',data:{sid:d,c:t.parent().children().length,i:t.index(),}});if(typeof a[i].ccPhoneNum=='undefined'){var n=a[i].clicktocall;n=n.match(/\{([^)]+)\}/);if(typeof n[1]=='undefined')return;e.ajax({url:'https://www.nextinsure.com/ListingDisplay/Display/PhoneAPI.aspx?papi=1',dataType:'jsonp',type:'GET',data:JSON.parse('{'+n[1]+'}'),timeout:0,success:function(e){var t=!1;for(pid in e){t=e[pid];break};if(typeof t.ccPhoneNum!='undefined'){a[i].phone=t.ccPhoneNum;window.location.href='tel:1'+t.ccPhoneNum}}})}
18else{window.location.href='tel:1'+a[i].ccPhoneNum}};window.ins_click=l;window.ins_call=f;var n='',o=!1;function u(e){n=e;try{window.setTimeout(function(){imagesLoaded=!0;d()},7000);window.setTimeout(function(){p(1000)},1000)}catch(a){imagesLoaded=!0;d()}};function d(){if(o)return;if(!!n&&!!imagesLoaded){o=!0;window.focus();window.location.replace(n)}};function p(e){if(e<3000){try{var t=document.getElementByTagName('img');for(var a=0;a<t.length;a++){if(!t[a].complete){window.setTimeout(function(){p(e+500)},500);return}}}catch(i){}};imagesLoaded=!0;d()};function s(i){e('.feedContainer').removeClass('updateFeed');if(i){var p=(typeof i['branded']!='undefined'),z=(typeof i['redirecting']!='undefined');if(z){e('body').addClass('page-feed-redirecting');e('body').addClass('page-feed-redirecting-');e('#copyright-wrapper,.feedsHead,.insBlocks,#header,.topScreen,#bottomBlocks-wrapper,#footer,#footer-wrapper,.feedForm,#footerMenu-wrapper').remove();var t=i.listings[0],r=e('<div/>
18').addClass('interstitial').attr('data-lid','ls0'),T=e('<p/>').addClass('intTitle').css('background',t['auto_redirect_primary_color']);T.html('Congratulations! It looks like <b>'+t['auto_redirect_company_name']+'</b> is your best match!');T.appendTo(r);var S=e('<img/>').addClass('intImg').attr('src',t['auto_redirect_logo']);S.appendTo(r);var F=e('<p/>').addClass('intSubTitle').addClass('intSubTitle').html(t['auto_redirect_subtitle']);F.appendTo(r);var j=e('<div/>').addClass('intLoader').addClass('intLoader').css('background',t['auto_redirect_primary_color']);j.appendTo(r);$intDescription=e('<div/>').addClass('intDescription').html(t['description']).hide();$intDescription.appendTo(r);e('.feedContainer').removeClass('loading');e('.feedContainer').append(r);a['ls0']=t;u(t.clickurl);e('.feedContainer').trigger(e.Event('feedRedirect',{feedList:a,resp:i}))}
19else{if(p){e('body').addClass('page-feed-branded');e('body').addClass('page-feed-branded-'+i['branded']);e('html').addClass('html-feed-branded');e('html').addClass('html-feed-branded-'+i['branded'])};var v='Call Agent <span class="sub">Click to see phone</span>',b='Free Quotes';if(typeof Drupal.settings.feedText.quote!='undefined')b=Drupal.settings.feedText.quote;if(typeof Drupal.settings.feedText.call!='undefined')v=Drupal.settings.feedText.call;if(typeof i.listings!='undefined'){var g=e('<div/>').addClass('insBlocks');for(var y in i.listings){var t=i.listings[y],D='SH0',B=D.substring(0,2),o=e('<div/>').attr('data-lid','ls'+y).addClass('insBlock').addClass('insBlock-'+B).addClass('insBlock-'+D);if(i.listings.length==1)o.addClass('insBlock-single');a['ls'+y]=t;var d=e('<div/>').addClass('feedLogo');$logoWrap=e('<div/>').addClass('feedLogoWrap');$logoWrap.append(e('<img/>').attr('src',t.logo).addClass('logo'));var W=((typeof t.altLogo!='undefined')&&(typeof t.altLogoMobile!='undefined')),x=((typeof t.brandLogo!='undefined')&&(typeof t.brandLogoMobile!='undefined'));if(p&&typeof t.brandLogo!='undefined'){var s=e('<img/>').attr('src',t.brandLogo).addClass('altLogo');if(x)s.addClass('hideMobile');$logoWrap.append(s);d.addClass('altFeedLogo')}
20else if(typeof t.altLogo!='undefined'){var s=e('<img/>').attr('src',t.altLogo).addClass('altLogo');$logoWrap.append(s);d.addClass('altFeedLogo')};if(p&&typeof t.brandLogoMobile!='undefined'){var s=e('<img/>').attr('src',t.brandLogoMobile).addClass('altLogo');if(x)s.addClass('showMobile');$logoWrap.append(s);d.addClass('altFeedLogo');d.addClass('altFeedLogoMobile')};d.append($logoWrap);d.appendTo(o);var n=e('<div/>').addClass('descriptionWrapper');e('<p/>').addClass('name').html(t.displayname).appendTo(n);var k=t.title;if(typeof t.atitle!='undefined')k=t.atitle;e('<p/>').addClass('title').html(k).appendTo(n);e('<div/>').addClass('description').html(t.description).appendTo(n);if(typeof t.adescription!='undefined'){n.find('.description').find('p,ul').remove();n.find('.description').prepend(t.adescription)};if(typeof t.aquote!='undefined'){b=t.aquote};if(typeof t.acall!='undefined'){v=t.acall};var h=e('<p/>').addClass('sitehost').text(t.sitehost),m=e('<div/>').addClass('buttonWrapper'),c=e('<a/>');if(typeof t.clickurl!='undefined'&&!!t.clickurl){c.addClass('btnGetQuote').html(b);d.find('img').addClass('btnGetQuote');if(!p)o.addClass('insBlock-click');else{c.addClass('insBlock-click');h.addClass('insBlock-click')}};if(typeof t.clicktocall!='undefined'&&!!t.clicktocall){c.addClass('btnCallNow').html(v);d.addClass('btnCallNow');if(!p)o.addClass('insBlock-call');else{c.addClass('insBlock-call');h.addClass('insBlock-call')}};h.appendTo(n);n.appendTo(o);c.appendTo(m);m.appendTo(o);g.append(o);if(p){n.append('<div class="descriptionWrapper" style="text-align:center;"></div>').children().unwrap();var C=e('<div/>').addClass('getQuoteTempInputWrapper').addClass('input'),L=e('<input type="tel" pattern="[0-9]*" maxlength="5" size="5" class="getQuoteTempInput" placeholder="Enter ZIP CODE" name="zip" maxlength="5" />');C.append(L);C.append('<span class="bottom-input-border"></span>');m.prepend(C);m.keydown(function(a){if(e.inArray(a.keyCode,[46,8,9,27,13,110,190])!==-1||(a.keyCode==65&&(a.ctrlKey===!0||a.metaKey===!0))||
20(a.keyCode==67&&(a.ctrlKey===!0||a.metaKey===!0))||(a.keyCode==88&&(a.ctrlKey===!0||a.metaKey===!0))||(a.keyCode>=35&&a.keyCode<=39)){return};if((a.shiftKey||(a.keyCode<48||a.keyCode>57))&&(a.keyCode<96||a.keyCode>105)){a.preventDefault()}})}
21else{e('.feedContainer .phoneBlock').appendTo(g)}};var w=e('.feedContainer').find('.insBlocks');if(w.length)w.replaceWith(g);else e('.feedContainer').append(g);e('.feedContainer .insBlock-click').on('click',function(){var a=(e(this).hasClass('insBlock')?e(this):e(this).parents('.insBlock'));l(a)});e('.feedContainer .insBlock-call').on('click',function(){var a=(e(this).hasClass('insBlock')?e(this):e(this).parents('.insBlock'));f(a)});e('.feedContainer').removeClass('loading');e('.feedForm').show();e('.feedContainer').trigger(e.Event('feedReady',{feedList:a,resp:i}))}
22else{e('.page-feed').addClass('showForm')}}}
23else{e('.page-feed').addClass('showForm')}}});
24;jQuery(function(e){e('.feedContainer').on('feedRedirect',function(e){try{gtmEvent('conversion_autoredirect',e.feedList.ls0)}catch(a){console.log('gtm event failed')}});e('.feedContainer').on('feedReady',function(e){gtmEvent('show_mixer_page',!1,e)});e('.feedContainer').on('feedClick',function(e,a){gtmEvent('conversion',a.feed)})});function getUrlParameter(e){e=e.replace(/[\[]/,'\\[').replace(/[\]]/,'\\]');var n=new RegExp('[\\?&]'+e+'=([^&#]*)'),a=n.exec(location.search);return a===null?'':decodeURIComponent(a[1].replace(/\+/g,' '))};function gtmEvent(n,a,c){var d=!1,t=!1,e=!1,i=!1;if(window.location.pathname.match(/auto|car/ig)!=null){var e='Auto'};if(window.location.pathname.match(/home/ig)!=null){var e='Home'};if(window.location.pathname.match(/life/ig)!=null){var e='Life'};if(window.location.pathname.match(/disability|health/ig)!=null){var e='Health';try{if(c.resp.query.individuals[0].age>=65){var e='Medicare'}}catch(r){}};if(window.location.pathname.match(/medicare|medicaid/ig)!=null){var e='Medicare'};var o=parseInt(getUrlParameter('brand'));try{if(typeof o!='undefined'&&o>0){var e=e+': brand='+o}}catch(r){};switch(n){case'show_mixer_page':dataLayer.push({'event':'show_feed','attributes':{'action':'Serving Mixer Results Page','category':e,'label':'',}});break;case'conversion':if(typeof a.displayname!='undefined'){var t=a.displayname};if(typeof a.cid!='undefined'){var i=a.cid};dataLayer.push({'event':'conversion','attributes':{'action':'Conversion','category':e,'label':t,'cid':i,}});break;case'conversion_autoredirect':if(typeof a.displayname!='undefined'){var t=a.displayname};if(typeof a.cid!='undefined'){var i=a.cid};dataLayer.push({'event':'conversion','attributes':{'action':'Conversion (Auto-Redirect)','category':e,'label':t,'cid':i,}});break}};;
25(function(e){jQuery.extend({debug:function(){window.debug=window.debug||[];args=jQuery.makeArray(arguments);if(typeof this=='object'){var e=(args.length?args[0]:window.debug.length),n=this}
26else{var e=(args.length>1?args.pop():window.debug.length),n=args[0]};window.debug[e]=n;if(typeof console!='undefined'){console.log(e,n)};return this}});jQuery.fn.debug=jQuery.debug})(jQuery);;
27/**
28 * Owl Carousel v2.2.1
29 * Copyright 2013-2017 David Deutsch
vendor: 42,703 bytes, lines 29-33
29
30 * Licensed under  ()
31 */
32!function(a,b,c,d){function e(b,c){this.settings=null,this.options=a.extend({},e.Defaults,c),this.$element=a(b),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this._states={current:{},tags:{initializing:["busy"],animating:["busy"],dragging:["interacting"]}},a.each(["onResize","onThrottledResize"],a.proxy(function(b,c){this._handlers[c]=a.proxy(this[c],this)},this)),a.each(e.Plugins,a.proxy(function(a,b){this._plugins[a.charAt(0).toLowerCase()+a.slice(1)]=new b(this)},this)),a.each(e.Workers,a.proxy(function(b,c){this._pipe.push({filter:c.filter,run:a.proxy(c.run,this)})},this)),this.setup(),this.initialize()}e.Defaults={items:3,loop:!1,center:!1,rewind:!1,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:b,fallbackEasing:"swing",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",refreshClass:"owl-refresh",loadedClass:"owl-loaded",loadingClass:"owl-loading",rtlClass:"owl-rtl",responsiveClass:"owl-responsive",dragClass:"owl-drag",itemClass:"owl-item",stageClass:"owl-stage",stageOuterClass:"owl-stage-outer",grabClass:"owl-grab"},e.Width={Default:"default",Inner:"inner",Outer:"outer"},e.Type={Event:"event",State:"state"},e.Plugins={},e.Workers=[{filter:["width","settings"],run:function(){this._width=this.$element.width()}},{filter:["width","items","settings"],run:function(a){a.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){this.$stage.children(".cloned").remove()}},{filter:["width","items","settings"],run:function(a){var b=this.settings.margin||"",c=!this.settings.autoWidth,d=this.settings.rtl,e={width:"auto","margin-left":d?b:"","margin-right":d?"":b};!c&&this.$stage.children().css(e),a.css=e}},{filter:["width","items","settings"],run:function(a){var b=(this.width()/this.settings.items).toFixed(3)-this.settings.margin,c=null,d=this._items.length,e=!this.settings.autoWidth,f=[];for(a.items={merge:!1,width:b};d--;)c=this._mergers[d],c=this.settings.mergeFit&&Math.min(c,this.settings.items)||c,a.items.merge=c>1||a.items.merge,f[d]=e?b*c:this._items[d].width();this._widths=f}},{filter:["items","settings"],run:function(){var b=[],c=this._items,d=this.settings,e=Math.max(2*d.items,4),f=2*Math.ceil(c.length/2),g=d.loop&&c.length?d.rewind?e:Math.max(e,f):0,h="",i="";for(g/=2;g--;)b.push(this.normalize(b.length/2,!0)),h+=c[b[b.length-1]][0].outerHTML,b.push(this.normalize(c.length-1-(b.length-1)/2,!0)),i=c[b[b.length-1]][0].outerHTML+i;this._clones=b,a(h).addClass("cloned").appendTo(this.$stage),a(i).addClass("cloned").prependTo(this.$stage)}},{filter:["width","items","settings"],run:function(){for(var a=this.settings.rtl?1:-1,b=this._clones.length+this._items.length,c=-1,d=0,e=0,f=[];++c<b;)d=f[c-1]||0,e=this._widths[this.relative(c)]+this.settings.margin,f.push(d+e*a);this._coordinates=f}},{filter:["width","items","settings"],run:function(){var a=this.settings.stagePadding,b=this._coordinates,c={width:Math.ceil(Math.abs(b[b.length-1]))+2*a,"padding-left":a||"","padding-right":a||""};this.$stage.css(c)}},{filter:["width","items","settings"],run:function(a){var b=this._coordinates.length,c=!this.settings.autoWidth,d=this.$stage.children();if(c&&a.items.merge)for(;b--;)a.css.width=this._widths[this.relative(b)],d.eq(b).css(a.css);else c&&(a.css.width=a.items.width,d.css(a.css))}},{filter:["items"],run:function(){this._coordinates.length<1&&this.$stage.removeAttr("style")}},{filter:["width","items","settings"],run:function(a){a.current=a.current?this.$stage.children().index(a.current):0,a.current=Math.max(this.minimum(),Math.min(this.maximum(),a.current)),this.reset(a.current)}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var a,b,c,d,e=this.settings.rtl?1:-1,f=2*this.settings.stagePadding,g=this.coordinates(this.current())+f,h=g+this.width()*e,i=[];for(c=0,d=this._coordinates.length;c<d;c++)a=this._coordinates[c-1]||0,b=Math.abs(this._coordinates[c])+f*e,(this.op(a,"<=",g)&&this.op(a,">",h)||this.op(b,"<",g)&&this.op(b,">",h))&&i.push(c);this.$stage.children(".active").removeClass("active"),this.$stage.children(":eq("+i.join("), :eq(")+")").addClass("active"),this.settings.center&&(this.$stage.children(".center").removeClass("center"),this.$stage.children().eq(this.current()).addClass("center"))}}],e.prototype.initialize=function(){if(this.enter("initializing"),this.trigger("initialize"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.autoWidth&&!this.is("pre-loading")){var b,c,e;b=this.$element.find("img"),c=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:d,e=this.$element.children(c).width(),b.length&&e<=0&&this.preloadAutoWidthImages(b)}this.$element.addClass(this.options.loadingClass),this.$stage=a("<"+this.settings.stageElement+' class="'+this.settings.stageClass+'"/>').wrap('<div class="'+this.settings.stageOuterClass+'"/>'),this.$element.append(this.$stage.parent()),this.replace(this.$element.children().not(this.$stage.parent())),this.$element.is(":visible")?this.refresh():this.invalidate("width"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass),this.registerEventHandlers(),this.leave("initializing"),this.trigger("initialized")},e.prototype.setup=function(){var b=this.viewport(),c=this.options.responsive,d=-1,e=null;c?(a.each(c,function(a){a<=b&&a>d&&(d=Number(a))}),e=a.extend({},this.options,c[d]),"function"==typeof e.stagePadding&&(e.stagePadding=e.stagePadding()),delete e.responsive,e.responsiveClass&&this.$element.attr("class",this.$element.attr("class").replace(new RegExp("("+this.options.responsiveClass+"-)\\S+\\s","g"),"$1"+d))):e=a.extend({},this.options),this.trigger("change",{property:{name:"settings",value:e}}),this._breakpoint=d,this.settings=e,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}})},e.prototype.optionsLogic=function(){this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},e.prototype.prepare=function(b){var c=this.trigger("prepare",{content:b});return c.data||(c.data=a("<"+this.settings.itemElement+"/>").addClass(this.options.itemClass).append(b)),this.trigger("prepared",{content:c.data}),c.data},e.prototype.update=function(){for(var b=0,c=this._pipe.length,d=a.proxy(function(a){return this[a]},this._invalidated),e={};b<c;)(this._invalidated.all||a.grep(this._pipe[b].filter,d).length>0)&&this._pipe[b].run(e),b++;this._invalidated={},!this.is("valid")&&this.enter("valid")},e.prototype.width=function(a){switch(a=a||e.Width.Default){case e.Width.Inner:case e.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},e.prototype.refresh=function(){this.enter("refreshing"),this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$element.addClass(this.options.refreshClass),this.update(),this.$element.removeClass(this.options.refreshClass),this.leave("refreshing"),this.trigger("refreshed")},e.prototype.onThrottledResize=function(){b.clearTimeout(this.resizeTimer),this.resizeTimer=b.setTimeout(this._handlers.onResize,this.settings.responsiveRefreshRate)},e.prototype.onResize=function(){return!!this._items.length&&(this._width!==this.$element.width()&&(!!this.$element.is(":visible")&&(this.enter("resizing"),this.trigger("resize").isDefaultPrevented()?(this.leave("resizing"),!1):(this.invalidate("width"),this.refresh(),this.leave("resizing"),void this.trigger("resized")))))},e.prototype.registerEventHandlers=function(){a.support.transition&&this.$stage.on(a.support.transition.end+".owl.core",a.proxy(this.onTransitionEnd,this)),this.settings.responsive!==!1&&this.on(b,"resize",this._handlers.onThrottledResize),this.settings.mouseDrag&&(this.$element.addClass(this.options.dragClass),this.$stage.on("mousedown.owl.core",a.proxy(this.onDragStart,this)),this.$stage.on("dragstart.owl.core selectstart.owl.core",function(){return!1})),this.settings.touchDrag&&(this.$stage.on("touchstart.owl.core",a.proxy(this.onDragStart,this)),this.$stage.on("touchcancel.owl.core",a.proxy(this.onDragEnd,this)))},e.prototype.onDragStart=function(b){var d=null;3!==b.which&&(a.support.transform?(d=this.$stage.css("transform").replace(/.*\(|\)| /g,"").split(","),d={x:d[16===d.length?12:4],y:d[16===d.length?13:5]}):(d=this.$stage.position(),d={x:this.settings.rtl?d.left+this.$stage.width()-this.width()+this.settings.margin:d.left,y:d.top}),this.is("animating")&&(a.support.transform?this.animate(d.x):this.$stage.stop(),this.invalidate("position")),this.$element.toggleClass(this.options.grabClass,"mousedown"===b.type),this.speed(0),this._drag.time=(new Date).getTime(),this._drag.target=a(b.target),this._drag.stage.start=d,this._drag.stage.current=d,this._drag.pointer=this.pointer(b),a(c).on("mouseup.owl.core touchend.owl.core",a.proxy(this.onDragEnd,this)),a(c).one("mousemove.owl.core touchmove.owl.core",a.proxy(function(b){var d=this.difference(this._drag.pointer,this.pointer(b));a(c).on("mousemove.owl.core touchmove.owl.core",a.proxy(this.onDragMove,this)),Math.abs(d.x)<Math.abs(d.y)&&this.is("valid")||(b.preventDefault(),this.enter("dragging"),this.trigger("drag"))},this)))},e.prototype.onDragMove=function(a){var b=null,c=null,d=null,e=this.difference(this._drag.pointer,this.pointer(a)),f=this.difference(this._drag.stage.start,e);this.is("dragging")&&(a.preventDefault(),this.settings.loop?(b=this.coordinates(this.minimum()),c=this.coordinates(this.maximum()+1)-b,f.x=((f.x-b)%c+c)%c+b):(b=this.settings.rtl?this.coordinates(this.maximum()):this.coordinates(this.minimum()),c=this.settings.rtl?this.coordinates(this.minimum()):this.coordinates(this.maximum()),d=this.settings.pullDrag?-1*e.x/5:0,f.x=Math.max(Math.min(f.x,b+d),c+d)),this._drag.stage.current=f,this.animate(f.x))},e.prototype.onDragEnd=function(b){var d=this.difference(this._drag.pointer,this.pointer(b)),e=this._drag.stage.current,f=d.x>0^this.settings.rtl?"left":"right";a(c).off(".owl.core"),this.$element.removeClass(this.options.grabClass),(0!==d.x&&this.is("dragging")||!this.is("valid"))&&(this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(this.closest(e.x,0!==d.x?f:this._drag.direction)),this.invalidate("position"),this.update(),this._drag.direction=f,(Math.abs(d.x)>3||(new Date).getTime()-this._drag.time>300)&&this._drag.target.one("click.owl.core",function(){return!1})),this.is("dragging")&&(this.leave("dragging"),this.trigger("dragged"))},e.prototype.closest=function(b,c){var d=-1,e=30,f=this.width(),g=this.coordinates();return this.settings.freeDrag||a.each(g,a.proxy(function(a,h){return"left"===c&&b>h-e&&b<h+e?d=a:"right"===c&&b>h-f-e&&b<h-f+e?d=a+1:this.op(b,"<",h)&&this.op(b,">",g[a+1]||h-f)&&(d="left"===c?a+1:a),d===-1},this)),this.settings.loop||(this.op(b,">",g[this.minimum()])?d=b=this.minimum():this.op(b,"<",g[this.maximum()])&&(d=b=this.maximum())),d},e.prototype.animate=function(b){var c=this.speed()>0;this.is("animating")&&this.onTransitionEnd(),c&&(this.enter("animating"),this.trigger("translate")),a.support.transform3d&&a.support.transition?this.$stage.css({transform:"translate3d("+b+"px,0px,0px)",transition:this.speed()/1e3+"s"}):c?this.$stage.animate({left:b+"px"},this.speed(),this.settings.fallbackEasing,a.proxy(this.onTransitionEnd,this)):this.$stage.css({left:b+"px"})},e.prototype.is=function(a){return this._states.current[a]&&this._states.current[a]>0},e.prototype.current=function(a){if(a===d)return this._current;if(0===this._items.length)return d;if(a=this.normalize(a),this._current!==a){var b=this.trigger("change",{property:{name:"position",value:a}});b.data!==d&&(a=this.normalize(b.data)),this._current=a,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current},e.prototype.invalidate=function(b){return"string"===a.type(b)&&(this._invalidated[b]=!0,this.is("valid")&&this.leave("valid")),a.map(this._invalidated,function(a,b){return b})},e.prototype.reset=function(a){a=this.normalize(a),a!==d&&(this._speed=0,this._current=a,this.suppress(["translate","translated"]),this.animate(this.coordinates(a)),this.release(["translate","translated"]))},e.prototype.normalize=function(a,b){var c=this._items.length,e=b?0:this._clones.length;return!this.isNumeric(a)||c<1?a=d:(a<0||a>=c+e)&&(a=((a-e/2)%c+c)%c+e/2),a},e.prototype.relative=function(a){return a-=this._clones.length/2,this.normalize(a,!0)},e.prototype.maximum=function(a){var b,c,d,e=this.settings,f=this._coordinates.length;if(e.loop)f=this._clones.length/2+this._items.length-1;else if(e.autoWidth||e.merge){for(b=this._items.length,c=this._items[--b].width(),d=this.$element.width();b--&&(c+=this._items[b].width()+this.settings.margin,!(c>d)););f=b+1}else f=e.center?this._items.length-1:this._items.length-e.items;return a&&(f-=this._clones.length/2),Math.max(f,0)},e.prototype.minimum=function(a){return a?0:this._clones.length/2},e.prototype.items=function(a){return a===d?this._items.slice():(a=this.normalize(a,!0),this._items[a])},e.prototype.mergers=function(a){return a===d?this._mergers.slice():(a=this.normalize(a,!0),this._mergers[a])},e.prototype.clones=function(b){var c=this._clones.length/2,e=c+this._items.length,f=function(a){return a%2===0?e+a/2:c-(a+1)/2};return b===d?a.map(this._clones,function(a,b){return f(b)}):a.map(this._clones,function(a,c){return a===b?f(c):null})},e.prototype.speed=function(a){return a!==d&&(this._speed=a),this._speed},e.prototype.coordinates=function(b){var c,e=1,f=b-1;return b===d?a.map(this._coordinates,a.proxy(function(a,b){return this.coordinates(b)},this)):(this.settings.center?(this.settings.rtl&&(e=-1,f=b+1),c=this._coordinates[b],c+=(this.width()-c+(this._coordinates[f]||0))/2*e):c=this._coordinates[f]||0,c=Math.ceil(c))},e.prototype.duration=function(a,b,c){return 0===c?0:Math.min(Math.max(Math.abs(b-a),1),6)*Math.abs(c||this.settings.smartSpeed)},e.prototype.to=function(a,b){var c=this.current(),d=null,e=a-this.relative(c),f=(e>0)-(e<0),g=this._items.length,h=this.minimum(),i=this.maximum();this.settings.loop?(!this.settings.rewind&&Math.abs(e)>g/2&&(e+=f*-1*g),a=c+e,d=((a-h)%g+g)%g+h,d!==a&&d-e<=i&&d-e>0&&(c=d-e,a=d,this.reset(c))):this.settings.rewind?(i+=1,a=(a%i+i)%i):a=Math.max(h,Math.min(i,a)),this.speed(this.duration(c,a,b)),this.current(a),this.$element.is(":visible")&&this.update()},e.prototype.next=function(a){a=a||!1,this.to(this.relative(this.current())+1,a)},e.prototype.prev=function(a){a=a||!1,this.to(this.relative(this.current())-1,a)},e.prototype.onTransitionEnd=function(a){if(a!==d&&(a.stopPropagation(),(a.target||a.srcElement||a.originalTarget)!==this.$stage.get(0)))return!1;this.leave("animating"),this.trigger("translated")},e.prototype.viewport=function(){var d;return this.options.responsiveBaseElement!==b?d=a(this.options.responsiveBaseElement).width():b.innerWidth?d=b.innerWidth:c.documentElement&&c.documentElement.clientWidth?d=c.documentElement.clientWidth:console.warn("Can not detect viewport width."),d},e.prototype.replace=function(b){this.$stage.empty(),this._items=[],b&&(b=b instanceof jQuery?b:a(b)),this.settings.nestedItemSelector&&(b=b.find("."+this.settings.nestedItemSelector)),b.filter(function(){return 1===this.nodeType}).each(a.proxy(function(a,b){b=this.prepare(b),this.$stage.append(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)},this)),this.reset(this.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},e.prototype.add=function(b,c){var e=this.relative(this._current);c=c===d?this._items.length:this.normalize(c,!0),b=b instanceof jQuery?b:a(b),this.trigger("add",{content:b,position:c}),b=this.prepare(b),0===this._items.length||c===this._items.length?(0===this._items.length&&this.$stage.append(b),0!==this._items.length&&this._items[c-1].after(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)):(this._items[c].before(b),this._items.splice(c,0,b),this._mergers.splice(c,0,1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)),this._items[e]&&this.reset(this._items[e].index()),this.invalidate("items"),this.trigger("added",{content:b,position:c})},e.prototype.remove=function(a){a=this.normalize(a,!0),a!==d&&(this.trigger("remove",{content:this._items[a],position:a}),this._items[a].remove(),this._items.splice(a,1),this._mergers.splice(a,1),this.invalidate("items"),this.trigger("removed",{content:null,position:a}))},e.prototype.preloadAutoWidthImages=function(b){b.each(a.proxy(function(b,c){this.enter("pre-loading"),c=a(c),a(new Image).one("load",a.proxy(function(a){c.attr("src",a.target.src),c.css("opacity",1),this.leave("pre-loading"),!this.is("pre-loading")&&!this.is("initializing")&&this.refresh()},this)).attr("src",c.attr("src")||c.attr("data-src")||c.attr("data-src-retina"))},this))},e.prototype.destroy=function(){this.$element.off(".owl.core"),this.$stage.off(".owl.core"),a(c).off(".owl.core"),this.settings.responsive!==!1&&(b.clearTimeout(this.resizeTimer),this.off(b,"resize",this._handlers.onThrottledResize));for(var d in this._plugins)this._plugins[d].destroy();this.$stage.children(".cloned").remove(),this.$stage.unwrap(),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class",this.$element.attr("class").replace(new RegExp(this.options.responsiveClass+"-\\S+\\s","g"),"")).removeData("owl.carousel")},e.prototype.op=function(a,b,c){var d=this.settings.rtl;switch(b){case"<":return d?a>c:a<c;case">":return d?a<c:a>c;case">=":return d?a<=c:a>=c;case"<=":return d?a>=c:a<=c}},e.prototype.on=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},e.prototype.off=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent("on"+b,c)},e.prototype.trigger=function(b,c,d,f,g){var h={item:{count:this._items.length,index:this.current()}},i=a.camelCase(a.grep(["on",b,d],function(a){return a}).join("-").toLowerCase()),j=a.Event([b,"owl",d||"carousel"].join(".").toLowerCase(),a.extend({relatedTarget:this},h,c));return this._supress[b]||(a.each(this._plugins,function(a,b){b.onTrigger&&b.onTrigger(j)}),this.register({type:e.Type.Event,name:b}),this.$element.trigger(j),this.settings&&"function"==typeof this.settings[i]&&this.settings[i].call(this,j)),j},e.prototype.enter=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]===d&&(this._states.current[b]=0),this._states.current[b]++},this))},e.prototype.leave=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]--},this))},e.prototype.register=function(b){if(b.type===e.Type.Event){if(a.event.special[b.name]||(a.event.special[b.name]={}),!a.event.special[b.name].owl){var c=a.event.special[b.name]._default;a.event.special[b.name]._default=function(a){return!c||!c.apply||a.namespace&&a.namespace.indexOf("owl")!==-1?a.namespace&&a.namespace.indexOf("owl")>-1:c.apply(this,arguments)},a.event.special[b.name].owl=!0}}else b.type===e.Type.State&&(this._states.tags[b.name]?this._states.tags[b.name]=this._states.tags[b.name].concat(b.tags):this._states.tags[b.name]=b.tags,this._states.tags[b.name]=a.grep(this._states.tags[b.name],a.proxy(function(c,d){return a.inArray(c,this._states.tags[b.name])===d},this)))},e.prototype.suppress=function(b){a.each(b,a.proxy(function(a,b){this._supress[b]=!0},this))},e.prototype.release=function(b){a.each(b,a.proxy(function(a,b){delete this._supress[b]},this))},e.prototype.pointer=function(a){var c={x:null,y:null};return a=a.originalEvent||a||b.event,a=a.touches&&a.touches.length?a.touches[0]:a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:a,a.pageX?(c.x=a.pageX,c.y=a.pageY):(c.x=a.clientX,c.y=a.clientY),c},e.prototype.isNumeric=function(a){return!isNaN(parseFloat(a))},e.prototype.difference=function(a,b){return{x:a.x-b.x,y:a.y-b.y}},a.fn.owlCarousel=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),f=d.data("owl.carousel");f||(f=new e(this,"object"==typeof b&&b),d.data("owl.carousel",f),a.each(["next","prev","to","destroy","refresh","replace","add","remove"],function(b,c){f.register({type:e.Type.Event,name:c}),f.$element.on(c+".owl.carousel.core",a.proxy(function(a){a.namespace&&a.relatedTarget!==this&&(this.suppress([c]),f[c].apply(this,[].slice.call(arguments,1)),this.release([c]))},f))})),"string"==typeof b&&"_"!==b.charAt(0)&&f[b].apply(f,c)})},a.fn.owlCarousel.Constructor=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._interval=null,this._visible=null,this._handlers={"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoRefresh&&this.watch()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={autoRefresh:!0,autoRefreshInterval:500},e.prototype.watch=function(){this._interval||(this._visible=this._core.$element.is(":visible"),this._interval=b.setInterval(a.proxy(this.refresh,this),this._core.settings.autoRefreshInterval))},e.prototype.refresh=function(){this._core.$element.is(":visible")!==this._visible&&(this._visible=!this._visible,this._core.$element.toggleClass("owl-hidden",!this._visible),this._visible&&this._core.invalidate("width")&&this._core.refresh())},e.prototype.destroy=function(){var a,c;b.clearInterval(this._interval);for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoRefresh=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel resized.owl.carousel":a.proxy(function(b){if(b.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(b.property&&"position"==b.property.name||"initialized"==b.type))for(var c=this._core.settings,e=c.center&&Math.ceil(c.items/2)||c.items,f=c.center&&e*-1||0,g=(b.property&&b.property.value!==d?b.property.value:this._core.current())+f,h=this._core.clones().length,i=a.proxy(function(a,b){this.load(b)},this);f++<e;)this.load(h/2+this._core.relative(g)),h&&a.each(this._core.clones(this._core.relative(g)),i),g++},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={lazyLoad:!1},e.prototype.load=function(c){var d=this._core.$stage.children().eq(c),e=d&&d.find(".owl-lazy");!e||a.inArray(d.get(0),this._loaded)>-1||(e.each(a.proxy(function(c,d){var e,f=a(d),g=b.devicePixelRatio>1&&f.attr("data-src-retina")||f.attr("data-src");this._core.trigger("load",{element:f,url:g},"lazy"),f.is("img")?f.one("load.owl.lazy",a.proxy(function(){f.css("opacity",1),this._core.trigger("loaded",{element:f,url:g},"lazy")},this)).attr("src",g):(e=new Image,e.onload=a.proxy(function(){f.css({"background-image":'url("'+g+'")',opacity:"1"}),this._core.trigger("loaded",{element:f,url:g},"lazy")},this),e.src=g)},this)),this._loaded.push(d.get(0)))},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this._core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Lazy=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._handlers={"initialized.owl.carousel refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&"position"==a.property.name&&this.update()},this),"loaded.owl.lazy":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&a.element.closest("."+this._core.settings.itemClass).index()===this._core.current()&&this.update()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},e.prototype.update=function(){var b=this._core._current,c=b+this._core.settings.items,d=this._core.$stage.children().toArray().slice(b,c),e=[],f=0;a.each(d,function(b,c){e.push(a(c).height())}),f=Math.max.apply(null,e),this._core.$stage.parent().height(f).addClass(this._core.settings.autoHeightClass)},e.prototype.destroy=function(){var a,b;for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoHeight=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._videos={},this._playing=null,this._handlers={"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.register({type:"state",name:"playing",tags:["interacting"]})},this),"resize.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.video&&this.isInFullScreen()&&a.preventDefault()},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.is("resizing")&&this._core.$stage.find(".cloned .owl-video-frame").remove()},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"===a.property.name&&this._playing&&this.stop()},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find(".owl-video");c.length&&(c.css("display","none"),this.fetch(c,a(b.content)))}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",a.proxy(function(a){this.play(a)},this))};e.Defaults={video:!1,videoHeight:!1,videoWidth:!1},e.prototype.fetch=function(a,b){var c=function(){return a.attr("data-vimeo-id")?"vimeo":a.attr("data-vzaar-id")?"vzaar":"youtube"}(),d=a.attr("data-vimeo-id")||a.attr("data-youtube-id")||a.attr("data-vzaar-id"),e=a.attr("data-width")||this._core.settings.videoWidth,f=a.attr("data-height")||this._core.settings.videoHeight,g=a.attr("href");if(!g)throw new Error("Missing video URL.");if(d=g.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/),d[3].indexOf("youtu")>-1)c="youtube";else if(d[3].indexOf("vimeo")>-1)c="vimeo";else{if(!(d[3].indexOf("vzaar")>-1))throw new Error("Video URL not supported.");c="vzaar"}d=d[6],this._videos[g]={type:c,id:d,width:e,height:f},b.attr("data-video",g),this.thumbnail(a,this._videos[g])},e.prototype.thumbnail=function(b,c){var d,e,f,g=c.width&&c.height?'style="width:'+c.width+"px;height:"+c.height+'px;"':"",h=b.find("img"),i="src",j="",k=this._core.settings,l=function(a){e='<div class="owl-video-play-icon"></div>',d=k.lazyLoad?'<div class="owl-video-tn '+j+'" '+i+'="'+a+'"></div>':'<div class="owl-video-tn" style="opacity:1;background-image:url('+a+')"></div>',b.after(d),b.after(e)};if(b.wrap('<div class="owl-video-wrapper"'+g+"></div>"),this._core.settings.lazyLoad&&(i="data-src",j="owl-lazy"),h.length)return l(h.attr(i)),h.remove(),!1;"youtube"===c.type?(f="//img.youtube.com/vi/"+c.id+"/hqdefault.jpg",l(f)):"vimeo"===c.type?a.ajax({type:"GET",url:"//vimeo.com/api/v2/video/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a[0].thumbnail_large,l(f)}}):"vzaar"===c.type&&a.ajax({type:"GET",url:"//vzaar.com/api/videos/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a.framegrab_url,l(f)}})},e.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},e.prototype.play=function(b){var c,d=a(b.target),e=d.closest("."+this._core.settings.itemClass),f=this._videos[e.attr("data-video")],g=f.width||"100%",h=f.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),e=this._core.items(this._core.relative(e.index())),this._core.reset(e.index()),"youtube"===f.type?c='<iframe width="'+g+'" height="'+h+'" src="//www.youtube.com/embed/'+f.id+"?autoplay=1&rel=0&v="+f.id+'" frameborder="0" allowfullscreen></iframe>':"vimeo"===f.type?c='<iframe src="//player.vimeo.com/video/'+f.id+'?autoplay=1" width="'+g+'" height="'+h+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>':"vzaar"===f.type&&(c='<iframe frameborder="0"height="'+h+'"width="'+g+'" allowfullscreen mozallowfullscreen webkitAllowFullScreen src="//view.vzaar.com/'+f.id+'/player?autoplay=true"></iframe>'),a('<div class="owl-video-frame">'+c+"</div>").insertAfter(e.find(".owl-video")),this._playing=e.addClass("owl-video-playing"))},e.prototype.isInFullScreen=function(){var b=c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement;return b&&a(b).parent().hasClass("owl-video-frame")},e.prototype.destroy=function(){var a,b;this._core.$element.off("click.owl.video");for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Video=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this.core=b,this.core.options=a.extend({},e.Defaults,this.core.options),this.swapping=!0,this.previous=d,this.next=d,this.handlers={"change.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&(this.previous=this.core.current(),this.next=a.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":a.proxy(function(a){a.namespace&&(this.swapping="translated"==a.type)},this),"translate.owl.carousel":a.proxy(function(a){a.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};e.Defaults={animateOut:!1,animateIn:!1},e.prototype.swap=function(){if(1===this.core.settings.items&&a.support.animation&&a.support.transition){this.core.speed(0);var b,c=a.proxy(this.clear,this),d=this.core.$stage.children().eq(this.previous),e=this.core.$stage.children().eq(this.next),f=this.core.settings.animateIn,g=this.core.settings.animateOut;this.core.current()!==this.previous&&(g&&(b=this.core.coordinates(this.previous)-this.core.coordinates(this.next),d.one(a.support.animation.end,c).css({left:b+"px"}).addClass("animated owl-animated-out").addClass(g)),f&&e.one(a.support.animation.end,c).addClass("animated owl-animated-in").addClass(f))}},e.prototype.clear=function(b){a(b.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},
33a.fn.owlCarousel.Constructor.Plugins.Animate=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._timeout=null,this._paused=!1,this._handlers={"changed.owl.carousel":a.proxy(function(a){a.namespace&&"settings"===a.property.name?this._core.settings.autoplay?this.play():this.stop():a.namespace&&"position"===a.property.name&&this._core.settings.autoplay&&this._setAutoPlayInterval()},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoplay&&this.play()},this),"play.owl.autoplay":a.proxy(function(a,b,c){a.namespace&&this.play(b,c)},this),"stop.owl.autoplay":a.proxy(function(a){a.namespace&&this.stop()},this),"mouseover.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"mouseleave.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.play()},this),"touchstart.owl.core":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"touchend.owl.core":a.proxy(function(){this._core.settings.autoplayHoverPause&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=a.extend({},e.Defaults,this._core.options)};e.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},e.prototype.play=function(a,b){this._paused=!1,this._core.is("rotating")||(this._core.enter("rotating"),this._setAutoPlayInterval())},e.prototype._getNextTimeout=function(d,e){return this._timeout&&b.clearTimeout(this._timeout),b.setTimeout(a.proxy(function(){this._paused||this._core.is("busy")||this._core.is("interacting")||c.hidden||this._core.next(e||this._core.settings.autoplaySpeed)},this),d||this._core.settings.autoplayTimeout)},e.prototype._setAutoPlayInterval=function(){this._timeout=this._getNextTimeout()},e.prototype.stop=function(){this._core.is("rotating")&&(b.clearTimeout(this._timeout),this._core.leave("rotating"))},e.prototype.pause=function(){this._core.is("rotating")&&(this._paused=!0)},e.prototype.destroy=function(){var a,b;this.stop();for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.autoplay=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(b){this._core=b,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":a.proxy(function(b){b.namespace&&this._core.settings.dotsData&&this._templates.push('<div class="'+this._core.settings.dotClass+'">'+a(b.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"</div>")},this),"added.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,0,this._templates.pop())},this),"remove.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,1)},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&this.draw()},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&!this._initialized&&(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._initialized&&(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers)};e.Defaults={nav:!1,navText:["prev","next"],navSpeed:!1,navElement:"div",navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},e.prototype.initialize=function(){var b,c=this._core.settings;this._controls.$relative=(c.navContainer?a(c.navContainer):a("<div>").addClass(c.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=a("<"+c.navElement+">").addClass(c.navClass[0]).html(c.navText[0]).prependTo(this._controls.$relative).on("click",a.proxy(function(a){this.prev(c.navSpeed)},this)),this._controls.$next=a("<"+c.navElement+">").addClass(c.navClass[1]).html(c.navText[1]).appendTo(this._controls.$relative).on("click",a.proxy(function(a){this.next(c.navSpeed)},this)),c.dotsData||(this._templates=[a("<div>").addClass(c.dotClass).append(a("<span>")).prop("outerHTML")]),this._controls.$absolute=(c.dotsContainer?a(c.dotsContainer):a("<div>").addClass(c.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","div",a.proxy(function(b){var d=a(b.target).parent().is(this._controls.$absolute)?a(b.target).index():a(b.target).parent().index();b.preventDefault(),this.to(d,c.dotsSpeed)},this));for(b in this._overrides)this._core[b]=a.proxy(this[b],this)},e.prototype.destroy=function(){var a,b,c,d;for(a in this._handlers)this.$element.off(a,this._handlers[a]);for(b in this._controls)this._controls[b].remove();for(d in this.overides)this._core[d]=this._overrides[d];for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},e.prototype.update=function(){var a,b,c,d=this._core.clones().length/2,e=d+this._core.items().length,f=this._core.maximum(!0),g=this._core.settings,h=g.center||g.autoWidth||g.dotsData?1:g.dotsEach||g.items;if("page"!==g.slideBy&&(g.slideBy=Math.min(g.slideBy,g.items)),g.dots||"page"==g.slideBy)for(this._pages=[],a=d,b=0,c=0;a<e;a++){if(b>=h||0===b){if(this._pages.push({start:Math.min(f,a-d),end:a-d+h-1}),Math.min(f,a-d)===f)break;b=0,++c}b+=this._core.mergers(this._core.relative(a))}},e.prototype.draw=function(){var b,c=this._core.settings,d=this._core.items().length<=c.items,e=this._core.relative(this._core.current()),f=c.loop||c.rewind;this._controls.$relative.toggleClass("disabled",!c.nav||d),c.nav&&(this._controls.$previous.toggleClass("disabled",!f&&e<=this._core.minimum(!0)),this._controls.$next.toggleClass("disabled",!f&&e>=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!c.dots||d),c.dots&&(b=this._pages.length-this._controls.$absolute.children().length,c.dotsData&&0!==b?this._controls.$absolute.html(this._templates.join("")):b>0?this._controls.$absolute.append(new Array(b+1).join(this._templates[0])):b<0&&this._controls.$absolute.children().slice(b).remove(),this._controls.$absolute.find(".active").removeClass("active"),this._controls.$absolute.children().eq(a.inArray(this.current(),this._pages)).addClass("active"))},e.prototype.onTrigger=function(b){var c=this._core.settings;b.page={index:a.inArray(this.current(),this._pages),count:this._pages.length,size:c&&(c.center||c.autoWidth||c.dotsData?1:c.dotsEach||c.items)}},e.prototype.current=function(){var b=this._core.relative(this._core.current());return a.grep(this._pages,a.proxy(function(a,c){return a.start<=b&&a.end>=b},this)).pop()},e.prototype.getPosition=function(b){var c,d,e=this._core.settings;return"page"==e.slideBy?(c=a.inArray(this.current(),this._pages),d=this._pages.length,b?++c:--c,c=this._pages[(c%d+d)%d].start):(c=this._core.relative(this._core.current()),d=this._core.items().length,b?c+=e.slideBy:c-=e.slideBy),c},e.prototype.next=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!0),b)},e.prototype.prev=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!1),b)},e.prototype.to=function(b,c,d){var e;!d&&this._pages.length?(e=this._pages.length,a.proxy(this._overrides.to,this._core)(this._pages[(b%e+e)%e].start,c)):a.proxy(this._overrides.to,this._core)(b,c)},a.fn.owlCarousel.Constructor.Plugins.Navigation=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(c){this._core=c,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":a.proxy(function(c){c.namespace&&"URLHash"===this._core.settings.startPosition&&a(b).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");if(!c)return;this._hashes[c]=b.content}},this),"changed.owl.carousel":a.proxy(function(c){if(c.namespace&&"position"===c.property.name){var d=this._core.items(this._core.relative(this._core.current())),e=a.map(this._hashes,function(a,b){return a===d?b:null}).join();if(!e||b.location.hash.slice(1)===e)return;b.location.hash=e}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers),a(b).on("hashchange.owl.navigation",a.proxy(function(a){var c=b.location.hash.substring(1),e=this._core.$stage.children(),f=this._hashes[c]&&e.index(this._hashes[c]);f!==d&&f!==this._core.current()&&this._core.to(this._core.relative(f),!1,!0)},this))};e.Defaults={URLhashListener:!1},e.prototype.destroy=function(){var c,d;a(b).off("hashchange.owl.navigation");for(c in this._handlers)this._core.$element.off(c,this._handlers[c]);for(d in Object.getOwnPropertyNames(this))"function"!=typeof this[d]&&(this[d]=null)},a.fn.owlCarousel.Constructor.Plugins.Hash=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){function e(b,c){var e=!1,f=b.charAt(0).toUpperCase()+b.slice(1);return a.each((b+" "+h.join(f+" ")+f).split(" "),function(a,b){if(g[b]!==d)return e=!c||b,!1}),e}function f(a){return e(a,!0)}var g=a("<support>").get(0).style,h="Webkit Moz O ms".split(" "),i={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},j={csstransforms:function(){return!!e("transform")},csstransforms3d:function(){return!!e("perspective")},csstransitions:function(){return!!e("transition")},cssanimations:function(){return!!e("animation")}};j.csstransitions()&&(a.support.transition=new String(f("transition")),a.support.transition.end=i.transition.end[a.support.transition]),j.cssanimations()&&(a.support.animation=new String(f("animation")),a.support.animation.end=i.animation.end[a.support.animation]),j.csstransforms()&&(a.support.transform=new String(f("transform")),a.support.transform3d=j.csstransforms3d())}(window.Zepto||window.jQuery,window,document);
33;
34(function(t){t.extend(t.fn,{validate:function(e){if(!this.length){if(e&&e.debug&&window.console){console.warn("nothing selected, can't validate, returning nothing")};return};var i=t.data(this[0],"validator");if(i){return i};this.attr("novalidate","novalidate");i=new t.validator(e,this[0]);t.data(this[0],"validator",i);if(i.settings.onsubmit){this.validateDelegate(":submit","click",function(e){if(i.settings.submitHandler){i.submitButton=e.target};if(t(e.target).hasClass("cancel")){i.cancelSubmit=!0}});this.submit(function(e){if(i.settings.debug){e.preventDefault()};function s(){var s;if(i.settings.submitHandler){if(i.submitButton){s=t("<input type='hidden'/>").attr("name",i.submitButton.name).val(i.submitButton.value).appendTo(i.currentForm)};i.settings.submitHandler.call(i,i.currentForm,e);if(i.submitButton){s.remove()};return!1};return!0};if(i.cancelSubmit){i.cancelSubmit=!1;return s()};if(i.form()){if(i.pendingRequest){i.formSubmitted=!0;return!1};return s()}
35else{i.focusInvalid();return!1}})};return i},valid:function(){if(t(this[0]).is("form")){return this.validate().form()}
36else{var e=!0,i=t(this[0].form).validate();this.each(function(){e&=i.element(this)});return e}},removeAttrs:function(e){var i={},s=this;t.each(e.split(/\s/),function(t,e){i[e]=s.attr(e);s.removeAttr(e)});return i},rules:function(e,i){var s=this[0];if(e){var a=t.data(s.form,"validator").settings,o=a.rules,n=t.validator.staticRules(s);switch(e){case"add":t.extend(n,t.validator.normalizeRule(i));o[s.name]=n;if(i.messages){a.messages[s.name]=t.extend(a.messages[s.name],i.messages)};break;case"remove":if(!i){delete o[s.name];return n};var u={};t.each(i.split(/\s/),function(t,e){u[e]=n[e];delete n[e]});return u}};var r=t.validator.normalizeRules(t.extend({},t.validator.classRules(s),t.validator.attributeRules(s),t.validator.dataRules(s),t.validator.staticRules(s)),s);if(r.required){var l=r.required;delete r.required;r=t.extend({required:l},r)};return r}});t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+e.value)},filled:function(e){return!!t.trim(""+e.value)},unchecked:function(t){return!t.checked}});t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e);this.currentForm=i;this.init()};t.validator.format=function(e,i){if(arguments.length===1){return function(){var i=t.makeArray(arguments);i.unshift(e);return t.validator.format.apply(this,i)}};if(arguments.length>2&&i.constructor!==Array){i=t.makeArray(arguments).slice(1)};if(i.constructor!==Array){i=[i]};t.each(i,function(t,i){e=e.replace(new RegExp("\\{"+t+"\\}","g"),i)});return e};t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t,e){this.lastActive=t;if(this.settings.focusCleanup&&!this.blockFocusCleanup){if(this.settings.unhighlight){this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass)};this.addWrapper(this.errorsFor(t)).hide()}},onfocusout:function(t,e){if(!this.checkable(t)&&(t.name in this.submitted||!this.optional(t))){this.element(t)}},onkeyup:function(t,e){if(e.which===9&&this.elementValue(t)===""){return}
37else if(t.name in this.submitted||t===this.lastElement){this.element(t)}},onclick:function(t,e){if(t.name in this.submitted){this.element(t)}
38else if(t.parentNode.name in this.submitted){this.element(t.parentNode)}},highlight:function(e,i,s){if(e.type==="radio"){this.findByName(e.name).addClass(i).removeClass(s)}
39else{t(e).addClass(i).removeClass(s)}},unhighlight:function(e,i,s){if(e.type==="radio"){this.findByName(e.name).removeClass(i).addClass(s)}
40else{t(e).removeClass(i).addClass(s)}}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){this.labelContainer=t(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm);this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var s=(this.groups={});
40t.each(this.settings.groups,function(e,i){if(typeof i==="string"){i=i.split(/\s/)};t.each(i,function(t,i){s[i]=e})});var e=this.settings.rules;t.each(e,function(i,s){e[i]=t.validator.normalizeRule(s)});function i(e){var i=t.data(this[0].form,"validator"),s="on"+e.type.replace(/^validate/,"");if(i.settings[s]){i.settings["name_event"]=s;i.settings[s].call(i,this[0],e)}};t(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",i).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",i);if(this.settings.invalidHandler){t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)}},form:function(){this.checkForm();t.extend(this.submitted,this.errorMap);this.invalid=t.extend({},this.errorMap);if(!this.valid()){t(this.currentForm).triggerHandler("invalid-form",[this])};this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=(this.currentElements=this.elements());e[t];t++){this.check(e[t])};return this.valid()},element:function(e){e=this.validationTargetFor(this.clean(e));this.lastElement=e;this.prepareElement(e);this.currentElements=t(e);var i=this.check(e)!==!1;if(i){delete this.invalid[e.name]}
41else{this.invalid[e.name]=!0};if(!this.numberOfInvalids()){this.toHide=this.toHide.add(this.containers)};this.showErrors();return i},showErrors:function(e){if(e){t.extend(this.errorMap,e);this.errorList=[];for(var i in e){this.errorList.push({message:e[i],element:this.findByName(i)[0]})};this.successList=t.grep(this.successList,function(t){return!(t.name in e)})};if(this.settings.showErrors){this.settings.showErrors.call(this,this.errorMap,this.errorList)}
42else{this.defaultShowErrors()}},resetForm:function(){if(t.fn.resetForm){t(this.currentForm).resetForm()};this.submitted={};this.lastElement=null;this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass).removeData("previousValue")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e=0;for(var i in t){e++};return e},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return this.size()===0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid){try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}}},findLastActive:function(){var e=this.lastActive;return e&&t.grep(this.errorList,function(t){return t.element.name===e.name}).length===1&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){if(!this.name&&e.settings.debug&&window.console){console.error("%o has no name assigned",this)};if(this.name in i||!e.objectLength(t(this).rules())){return!1};i[this.name]=!0;return!0})},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.replace(" ",".");return t(this.settings.errorElement+"."+e,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=t([]);this.toHide=t([]);this.currentElements=t([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset();this.toHide=this.errorsFor(t)},elementValue:function(e){var s=t(e).attr("type"),i=t(e).val();if(s==="radio"||s==="checkbox"){return t("input[name=\""+t(e).attr("name")+"\"]:checked").val()};if(typeof i==="string"){return i.replace(/\r/g,"")};return i},check:function(e){e=this.validationTargetFor(this.clean(e));var n=t(e).rules(),a=!1,o=this.elementValue(e),i;for(var r in n){var s={method:r,parameters:n[r]};try{i=t.validator.methods[r].call(this,o,e,s.parameters);if(i==="dependency-mismatch"){a=!0;continue};a=!1;if(i==="pending"){this.toHide=this.toHide.not(this.errorsFor(e));return};if(!i){this.formatAndAdd(e,s);return!1}}catch(u){if(this.settings.debug&&window.console){console.log("exception occured when checking element "+e.id+", check the '"+s.method+"' method",u)};throw u}};if(a){return};if(this.objectLength(n)){this.successList.push(e)};return!0},customDataMessage:function(e,i){return t(e).data("msg-"+i.toLowerCase())||(e.attributes&&t(e).attr("data-msg-"+i.toLowerCase()))},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor===String?i:i[e])},findDefined:function(){for(var t=0;t<arguments.length;t++){if(arguments[t]!==undefined){return arguments[t]}};return undefined},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customDataMessage(e,i),!this.settings.ignoreTitle&&e.title||undefined,t.validator.messages[i],"<strong>Warning: No message defined for "+e.name+"</strong>")},formatAndAdd:function(e,i){var s=this.defaultMessage(e,i.method),r=/\$?\{(\d+)\}/g;if(typeof s==="function"){s=s.call(this,i.parameters,e)}
43else if(r.test(s)){s=t.validator.format(s.replace(r,"{$1}"),i.parameters)};this.errorList.push({message:s,element:e});this.errorMap[e.name]=s;this.submitted[e.name]=s},addWrapper:function(t){if(this.settings.wrapper){t=t.add(t.parent(this.settings.wrapper))};return t},defaultShowErrors:function(){var t,i;for(t=0;this.errorList[t];t++){var e=this.errorList[t];if(this.settings.highlight){this.settings.highlight.call(this,e.element,this.settings.errorClass,this.settings.val
43idClass)};this.showLabel(e.element,e.message)};if(this.errorList.length){this.toShow=this.toShow.add(this.containers)};if(this.settings.success){for(t=0;this.successList[t];t++){this.showLabel(this.successList[t])}};if(this.settings.unhighlight){for(t=0,i=this.validElements();i[t];t++){this.settings.unhighlight.call(this,i[t],this.settings.errorClass,this.settings.validClass)}};this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var s=this.errorsFor(e);if(s.length){s.removeClass(this.settings.validClass).addClass(this.settings.errorClass);if(s.attr("generated")){s.html(i)}}
44else{s=t("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(e),generated:!0}).addClass(this.settings.errorClass).html(i||"");if(this.settings.wrapper){s=s.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()};if(!this.labelContainer.append(s).length){if(this.settings.errorPlacement){this.settings.errorPlacement(s,t(e))}
45else{s.insertAfter(e)}}};if(!i&&this.settings.success){s.text("");if(typeof this.settings.success==="string"){s.addClass(this.settings.success)}
46else{this.settings.success(s,e)}};this.toShow=this.toShow.add(s)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")===i})},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){if(this.checkable(t)){t=this.findByName(t.name).not(this.settings.ignore)[0]};return t},checkable:function(t){return(/radio|checkbox/i).test(t.type)},findByName:function(e){return t(this.currentForm).find("[name=\""+e+"\"]")},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i)){return this.findByName(i.name).filter(":checked").length}};return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0}
46,dependTypes:{"boolean":function(t,e){return t},"string":function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){var i=this.elementValue(e);return!t.validator.methods.required.call(this,i,e)&&"dependency-mismatch"},startRequest:function(t){if(!this.pending[t.name]){this.pendingRequest++;this.pending[t.name]=!0}},stopRequest:function(e,i){this.pendingRequest--;if(this.pendingRequest<0){this.pendingRequest=0};delete this.pending[e.name];if(i&&this.pendingRequest===0&&this.formSubmitted&&this.form()){t(this.currentForm).submit();this.formSubmitted=!1}
47else if(!i&&this.pendingRequest===0&&this.formSubmitted){t(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=!1}},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){if(e.constructor===String){this.classRuleSettings[e]=i}
48else{t.extend(this.classRuleSettings,e)}},classRules:function(e){var s={};var i=t(e).attr("class");if(i){t.each(i.split(" "),function(){if(this in t.validator.classRuleSettings){t.extend(s,t.validator.classRuleSettings[this])}})};return s},attributeRules:function(e){var r={};var n=t(e);for(var s in t.validator.methods){var i;if(s==="required"){i=n.get(0).getAttribute(s);if(i===""){i=!0};i=!!i}
49else{i=n.attr(s)};if(i){r[s]=i}
50else if(n[0].getAttribute("type")===s){r[s]=!0}};if(r.maxlength&&/-1|2147483647|524288/.test(r.maxlength)){delete r.maxlength};return r},dataRules:function(e){var i,s,r={},n=t(e);for(i in t.validator.methods){s=n.data("rule-"+i.toLowerCase());if(s!==undefined){r[i]=s}};return r},staticRules:function(e){var s={};var i=t.data(e.form,"validator");if(i.settings.rules){s=t.validator.normalizeRule(i.settings.rules[e.name])||{}};return s},normalizeRules:function(e,i){t.each(e,function(s,r){if(r===!1){delete e[s];return};if(r.param||r.depends){var n=!0;switch(typeof r.depends){case"string":n=!!t(r.depends,i.form).length;break;case"function":n=r.depends.call(i,i);break};if(n){e[s]=r.param!==undefined?r.param:!0}
51else{delete e[s]}}});t.each(e,function(s,r){e[s]=t.isFunction(r)?r(i):r});t.each(["minlength","maxlength","min","max"],function(){if(e[this]){e[this]=Number(e[this])}});t.each(["rangelength","range"],function(){var i;if(e[this]){if(t.isArray(e[this])){e[this]=[Number(e[this][0]),Number(e[this][1])]}
52else if(typeof e[this]==="string"){i=e[this].split(/[\s,]+/);e[this]=[Number(i[0]),Number(i[1])]}}});if(t.validator.autoCreateRanges){if(e.min&&e.max){e.range=[e.min,e.max];delete e.min;delete e.max};if(e.minlength&&e.maxlength){e.rangelength=[e.minlength,e.maxlength];delete e.minlength;delete e.maxlength}};return e},normalizeRule:function(e){if(typeof e==="string"){var i={};t.each(e.split(/\s/),function(){i[this]=!0});e=i};return e},addMethod:function(e,i,s){t.validator.methods[e]=i;t.validator.messages[e]=s!==undefined?s:t.validator.messages[e];if(i.length<3){t.validator.addClassRules(e,t.validator.normalizeRule(e))}},methods:{required:function(e,i,s){if(!this.depend(s,i)){return"dependency-mismatch"};if(i.nodeName.toLowerCase()==="select"){var r=t(i).val();return r&&r.length>0};if(this.checkable(i)){return this.getLength(e,i)>0};return t.trim(e).length>0},remote:function(e,i,s){if(this.optional(i)){return"dependency-mismatch"};var n=this.previousValue(i);if(!this.settings.messages[i.name]){this.settings.messages[i.name]={}};n.originalMessage=this.settings.messages[i.name].remote;this.settings.messages[i.name].remote=n.message;s=typeof s==="string"&&{url:s}||s;if(n.old===e){return n.valid};n.old=e;var r=this;this.startRequest(i);var a={};a[i.name]=e;t.ajax(t.extend(!0,{url:s,mode:"abort",port:"validate"+i.name,dataType:"json",data:a,success:function(s){r.settings.messages[i.name].remote=n.originalMessage;var u=s===!0||s==="true";if(u){var l=r.formSubmitted;r.prepareElement(i);r.formSubmitted=l;r.successList.push(i);delete r.invalid[i.name];r.showErrors()}
53else{var o={};var a=s||r.defaultMessage(i,"remote");o[i.name]=n.message=t.isFunction(a)?a(e):a;r.invalid[i.name]=!0;r.showErrors(o)};n.valid=u;r.stopRequest(i,u)}},s));return"pending"},minlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r>=s},maxlength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||r<=s},rangelength:function(e,i,s){var r=t.isArray(e)?e.length:this.getLength(t.trim(e),i);return this.optional(i)||(r>=s[0]&&r<=s[1])}
53,min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||t<=i},range:function(t,e,i){return this.optional(e)||(t>=i[0]&&t<=i[1])},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(new Date(t).toString())},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e)){return"dependency-mismatch"};if(/[^0-9 \-]+/.test(t)){return!1};var n=0,i=0,r=!1;t=t.replace(/\D/g,"");for(var s=t.length-1;s>=0;s--){var a=t.charAt(s);i=parseInt(a,10);if(r){if((i*=2)>9){i-=9}};n+=i;r=!r};return(n%10)===0},equalTo:function(e,i,s){var r=t(s);if(this.settings.onfocusout){r.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()})};return e===r.val()}}});t.format=t.validator.format}(jQuery));(function(t){var e={};if(t.ajaxPrefilter){t.ajaxPrefilter(function(t,i,s){var r=t.port;if(t.mode==="abort"){if(e[r]){e[r].abort()};e[r]=s}})}
54else{var i=t.ajax;t.ajax=function(s){var n=("mode" in s?s:t.ajaxSettings).mode,r=("port" in s?s:t.ajaxSettings).port;if(n==="abort"){if(e[r]){e[r].abort()};return(e[r]=i.apply(this,arguments))};return i.apply(this,arguments)}}}(jQuery));(function(t){t.extend(t.fn,{validateDelegate:function(e,i,s){return this.bind(i,function(i){var r=t(i.target);if(r.is(e)){return s.apply(r,arguments)}})}})}(jQuery));;
55(function(e){Drupal.form_placeholder={};Drupal.form_placeholder.placeholderIsSupported=function(){var e=Object.prototype.toString.call(window.operamini)=='[object OperaMini]';return'placeholder' in document.createElement('input')&&!e};Drupal.behaviors.form_placeholder={attach:function(a,r){var o=r.form_placeholder.include;if(o){o+=', '};o+='.form-placeholder-include-children *';o+=', .form-placeholder-include';var l=r.form_placeholder.exclude;if(l){l+=', '};l+='.form-placeholder-exclude-children *';l+=', .form-placeholder-exclude';var t=r.form_placeholder.required_indicator;e(o,a).not(l).each(function(){$textfield=e(this);if(!$textfield.is('input[type=text], input[type=email], input[type=password], textarea')){return}
56else if(Drupal.form_placeholder.placeholderIsSupported()||r.form_placeholder.fallback_support){$form=$textfield.closest('form');$label=$form.find('label[for='+this.id+']');if(t==='append'){$label.find('.form-required').insertAfter($textfield).prepend('&nbsp;')}
57else if(t==='remove'){$label.find('.form-required').remove()}
58else if(t==='text'){$label.find('.form-required').text('('+Drupal.t('required')+')')};$textfield.attr('placeholder',e.trim($label.text()));$label.hide();if(!Drupal.form_placeholder.placeholderIsSupported()&&r.form_placeholder.fallback_support){$textfield.placeholder()}}})}}})(jQuery);;
59(function(a){Drupal.behaviors.owlcarousel={attach:function(r,i){for(var e in i.owlcarousel){var o=a('.'+e);if(i.owlcarousel[e].settings.lazyLoad){var s=o.find('img');a.each(s,function(i,r){a(r).attr('data-src',a(r).attr('src'))});s.addClass('lazyOwl')};if(!o.hasClass('disabled')){o.owlCarousel(i.owlcarousel[e].settings)};if(i.owlcarousel[e].views.ajax_pagination){var n=a('.'+e);n.parent().css('height',n.height());var t=n.parent().parent(),c=a(t).find('.pager-next a',r),l=a(t).find('.pager-previous a',r);
59a(c).once('ajax',function(){a(c,r).click(function(){n.trigger('owl.next')})});a(l).once('ajax',function(){a(l,r).click(function(){n.trigger('owl.prev')})})}}}}}(jQuery));;
60(function(){'use strict';if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'')}};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(n){if(this===null){throw new TypeError()};var e=Object(this),i=e.length>>>0;if(i===0){return-1};var r=0;if(arguments.length>0){r=Number(arguments[1]);if(r!==r){r=0}
61else if(r!==0&&r!==Infinity&&r!==-Infinity){r=(r>0||-1)*Math.floor(Math.abs(r))}};if(r>=i){return-1};var t=r>=0?r:Math.max(i-Math.abs(r),0);for(;t<i;t++){if(t in e&&e[t]===n){return t}};return-1}};if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(n){if(this===null){throw new TypeError()};var e=Object(this),i=e.length>>>0;if(i===0){return-1};var r=i;if(arguments.length>1){r=Number(arguments[1]);if(r!==r){r=0}
62else if(r!==0&&r!==Infinity&&r!==-Infinity){r=(r>0||-1)*Math.floor(Math.abs(r))}};var t=r>=0?Math.min(r,i-1):i-Math.abs(r);for(;t>=0;t--){if(t in e&&e[t]===n){return t}};return-1}};if(!Array.prototype.filter){Array.prototype.filter=function(r){if(this===null){throw new TypeError()};var n=Object(this),f=n.length>>>0;if(typeof r!=='function'){throw new TypeError()};var e=[],o=arguments[1];for(var t=0;t<f;t++){if(t in n){var i=n[t];if(r.call(o,i,t,n)){e.push(i)}}};return e}};if(!Array.prototype.map){Array.prototype.map=function(t,e){var u,i,r;if(this===null){throw new TypeError(' this is null or not defined')};var n=Object(this),a=n.length>>>0;if({}.toString.call(t)!=='[object Function]'){throw new TypeError(t+' is not a function')};if(e){u=e};i=new Array(a);r=0;while(r<a){var o,f;if(r in n){o=n[r];f=t.call(u,o,r,n);i[r]=f};r++};return i}}})();;
63/*jshint strict:true, browser:true, curly:true, eqeqeq:true, expr:true, forin:true, latedef:true, newcap:true, noarg:true, trailing: true, undef:true, unused:true */
64/*global Drupal: true, jQuery: true, XRegExp:true*/
65/**
66 * File:        clientside_validation.js
67 * Version:     7.x-1.x
68 * Description: Add clientside validation rules
69 * Author:      Attiks
70 * Language:    Javascript
71 * Project:     clientside_validation
72 * @module clientside_validation
73 */
74
75
76(/** @lends Drupal */function ($) {
77  /**
78   * Drupal.behaviors.clientsideValidation.
79   *
80   * Attach clientside validation to the page or rebind the rules in case of AJAX calls.
81   * @extends Drupal.behaviors
82   * @fires clientsideValidationInitialized
83   */
84  "use strict";
85  Drupal.behaviors.clientsideValidation = {
86    attach: function (context) {
87      if (!Drupal.myClientsideValidation) {
88        if (Drupal.settings.clientsideValidation) {
89          Drupal.myClientsideValidation = new Drupal.clientsideValidation();
90        }
91      }
92      else {
93        if (typeof(Drupal.settings.clientsideValidation.forms) === 'undefined') {
94          return;
95        }
96        var update = false;
97        $.each(Drupal.settings.clientsideValidation.forms, function (f) {
98          if ($(context).find('#' + f).length || $(context).is('#' + f)) {
99            update = true;
100          }
101        });
102        //update settings
103        if (update) {
104          Drupal.myClientsideValidation.data = Drupal.settings.clientsideValidation;
105          Drupal.myClientsideValidation.forms = Drupal.myClientsideValidation.data.forms;
106          Drupal.myClientsideValidation.groups = Drupal.myClientsideValidation.data.groups;
107          Drupal.myClientsideValidation.bindForms();
108        }
109      }
110
111      /**
112       * Let other modules know we are ready.
113       * @event clientsideValidationInitialized
114       * @name clientsideValidationInitialized
115       * @memberof Drupal.clientsideValidation
116       */
117      $.event.trigger('clientsideValidationInitialized');
118    }
119  };
120
121  /**
122   * Drupal.clientsideValidation.
123   * This module adds clientside validation for all forms and webforms using jquery.validate
124   * Don't forget to read the README
125   *
126   * @class Drupal.clientsideValidation
127   * @see https://github.com/jzaefferer/jquery-validation
128   * @fires clientsideValidationAddCustomRules
129   */
130  Drupal.clientsideValidation = function() {
131    var self = this;
132    if (typeof window.time !== 'undefined') {
133      // activate by setting clientside_validation_add_js_timing
134      self.time = window.time;
135    }
136    else {
137      self.time = {
138        start: function() {},
139        stop: function() {},
140        report: function() {}
141      };
142    }
143    self.time.start('1. clientsideValidation');
144
145    /**
146     * prefix to use
147     * @memberof Drupal.clientsideValidation
148     * @type string
149     * @readonly
150     * @private
151     */
152    this.prefix = 'clientsidevalidation-';
153
154    /**
155     * local copy of settings
156     * @memberof Drupal.clientsideValidation
157     * @type array
158     * @readonly
159     * @private
160     */
161    this.data = $.extend(true, {}, Drupal.settings.clientsideValidation);
162
163    /**
164     * local reference of all defined forms
165     * @memberof Drupal.clientsideValidation
166     * @type array
167     * @readonly
168     */
169    this.forms = this.data.forms;
170
171    /**
172     * list of all defined validators
173     * @memberof Drupal.clientsideValidation
174     * @type array
175     * @readonly
176     */
177    this.validators = {};
178
179    /**
180     * groups used for radios/checkboxes
181     * @memberof Drupal.clientsideValidation
182     * @type array
183     * @readonly
184     * @private
185     */
186    this.groups = this.data.groups;
187
188    // disable class and attribute rules defined by jquery.validate
189    $.validator.classRules = function() {
190      return {};
191    };
192    $.validator.attributeRules = function() {
193      return {};
194    };
195
196    /**
197     * add extra rules not defined in jquery.validate
198     * @see jquery.validate
199     */
200    this.addExtraRules();
201
202    /**
203     * bind all rules to all forms
204     * @see Drupal.clientsideValidation.prototype.bindForms
205     */
206    this.bindForms();
207    self.time.stop('1. clientsideValidation');
208    self.time.report();
209  };
210
211  /**
212   * findVerticalTab helper.
213   * @memberof Drupal.clientsideValidation
214   * @private
215   */
216  Drupal.clientsideValidation.prototype.findVerticalTab = function(element) {
217    element = $(element);
218
219    // Check for the vertical tabs fieldset and the verticalTab data
220    var fieldset = element.parents('fieldset.vertical-tabs-pane');
221    if ((fieldset.size() > 0) && (typeof(fieldset.data('verticalTab')) !== 'undefined')) {
222      var tab = $(fieldset.data('verticalTab').item[0]).find('a');
223      if (tab.size()) {
224        return tab;
225      }
226    }
227
228    // Return null by default
229    return null;
230  };
231
232  /**
233   * findHorizontalTab helper.
234   * @memberof Drupal.clientsideValidation
235   * @private
236   */
237  Drupal.clientsideValidation.prototype.findHorizontalTab = function(element) {
238    element = $(element);
239
240    // Check for the vertical tabs fieldset and the verticalTab data
241    var fieldset = element.parents('fieldset.horizontal-tabs-pane');
242    if ((fieldset.size() > 0) && (typeof(fieldset.data('horizontalTab')) !== 'undefined')) {
243      var tab = $(fieldset.data('horizontalTab').item[0]).find('a');
244      if (tab.size()) {
245        return tab;
246      }
247    }
248
249    // Return null by default
250    return null;
251  };
252
253  /**
254   * Bind all forms.
255   * @memberof Drupal.clientsideValidation
256   * @public
257   */
258  Drupal.clientsideValidation.prototype.bindForms = function(){
259    var self = this;
260    var groupkey;
261    if (typeof(self.forms) === 'undefined') {
262      return;
263    }
264    self.time.start('2. bindForms');
265    // unset invalid forms
266    $.each (self.forms, function (f) {
267      if ($('#' + f).length < 1) {
268        delete self.forms[f];
269      }
270    });
271    $.each (self.forms, function(f) {
272      var errorel = self.prefix + f + '-errors';
273      // Remove any existing validation stuff
274      if (self.validators[f]) {
275        // Doesn't work :: $('#' + f).rules('remove');
276        var form = $('#' + f).get(0);
277        if (typeof(form) !== 'undefined') {
278          $.removeData(form, 'validator');
279        }
280      }
281
282      if('checkboxrules' in self.forms[f]){
283        self.time.start('checkboxrules_groups');
284        groupkey = "";
285        $.each (self.forms[f].checkboxrules, function(r) {
286          groupkey = r + '_group';
287          self.groups[f][groupkey] = [];
288          $.each(this, function(){
289            $(this[2]).find('input[type=checkbox]').each(function(){
290              self.groups[f][groupkey].push($(this).attr('name'));
291            });
292          });
293        });
294        self.time.stop('checkboxrules_groups');
295      }
296
297      if('daterangerules' in self.forms[f]){
298        self.time.start('daterangerules');
299        groupkey = "";
300        $.each (self.forms[f].daterangerules, function(r) {
301          groupkey = r + '_group';
302          self.groups[f][groupkey] = [];
303          $.each(this, function(){
304            $('#' + f + ' #' + r + ' :input').not('input[type=image]').each(function(){
305              self.groups[f][groupkey].push($(this).attr('name'));
306            });
307          });
308        });
309        self.time.stop('daterangerules');
310      }
311
312      if('dateminrules' in self.forms[f]){
313        self.time.start('dateminrules');
314        groupkey = "";
315        $.each (self.forms[f].dateminrules, function(r) {
316          groupkey = r + '_group';
317          self.groups[f][groupkey] = [];
318          $.each(this, function(){
319            $('#' + f + ' #' + r + ' :input').not('input[type=image]').each(function(){
320              self.groups[f][groupkey].push($(this).attr('name'));
321            });
322          });
323        });
324        self.time.stop('dateminrules');
325      }
326
327      if('datemaxrules' in self.forms[f]){
328        self.time.start('datemaxrules');
329        groupkey = "";
330        $.each (self.forms[f].datemaxrules, function(r) {
331          groupkey = r + '_group';
332          self.groups[f][groupkey] = [];
333          $.each(this, function(){
334            $('#' + f + ' #' + r + ' :input').not('input[type=image]').each(function(){
335              self.groups[f][groupkey].push($(this).attr('name'));
336            });
337          });
338        });
339        self.time.stop('datemaxrules');
340      }
341
342
343      // Add basic settings
344      // todo: find cleaner fix
345      // ugly fix for nodes in colorbox
346      if(typeof $('#' + f).validate === 'function') {
347        var validate_options = {
348          errorClass: 'error',
349          groups: self.groups[f],
350          errorElement: self.forms[f].general.errorElement,
351          unhighlight: function(element, errorClass, validClass) {
352            var tab;
353
354            // If this is a pending element skip handling.
355            if (typeof this.pending[element.name] != 'undefined') {
356              return;
357            }
358
359            // Default behavior
360            $(element).removeClass(errorClass).addClass(validClass);
361
362            // Sort the classes out for the tabs - we only want to remove the
363            // highlight if there are no inputs with errors...
364            var fieldset = $(element).parents('fieldset.vertical-tabs-pane');
365            if (fieldset.size() && fieldset.find('.' + errorClass).not('label').size() === 0) {
366              tab = self.findVerticalTab(element);
367              if (tab) {
368                tab.removeClass(errorClass).addClass(validClass);
369              }
370            }
371
372            // Same for horizontal tabs
373            fieldset = $(element).parents('fieldset.horizontal-tabs-pane');
374            if (fieldset.size() && fieldset.find('.' + errorClass).not('label').size() === 0) {
375              tab = self.findHorizontalTab(element);
376              if (tab) {
377                tab.removeClass(errorClass).addClass(validClass);
378              }
379            }
380
381            /**
382             * Let other modules know this / which / an element is valid.
383             * @event clientsideValidationValid
384             * @name clientsideValidationValid
385             * @memberof Drupal.clientsideValidation
386             */
387            $(element).trigger('clientsideValidationValid');
388            $.event.trigger('clientsideValidationValid', [element]);
389          },
390          highlight: function(element, errorClass, validClass) {
391            // Default behavior
392            $(element).addClass(errorClass).removeClass(validClass);
393
394            // Sort the classes out for the tabs
395            var tab = self.findVerticalTab(element);
396            if (tab) {
397              tab.addClass(errorClass).removeClass(validClass);
398            }
399            tab = self.findHorizontalTab(element);
400            if (tab) {
401              tab.addClass(errorClass).removeClass(validClass);
402            }
403
404            /**
405             * Let other modules know this / which / an element is invalid.
406             * @event clientsideValidationInvalid
407             * @name clientsideValidationInvalid
408             * @memberof Drupal.clientsideValidation
409             */
410            $(element).trigger('clientsideValidationInvalid');
411            $.event.trigger('clientsideValidationInvalid', [element]);
412          },
413          invalidHandler: function(form, validator) {
414            var tab;
415            if (validator.errorList.length > 0) {
416              // Check if any of the errors are in the selected tab
417              var errors_in_selected = false;
418              for (var i = 0; i < validator.errorList.length; i++) {
419                tab = self.findVerticalTab(validator.errorList[i].element);
420                if (tab && tab.parent().hasClass('selected')) {
421                  errors_in_selected = true;
422                  break;
423                }
424              }
425
426              // Only focus the first tab with errors if the selected tab doesn't have
427              // errors itself. We shouldn't hide a tab that contains errors!
428              if (!errors_in_selected) {
429                tab = self.findVerticalTab(validator.errorList[0].element);
430                if (tab) {
431                  tab.click();
432                }
433              }
434
435              // Same for vertical tabs
436              // Check if any of the errors are in the selected tab
437              errors_in_selected = false;
438              for (i = 0; i < validator.errorList.length; i++) {
439                tab = self.findHorizontalTab(validator.errorList[i].element);
440                if (tab && tab.parent().hasClass('selected')) {
441                  errors_in_selected = true;
442                  break;
443                }
444              }
445
446              // Only focus the first tab with errors if the selected tab doesn't have
447              // errors itself. We shouldn't hide a tab that contains errors!
448              if (!errors_in_selected) {
449                tab = self.findHorizontalTab(validator.errorList[0].element);
450                if (tab) {
451                  tab.click();
452                }
453              }
454              if (self.forms[f].general.scrollTo) {
455                if (!$('html, body').hasClass('cv-scrolling')) {
456                  var x;
457                  if ($("#" + errorel).length) {
458                    $("#" + errorel).show();
459                    x = $("#" + errorel).offset().top - $("#" + errorel).height() - 100; // provides buffer in viewport
460                  }
461                  else {
462                    var first_element = $(validator.errorList[0].element);
463                    var hidden_element = first_element.is(":hidden");
464                    if (hidden_element) {
465                      var original_visibility = first_element.css('visibility');
466                      var original_position = first_element.css('position');
467                      first_element.css('visibility', 'hidden');
468                      first_element.css('position', 'absolute');
469                      first_element.show();
470                    }
471                    x = first_element.offset().top - first_element.height() - 100;
472                    if (hidden_element) {
473                      first_element.hide();
474                      first_element.css('position', original_position);
475                      first_element.css('visibility', original_visibility);
476                    }
477                  }
478                  $('html, body').addClass('cv-scrolling').animate(
479                    {scrollTop: x},
480                    {
481                      duration: self.forms[f].general.scrollSpeed,
482                      complete: function () {
483                        $('html, body').removeClass('cv-scrolling')
484                      }
485                    }
486                  );
487                  $('.wysiwyg-toggle-wrapper a').each(function() {
488                    $(this).click();
489                    $(this).click();
490                  });
491                }
492              }
493
494              /**
495               * Notify that the form contains errors.
496               * @event clientsideValidationFormHasErrors
497               * @name clientsideValidationFormHasErrors
498               * @memberof Drupal.clientsideValidation
499               */
500              $.event.trigger('clientsideValidationFormHasErrors', [form.target]);
501            }
502          }
503        };
504
505        switch (parseInt(self.forms[f].errorPlacement, 10)) {
506          case 0: // CLIENTSIDE_VALIDATION_JQUERY_SELECTOR
507            if ($(self.forms[f].errorJquerySelector).length) {
508              if (!$(self.forms[f].errorJquerySelector + ' #' + errorel).length) {
509                $('<div id="' + errorel + '" class="messages error clientside-error"><ul></ul></div>').prependTo(self.forms[f].errorJquerySelector).hide();
510              }
511            }
512            else if (!$('#' + errorel).length) {
513              $('<div id="' + errorel + '" class="messages error clientside-error"><ul></ul></div>').insertBefore('#' + f).hide();
514            }
515            validate_options.errorContainer = '#' + errorel;
516            validate_options.errorLabelContainer = '#' + errorel + ' ul';
517            validate_options.wrapper = 'li';
518            break;
519          case 1: // CLIENTSIDE_VALIDATION_TOP_OF_FORM
520            if (!$('#' + errorel).length) {
521              $('<div id="' + errorel + '" class="messages error clientside-error"><ul></ul></div>').insertBefore('#' + f).hide();
522            }
523            validate_options.errorContainer = '#' + errorel;
524            validate_options.errorLabelContainer = '#' + errorel + ' ul';
525            validate_options.wrapper = 'li';
526            break;
527          case 2: // CLIENTSIDE_VALIDATION_BEFORE_LABEL
528            validate_options.errorPlacement = function(error, element) {
529              var parents;
530              if (element.is(":radio")) {
531                parents = element.parents(".form-type-checkbox-tree");
532                if(parents.length) {
533                  error.insertBefore(parents.find("label").first());
534                }
535                else {
536                  parents = element.parents('.form-radios').prev('label');
537                  if (!parents.length) {
538                    parents = 'label[for="'+ element.attr('id') +'"]';
539                  }
540                  error.insertBefore(parents);
541                }
542              }
543              else if (element.is(":checkbox")) {
544                parents = element.parents(".form-type-checkbox-tree");
545                if(parents.length) {
546                  error.insertBefore(parents.find("label").first());
547                }
548                else {
549                  parents = element.parents('.form-radios').prev('label');
550                  if (!parents.length) {
551                    parents = 'label[for="'+ element.attr('id') +'"]';
552                  }
553                  error.insertBefore(parents);
554                }
555              }
556              else {
557                error.insertBefore('label[for="'+ element.attr('id') +'"]');
558              }
559            };
560            break;
561          case 3: // CLIENTSIDE_VALIDATION_AFTER_LABEL
562            validate_options.errorPlacement = function(error, element) {
563              var parents;
564              if (element.is(":radio")) {
565                parents = element.parents(".form-type-checkbox-tree");
566                if(parents.length) {
567                  error.insertAfter(parents.find("label").first());
568                }
569                else {
570                  parents = element.parents('.form-radios').prev('label');
571                  if (!parents.length) {
572                    parents = 'label[for="'+ element.attr('id') +'"]';
573                  }
574                  error.insertAfter(parents);
575                }
576              }
577              else if (element.is(":checkbox")) {
578                parents = element.parents(".form-type-checkbox-tree");
579                if(parents.length) {
580                  error.insertAfter(parents.find("label").first());
581                }
582                else {
583                  parents = element.parents('.form-checkboxes').prev('label');
584                  if (!parents.length) {
585                    parents = 'label[for="'+ element.attr('id') +'"]';
586                  }
587                  error.insertAfter(parents);
588                }
589              }
590              else {
591                error.insertAfter('label[for="'+ element.attr('id') +'"]');
592              }
593            };
594            break;
595          case 4: // CLIENTSIDE_VALIDATION_BEFORE_INPUT
596            validate_options.errorPlacement = function(error, element) {
597              error.insertBefore(element);
598            };
599            break;
600          case 5: // CLIENTSIDE_VALIDATION_AFTER_INPUT
601            validate_options.errorPlacement = function(error, element) {
602              var parents;
603              if (element.is(":radio")) {
604                parents = element.parents(".form-type-checkbox-tree");
605                if(parents.length) {
606                  error.insertAfter(parents);
607                }
608                else {
609                  parents = element.parents('.form-radios');
610                  if (!parents.length) {
611                    parents = element;
612                  }
613                  error.insertAfter(parents);
614                }
615              }
616              else if (element.is(":checkbox")) {
617                parents = element.parents(".form-type-checkbox-tree");
618                if(parents.length) {
619                  error.insertAfter(parents);
620                }
621                else {
622                  parents = element.parents('.form-checkboxes');
623                  if (!parents.length) {
624                    parents = element;
625                  }
626                  error.insertAfter(parents);
627                }
628              }
629              else if (element.next('div.grippie').length) {
630                error.insertAfter(element.next('div.grippie'));
631              } else {
632                error.insertAfter(element);
633              }
634            };
635            break;
636          case 6: // CLIENTSIDE_VALIDATION_TOP_OF_FIRST_FORM
637            if ($('div.messages--error').length) {
638              if ($('div.messages--error').attr('id').length) {
639                errorel = $('div.messages--error').attr('id');
640              }
641              else {
642                $('div.messages--error').attr('id', errorel);
643              }
644            }
645            else if ($('div.messages.error').length) {
646              if ($('div.messages.error').attr('id').length) {
647                errorel = $('div.messages.error').attr('id');
648              }
649              else {
650                $('div.messages.error').attr('id', errorel);
651              }
652            }
653            else if (!$('#' + errorel).length) {
654              $('<div id="' + errorel + '" class="messages error clientside-error"><ul></ul></div>').insertBefore('#' + f).hide();
655            }
656            validate_options.errorContainer = '#' + errorel;
657            validate_options.errorLabelContainer = '#' + errorel + ' ul';
658            validate_options.wrapper = 'li';
659            break;
660          case 7: // CLIENTSIDE_VALIDATION_CUSTOM_ERROR_FUNCTION
661            validate_options.errorPlacement = function (error, element) {
662              var func = self.forms[f].customErrorFunction;
663              Drupal.myClientsideValidation[func](error, element);
664            };
665            break;
666        }
667
668        if (!self.forms[f].includeHidden) {
669          validate_options.ignore = ':input:hidden';
670        }
671        else {
672          validate_options.ignore = '';
673        }
674        if(self.forms[f].general.validateTabs) {
675          if($('.vertical-tabs-pane input').length) {
676            validate_options.ignore += ' :not(.vertical-tabs-pane :input, .horizontal-tabs-pane :input)';
677          }
678        }
679        else {
680          validate_options.ignore += (validate_options.ignore === '') ? '.horizontal-tab-hidden :input' : ', .horizontal-tab-hidden :input';
681        }
682        //Since we can only give boolean false to onsubmit, onfocusout and onkeyup, we need
683        //a lot of if's (boolean true can not be passed to these properties).
684        if (!Boolean(parseInt(self.forms[f].general.validateOnSubmit, 10))) {
685          validate_options.onsubmit = false;
686        }
687        if (!Boolean(parseInt(self.forms[f].general.validateOnBlur, 10))) {
688          validate_options.onfocusout = false;
689        }
690        if (Boolean(parseInt(self.forms[f].general.validateOnBlurAlways, 10))) {
691          validate_options.onfocusout = function(element) {
692            if ( !this.checkable(element) ) {
693              this.element(element);
694            }
695          };
696        }
697        if (!Boolean(parseInt(self.forms[f].general.validateOnKeyUp, 10))) {
698          validate_options.onkeyup = false;
699        }
700        // Only apply this setting if errorplacement is set to the top of the form
701        if (parseInt(self.forms[f].general.showMessages, 10) > 0 && parseInt(self.forms[f].errorPlacement, 10) === 1) {
702          var showMessages = parseInt(self.forms[f].general.showMessages, 10);
703          // Show only last message
704          if (showMessages === 2) {
705            validate_options.showErrors = function() {
706              var allErrors = this.errors();
707              var i;
708              this.toHide = allErrors;
709              $(':input.' + this.settings.errorClass).removeClass(this.settings.errorClass);
710              for ( i = this.errorList.length -1; this.errorList[i]; i++ ) {
711                var error = this.errorList[i];
712                this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
713                this.showLabel( error.element, error.message );
714              }
715              if( this.errorList.length ) {
716                this.toShow = this.toShow.add( this.containers );
717              }
718              if (this.settings.success) {
719                for ( i = 0; this.successList[i]; i++ ) {
720                  this.showLabel( this.successList[i] );
721                }
722              }
723              if (this.settings.unhighlight) {
724                var elements;
725                for ( i = 0, elements = this.validElements(); elements[i]; i++ ) {
726                  this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
727                }
728              }
729              this.toHide = this.toHide.not( this.toShow );
730              this.hideErrors();
731              this.addWrapper( this.toShow ).show();
732            };
733          }
734          // Show only first message
735          else if(showMessages === 1) {
736            validate_options.showErrors = function() {
737              var allErrors = this.errors();
738              var i;
739              var elements;
740              if (this.settings.unhighlight) {
741                var firstErrorElement = this.clean($(allErrors[0]).attr('for'));
742                //for attr points to name or id
743                if (typeof firstErrorElement === 'undefined') {
744                  firstErrorElement = this.clean('#' + $(allErrors[0]).attr('for'));
745                }
746                for (i = 0, elements = this.elements().not($(firstErrorElement)); elements[i]; i++) {
747                  this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
748                }
749              }
750
751              for ( i = 0; this.errorList[i] && i<1; i++ ) {
752                var error = this.errorList[i];
753                this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
754                this.showLabel( error.element, error.message );
755              }
756              if( this.errorList.length ) {
757                this.toShow = this.toShow.add( this.containers );
758              }
759              if (this.settings.success) {
760                for ( i = 0; this.successList[i]; i++ ) {
761                  this.showLabel( this.successList[i] );
762                }
763              }
764              if (this.settings.unhighlight) {
765                for ( i = 0, elements = this.validElements(); elements[i]; i++ ) {
766                  this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
767                }
768              }
769
770              this.toHide = this.toHide.not( this.toShow );
771              this.hideErrors();
772              this.addWrapper( this.toShow ).show();
773              allErrors = this.errors();
774              allErrors.splice(0,1);
775              this.toHide = allErrors;
776              this.hideErrors();
777            };
778          }
779        }
780        /**
781         * Let other modules alter the validation options for this form.
782         * @event clientsideValidationAlterOptions
783         * @name clientsideValidationAlterOptions
784         * @memberof Drupal.clientsideValidation
785         */
786        $.event.trigger('clientsideValidationAlterOptions', [validate_options, f]);
787        self.validators[f] = $('#' + f).validate(validate_options);
788
789        // Disable HTML5 validation
790        if (!Boolean(parseInt(self.forms[f].general.disableHtml5Validation, 10))) {
791          $('#' + f).removeAttr('novalidate');
792        }
793        else {
794          $('#' + f).attr('novalidate', 'novalidate');
795        }
796        // Bind all rules
797        self.bindRules(f);
798
799      }
800    });
801  self.time.stop('2. bindForms');
802  };
803
804  /**
805   * Bind all rules.
806   * @memberof Drupal.clientsideValidation
807   */
808  Drupal.clientsideValidation.prototype.bindRules = function(formid){
809    var self = this;
810    self.time.start('3. bindRules');
811    var $form = $('#' + formid);
812    var hideErrordiv = function(){
813      //wait just one milisecond until the error div is updated
814      window.setTimeout(function(){
815        var visibles = 0;
816        // @TODO: check settings
817        $(".clientside-error ul li").each(function(){
818          if($(this).is(':visible')){
819            visibles++;
820          }
821          else {
822            $(this).remove();
823          }
824        });
825        if(visibles < 1){
826          $(".clientside-error").hide();
827        }
828      }, 1);
829    };
830    if('checkboxrules' in self.forms[formid]){
831      self.time.start('checkboxrules');
832      $.each (self.forms[formid].checkboxrules, function(r) {
833        var $checkboxes = $form.find(this.checkboxgroupminmax[2]).find('input[type="checkbox"]');
834        if ($checkboxes.length) {
835          var identifier = 'require-one-' + this.checkboxgroupminmax[2].substring(1);
836          var min = this.checkboxgroupminmax[0];
837          var message = this.messages.checkboxgroupminmax;
838          $checkboxes.addClass(identifier);
839          $checkboxes.each(function(){
840            var $checkbox = $(this);
841            var newrule = {
842              require_from_group: [min, '.' + identifier]
843            };
844            $checkbox.rules("add", newrule);
845            $checkbox.change(hideErrordiv);
846
847            if (typeof self.validators[formid].settings.messages[$checkbox.attr('name')] === 'undefined') {
848              self.validators[formid].settings.messages[$checkbox.attr('name')] = {};
849            }
850            $.extend(self.validators[formid].settings.messages[$checkbox.attr('name')], {
851              require_from_group: message
852            });
853          });
854
855          if (typeof self.validators[formid].settings.messages['.' + identifier] === 'undefined') {
856            self.validators[formid].settings.messages['.' + identifier] = {};
857          }
858          $.extend(self.validators[formid].settings.messages['.' + identifier], {
859            require_from_group: message
860          });
861        }
862      });
863      self.time.stop('checkboxrules');
864    }
865    if('daterangerules' in self.forms[formid]){
866      self.time.start('daterangerules');
867      $.each (self.forms[formid].daterangerules, function(r) {
868        $form.find('#' + r).find('input, select').not('input[type=image]').each(function(){
869          // Make sure we are working with the copy of rules object.
870          var rule = $.extend(true, {}, self.forms[formid].daterangerules[r]);
871          if (typeof self.validators[formid].settings.messages[r] === 'undefined') {
872            self.validators[formid].settings.messages[r] = {};
873          }
874          $.extend(self.validators[formid].settings.messages[r], rule.messages);
875          delete rule.messages;
876          $(this).rules("add", rule);
877          $(this).blur(hideErrordiv);
878        });
879      });
880      self.time.stop('daterangerules');
881    }
882
883    if('dateminrules' in self.forms[formid]){
884      self.time.start('dateminrules');
885      $.each (self.forms[formid].dateminrules, function(r) {
886        $form.find('#' + r).find('input, select').not('input[type=image]').each(function(){
887          // Make sure we are working with the copy of rules object.
888          var rule = $.extend(true, {}, self.forms[formid].dateminrules[r]);
889          if (typeof self.validators[formid].settings.messages[r] === 'undefined') {
890            self.validators[formid].settings.messages[r] = {};
891          }
892          $.extend(self.validators[formid].settings.messages[r], rule.messages);
893          delete rule.messages;
894          $(this).rules("add", rule);
895          $(this).blur(hideErrordiv);
896        });
897      });
898      self.time.stop('dateminrules');
899    }
900
901    if('datemaxrules' in self.forms[formid]){
902      self.time.start('datemaxrules');
903      $.each (self.forms[formid].datemaxrules, function(r) {
904        $form.find('#' + r).find('input, select').not('input[type=image]').each(function(){
905          // Make sure we are working with the copy of rules object.
906          var rule = $.extend(true, {}, self.forms[formid].datemaxrules[r]);
907          if (typeof self.validators[formid].settings.messages[r] === 'undefined') {
908            self.validators[formid].settings.messages[r] = {};
909          }
910          $.extend(self.validators[formid].settings.messages[r], rule.messages);
911          delete rule.messages;
912          $(this).rules("add", rule);
913          $(this).blur(hideErrordiv);
914        });
915      });
916      self.time.stop('datemaxrules');
917    }
918
919    if ('rules' in self.forms[formid]) {
920      self.time.start('rules');
921      // Make sure we are working with the copy of rules object.
922      var rules = $.extend(true, {}, self.forms[formid].rules);
923      // :input can be slow, see http://jsperf.com/input-vs-input/2
924      $form.find('input, textarea, select').each(function(idx, elem) {
925        var rule = rules[elem.name];
926        if (rule) {
927          var $elem = $(elem);
928          if (typeof self.validators[formid].settings.messages[elem.name] === 'undefined') {
929            self.validators[formid].settings.messages[elem.name] = {};
930          }
931          $.extend(self.validators[formid].settings.messages[elem.name], rule.messages);
932          delete rule.messages;
933          $elem.rules("add",rule);
934          $elem.change(hideErrordiv);
935        }
936      });
937      self.time.stop('rules');
938    }
939    self.time.stop('3. bindRules');
940  };
941
942  /**
943   * Add extra rules.
944   * @memberof Drupal.clientsideValidation
945  */
946  Drupal.clientsideValidation.prototype.addExtraRules = function(){
947    var self = this;
948
949    $.validator.addMethod("numberDE", function(value, element) {
950      return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);
951    });
952
953    $.validator.addMethod("min_comma", function(value, element, param) {
954      var real_val = Number(value.replace(',', '.'));
955      return this.optional(element) || real_val >= param;
956    });
957
958    $.validator.addMethod("max_comma", function(value, element, param) {
959      var real_val = Number(value.replace(',', '.'));
960      return this.optional(element) || real_val <= param;
961    });
962
963    $.validator.addMethod("range_comma", function(value, element, param) {
964      var real_val = Number(value.replace(',', '.'));
965      return this.optional(element) || (real_val >= param[0] && real_val <= param[1]);
966    });
967
968    // Min a and maximum b checkboxes from a group
969    $.validator.addMethod("checkboxgroupminmax", function(value, element, param) {
970      var amountChecked = $(param[2]).find('input:checked').length;
971      return (amountChecked >= param[0] && amountChecked <= param[1]);
972    }, $.format('Minimum {0}, maximum {1}'));
973
974    // Allow integers, same as digits but including a leading '-'
975    $.validator.addMethod("digits_negative", function(value, element) {
976      return this.optional(element) || /^-?\d+$/.test(value);
977    }, $.format('Please enter only digits.'));
978
979    // One of the values
980    $.validator.addMethod("oneOf", function(value, element, param) {
981      for (var p in param.values) {
982        if (param.values[p] === value && param.caseSensitive) {
983          return !param.negate;
984        }
985        else if (param.values[p].toLowerCase() === value.toLowerCase() && !param.caseSensitive) {
986          return !param.negate;
987        }
988      }
989      return param.negate;
990    }, $.format(''));
991
992    $.validator.addMethod("specificVals", function(value, element, param){
993      for (var i in value) {
994        if(param.indexOf(value[i]) === -1) {
995            return false;
996        }
997      }
998      return true;
999    });
1000
1001    $.validator.addMethod("blacklist", function(value, element, param) {
1002      if (typeof(value) !== 'object') {
1003        value = value.split(' ');
1004      }
1005      for (var i in value) {
1006        if(param.values.indexOf(value[i]) !== -1) {
1007            return param.negate;
1008        }
1009      }
1010      return !param.negate;
1011    });
1012
1013    // Default regular expression support
1014    var ajaxPCREfn = function(value, element, param) {
1015      var result = false;
1016      $.ajax({
1017        'url': Drupal.settings.basePath + 'clientside_validation/ajax',
1018        'type': "POST",
1019        'data': {
1020          'value': value,
1021          'param': param
1022        },
1023        'dataType': 'json',
1024        'async': false,
1025        'success': function(res){
1026          result = res;
1027        }
1028      });
1029      if (result.result === false) {
1030        if (result.message.length) {
1031          $.extend($.validator.messages, {
1032            "regexMatchPCRE": result.message
1033          });
1034        }
1035      }
1036      return result.result;
1037    };
1038
1039    // Regular expression support using XRegExp
1040    var xregexPCREfn = function(value, element, param) {
1041      if (window.XRegExp && XRegExp.version ) {
1042        try {
1043          var result = true;
1044          for (var i = 0; i < param.expressions.length; i++) {
1045            var reg = param.expressions[i];
1046            var delim = reg.lastIndexOf(reg.charAt(0));
1047            // Only allow supported modifiers
1048            var modraw = reg.substr(delim + 1) || '';
1049            var mod = '';
1050            if (mod !== '') {
1051              for (var l = 0; l < 6; l++) {
1052                if (modraw.indexOf('gimnsx'[l]) !== -1) {
1053                  mod += 'gimnsx'[l];
1054                }
1055              }
1056            }
1057            reg = reg.substring(1, delim);
1058            if (!(new XRegExp(reg, mod).test(value))) {
1059              result = false;
1060              if (param.messages[i].length) {
1061                $.extend($.validator.messages, {
1062                  "regexMatchPCRE": param.messages[i]
1063                });
1064              }
1065            }
1066          }
1067          return result;
1068        }
1069        catch (e) {
1070          return ajaxPCREfn(value, element, param);
1071        }
1072      }
1073      else {
1074        return ajaxPCREfn(value, element, param);
1075      }
1076    };
1077
1078    // Decide which one to use
1079    if (self.data.general.usexregxp) {
1080      $.validator.addMethod("regexMatchPCRE", xregexPCREfn, $.format('The value does not match the expected format.'));
1081    }
1082    else {
1083      $.validator.addMethod("regexMatchPCRE", ajaxPCREfn, $.format('The value does not match the expected format.'));
1084    }
1085
1086    // Unique values
1087    $.validator.addMethod("notEqualTo", function(value, element, param) {
1088      var ret = true;
1089      $.each(param, function (index, selector){
1090        var $target = $(selector);
1091        $target.unbind(".validate-notEqualTo").bind("blur.validate-notEqualTo", function() {
1092          $(element).valid();
1093        });
1094        ret = ret && ($target.val() !== value);
1095      });
1096      return ret;
1097    }, $.format('Please don\'t enter the same value again.'));
1098
1099    $.validator.addMethod("regexMatch", function(value, element, param) {
1100      if (this.optional(element) && value === '') {
1101        return this.optional(element);
1102      }
1103      else {
1104        var modifier = param.regex[1];
1105        var valid_modifiers = ['i', 'g', 'm'];
1106        if ($.inArray(modifier, valid_modifiers) === -1) {
1107          modifier = '';
1108        }
1109        var regexp = new RegExp(param.regex[0], modifier);
1110        if(regexp.test(value)){
1111          return !param.negate;
1112        }
1113        return param.negate;
1114      }
1115
1116    }, $.format('The value does not match the expected format.'));
1117
1118    $.validator.addMethod("captcha", function (value, element, param) {
1119      var result = false;
1120      var sid = $(element).closest('.captcha').find('input[name=captcha_sid]').val();
1121      $.ajax({
1122        'url': Drupal.settings.basePath + 'clientside_validation/captcha',
1123        'type': "POST",
1124        'data': {
1125          'value': value,
1126          'param': [sid, param.captcha_validate, param.token, param.captcha_token]
1127        },
1128        'dataType': 'json',
1129        'async': false,
1130        'success': function(res){
1131          result = res;
1132        }
1133      });
1134      if (result.result === false) {
1135        if (typeof result.message !== 'undefined' && result.message.length) {
1136          $.extend($.validator.messages, {
1137            "captcha": result.message
1138          });
1139        }
1140      }
1141      return result.result;
1142    }, $.format('Wrong answer.'));
1143
1144    $.validator.addMethod("rangewords", function(value, element, param) {
1145      return this.optional(element) || (param[0] <= $.trim(value).split(/\s+/).length && value.split(/\s+/).length <= param[1]);
1146    }, $.format('The value must be between {0} and {1} words long'));
1147
1148    $.validator.addMethod("minwords", function(value, element, param) {
1149      return this.optional(element) || param <= $.trim(value).split(/\s+/).length;
1150    }, $.format('The value must be more than {0} words long'));
1151
1152    $.validator.addMethod("maxwords", function(value, element, param) {
1153      return this.optional(element) || $.trim(value).split(/\s+/).length <= param;
1154    }, $.format('The value must be fewer than {0} words long'));
1155
1156    $.validator.addMethod("plaintext", function(value, element, param){
1157      var result = param.negate ? (value !== strip_tags(value, param.tags)) : (value === strip_tags(value, param.tags));
1158      return this.optional(element) || result;
1159    }, $.format('The value must be plaintext'));
1160
1161    $.validator.addMethod("selectMinlength", function(value, element, param) {
1162      var result = $(element).find('option:selected').length >= param.min;
1163      if (param.negate) {
1164        result = !result;
1165      }
1166      return this.optional(element) || result;
1167    }, $.format('You must select at least {0} values'));
1168
1169    $.validator.addMethod("selectMaxlength", function(value, element, param) {
1170      var result = $(element).find('option:selected').length <= param.max;
1171      if (param.negate) {
1172        result = !result;
1173      }
1174      return this.optional(element) || result;
1175    }, $.format('You must select a maximum of {0} values'));
1176
1177    $.validator.addMethod("selectRangelength", function(value, element, param) {
1178      var result = ($(element).find('option:selected').length >= param.range[0] && $(element).find('option:selected').length <= param.range[1]);
1179      if (param.negate) {
1180        result = !result;
1181      }
1182      return this.optional(element) || result;
1183    }, $.format('You must select at between {0} and {1} values'));
1184
1185    $.validator.addMethod("datemin", function(value, element, param) {
1186      //Assume [month], [day], and [year] ??
1187      var dayelem, monthelem, yearelem, name, $form, element_name;
1188      $form = $(element).closest('form');
1189      element_name = $(element).attr('name');
1190      if (element_name.indexOf('[day]') > 0) {
1191        dayelem = $(element);
1192        name = dayelem.attr('name').replace('[day]', '');
1193        monthelem = $form.find("[name='" + name + "[month]']");
1194        yearelem = $form.find("[name='" + name + "[year]']");
1195      }
1196      else if (element_name.indexOf('[month]') > 0) {
1197        monthelem = $(element);
1198        name = monthelem.attr('name').replace('[month]', '');
1199        dayelem = $form.find("[name='" + name + "[day]']");
1200        yearelem = $form.find("[name='" + name + "[year]']");
1201      }
1202      else if ($(element).attr('name').indexOf('[year]') > 0) {
1203        yearelem = $(element);
1204        name = yearelem.attr('name').replace('[year]', '');
1205        dayelem = $form.find("[name='" + name + "[day]']");
1206        monthelem = $form.find("[name='" + name + "[month]']");
1207      }
1208
1209      if (parseInt(yearelem.val(), 10) < parseInt(param[0], 10)) {
1210        return false;
1211      }
1212      else if (parseInt(yearelem.val(), 10) === parseInt(param[0], 10)){
1213        if (parseInt(monthelem.val(), 10) < parseInt(param[1], 10)){
1214          return false;
1215        }
1216        else if (parseInt(monthelem.val(), 10) === parseInt(param[1], 10)){
1217          if(parseInt(dayelem.val(), 10) < parseInt(param[2], 10)) {
1218            return false;
1219          }
1220        }
1221      }
1222      yearelem.once('daterange', function() {
1223        $(this).change(function(){$(this).trigger('focusout').trigger('blur');});
1224      }).removeClass('error');
1225      monthelem.once('daterange', function() {
1226        $(this).change(function(){$(this).trigger('focusout').trigger('blur');});
1227      }).removeClass('error');
1228      dayelem.once('daterange', function() {
1229        $(this).change(function(){$(this).trigger('focusout').trigger('blur');});
1230      }).removeClass('error');
1231      return true;
1232    });
1233
1234    $.validator.addMethod("datemax", function(value, element, param) {
1235      //Assume [month], [day], and [year] ??
1236      var dayelem, monthelem, yearelem, name, $form, element_name;
1237      $form = $(element).closest('form');
1238      element_name = $(element).attr('name');
1239      if (element_name.indexOf('[day]') > 0) {
1240        dayelem = $(element);
1241        name = dayelem.attr('name').replace('[day]', '');
1242        monthelem = $form.find("[name='" + name + "[month]']");
1243        yearelem = $form.find("[name='" + name + "[year]']");
1244      }
1245      else if (element_name.indexOf('[month]') > 0) {
1246        monthelem = $(element);
1247        name = monthelem.attr('name').replace('[month]', '');
1248        dayelem = $form.find("[name='" + name + "[day]']");
1249        yearelem = $form.find("[name='" + name + "[year]']");
1250      }
1251      else if (element_name.indexOf('[year]') > 0) {
1252        yearelem = $(element);
1253        name = yearelem.attr('name').replace('[year]', '');
1254        dayelem = $form.find("[name='" + name + "[day]']");
1255        monthelem = $form.find("[name='" + name + "[month]']");
1256
1257      }
1258
1259      if (parseInt(yearelem.val(), 10) > parseInt(param[0], 10)) {
1260        return false;
1261      }
1262      else if (parseInt(yearelem.val(), 10) === parseInt(param[0], 10)){
1263        if (parseInt(monthelem.val(), 10) > parseInt(param[1], 10)){
1264          return false;
1265        }
1266        else if (parseInt(monthelem.val(), 10) === parseInt(param[1], 10)){
1267          if(parseInt(dayelem.val(), 10) > parseInt(param[2], 10)) {
1268            return false;
1269          }
1270        }
1271      }
1272      yearelem.once('daterange', function() {
1273        $(this).change(function(){$(this).trigger('focusout').trigger('blur');});
1274      }).removeClass('error');
1275      monthelem.once('daterange', function() {
1276        $(this).change(function(){$(this).trigger('focusout').trigger('blur');});
1277      }).removeClass('error');
1278      dayelem.once('daterange', function() {
1279        $(this).change(function(){$(this).trigger('focusout').trigger('blur');});
1280      }).removeClass('error');
1281      return true;
1282    });
1283
1284    $.validator.addMethod("daterange", function(value, element, param) {
1285      //Assume [month], [day], and [year] ??
1286      var dayelem, monthelem, yearelem, name, $form, element_name;
1287      $form = $(element).closest('form');
1288      element_name = $(element).attr('name');
1289      if (element_name.indexOf('[day]') > 0) {
1290        dayelem = $(element);
1291        name = dayelem.attr('name').replace('[day]', '');
1292        monthelem = $form.find("[name='" + name + "[month]']");
1293        yearelem = $form.find("[name='" + name + "[year]']");
1294      }
1295      else if (element_name.indexOf('[month]') > 0) {
1296        monthelem = $(element);
1297        name = monthelem.attr('name').replace('[month]', '');
1298        dayelem = $form.find("[name='" + name + "[day]']");
1299        yearelem = $form.find("[name='" + name + "[year]']");
1300      }
1301      else if (element_name.indexOf('[year]') > 0) {
1302        yearelem = $(element);
1303        name = yearelem.attr('name').replace('[year]', '');
1304        dayelem = $form.find("[name='" + name + "[day]']");
1305        monthelem = $form.find("[name='" + name + "[month]']");
1306      }
1307
1308      if (parseInt(yearelem.val(), 10) < parseInt(param[0][0], 10)) {
1309        return false;
1310      }
1311      else if (parseInt(yearelem.val(), 10) === parseInt(param[0][0], 10)){
1312        if (parseInt(monthelem.val(), 10) < parseInt(param[0][1], 10)){
1313          return false;
1314        }
1315        else if (parseInt(monthelem.val(), 10) === parseInt(param[0][1], 10)){
1316          if(parseInt(dayelem.val(), 10) < parseInt(param[0][2], 10)) {
1317            return false;
1318          }
1319        }
1320      }
1321
1322      if (parseInt(yearelem.val(), 10) > parseInt(param[1][0], 10)) {
1323        return false;
1324      }
1325      else if (parseInt(yearelem.val(), 10) === parseInt(param[1][0], 10)){
1326        if (parseInt(monthelem.val(), 10) > parseInt(param[1][1], 10)){
1327          return false;
1328        }
1329        else if (parseInt(monthelem.val(), 10) === parseInt(param[1][1], 10)){
1330          if(parseInt(dayelem.val(), 10) > parseInt(param[1][2], 10)) {
1331            return false;
1332          }
1333        }
1334      }
1335      yearelem.once('daterange', function() {
1336        $(this).change(function(){$(this).trigger('focusout').trigger('blur');});
1337      }).removeClass('error');
1338      monthelem.once('daterange', function() {
1339        $(this).change(function(){$(this).trigger('focusout').trigger('blur');});
1340      }).removeClass('error');
1341      dayelem.once('daterange', function() {
1342        $(this).change(function(){$(this).trigger('focusout').trigger('blur');});
1343      }).removeClass('error');
1344      return true;
1345    });
1346
1347    $.validator.addMethod("dateFormat", function(value, element, param) {
1348      try{
1349        var parts = value.split(param.splitter);
1350        var expectedpartscount = 0;
1351        var day = parseInt(parts[param.daypos], 10);
1352
1353        var month = parseInt(parts[param.monthpos], 10);
1354        if (isNaN(month)) {
1355          var date_parts = param.format.split(param.splitter);
1356          var full_idx = date_parts.indexOf("F");
1357          var abbr_idx = date_parts.indexOf("M");
1358          var mopos = Math.max(full_idx, abbr_idx);
1359          if (parseInt(mopos) > -1) {
1360            param.monthpos = mopos;
1361            date = new Date(parts[param.monthpos] + " 1, 2000");
1362            month = date.getMonth();
1363          }
1364          else {
1365            if (typeof Drupal.settings.clientsideValidation.general.months[parts[param.monthpos]] !== 'undefined') {
1366              month = Drupal.settings.clientsideValidation.general.months[parts[param.monthpos]];
1367            }
1368            else {
1369              month = new Date(parts[param.monthpos] + " 1, 2000");
1370              month = month.getMonth();
1371            }
1372          }
1373        }
1374        else {
1375          month--;
1376        }
1377
1378        var year = parseInt(parts[param.yearpos], 10);
1379        var date = new Date();
1380        var result = true;
1381        if (param.daypos !== false && parts[param.daypos].toString().length !== parts[param.daypos].length){
1382          result = false;
1383        }
1384        if (param.monthpos !== false && parts[param.monthpos].toString().length !== parts[param.monthpos].length){
1385          result = false;
1386        }
1387        if (param.yearpos !== false && parts[param.yearpos].toString().length !== parts[param.yearpos].length){
1388          result = false;
1389        }
1390        if (param.yearpos !== false){
1391          expectedpartscount++;
1392          date.setFullYear(year);
1393          if (year !== date.getFullYear()) {
1394            result = false;
1395          }
1396        }
1397        if (param.monthpos !== false) {
1398          expectedpartscount++;
1399          date.setMonth(month, 1);
1400          if (month !== date.getMonth()) {
1401            result = false;
1402          }
1403        }
1404        if (param.daypos !== false) {
1405          expectedpartscount++;
1406          date.setDate(day);
1407          if (day !== date.getDate()) {
1408            result = false;
1409          }
1410        }
1411        if (expectedpartscount !== parts.length) {
1412          result = false;
1413        }
1414        return this.optional(element) || result;
1415      } catch(e) {
1416        return this.optional(element) || false;
1417      }
1418    }, $.format('The date is not in a valid format'));
1419
1420    // Require one of several
1421    $.validator.addMethod("requireOneOf", function(value, element, param) {
1422      var ret = false;
1423      if (value === "") {
1424        $.each(param, function(index, name) {
1425          // @TODO: limit to current form
1426          if (!ret && $("[name='" + name + "']").val().length) {
1427            ret = true;
1428          }
1429        });
1430      }
1431      else {
1432        $(element).removeClass("error");
1433        ret = true;
1434      }
1435      $(element).blur(function () {
1436        $.each(param, function(index, name) {
1437          // @TODO: limit to current form
1438          $("[name='" + name + "']").valid();
1439        });
1440      });
1441      return ret;
1442    }, $.format('Please fill in at least one of the fields'));
1443
1444    // Support for Drupal urls.
1445    $.validator.addMethod("drupalURL", function(value, element) {
1446      var result = false;
1447      if (this.settings['name_event'] == 'onkeyup') {
1448        return true;
1449      }
1450      if ($.validator.methods.url.call(this, value, element)) {
1451        return true;
1452      }
1453      $.ajax({
1454        'url': Drupal.settings.basePath + 'clientside_validation/drupalURL',
1455        'type': "POST",
1456        'data': {
1457          'value': value
1458        },
1459        'dataType': 'json',
1460        'async': false,
1461        'success': function(res){
1462          result = res;
1463        }
1464      });
1465      return result.result;
1466    }, $.format('Please fill in a valid url'));
1467
1468    // Support for phone
1469    $.validator.addMethod("phone", function(value, element, param) {
1470      var country_code = param;
1471      var result = false;
1472      $.ajax({
1473        'url': Drupal.settings.basePath + 'clientside_validation/phone',
1474        'type': "POST",
1475        'data': {
1476          'value': value,
1477          'country_code': country_code
1478        },
1479        'dataType': 'json',
1480        'async': false,
1481        'success': function(res){
1482          result = res;
1483        }
1484      });
1485      return this.optional(element) || result.result;
1486
1487    }, $.format('Please fill in a valid phone number'));
1488
1489    // EAN code
1490    $.validator.addMethod("validEAN", function(value, element) {
1491      if (this.optional(element) && value === '') {
1492        return this.optional(element);
1493      }
1494      else {
1495        if (value.length > 13) {
1496          return false;
1497        }
1498        else if (value.length !== 13) {
1499          value = '0000000000000'.substr(0, 13 - value.length).concat(value);
1500        }
1501        if (value === '0000000000000') {
1502          return false;
1503        }
1504        if (isNaN(parseInt(value, 10)) || parseInt(value, 10) === 0) {
1505          return false;
1506        }
1507        var runningTotal = 0;
1508        for (var c = 0; c < 12; c++) {
1509          if (c % 2 === 0) {
1510            runningTotal += 3 * parseInt(value.substr(c, 1), 10);
1511          }
1512          else {
1513            runningTotal += parseInt(value.substr(c, 1), 10);
1514          }
1515        }
1516        var rem = runningTotal % 10;
1517        if (rem !== 0) {
1518          rem = 10 - rem;
1519        }
1520
1521        return rem === parseInt(value.substr(12, 1), 10);
1522
1523      }
1524    }, $.format('Not a valid EAN number.'));
1525
1526    $.validator.addMethod("require_from_group", function(value, element, options) {
1527      var $fields = $(options[1], element.form),
1528        $fieldsFirst = $fields.eq(0),
1529        validator = $fieldsFirst.data("valid_req_grp") ? $fieldsFirst.data("valid_req_grp") : $.extend({}, this),
1530        isValid = $fields.filter(function() {
1531          return validator.elementValue(this);
1532        }).length >= options[0];
1533
1534      // Store the cloned validator for future validation
1535      $fieldsFirst.data("valid_req_grp", validator);
1536
1537      // If element isn't being validated, run each require_from_group field's validation rules
1538      if (!$(element).data("being_validated")) {
1539        $fields.data("being_validated", true);
1540        $fields.each(function() {
1541          validator.element(this);
1542        });
1543        $fields.data("being_validated", false);
1544      }
1545      return isValid;
1546    }, $.validator.format("Please fill at least {0} of these fields."));
1547
1548
1549    // Enhances the provided "remote" method by adding our own success and
1550    // progress handling.
1551    $.validator.methods.original_remote = $.validator.methods.remote;
1552    $.validator.methods.remote = function(value, element, param) {
1553      if ( this.optional(element) ) {
1554        return "dependency-mismatch";
1555      }
1556
1557      var previous = this.previousValue(element);
1558      if (!this.settings.messages[element.name] ) {
1559        this.settings.messages[element.name] = {};
1560      }
1561      previous.originalMessage = this.settings.messages[element.name].remote;
1562      this.settings.messages[element.name].remote = previous.message;
1563
1564      param = typeof param === "string" && {url:param} || param;
1565
1566      if ( previous.old === value ) {
1567        return previous.valid;
1568      }
1569
1570      previous.old = value;
1571      var validator = this;
1572      this.startRequest(element);
1573      var data = {};
1574      data[element.name] = value;
1575
1576      $.ajax($.extend(true, {
1577        url: param,
1578        mode: "abort",
1579        port: "validate" + element.name,
1580        dataType: "json",
1581        progress: {
1582          type: 'throbber',
1583          message: Drupal.t('Please wait...')
1584        },
1585        data: data,
1586        // We provide our own success handling to ensure the pending array is
1587        // cleaned before executing showErrors(). That way handling highlight
1588        // unhighlight is easier for pending elements (avoid) flickering.
1589        // However we still need the original success handler of Drupal.ajax to
1590        // do the progress handling.
1591        success: function(response) {
1592          // Remove element from pending list as we now know what state it has.
1593          delete validator.pending[element.name];
1594          validator.settings.messages[element.name].remote = previous.originalMessage;
1595          var valid = response === true || response === "true";
1596          if ( valid ) {
1597            var submitted = validator.formSubmitted;
1598            // Don't invoke this because this will avoid that the highlight /
1599            // unhighlight handlers are called.
1600            // validator.prepareElement(element);
1601            validator.formSubmitted = submitted;
1602            validator.successList.push(element);
1603            delete validator.invalid[element.name];
1604            validator.showErrors();
1605          } else {
1606            var errors = {};
1607            var message = response || validator.defaultMessage( element, "remote" );
1608            errors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;
1609            validator.invalid[element.name] = true;
1610            validator.showErrors(errors);
1611          }
1612          previous.valid = valid;
1613          validator.stopRequest(element, valid);
1614        },
1615        beforeSend: function () {
1616          // Disable the element that received the change to prevent user interface
1617          // interaction while the Ajax request is in progress. ajax.ajaxing prevents
1618          // the element from triggering a new request, but does not prevent the user
1619          // from changing its value.
1620          $(element).addClass('progress-disabled').attr('disabled', true);
1621
1622          // Insert progressbar or throbber.
1623          if (this.progress.type == 'bar') {
1624            var progressBar = new Drupal.progressBar('ajax-progress-' + element.id, eval(this.progress.update_callback), this.progress.method, eval(this.progress.error_callback));
1625            if (this.progress.message) {
1626              progressBar.setProgress(-1, this.progress.message);
1627            }
1628            if (this.progress.url) {
1629              progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500);
1630            }
1631            this.progress.element = $(progressBar.element).addClass('ajax-progress ajax-progress-bar');
1632            this.progress.object = progressBar;
1633            $(element).after(this.progress.element);
1634          }
1635          else if (this.progress.type == 'throbber') {
1636            this.progress.element = $('<div class="ajax-progress ajax-progress-throbber"><div class="throbber">&nbsp;</div></div>');
1637            if (this.progress.message) {
1638              $('.throbber', this.progress.element).after('<div class="message">' + this.progress.message + '</div>');
1639            }
1640            $(element).after(this.progress.element);
1641          }
1642        },
1643        complete: function() {
1644          // Remove the progress element.
1645          if (this.progress.element) {
1646            $(this.progress.element).remove();
1647          }
1648          if (this.progress.object) {
1649            this.progress.object.stopMonitoring();
1650          }
1651          $(element).removeClass('progress-disabled').removeAttr('disabled');
1652        }
1653      }, param));
1654      return "pending";
1655    };
1656
1657
1658    /**
1659     * Allow other modules to add more rules.
1660     * @event clientsideValidationAddCustomRules
1661     * @name clientsideValidationAddCustomRules
1662     * @memberof Drupal.clientsideValidation
1663     */
1664    $.event.trigger('clientsideValidationAddCustomRules');
1665
1666
1667    /**
1668     * strip illegal tags
1669     * @memberof Drupal.clientsideValidation
1670     * @private
1671     */
1672    function strip_tags (input, allowed) {
1673      allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
1674      var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
1675          commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
1676      return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
1677        return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
1678      });
1679    }
1680  };
1681
1682  Drupal.behaviors.ZZZClientsideValidation = {
1683    attach: function () {
1684      function changeAjax(ajax_el) {
1685        var origBeforeSubmit = Drupal.ajax[ajax_el].options.beforeSubmit;
1686        Drupal.ajax[ajax_el].options.beforeSubmit = function (form_values, element, options) {
1687          var ret = origBeforeSubmit(form_values, element, options);
1688          // If this function didn't return anything, just set the return value to true.
1689          // If it did return something, allow it to prevent submit if necessary.
1690          if (typeof ret === 'undefined') {
1691            ret = true;
1692          }
1693          var id = element.is('form') ? element.attr('id') : element.closest('form').attr('id');
1694          if (id && Drupal.myClientsideValidation.validators[id] && Drupal.myClientsideValidation.validators[id].form) {
1695            Drupal.myClientsideValidation.validators[id].onsubmit = false;
1696            ret = ret && Drupal.myClientsideValidation.validators[id].form();
1697            if (!ret) {
1698              Drupal.ajax[ajax_el].ajaxing = false;
1699            }
1700          }
1701          return ret;
1702        };
1703      }
1704      // Set validation for ctools modal forms
1705      for (var ajax_el in Drupal.ajax) {
1706        if (Drupal.ajax.hasOwnProperty(ajax_el) && typeof Drupal.ajax[ajax_el] !== 'undefined') {
1707          var $ajax_el = $(Drupal.ajax[ajax_el].element);
1708          var ajax_form = $ajax_el.is('form') ? $ajax_el.attr('id') : $ajax_el.closest('form').attr('id');
1709          var change_ajax = true;
1710          if (ajax_form != null && typeof Drupal.myClientsideValidation.forms[ajax_form] !== 'undefined') {
1711            change_ajax = Boolean(parseInt(Drupal.myClientsideValidation.forms[ajax_form].general.validateBeforeAjax, 10));
1712          }
1713          if (!$ajax_el.hasClass('cancel') && change_ajax) {
1714            changeAjax(ajax_el);
1715          }
1716        }
1717      }
1718    }
1719  };
1720
1721  /**
1722   * Integrate with the states handling.
1723   *
1724   * Prvides the condtions:
1725   *  * clientside_validation: Value is valid.
1726   *  * clientside_validated: Value was validated actually.
1727   */
1728  if (typeof Drupal.states != 'undefined') {
1729    Drupal.states.Trigger.states.clientside_validation = function (element) {
1730      element
1731        .bind('clientsideValidationValid', function () {
1732          element.trigger({type: 'state:clientside_validation', value: true});
1733          element.trigger({type: 'state:clientside_validated', value: true});
1734        })
1735        .bind('clientsideValidationInvalid', function () {
1736          element.trigger({type: 'state:clientside_validation', value: false});
1737          element.trigger({type: 'state:clientside_validated', value: true});
1738        })
1739        .bind('change keyup', function () {
1740          element.trigger({type: 'state:clientside_validated', value: false});
1741        });
1742
1743      Drupal.states.postponed.push($.proxy(function () {
1744        element.trigger({type: 'state:clientside_validation', value: true});
1745        element.trigger({type: 'state:clientside_validated', value: false});
1746      }, window));
1747    };
1748  }
1749})(jQuery);
1750;

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.